CMS 3D CMS Logo

EcalRecHitProducerGPU.cc
Go to the documentation of this file.
31 
33 
34 class EcalRecHitProducerGPU : public edm::stream::EDProducer<edm::ExternalWork> {
35 public:
36  explicit EcalRecHitProducerGPU(edm::ParameterSet const& ps);
37  ~EcalRecHitProducerGPU() override;
39 
40 private:
42  void produce(edm::Event&, edm::EventSetup const&) override;
43 
44 private:
45  // data
46  uint32_t neb_, nee_; // extremely important, in particular neb_
47 
48  // gpu input
52 
53  // event data
55 
57 
58  // gpu output
61 
62  // configuration parameters
64 
65  // conditions handles
69 
75 
76  // Associate reco flagbit (outer vector) to many db status flags (inner vector)
77  std::vector<int>
78  expanded_v_DB_reco_flags_; // Transform a map in a vector // FIXME AM: int or uint32 to be checked
79  std::vector<uint32_t> expanded_Sizes_v_DB_reco_flags_; // Saving the size for each piece
80  std::vector<uint32_t> expanded_flagbit_v_DB_reco_flags_; // And the "key" for each key
81 
82  uint32_t flagmask_; // do not propagate channels with these flags on
83 };
84 
87 
88  desc.add<edm::InputTag>("uncalibrecHitsInLabelEB",
89  edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEB"));
90  desc.add<edm::InputTag>("uncalibrecHitsInLabelEE",
91  edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEE"));
92 
93  desc.add<std::string>("recHitsLabelEB", "EcalRecHitsGPUEB");
94  desc.add<std::string>("recHitsLabelEE", "EcalRecHitsGPUEE");
95 
96  desc.add<bool>("killDeadChannels", true);
97 
98  desc.add<double>("EBLaserMIN", 0.01);
99  desc.add<double>("EELaserMIN", 0.01);
100  desc.add<double>("EBLaserMAX", 30.0);
101  desc.add<double>("EELaserMAX", 30.0);
102 
103  desc.add<uint32_t>("maxNumberHitsEB", 61200);
104  desc.add<uint32_t>("maxNumberHitsEE", 14648);
105 }
106 
108  //---- input
109  uncalibRecHitsInEBToken_ = consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEB"));
110  uncalibRecHitsInEEToken_ = consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEE"));
111 
112  //---- output
113  recHitsTokenEB_ = produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEB"));
114  recHitsTokenEE_ = produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEE"));
115 
116  bool killDeadChannels = ps.getParameter<bool>("killDeadChannels");
118 
119  configParameters_.EBLaserMIN = ps.getParameter<double>("EBLaserMIN");
120  configParameters_.EELaserMIN = ps.getParameter<double>("EELaserMIN");
121  configParameters_.EBLaserMAX = ps.getParameter<double>("EBLaserMAX");
122  configParameters_.EELaserMAX = ps.getParameter<double>("EELaserMAX");
123 
124  // max number of digis to allocate for
125  configParameters_.maxNumberHitsEB = ps.getParameter<uint32_t>("maxNumberHitsEB");
126  configParameters_.maxNumberHitsEE = ps.getParameter<uint32_t>("maxNumberHitsEE");
127 
128  flagmask_ = 0;
131  flagmask_ |= 0x1 << EcalRecHit::kDead;
132  flagmask_ |= 0x1 << EcalRecHit::kKilled;
135 
137 
138  // for recovery and killing
139 
140  configParameters_.recoverEBIsolatedChannels = ps.getParameter<bool>("recoverEBIsolatedChannels");
141  configParameters_.recoverEEIsolatedChannels = ps.getParameter<bool>("recoverEEIsolatedChannels");
142  configParameters_.recoverEBVFE = ps.getParameter<bool>("recoverEBVFE");
143  configParameters_.recoverEEVFE = ps.getParameter<bool>("recoverEEVFE");
144  configParameters_.recoverEBFE = ps.getParameter<bool>("recoverEBFE");
145  configParameters_.recoverEEFE = ps.getParameter<bool>("recoverEEFE");
146 }
147 
149 
151  edm::EventSetup const& setup,
153  // cuda products
154  auto const& ebUncalibRecHitsProduct = event.get(uncalibRecHitsInEBToken_);
155  auto const& eeUncalibRecHitsProduct = event.get(uncalibRecHitsInEEToken_);
156  // raii
157  cms::cuda::ScopedContextAcquire ctx{ebUncalibRecHitsProduct, std::move(holder), cudaState_};
158  // get actual object
159  auto const& ebUncalibRecHits = ctx.get(ebUncalibRecHitsProduct);
160  auto const& eeUncalibRecHits = ctx.get(eeUncalibRecHitsProduct);
161 
162  ecal::rechit::EventInputDataGPU inputDataGPU{ebUncalibRecHits, eeUncalibRecHits};
163 
164  neb_ = ebUncalibRecHits.size;
165  nee_ = eeUncalibRecHits.size;
166 
168  edm::LogError("EcalRecHitProducerGPU")
169  << "max number of channels exceeded. See options 'maxNumberHitsEB and maxNumberHitsEE' ";
170  }
171 
172  int nchannelsEB = ebUncalibRecHits.size; // --> offsetForInput, first EB and then EE
173 
174  // conditions
175  // - laser correction
176  // - IC
177  // - adt2gev
178 
179  //
183 
189 
190  auto const& ADCToGeVConstantProduct = ADCToGeVConstantHandle_->getProduct(ctx.stream());
191  auto const& IntercalibConstantsProduct = IntercalibConstantsHandle_->getProduct(ctx.stream());
192  auto const& ChannelStatusProduct = ChannelStatusHandle_->getProduct(ctx.stream());
193 
194  auto const& LaserAPDPNRatiosProduct = LaserAPDPNRatiosHandle_->getProduct(ctx.stream());
195  auto const& LaserAPDPNRatiosRefProduct = LaserAPDPNRatiosRefHandle_->getProduct(ctx.stream());
196  auto const& LaserAlphasProduct = LaserAlphasHandle_->getProduct(ctx.stream());
197  auto const& LinearCorrectionsProduct = LinearCorrectionsHandle_->getProduct(ctx.stream());
198  auto const& recHitParametersProduct = recHitParametersHandle_->getProduct(ctx.stream());
199 
200  // set config ptrs : this is done to avoid changing things downstream
201  configParameters_.ChannelStatusToBeExcluded = recHitParametersProduct.channelStatusToBeExcluded.get();
203  configParameters_.expanded_v_DB_reco_flags = recHitParametersProduct.expanded_v_DB_reco_flags.get();
204  configParameters_.expanded_Sizes_v_DB_reco_flags = recHitParametersProduct.expanded_Sizes_v_DB_reco_flags.get();
205  configParameters_.expanded_flagbit_v_DB_reco_flags = recHitParametersProduct.expanded_flagbit_v_DB_reco_flags.get();
207 
208  // bundle up conditions
209  ecal::rechit::ConditionsProducts conditions{ADCToGeVConstantProduct,
210  IntercalibConstantsProduct,
211  ChannelStatusProduct,
212  LaserAPDPNRatiosProduct,
213  LaserAPDPNRatiosRefProduct,
214  LaserAlphasProduct,
215  LinearCorrectionsProduct,
217 
218  // dev mem
220 
221  //
222  // schedule algorithms
223  //
224 
225  edm::TimeValue_t event_time = event.time().value();
226 
228  inputDataGPU, eventOutputDataGPU_, conditions, configParameters_, nchannelsEB, event_time, ctx.stream());
229 
230  cudaCheck(cudaGetLastError());
231 }
232 
235 
238 
239  // put into the event
242 }
243 
ecal::rechit::ConfigurationParameters::recoverEBFE
bool recoverEBFE
Definition: DeclsForKernels.h:262
EcalRecHit::kNeighboursRecovered
Definition: EcalRecHit.h:29
EcalLaserAPDPNRatiosGPU.h
EcalRecHit::kTPSaturated
Definition: EcalRecHit.h:33
EcalRecHitProducerGPU::flagmask_
uint32_t flagmask_
Definition: EcalRecHitProducerGPU.cc:82
EcalRecHitProducerGPU::EcalRecHitProducerGPU
EcalRecHitProducerGPU(edm::ParameterSet const &ps)
Definition: EcalRecHitProducerGPU.cc:107
EcalLaserAPDPNRatiosRcd
Definition: EcalLaserAPDPNRatiosRcd.h:24
EcalLinearCorrectionsGPU.h
ecal::rechit::ConfigurationParameters::recoverEEIsolatedChannels
bool recoverEEIsolatedChannels
Definition: DeclsForKernels.h:259
EcalLaserAlphasGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalLaserAlphasGPU.cc:13
EcalRecHitProducerGPU::expanded_Sizes_v_DB_reco_flags_
std::vector< uint32_t > expanded_Sizes_v_DB_reco_flags_
Definition: EcalRecHitProducerGPU.cc:79
cms::cuda::ScopedContextProduce
Definition: ScopedContext.h:149
ecal::rechit::ConfigurationParameters::killDeadChannels
bool killDeadChannels
Definition: DeclsForKernels.h:256
EcalRecHit::kL1SpikeFlag
Definition: EcalRecHit.h:34
EcalIntercalibConstantsGPU.h
EcalRecHitProducerGPU::IntercalibConstantsHandle_
edm::ESHandle< EcalIntercalibConstantsGPU > IntercalibConstantsHandle_
Definition: EcalRecHitProducerGPU.cc:67
edm::EDGetTokenT
Definition: EDGetToken.h:33
EcalLaserAPDPNRatiosRefGPU.h
edm::EDPutTokenT
Definition: EDPutToken.h:33
EcalRecHitProducerGPU::LaserAlphasHandle_
edm::ESHandle< EcalLaserAlphasGPU > LaserAlphasHandle_
Definition: EcalRecHitProducerGPU.cc:72
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EcalLinearCorrectionsRcd.h
EcalLaserAPDPNRatiosRefRcd.h
EcalRecHitProducerGPU::recHitsTokenEB_
edm::EDPutTokenT< OutputProduct > recHitsTokenEB_
Definition: EcalRecHitProducerGPU.cc:60
EcalRecHitProducerGPU::uncalibRecHitsInEBToken_
edm::EDGetTokenT< InputProduct > uncalibRecHitsInEBToken_
Definition: EcalRecHitProducerGPU.cc:50
EDProducer.h
EcalRecHitParametersGPU::getProduct
const Product & getProduct(cudaStream_t) const
Definition: EcalRecHitParametersGPU.cc:36
EcalLaserAlphasRcd.h
EcalIntercalibConstantsGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalIntercalibConstantsGPU.cc:13
EcalRecHitProducerGPU::configParameters_
ecal::rechit::ConfigurationParameters configParameters_
Definition: EcalRecHitProducerGPU.cc:63
EcalIntercalibConstantsGPU::getOffset
uint32_t getOffset() const
Definition: EcalIntercalibConstantsGPU.h:31
EcalRecHit::kTowerRecovered
Definition: EcalRecHit.h:30
EcalRechitADCToGeVConstantGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalRechitADCToGeVConstantGPU.cc:13
EcalLaserAPDPNRatiosRefRcd
Definition: EcalLaserAPDPNRatiosRefRcd.h:24
EcalRecHitProducerGPU::uncalibRecHitsInEEToken_
edm::EDGetTokenT< InputProduct > uncalibRecHitsInEEToken_
Definition: EcalRecHitProducerGPU.cc:51
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
ecal::rechit::ConfigurationParameters::EBLaserMAX
float EBLaserMAX
Definition: DeclsForKernels.h:267
EcalRechitADCToGeVConstantGPU.h
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:34
MakerMacros.h
ecal::rechit::ConfigurationParameters::maxNumberHitsEE
uint32_t maxNumberHitsEE
Definition: DeclsForKernels.h:277
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalRecHitProducerGPU::neb_
uint32_t neb_
Definition: EcalRecHitProducerGPU.cc:46
Service.h
EcalRecHitProducerGPU::LaserAPDPNRatiosHandle_
edm::ESHandle< EcalLaserAPDPNRatiosGPU > LaserAPDPNRatiosHandle_
Definition: EcalRecHitProducerGPU.cc:70
ecal::rechit::ConfigurationParameters::expanded_Sizes_v_DB_reco_flags
const uint32_t * expanded_Sizes_v_DB_reco_flags
Definition: DeclsForKernels.h:271
edm::ESHandle< EcalRechitADCToGeVConstantGPU >
ecal::rechit::ConfigurationParameters::expanded_v_DB_reco_flagsSize
uint32_t expanded_v_DB_reco_flagsSize
Definition: DeclsForKernels.h:273
EcalRecHit.h
StringToEnumValue.h
ecal::rechit::ConfigurationParameters::recoverEEFE
bool recoverEEFE
Definition: DeclsForKernels.h:263
JobConfigurationGPURecord
Definition: JobConfigurationGPURecord.h:6
ecal::rechit::ConfigurationParameters::maxNumberHitsEB
uint32_t maxNumberHitsEB
Definition: DeclsForKernels.h:276
EcalRecHitParametersGPU::getValues
std::tuple< intvec, intvec, uint32vec, uint32vec > getValues() const
Definition: EcalRecHitParametersGPU.h:33
EcalLaserAPDPNRatiosRcd.h
EcalRecHit.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ecal::rechit::create_ecal_rehit
void create_ecal_rehit(EventInputDataGPU const &eventInputGPU, EventOutputDataGPU &eventOutputGPU, ConditionsProducts const &conditions, ConfigurationParameters const &configParameters, uint32_t const nChannelsBarrel, edm::TimeValue_t const event_time, cudaStream_t cudaStream)
EcalRecHitProducerGPU::recHitsTokenEE_
edm::EDPutTokenT< OutputProduct > recHitsTokenEE_
Definition: EcalRecHitProducerGPU.cc:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalRecHitProducerGPU::eventOutputDataGPU_
ecal::rechit::EventOutputDataGPU eventOutputDataGPU_
Definition: EcalRecHitProducerGPU.cc:54
EcalUncalibratedRecHit.h
EcalRecHitProducerGPU::nee_
uint32_t nee_
Definition: EcalRecHitProducerGPU.cc:46
JobConfigurationGPURecord.h
EcalLinearCorrectionsGPU::getProduct
const Product & getProduct(cudaStream_t) const
Definition: EcalLinearCorrectionsGPU.cc:37
cms::cuda::ContextState
Definition: ContextState.h:15
ecal::rechit::ConfigurationParameters::recoverEBIsolatedChannels
bool recoverEBIsolatedChannels
Definition: DeclsForKernels.h:258
edm::ParameterSet
Definition: ParameterSet.h:47
ecal::rechit::EventOutputDataGPU
Definition: DeclsForKernels.h:280
EcalRecHitProducerGPU::LinearCorrectionsHandle_
edm::ESHandle< EcalLinearCorrectionsGPU > LinearCorrectionsHandle_
Definition: EcalRecHitProducerGPU.cc:73
EcalRecHitProducerGPU::expanded_flagbit_v_DB_reco_flags_
std::vector< uint32_t > expanded_flagbit_v_DB_reco_flags_
Definition: EcalRecHitProducerGPU.cc:80
Event.h
EcalChannelStatusRcd
Definition: EcalChannelStatusRcd.h:5
ecal::rechit::EventOutputDataGPU::allocate
void allocate(ConfigurationParameters const &configParameters, cudaStream_t cudaStream)
Definition: DeclsForKernels.h:283
ecal::rechit::ConfigurationParameters
Definition: DeclsForKernels.h:251
EcalRecHitProducerGPU::LaserAPDPNRatiosRefHandle_
edm::ESHandle< EcalLaserAPDPNRatiosRefGPU > LaserAPDPNRatiosRefHandle_
Definition: EcalRecHitProducerGPU.cc:71
EcalADCToGeVConstantRcd.h
EcalRecHitProducerGPU::cudaState_
cms::cuda::ContextState cudaState_
Definition: EcalRecHitProducerGPU.cc:56
EcalLaserAlphasRcd
Definition: EcalLaserAlphasRcd.h:24
EcalLinearCorrectionsRcd
Definition: EcalLinearCorrectionsRcd.h:5
cudaCheck.h
EcalRechitChannelStatusGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalRechitChannelStatusGPU.cc:21
EcalRecHitProducerGPU::~EcalRecHitProducerGPU
~EcalRecHitProducerGPU() override
Definition: EcalRecHitProducerGPU.cc:148
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
ecal::rechit::ConfigurationParameters::recoverEEVFE
bool recoverEEVFE
Definition: DeclsForKernels.h:261
ecal::rechit::ConfigurationParameters::recoverEBVFE
bool recoverEBVFE
Definition: DeclsForKernels.h:260
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalRecHit::kDead
Definition: EcalRecHit.h:31
EcalRecHitParametersGPU.h
ecal::rechit::ConfigurationParameters::ChannelStatusToBeExcludedSize
uint32_t ChannelStatusToBeExcludedSize
Definition: DeclsForKernels.h:254
get
#define get
EcalRecHitProducerGPU::produce
void produce(edm::Event &, edm::EventSetup const &) override
Definition: EcalRecHitProducerGPU.cc:233
ecal::rechit::ConditionsProducts
Definition: DeclsForKernels.h:309
EcalLaserAPDPNRatiosRefGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalLaserAPDPNRatiosRefGPU.cc:13
HLT_FULL_cff.killDeadChannels
killDeadChannels
Definition: HLT_FULL_cff.py:8253
EcalRecHitProducerGPU::expanded_v_DB_reco_flags_
std::vector< int > expanded_v_DB_reco_flags_
Definition: EcalRecHitProducerGPU.cc:78
CUDAService.h
EcalRechitChannelStatusGPU.h
EcalRecHitProducerGPU
Definition: EcalRecHitProducerGPU.cc:34
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
eostools.move
def move(src, dest)
Definition: eostools.py:511
cudaCheck
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:62
EcalRecHitProducerGPU::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: EcalRecHitProducerGPU.cc:85
cms::cuda::Product
Definition: Product.h:34
ScopedContext.h
ecal::rechit::ConfigurationParameters::flagmask
uint32_t flagmask
Definition: DeclsForKernels.h:275
EcalRecHitProducerGPU::ChannelStatusHandle_
edm::ESHandle< EcalRechitChannelStatusGPU > ChannelStatusHandle_
Definition: EcalRecHitProducerGPU.cc:68
EcalLaserAlphasGPU.h
ecal::rechit::ConfigurationParameters::expanded_v_DB_reco_flags
const int * expanded_v_DB_reco_flags
Definition: DeclsForKernels.h:270
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ecal::rechit::ConfigurationParameters::ChannelStatusToBeExcluded
const int * ChannelStatusToBeExcluded
Definition: DeclsForKernels.h:253
ecal::rechit::ConfigurationParameters::EELaserMAX
float EELaserMAX
Definition: DeclsForKernels.h:268
ecal::rechit::EventInputDataGPU
Definition: DeclsForKernels.h:303
ecal::rechit::EventOutputDataGPU::recHitsEB
RecHit<::calo::common::DevStoragePolicy > recHitsEB
Definition: DeclsForKernels.h:281
ecal::rechit::ConfigurationParameters::EELaserMIN
float EELaserMIN
Definition: DeclsForKernels.h:266
ParameterSet.h
EcalLaserAPDPNRatiosGPU::getProduct
const Product & getProduct(cudaStream_t) const
Definition: EcalLaserAPDPNRatiosGPU.cc:39
EcalRecHit::kKilled
Definition: EcalRecHit.h:32
event
Definition: event.py:1
ecal::rechit::ConfigurationParameters::expanded_flagbit_v_DB_reco_flags
const uint32_t * expanded_flagbit_v_DB_reco_flags
Definition: DeclsForKernels.h:272
edm::Event
Definition: Event.h:73
ecal::rechit::ConfigurationParameters::EBLaserMIN
float EBLaserMIN
Definition: DeclsForKernels.h:265
ecal::rechit::EventOutputDataGPU::recHitsEE
RecHit<::calo::common::DevStoragePolicy > recHitsEE
Definition: DeclsForKernels.h:281
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalIntercalibConstantsRcd.h
EcalRecHitProducerGPU::ADCToGeVConstantHandle_
edm::ESHandle< EcalRechitADCToGeVConstantGPU > ADCToGeVConstantHandle_
Definition: EcalRecHitProducerGPU.cc:66
EcalRecHitProducerGPU::recHitParametersHandle_
edm::ESHandle< EcalRecHitParametersGPU > recHitParametersHandle_
Definition: EcalRecHitProducerGPU.cc:74
EcalADCToGeVConstantRcd
Definition: EcalADCToGeVConstantRcd.h:5
edm::InputTag
Definition: InputTag.h:15
EcalChannelStatusRcd.h
edm::TimeValue_t
unsigned long long TimeValue_t
Definition: Timestamp.h:28
EcalRecHitBuilderKernels.h
RecoTypes.h
EcalRecHitProducerGPU::acquire
void acquire(edm::Event const &, edm::EventSetup const &, edm::WaitingTaskWithArenaHolder) override
Definition: EcalRecHitProducerGPU.cc:150