CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EcalRecHitProducerGPU.cc
Go to the documentation of this file.
32 
34 
35 class EcalRecHitProducerGPU : public edm::stream::EDProducer<edm::ExternalWork> {
36 public:
37  explicit EcalRecHitProducerGPU(edm::ParameterSet const& ps);
38  ~EcalRecHitProducerGPU() override;
40 
41 private:
43  void produce(edm::Event&, edm::EventSetup const&) override;
44 
45 private:
46  // data
47  uint32_t neb_, nee_; // extremely important, in particular neb_
48 
49  // gpu input
53 
54  // event data
56 
58 
59  // gpu output
62 
63  // configuration parameters
65 
66  // conditions tokens
75 
76  // conditions handles
79 
80  // Associate reco flagbit (outer vector) to many db status flags (inner vector)
81  std::vector<int>
82  expanded_v_DB_reco_flags_; // Transform a map in a vector // FIXME AM: int or uint32 to be checked
83  std::vector<uint32_t> expanded_Sizes_v_DB_reco_flags_; // Saving the size for each piece
84  std::vector<uint32_t> expanded_flagbit_v_DB_reco_flags_; // And the "key" for each key
85 
86  uint32_t flagmask_; // do not propagate channels with these flags on
87 };
88 
91 
92  desc.add<edm::InputTag>("uncalibrecHitsInLabelEB",
93  edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEB"));
94  desc.add<edm::InputTag>("uncalibrecHitsInLabelEE",
95  edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEE"));
96 
97  desc.add<std::string>("recHitsLabelEB", "EcalRecHitsGPUEB");
98  desc.add<std::string>("recHitsLabelEE", "EcalRecHitsGPUEE");
99 
100  desc.add<bool>("killDeadChannels", true);
101 
102  desc.add<double>("EBLaserMIN", 0.01);
103  desc.add<double>("EELaserMIN", 0.01);
104  desc.add<double>("EBLaserMAX", 30.0);
105  desc.add<double>("EELaserMAX", 30.0);
106 
107  desc.add<uint32_t>("maxNumberHitsEB", 61200);
108  desc.add<uint32_t>("maxNumberHitsEE", 14648);
109 }
110 
112  //---- input
113  uncalibRecHitsInEBToken_ = consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEB"));
114  uncalibRecHitsInEEToken_ = consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibrecHitsInLabelEE"));
115 
116  //---- output
117  recHitsTokenEB_ = produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEB"));
118  recHitsTokenEE_ = produces<OutputProduct>(ps.getParameter<std::string>("recHitsLabelEE"));
119 
120  bool killDeadChannels = ps.getParameter<bool>("killDeadChannels");
122 
123  configParameters_.EBLaserMIN = ps.getParameter<double>("EBLaserMIN");
124  configParameters_.EELaserMIN = ps.getParameter<double>("EELaserMIN");
125  configParameters_.EBLaserMAX = ps.getParameter<double>("EBLaserMAX");
126  configParameters_.EELaserMAX = ps.getParameter<double>("EELaserMAX");
127 
128  // max number of digis to allocate for
129  configParameters_.maxNumberHitsEB = ps.getParameter<uint32_t>("maxNumberHitsEB");
130  configParameters_.maxNumberHitsEE = ps.getParameter<uint32_t>("maxNumberHitsEE");
131 
132  flagmask_ = 0;
135  flagmask_ |= 0x1 << EcalRecHit::kDead;
136  flagmask_ |= 0x1 << EcalRecHit::kKilled;
139 
141 
142  // for recovery and killing
143 
144  configParameters_.recoverEBIsolatedChannels = ps.getParameter<bool>("recoverEBIsolatedChannels");
145  configParameters_.recoverEEIsolatedChannels = ps.getParameter<bool>("recoverEEIsolatedChannels");
146  configParameters_.recoverEBVFE = ps.getParameter<bool>("recoverEBVFE");
147  configParameters_.recoverEEVFE = ps.getParameter<bool>("recoverEEVFE");
148  configParameters_.recoverEBFE = ps.getParameter<bool>("recoverEBFE");
149  configParameters_.recoverEEFE = ps.getParameter<bool>("recoverEEFE");
150 
151  // conditions tokens
152  tokenADCToGeVConstant_ = esConsumes<EcalRechitADCToGeVConstantGPU, EcalADCToGeVConstantRcd>();
153  tokenIntercalibConstants_ = esConsumes<EcalIntercalibConstantsGPU, EcalIntercalibConstantsRcd>();
154  tokenChannelStatus_ = esConsumes<EcalRechitChannelStatusGPU, EcalChannelStatusRcd>();
155  tokenLaserAPDPNRatios_ = esConsumes<EcalLaserAPDPNRatiosGPU, EcalLaserAPDPNRatiosRcd>();
156  tokenLaserAPDPNRatiosRef_ = esConsumes<EcalLaserAPDPNRatiosRefGPU, EcalLaserAPDPNRatiosRefRcd>();
157  tokenLaserAlphas_ = esConsumes<EcalLaserAlphasGPU, EcalLaserAlphasRcd>();
158  tokenLinearCorrections_ = esConsumes<EcalLinearCorrectionsGPU, EcalLinearCorrectionsRcd>();
159  tokenRecHitParameters_ = esConsumes<EcalRecHitParametersGPU, JobConfigurationGPURecord>();
160 }
161 
163 
165  edm::EventSetup const& setup,
167  // cuda products
168  auto const& ebUncalibRecHitsProduct = event.get(uncalibRecHitsInEBToken_);
169  auto const& eeUncalibRecHitsProduct = event.get(uncalibRecHitsInEEToken_);
170  // raii
171  cms::cuda::ScopedContextAcquire ctx{ebUncalibRecHitsProduct, std::move(holder), cudaState_};
172  // get actual object
173  auto const& ebUncalibRecHits = ctx.get(ebUncalibRecHitsProduct);
174  auto const& eeUncalibRecHits = ctx.get(eeUncalibRecHitsProduct);
175 
176  ecal::rechit::EventInputDataGPU inputDataGPU{ebUncalibRecHits, eeUncalibRecHits};
177 
178  neb_ = ebUncalibRecHits.size;
179  nee_ = eeUncalibRecHits.size;
180 
181  // stop here if there are no uncalibRecHits
182  if (neb_ + nee_ == 0)
183  return;
184 
186  edm::LogError("EcalRecHitProducerGPU")
187  << "max number of channels exceeded. See options 'maxNumberHitsEB and maxNumberHitsEE' ";
188  }
189 
190  int nchannelsEB = ebUncalibRecHits.size; // --> offsetForInput, first EB and then EE
191 
192  // conditions
193  // - laser correction
194  // - IC
195  // - adt2gev
196 
197  //
200 
201  auto const& ADCToGeVConstantProduct = setup.getData(tokenADCToGeVConstant_).getProduct(ctx.stream());
202  auto const& IntercalibConstantsProduct = IntercalibConstantsHandle_->getProduct(ctx.stream());
203  auto const& ChannelStatusProduct = setup.getData(tokenChannelStatus_).getProduct(ctx.stream());
204 
205  auto const& LaserAPDPNRatiosProduct = setup.getData(tokenLaserAPDPNRatios_).getProduct(ctx.stream());
206  auto const& LaserAPDPNRatiosRefProduct = setup.getData(tokenLaserAPDPNRatiosRef_).getProduct(ctx.stream());
207  auto const& LaserAlphasProduct = setup.getData(tokenLaserAlphas_).getProduct(ctx.stream());
208  auto const& LinearCorrectionsProduct = setup.getData(tokenLinearCorrections_).getProduct(ctx.stream());
209  auto const& recHitParametersProduct = recHitParametersHandle_->getProduct(ctx.stream());
210 
211  // set config ptrs : this is done to avoid changing things downstream
212  configParameters_.ChannelStatusToBeExcluded = recHitParametersProduct.channelStatusToBeExcluded.get();
214  configParameters_.expanded_v_DB_reco_flags = recHitParametersProduct.expanded_v_DB_reco_flags.get();
215  configParameters_.expanded_Sizes_v_DB_reco_flags = recHitParametersProduct.expanded_Sizes_v_DB_reco_flags.get();
216  configParameters_.expanded_flagbit_v_DB_reco_flags = recHitParametersProduct.expanded_flagbit_v_DB_reco_flags.get();
218 
219  // bundle up conditions
220  ecal::rechit::ConditionsProducts conditions{ADCToGeVConstantProduct,
221  IntercalibConstantsProduct,
222  ChannelStatusProduct,
223  LaserAPDPNRatiosProduct,
224  LaserAPDPNRatiosRefProduct,
225  LaserAlphasProduct,
226  LinearCorrectionsProduct,
228 
229  // dev mem
231 
232  //
233  // schedule algorithms
234  //
235 
236  edm::TimeValue_t event_time = event.time().value();
237 
239  inputDataGPU, eventOutputDataGPU_, conditions, configParameters_, nchannelsEB, event_time, ctx.stream());
240 
241  cudaCheck(cudaGetLastError());
242 }
243 
246 
249 
250  // put into the event
253 }
254 
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:86
EcalRecHitProducerGPU::EcalRecHitProducerGPU
EcalRecHitProducerGPU(edm::ParameterSet const &ps)
Definition: EcalRecHitProducerGPU.cc:111
EcalLinearCorrectionsGPU.h
ecal::rechit::ConfigurationParameters::recoverEEIsolatedChannels
bool recoverEEIsolatedChannels
Definition: DeclsForKernels.h:259
EcalRecHitProducerGPU::expanded_Sizes_v_DB_reco_flags_
std::vector< uint32_t > expanded_Sizes_v_DB_reco_flags_
Definition: EcalRecHitProducerGPU.cc:83
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:77
edm::EDGetTokenT
Definition: EDGetToken.h:33
EcalRecHitProducerGPU::tokenLaserAPDPNRatios_
edm::ESGetToken< EcalLaserAPDPNRatiosGPU, EcalLaserAPDPNRatiosRcd > tokenLaserAPDPNRatios_
Definition: EcalRecHitProducerGPU.cc:70
EcalLaserAPDPNRatiosRefGPU.h
edm::EDPutTokenT
Definition: EDPutToken.h:33
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EcalLinearCorrectionsRcd.h
EcalLaserAPDPNRatiosRefRcd.h
EcalRecHitProducerGPU::recHitsTokenEB_
edm::EDPutTokenT< OutputProduct > recHitsTokenEB_
Definition: EcalRecHitProducerGPU.cc:61
EcalRecHitProducerGPU::uncalibRecHitsInEBToken_
edm::EDGetTokenT< InputProduct > uncalibRecHitsInEBToken_
Definition: EcalRecHitProducerGPU.cc:51
EcalRecHitProducerGPU::tokenLaserAlphas_
edm::ESGetToken< EcalLaserAlphasGPU, EcalLaserAlphasRcd > tokenLaserAlphas_
Definition: EcalRecHitProducerGPU.cc:72
EDProducer.h
EcalRecHitParametersGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalRecHitParametersGPU.cc:25
EcalLaserAlphasRcd.h
EcalIntercalibConstantsGPU::getProduct
Product const & getProduct(cudaStream_t) const
Definition: EcalIntercalibConstantsGPU.cc:13
EcalRecHitProducerGPU::configParameters_
ecal::rechit::ConfigurationParameters configParameters_
Definition: EcalRecHitProducerGPU.cc:64
EcalIntercalibConstantsGPU::getOffset
uint32_t getOffset() const
Definition: EcalIntercalibConstantsGPU.h:31
EcalRecHit::kTowerRecovered
Definition: EcalRecHit.h:30
EcalRecHitProducerGPU::tokenRecHitParameters_
edm::ESGetToken< EcalRecHitParametersGPU, JobConfigurationGPURecord > tokenRecHitParameters_
Definition: EcalRecHitProducerGPU.cc:74
ESGetToken.h
EcalRecHitProducerGPU::uncalibRecHitsInEEToken_
edm::EDGetTokenT< InputProduct > uncalibRecHitsInEEToken_
Definition: EcalRecHitProducerGPU.cc:52
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
EcalRecHitProducerGPU::tokenLinearCorrections_
edm::ESGetToken< EcalLinearCorrectionsGPU, EcalLinearCorrectionsRcd > tokenLinearCorrections_
Definition: EcalRecHitProducerGPU.cc:73
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:47
Service.h
ecal::rechit::ConfigurationParameters::expanded_Sizes_v_DB_reco_flags
const uint32_t * expanded_Sizes_v_DB_reco_flags
Definition: DeclsForKernels.h:271
edm::ESHandle< EcalIntercalibConstantsGPU >
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
ecal::rechit::ConfigurationParameters::maxNumberHitsEB
uint32_t maxNumberHitsEB
Definition: DeclsForKernels.h:276
EcalRecHitParametersGPU::getValues
std::tuple< intvec, intvec, uint32vec, uint32vec > getValues() const
Definition: EcalRecHitParametersGPU.h:40
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:61
EcalRecHitProducerGPU::eventOutputDataGPU_
ecal::rechit::EventOutputDataGPU eventOutputDataGPU_
Definition: EcalRecHitProducerGPU.cc:55
EcalUncalibratedRecHit.h
EcalRecHitProducerGPU::nee_
uint32_t nee_
Definition: EcalRecHitProducerGPU.cc:47
JobConfigurationGPURecord.h
cms::cuda::ContextState
Definition: ContextState.h:15
ecal::rechit::ConfigurationParameters::recoverEBIsolatedChannels
bool recoverEBIsolatedChannels
Definition: DeclsForKernels.h:258
EcalRecHitProducerGPU::tokenIntercalibConstants_
edm::ESGetToken< EcalIntercalibConstantsGPU, EcalIntercalibConstantsRcd > tokenIntercalibConstants_
Definition: EcalRecHitProducerGPU.cc:68
edm::ParameterSet
Definition: ParameterSet.h:47
ecal::rechit::EventOutputDataGPU
Definition: DeclsForKernels.h:280
EcalRecHitProducerGPU::expanded_flagbit_v_DB_reco_flags_
std::vector< uint32_t > expanded_flagbit_v_DB_reco_flags_
Definition: EcalRecHitProducerGPU.cc:84
Event.h
ecal::rechit::EventOutputDataGPU::allocate
void allocate(ConfigurationParameters const &configParameters, cudaStream_t cudaStream)
Definition: DeclsForKernels.h:283
ecal::rechit::ConfigurationParameters
Definition: DeclsForKernels.h:251
EcalADCToGeVConstantRcd.h
EcalRecHitProducerGPU::tokenLaserAPDPNRatiosRef_
edm::ESGetToken< EcalLaserAPDPNRatiosRefGPU, EcalLaserAPDPNRatiosRefRcd > tokenLaserAPDPNRatiosRef_
Definition: EcalRecHitProducerGPU.cc:71
EcalRecHitProducerGPU::cudaState_
cms::cuda::ContextState cudaState_
Definition: EcalRecHitProducerGPU.cc:57
cudaCheck.h
EcalRecHitProducerGPU::~EcalRecHitProducerGPU
~EcalRecHitProducerGPU() override
Definition: EcalRecHitProducerGPU.cc:162
edm::stream::EDProducer
Definition: EDProducer.h:36
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:244
ecal::rechit::ConditionsProducts
Definition: DeclsForKernels.h:309
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< EcalRechitADCToGeVConstantGPU, EcalADCToGeVConstantRcd >
HLT_FULL_cff.killDeadChannels
killDeadChannels
Definition: HLT_FULL_cff.py:8268
EcalRecHitProducerGPU::expanded_v_DB_reco_flags_
std::vector< int > expanded_v_DB_reco_flags_
Definition: EcalRecHitProducerGPU.cc:82
CUDAService.h
EcalRechitChannelStatusGPU.h
EcalRecHitProducerGPU
Definition: EcalRecHitProducerGPU.cc:35
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:69
EcalRecHitProducerGPU::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: EcalRecHitProducerGPU.cc:89
cms::cuda::Product
Definition: Product.h:34
ScopedContext.h
ecal::rechit::ConfigurationParameters::flagmask
uint32_t flagmask
Definition: DeclsForKernels.h:275
EcalLaserAlphasGPU.h
ecal::rechit::ConfigurationParameters::expanded_v_DB_reco_flags
const int * expanded_v_DB_reco_flags
Definition: DeclsForKernels.h:270
EventSetup.h
EcalRecHitProducerGPU::tokenADCToGeVConstant_
edm::ESGetToken< EcalRechitADCToGeVConstantGPU, EcalADCToGeVConstantRcd > tokenADCToGeVConstant_
Definition: EcalRecHitProducerGPU.cc:67
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
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
EcalRecHitProducerGPU::tokenChannelStatus_
edm::ESGetToken< EcalRechitChannelStatusGPU, EcalChannelStatusRcd > tokenChannelStatus_
Definition: EcalRecHitProducerGPU.cc:69
ecal::rechit::ConfigurationParameters::EBLaserMIN
float EBLaserMIN
Definition: DeclsForKernels.h:265
ecal::rechit::EventOutputDataGPU::recHitsEE
RecHit<::calo::common::DevStoragePolicy > recHitsEE
Definition: DeclsForKernels.h:281
EcalIntercalibConstantsRcd.h
EcalRecHitProducerGPU::recHitParametersHandle_
edm::ESHandle< EcalRecHitParametersGPU > recHitParametersHandle_
Definition: EcalRecHitProducerGPU.cc:78
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:164