CMS 3D CMS Logo

EcalDigiProducer.cc
Go to the documentation of this file.
1 #include <memory>
2 
17 //#include "SimCalorimetry/EcalSimAlgos/interface/ESFastTDigitizer.h"
34 
36 
38  edm::ProducesCollector producesCollector,
40  : EcalDigiProducer(params, iC) {
42  producesCollector.produces<EBDigiCollection>(m_apdDigiTag);
43 
45  producesCollector.produces<EBDigiCollection>(m_componentDigiTag);
46 
47  producesCollector.produces<EBDigiCollection>(m_EBdigiCollection);
48  producesCollector.produces<EEDigiCollection>(m_EEdigiCollection);
49  producesCollector.produces<ESDigiCollection>(m_ESdigiCollection);
50 }
51 
52 // version for Pre-Mixing, for use outside of MixingModule
55  m_APDShape(iC),
56  m_ComponentShapes(iC),
57  m_EBShape(iC),
58  m_EEShape(iC),
59  m_ESShape(),
60  m_EBdigiCollection(params.getParameter<std::string>("EBdigiCollection")),
61  m_EEdigiCollection(params.getParameter<std::string>("EEdigiCollection")),
62  m_ESdigiCollection(params.getParameter<std::string>("ESdigiCollection")),
63  m_hitsProducerTag(params.getParameter<std::string>("hitsProducer")),
64  m_HitsEBToken_(iC.consumes<std::vector<PCaloHit>>(edm::InputTag(m_hitsProducerTag, "EcalHitsEB"))),
65  m_HitsEEToken_(iC.consumes<std::vector<PCaloHit>>(edm::InputTag(m_hitsProducerTag, "EcalHitsEE"))),
66  m_HitsESToken_(iC.consumes<std::vector<PCaloHit>>(edm::InputTag(m_hitsProducerTag, "EcalHitsES"))),
67  m_pedestalsToken(iC.esConsumes()),
68  m_icalToken(iC.esConsumes()),
69  m_laserToken(iC.esConsumes()),
70  m_agcToken(iC.esConsumes()),
71  m_grToken(iC.esConsumes()),
72  m_geometryToken(iC.esConsumes()),
73  m_useLCcorrection(params.getUntrackedParameter<bool>("UseLCcorrection")),
74  m_apdSeparateDigi(params.getParameter<bool>("apdSeparateDigi")),
75  m_componentSeparateDigi(params.getParameter<bool>("componentSeparateDigi")),
76 
77  m_EBs25notCont(params.getParameter<double>("EBs25notContainment")),
78  m_EEs25notCont(params.getParameter<double>("EEs25notContainment")),
79 
80  m_readoutFrameSize(ecalPh1::sampleSize),
81  m_ParameterMap(new EcalSimParameterMap(params.getParameter<double>("simHitToPhotoelectronsBarrel"),
82  params.getParameter<double>("simHitToPhotoelectronsEndcap"),
83  params.getParameter<double>("photoelectronsToAnalogBarrel"),
84  params.getParameter<double>("photoelectronsToAnalogEndcap"),
85  params.getParameter<double>("samplingFactor"),
86  params.getParameter<double>("timePhase"),
87  m_readoutFrameSize,
88  params.getParameter<int>("binOfMaximum"),
89  params.getParameter<bool>("doPhotostatistics"),
90  params.getParameter<bool>("syncPhase"))),
91 
92  m_apdDigiTag(params.getParameter<std::string>("apdDigiTag")),
93  m_apdParameters(new APDSimParameters(params.getParameter<bool>("apdAddToBarrel"),
94  m_apdSeparateDigi,
95  params.getParameter<double>("apdSimToPELow"),
96  params.getParameter<double>("apdSimToPEHigh"),
97  params.getParameter<double>("apdTimeOffset"),
98  params.getParameter<double>("apdTimeOffWidth"),
99  params.getParameter<bool>("apdDoPEStats"),
100  m_apdDigiTag,
101  params.getParameter<std::vector<double>>("apdNonlParms"))),
102 
103  m_componentDigiTag(params.getParameter<std::string>("componentDigiTag")),
104  m_componentParameters(
105  std::make_unique<ComponentSimParameterMap>(params.getParameter<bool>("componentAddToBarrel"),
106  m_componentSeparateDigi,
107  params.getParameter<double>("simHitToPhotoelectronsBarrel"),
108  0, // endcap parameters not needed
109  params.getParameter<double>("photoelectronsToAnalogBarrel"),
110  0,
111  params.getParameter<double>("samplingFactor"),
112  params.getParameter<double>("componentTimePhase"),
113  m_readoutFrameSize,
114  params.getParameter<int>("binOfMaximum"),
115  params.getParameter<bool>("doPhotostatistics"),
116  params.getParameter<bool>("syncPhase"))),
117 
118  m_APDResponse(!m_apdSeparateDigi ? nullptr
119  : new EBHitResponse(m_ParameterMap.get(),
120  &m_EBShape,
121  true,
122  false,
123  m_apdParameters.get(),
124  &m_APDShape,
125  m_componentParameters.get(),
126  &m_ComponentShapes)),
127 
128  m_ComponentResponse(!m_componentSeparateDigi
129  ? nullptr
130  : std::make_unique<EBHitResponse>(
131  m_ParameterMap.get(),
132  &m_EBShape,
133  false,
134  true,
135  m_apdParameters.get(),
136  &m_APDShape,
137  m_componentParameters.get(),
138  &m_ComponentShapes)), // check if that false is correct // TODO HERE JCH
139 
140  m_EBResponse(new EBHitResponse(m_ParameterMap.get(),
141  &m_EBShape,
142  false, // barrel
143  false, // normal non-component shape based
144  m_apdParameters.get(),
145  &m_APDShape,
146  m_componentParameters.get(),
147  &m_ComponentShapes)),
148 
149  m_EEResponse(new EEHitResponse(m_ParameterMap.get(), &m_EEShape)),
150  m_ESResponse(new ESHitResponse(m_ParameterMap.get(), &m_ESShape)),
151  m_ESOldResponse(new CaloHitResponse(m_ParameterMap.get(), &m_ESShape)),
152 
153  m_addESNoise(params.getParameter<bool>("doESNoise")),
154  m_PreMix1(params.getParameter<bool>("EcalPreMixStage1")),
155  m_PreMix2(params.getParameter<bool>("EcalPreMixStage2")),
156 
157  m_doFastES(params.getParameter<bool>("doFast")),
158 
159  m_doEB(params.getParameter<bool>("doEB")),
160  m_doEE(params.getParameter<bool>("doEE")),
161  m_doES(params.getParameter<bool>("doES")),
162 
163  m_ESElectronicsSim(m_doFastES ? nullptr : new ESElectronicsSim(m_addESNoise)),
164 
165  m_ESOldDigitizer(m_doFastES ? nullptr
166  : new ESOldDigitizer(m_ESOldResponse.get(), m_ESElectronicsSim.get(), m_addESNoise)),
167 
168  m_ESElectronicsSimFast(!m_doFastES ? nullptr : new ESElectronicsSimFast(m_addESNoise, m_PreMix1)),
169 
170  m_ESDigitizer(!m_doFastES ? nullptr
171  : new ESDigitizer(m_ESResponse.get(), m_ESElectronicsSimFast.get(), m_addESNoise)),
172 
173  m_APDDigitizer(nullptr),
174  m_ComponentDigitizer(nullptr),
175  m_BarrelDigitizer(nullptr),
176  m_EndcapDigitizer(nullptr),
177  m_ElectronicsSim(nullptr),
178  m_Coder(nullptr),
179  m_APDElectronicsSim(nullptr),
180  m_APDCoder(nullptr),
181  m_Geometry(nullptr),
182  m_EBCorrNoise({{nullptr, nullptr, nullptr}}),
183  m_EECorrNoise({{nullptr, nullptr, nullptr}}) {
184  // "produces" statements taken care of elsewhere.
185  // if(m_apdSeparateDigi) mixMod.produces<EBDigiCollection>(m_apdDigiTag);
186  // mixMod.produces<EBDigiCollection>(m_EBdigiCollection);
187  // mixMod.produces<EEDigiCollection>(m_EEdigiCollection);
188  // mixMod.produces<ESDigiCollection>(m_ESdigiCollection);
189  if (m_doEB)
190  iC.consumes<std::vector<PCaloHit>>(edm::InputTag(m_hitsProducerTag, "EcalHitsEB"));
191  if (m_doEE)
192  iC.consumes<std::vector<PCaloHit>>(edm::InputTag(m_hitsProducerTag, "EcalHitsEE"));
193  if (m_doES) {
194  iC.consumes<std::vector<PCaloHit>>(edm::InputTag(m_hitsProducerTag, "EcalHitsES"));
195  m_esGainToken = iC.esConsumes();
196  m_esMIPToGeVToken = iC.esConsumes();
197  m_esPedestalsToken = iC.esConsumes();
198  m_esMIPsToken = iC.esConsumes();
199  }
200 
201  const std::vector<double> ebCorMatG12 = params.getParameter<std::vector<double>>("EBCorrNoiseMatrixG12");
202  const std::vector<double> eeCorMatG12 = params.getParameter<std::vector<double>>("EECorrNoiseMatrixG12");
203  const std::vector<double> ebCorMatG06 = params.getParameter<std::vector<double>>("EBCorrNoiseMatrixG06");
204  const std::vector<double> eeCorMatG06 = params.getParameter<std::vector<double>>("EECorrNoiseMatrixG06");
205  const std::vector<double> ebCorMatG01 = params.getParameter<std::vector<double>>("EBCorrNoiseMatrixG01");
206  const std::vector<double> eeCorMatG01 = params.getParameter<std::vector<double>>("EECorrNoiseMatrixG01");
207 
208  const bool applyConstantTerm = params.getParameter<bool>("applyConstantTerm");
209  const double rmsConstantTerm = params.getParameter<double>("ConstantTerm");
210 
211  const bool addNoise = params.getParameter<bool>("doENoise");
212  const bool cosmicsPhase = params.getParameter<bool>("cosmicsPhase");
213  const double cosmicsShift = params.getParameter<double>("cosmicsShift");
214 
215  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
216 
217  // further phase for cosmics studies
218  if (cosmicsPhase) {
219  if (m_doEB)
220  m_EBResponse->setPhaseShift(1. + cosmicsShift);
221  if (m_doEE)
222  m_EEResponse->setPhaseShift(1. + cosmicsShift);
223  }
224 
225  EcalCorrMatrix ebMatrix[3];
226  EcalCorrMatrix eeMatrix[3];
227 
228  assert(ebCorMatG12.size() == m_readoutFrameSize);
229  assert(eeCorMatG12.size() == m_readoutFrameSize);
230  assert(ebCorMatG06.size() == m_readoutFrameSize);
231  assert(eeCorMatG06.size() == m_readoutFrameSize);
232  assert(ebCorMatG01.size() == m_readoutFrameSize);
233  assert(eeCorMatG01.size() == m_readoutFrameSize);
234 
235  assert(1.e-7 > fabs(ebCorMatG12[0] - 1.0));
236  assert(1.e-7 > fabs(ebCorMatG06[0] - 1.0));
237  assert(1.e-7 > fabs(ebCorMatG01[0] - 1.0));
238  assert(1.e-7 > fabs(eeCorMatG12[0] - 1.0));
239  assert(1.e-7 > fabs(eeCorMatG06[0] - 1.0));
240  assert(1.e-7 > fabs(eeCorMatG01[0] - 1.0));
241 
242  for (unsigned int row(0); row != m_readoutFrameSize; ++row) {
243  assert(0 == row || 1. >= ebCorMatG12[row]);
244  assert(0 == row || 1. >= ebCorMatG06[row]);
245  assert(0 == row || 1. >= ebCorMatG01[row]);
246  assert(0 == row || 1. >= eeCorMatG12[row]);
247  assert(0 == row || 1. >= eeCorMatG06[row]);
248  assert(0 == row || 1. >= eeCorMatG01[row]);
249  for (unsigned int column(0); column <= row; ++column) {
250  const unsigned int index(row - column);
251  ebMatrix[0](row, column) = ebCorMatG12[index];
252  eeMatrix[0](row, column) = eeCorMatG12[index];
253  ebMatrix[1](row, column) = ebCorMatG06[index];
254  eeMatrix[1](row, column) = eeCorMatG06[index];
255  ebMatrix[2](row, column) = ebCorMatG01[index];
256  eeMatrix[2](row, column) = eeCorMatG01[index];
257  }
258  }
259 
260  m_EBCorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[0]);
261  m_EECorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[0]);
262  m_EBCorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[1]);
263  m_EECorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[1]);
264  m_EBCorrNoise[2] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[2]);
265  m_EECorrNoise[2] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[2]);
266 
267  m_Coder = std::make_unique<EcalCoder>(addNoise,
268  m_PreMix1,
269  m_EBCorrNoise[0].get(),
270  m_EECorrNoise[0].get(),
271  m_EBCorrNoise[1].get(),
272  m_EECorrNoise[1].get(),
273  m_EBCorrNoise[2].get(),
274  m_EECorrNoise[2].get());
275 
276  m_ElectronicsSim =
277  std::make_unique<EcalElectronicsSim_Ph1>(m_ParameterMap.get(), m_Coder.get(), applyConstantTerm, rmsConstantTerm);
278 
279  if (m_apdSeparateDigi) {
280  m_APDCoder = std::make_unique<EcalCoder>(false,
281  m_PreMix1,
282  m_EBCorrNoise[0].get(),
283  m_EECorrNoise[0].get(),
284  m_EBCorrNoise[1].get(),
285  m_EECorrNoise[1].get(),
286  m_EBCorrNoise[2].get(),
287  m_EECorrNoise[2].get());
288 
289  m_APDElectronicsSim = std::make_unique<EcalElectronicsSim_Ph1>(
290  m_ParameterMap.get(), m_APDCoder.get(), applyConstantTerm, rmsConstantTerm);
291 
292  m_APDDigitizer = std::make_unique<EBDigitizer>(m_APDResponse.get(), m_APDElectronicsSim.get(), false);
293  }
294  if (m_componentSeparateDigi) {
295  m_ComponentCoder = std::make_unique<EcalCoder>(addNoise,
296  m_PreMix1,
297  m_EBCorrNoise[0].get(),
298  m_EECorrNoise[0].get(),
299  m_EBCorrNoise[1].get(),
300  m_EECorrNoise[1].get(),
301  m_EBCorrNoise[2].get(),
302  m_EECorrNoise[2].get());
303  m_ComponentElectronicsSim = std::make_unique<EcalElectronicsSim_Ph1>(
304  m_ParameterMap.get(), m_ComponentCoder.get(), applyConstantTerm, rmsConstantTerm);
305  m_ComponentDigitizer =
306  std::make_unique<EBDigitizer>(m_ComponentResponse.get(), m_ComponentElectronicsSim.get(), addNoise);
307  }
308 
309  if (m_doEB) {
310  m_BarrelDigitizer = std::make_unique<EBDigitizer>(m_EBResponse.get(), m_ElectronicsSim.get(), addNoise);
311  }
312 
313  if (m_doEE) {
314  m_EndcapDigitizer = std::make_unique<EEDigitizer>(m_EEResponse.get(), m_ElectronicsSim.get(), addNoise);
315  }
316 }
317 
319 
322  randomEngine_ = &rng->getEngine(event.streamID());
323 
326  if (m_doEB) {
327  m_BarrelDigitizer->initializeHits();
328  if (m_apdSeparateDigi) {
329  m_APDDigitizer->initializeHits();
330  }
332  m_ComponentDigitizer->initializeHits();
333  }
334  }
335  if (m_doEE) {
336  m_EndcapDigitizer->initializeHits();
337  }
338  if (m_doES) {
339  if (m_doFastES) {
340  m_ESDigitizer->initializeHits();
341  } else {
342  m_ESOldDigitizer->initializeHits();
343  }
344  }
345 }
346 
348  HitsHandle const &eeHandle,
349  HitsHandle const &esHandle,
350  int bunchCrossing) {
351  if (m_doEB && ebHandle.isValid()) {
352  m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_);
353 
354  if (m_apdSeparateDigi) {
355  m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_);
356  }
358  m_ComponentDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_);
359  }
360  }
361 
362  if (m_doEE && eeHandle.isValid()) {
363  m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, randomEngine_);
364  }
365 
366  if (m_doES && esHandle.isValid()) {
367  if (m_doFastES) {
368  m_ESDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_);
369  } else {
370  m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_);
371  }
372  }
373 }
374 
376  // Step A: Get Inputs
377  const edm::Handle<std::vector<PCaloHit>> &ebHandle = e.getHandle(m_HitsEBToken_);
378  if (m_doEB) {
382  }
383 
384  const edm::Handle<std::vector<PCaloHit>> &eeHandle = e.getHandle(m_HitsEEToken_);
385  if (m_doEE) {
387  }
388 
389  const edm::Handle<std::vector<PCaloHit>> &esHandle = e.getHandle(m_HitsESToken_);
390 
391  accumulateCaloHits(ebHandle, eeHandle, esHandle, 0);
392 }
393 
396  edm::StreamID const &streamID) {
397  // Step A: Get Inputs
399  if (m_doEB) {
400  edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB");
401  e.getByLabel(ebTag, ebHandle);
402  }
403 
405  if (m_doEE) {
406  edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE");
407  e.getByLabel(eeTag, eeHandle);
408  }
409 
411  if (m_doES) {
412  edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES");
413  e.getByLabel(esTag, esHandle);
414  }
415 
416  accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing());
417 }
418 
420  // Step B: Create empty output
421  std::unique_ptr<EBDigiCollection> apdResult(!m_apdSeparateDigi || !m_doEB ? nullptr : new EBDigiCollection());
422  std::unique_ptr<EBDigiCollection> componentResult(!m_componentSeparateDigi || !m_doEB ? nullptr
423  : new EBDigiCollection());
424  std::unique_ptr<EBDigiCollection> barrelResult(new EBDigiCollection());
425  std::unique_ptr<EEDigiCollection> endcapResult(new EEDigiCollection());
426  std::unique_ptr<ESDigiCollection> preshowerResult(new ESDigiCollection());
427 
428  // run the algorithm
429 
430  if (m_doEB) {
431  m_BarrelDigitizer->run(*barrelResult, randomEngine_);
432  cacheEBDigis(&*barrelResult);
433 
434  edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size();
435 
436  if (m_apdSeparateDigi) {
437  m_APDDigitizer->run(*apdResult, randomEngine_);
438  edm::LogInfo("DigiInfo") << "APD Digis: " << apdResult->size();
439  }
441  m_ComponentDigitizer->run(*componentResult, randomEngine_);
442  edm::LogInfo("DigiInfo") << "Component Digis: " << componentResult->size();
443  }
444  }
445 
446  if (m_doEE) {
447  m_EndcapDigitizer->run(*endcapResult, randomEngine_);
448  edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size();
449  cacheEEDigis(&*endcapResult);
450  }
451  if (m_doES) {
452  if (m_doFastES) {
453  m_ESDigitizer->run(*preshowerResult, randomEngine_);
454  } else {
455  m_ESOldDigitizer->run(*preshowerResult, randomEngine_);
456  }
457  edm::LogInfo("EcalDigi") << "ES Digis: " << preshowerResult->size();
458  }
459 
460  // Step D: Put outputs into event
461  if (m_apdSeparateDigi) {
462  // event.put(std::move(apdResult), m_apdDigiTag ) ;
463  }
464 
465  event.put(std::move(barrelResult), m_EBdigiCollection);
467  event.put(std::move(componentResult), m_componentDigiTag);
468  }
469  event.put(std::move(endcapResult), m_EEdigiCollection);
470  event.put(std::move(preshowerResult), m_ESdigiCollection);
471 
472  randomEngine_ = nullptr; // to prevent access outside event
473 }
474 
477  if (!rng.isAvailable()) {
478  throw cms::Exception("Configuration") << "RandomNumberGenerator service is not available.\n"
479  "You must add the service in the configuration file\n"
480  "or remove the module that requires it.";
481  }
482  CLHEP::HepRandomEngine *engine = &rng->getEngine(lumi.index());
483 
484  if (m_doEB) {
485  if (nullptr != m_APDResponse)
486  m_APDResponse->initialize(engine);
487  if (nullptr != m_ComponentResponse)
488  m_ComponentResponse->initialize(engine);
489  m_EBResponse->initialize(engine);
490  }
491 }
492 
494  // Pedestals from event setup
495 
496  const EcalPedestals *pedestals = &eventSetup.getData(m_pedestalsToken);
497 
498  m_Coder->setPedestals(pedestals);
499  if (nullptr != m_APDCoder)
500  m_APDCoder->setPedestals(pedestals);
501  if (nullptr != m_ComponentCoder)
502  m_ComponentCoder->setPedestals(pedestals);
503 
504  // Ecal Intercalibration Constants
505  const EcalIntercalibConstantsMC *ical = &eventSetup.getData(m_icalToken);
506 
507  m_Coder->setIntercalibConstants(ical);
508  if (nullptr != m_APDCoder)
509  m_APDCoder->setIntercalibConstants(ical);
510  if (nullptr != m_ComponentCoder)
511  m_ComponentCoder->setIntercalibConstants(ical);
512 
513  m_EBResponse->setIntercal(ical);
514  if (nullptr != m_APDResponse)
515  m_APDResponse->setIntercal(ical);
516  if (nullptr != m_ComponentResponse)
517  m_ComponentResponse->setIntercal(ical);
518 
519  // Ecal LaserCorrection Constants
520  const EcalLaserDbService *laser = &eventSetup.getData(m_laserToken);
521  const edm::TimeValue_t eventTimeValue = event.time().value();
522 
523  m_EBResponse->setEventTime(eventTimeValue);
524  m_EBResponse->setLaserConstants(laser, m_useLCcorrection);
525 
526  m_EEResponse->setEventTime(eventTimeValue);
527  m_EEResponse->setLaserConstants(laser, m_useLCcorrection);
528 
529  // ADC -> GeV Scale
530  const EcalADCToGeVConstant *agc = &eventSetup.getData(m_agcToken);
531 
532  // Gain Ratios
533  const EcalGainRatios *gr = &eventSetup.getData(m_grToken);
534 
535  m_Coder->setGainRatios(gr);
536  if (nullptr != m_APDCoder)
537  m_APDCoder->setGainRatios(gr);
538  if (nullptr != m_ComponentCoder)
539  m_ComponentCoder->setGainRatios(gr);
540 
541  EcalMGPAGainRatio *defaultRatios = new EcalMGPAGainRatio();
542 
543  double theGains[m_Coder->NGAINS + 1];
544  theGains[0] = 0.;
545  theGains[3] = 1.;
546  theGains[2] = defaultRatios->gain6Over1();
547  theGains[1] = theGains[2] * (defaultRatios->gain12Over6());
548 
549  LogDebug("EcalDigi") << " Gains: "
550  << "\n"
551  << " g1 = " << theGains[1] << "\n"
552  << " g2 = " << theGains[2] << "\n"
553  << " g3 = " << theGains[3];
554 
555  delete defaultRatios;
556 
557  const double EBscale((agc->getEBValue()) * theGains[1] * (m_Coder->MAXADC) * m_EBs25notCont);
558 
559  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue() << "\n"
560  << " notCont = " << m_EBs25notCont << "\n"
561  << " saturation for EB = " << EBscale << ", " << m_EBs25notCont;
562 
563  const double EEscale((agc->getEEValue()) * theGains[1] * (m_Coder->MAXADC) * m_EEs25notCont);
564 
565  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue() << "\n"
566  << " notCont = " << m_EEs25notCont << "\n"
567  << " saturation for EB = " << EEscale << ", " << m_EEs25notCont;
568 
569  m_Coder->setFullScaleEnergy(EBscale, EEscale);
570  if (nullptr != m_APDCoder)
571  m_APDCoder->setFullScaleEnergy(EBscale, EEscale);
572  if (nullptr != m_ComponentCoder)
573  m_ComponentCoder->setFullScaleEnergy(EBscale, EEscale);
574 
575  if (m_doES) {
576  // ES condition objects
577  const ESGain *esgain = &eventSetup.getData(m_esGainToken);
578  const ESPedestals *espeds = &eventSetup.getData(m_esPedestalsToken);
579  const ESIntercalibConstants *esmips = &eventSetup.getData(m_esMIPsToken);
580  const ESMIPToGeVConstant *esMipToGeV = &eventSetup.getData(m_esMIPToGeVToken);
581  const int ESGain(1.1 > esgain->getESGain() ? 1 : 2);
582  const double ESMIPToGeV((1 == ESGain) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh());
583 
585  if (!m_doFastES) {
586  m_ESElectronicsSim->setGain(ESGain);
587  m_ESElectronicsSim->setPedestals(espeds);
588  m_ESElectronicsSim->setMIPs(esmips);
589  m_ESElectronicsSim->setMIPToGeV(ESMIPToGeV);
590  } else {
591  m_ESDigitizer->setGain(ESGain);
592  m_ESElectronicsSimFast->setPedestals(espeds);
593  m_ESElectronicsSimFast->setMIPs(esmips);
594  m_ESElectronicsSimFast->setMIPToGeV(ESMIPToGeV);
595  }
596  }
597 }
598 
602  updateGeometry();
603  }
604 }
605 
607  if (m_doEB) {
608  if (nullptr != m_APDResponse)
610  if (nullptr != m_ComponentResponse)
613  }
614  if (m_doEE) {
616  }
617  if (m_doES) {
619  m_ESOldResponse->setGeometry(m_Geometry);
620 
621  const std::vector<DetId> *theESDets(
624  : nullptr);
625 
626  if (!m_doFastES) {
627  if (nullptr != m_ESOldDigitizer && nullptr != theESDets)
628  m_ESOldDigitizer->setDetIds(*theESDets);
629  } else {
630  if (nullptr != m_ESDigitizer && nullptr != theESDets)
631  m_ESDigitizer->setDetIds(*theESDets);
632  }
633  }
634 }
635 
637  // noiseGenerator->setParameterMap(theParameterMap);
638  if (nullptr != m_BarrelDigitizer)
639  m_BarrelDigitizer->setNoiseSignalGenerator(noiseGenerator);
640 }
641 
643  // noiseGenerator->setParameterMap(theParameterMap);
644  if (nullptr != m_EndcapDigitizer)
645  m_EndcapDigitizer->setNoiseSignalGenerator(noiseGenerator);
646 }
647 
649  // noiseGenerator->setParameterMap(theParameterMap);
650  if (nullptr != m_ESDigitizer)
651  m_ESDigitizer->setNoiseSignalGenerator(noiseGenerator);
652 }
std::unique_ptr< EcalCoder > m_APDCoder
edm::ESWatcher< CaloGeometryRecord > m_geometryWatcher
const edm::EDGetTokenT< std::vector< PCaloHit > > m_HitsEEToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
float getESValueHigh() const
std::unique_ptr< ESDigitizer > m_ESDigitizer
edm::ESGetToken< ESMIPToGeVConstant, ESMIPToGeVConstantRcd > m_esMIPToGeVToken
const std::string m_ESdigiCollection
const edm::ESGetToken< EcalIntercalibConstantsMC, EcalIntercalibConstantsMCRcd > m_icalToken
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
Definition: ESGain.h:7
void setGain(const int gain)
Definition: ESShape.h:23
const std::string m_componentDigiTag
std::unique_ptr< EBHitResponse > m_APDResponse
const edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > m_laserToken
const std::string m_hitsProducerTag
const edm::EDGetTokenT< std::vector< PCaloHit > > m_HitsESToken_
std::unique_ptr< EcalCoder > m_Coder
T const * product() const
Definition: Handle.h:70
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const
edm::ESGetToken< ESGain, ESGainRcd > m_esGainToken
assert(be >=bs)
const edm::EDGetTokenT< std::vector< PCaloHit > > m_HitsEBToken_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
const std::string m_EEdigiCollection
std::unique_ptr< ESHitResponse > m_ESResponse
void setEENoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
std::unique_ptr< EBHitResponse > m_ComponentResponse
void setEBNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void setESNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing)
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
Creates electronics signals from hits.
const double m_EBs25notCont
edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > m_esMIPsToken
std::unique_ptr< EcalCoder > m_ComponentCoder
ComponentShapeCollection m_ComponentShapes
std::unique_ptr< CaloHitResponse > m_ESOldResponse
float getESValueLow() const
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void setEventSetup(const edm::EventSetup &evtSetup)
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
unsigned long long TimeValue_t
Definition: Timestamp.h:21
void setEventSetup(const edm::EventSetup &evtSetup, bool normalize=true)
const CaloGeometry * m_Geometry
void checkCalibrations(const edm::Event &event, const edm::EventSetup &eventSetup)
void checkGeometry(const edm::EventSetup &eventSetup)
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
Log< level::Info, false > LogInfo
float gain12Over6() const
const edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > m_agcToken
CLHEP::HepRandomEngine * randomEngine_
std::unique_ptr< EEHitResponse > m_EEResponse
edm::ESGetToken< ESPedestals, ESPedestalsRcd > m_esPedestalsToken
std::unique_ptr< EBDigitizer > m_ComponentDigitizer
float gain6Over1() const
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
const bool m_apdSeparateDigi
bool isValid() const
Definition: HandleBase.h:70
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
const bool m_componentSeparateDigi
HLT enums.
math::ErrorD< ecalPh1::sampleSize >::type EcalCorrMatrix
const std::string m_apdDigiTag
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > m_pedestalsToken
std::unique_ptr< EBHitResponse > m_EBResponse
bool isAvailable() const
Definition: Service.h:40
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
#define get
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const
~EcalDigiProducer() override
EcalDigiProducer(const edm::ParameterSet &params, edm::ProducesCollector, edm::ConsumesCollector &iC)
const std::string m_EBdigiCollection
std::unique_ptr< EBDigitizer > m_APDDigitizer
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
const edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > m_grToken
def move(src, dest)
Definition: eostools.py:511
float getESGain() const
Definition: ESGain.h:13
const double m_EEs25notCont
Definition: event.py:1
#define LogDebug(id)