CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes
EcalDigiProducer Class Reference

#include <EcalDigiProducer.h>

Inheritance diagram for EcalDigiProducer:
DigiAccumulatorMixMod EcalTBDigiProducer

Public Member Functions

void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
 EcalDigiProducer (const edm::ParameterSet &params, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
 EcalDigiProducer (const edm::ParameterSet &params, edm::ConsumesCollector &iC)
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
void setEBNoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
void setEENoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
void setESNoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
 ~EcalDigiProducer () override
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
 DigiAccumulatorMixMod (DigiAccumulatorMixMod const &)=delete
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
DigiAccumulatorMixMod const & operator= (DigiAccumulatorMixMod const &)=delete
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Protected Attributes

std::unique_ptr< EBHitResponsem_EBResponse
 
std::unique_ptr< EEHitResponsem_EEResponse
 
std::unique_ptr< const
EcalSimParameterMap
m_ParameterMap
 

Private Types

typedef EcalElectronicsSim
< EcalCoder, EcalSamples,
EcalDataFrame
EcalElectronicsSim_Ph1
 
typedef CaloTSamples< float, 10 > EcalSamples
 
typedef edm::Handle
< std::vector< PCaloHit > > 
HitsHandle
 

Private Member Functions

void accumulateCaloHits (HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing)
 
virtual void cacheEBDigis (const EBDigiCollection *ebDigiPtr) const
 
virtual void cacheEEDigis (const EEDigiCollection *eeDigiPtr) const
 
void checkCalibrations (const edm::Event &event, const edm::EventSetup &eventSetup)
 
void checkGeometry (const edm::EventSetup &eventSetup)
 
void updateGeometry ()
 

Private Attributes

const bool m_addESNoise
 
const edm::ESGetToken
< EcalADCToGeVConstant,
EcalADCToGeVConstantRcd
m_agcToken
 
std::unique_ptr< EcalCoderm_APDCoder
 
const std::string m_apdDigiTag
 
std::unique_ptr< EBDigitizerm_APDDigitizer
 
std::unique_ptr
< EcalElectronicsSim_Ph1
m_APDElectronicsSim
 
std::unique_ptr< const
APDSimParameters
m_apdParameters
 
std::unique_ptr< EBHitResponsem_APDResponse
 
const bool m_apdSeparateDigi
 
APDShape m_APDShape
 
std::unique_ptr< EBDigitizerm_BarrelDigitizer
 
std::unique_ptr< EcalCoderm_Coder
 
const bool m_doEB
 
const bool m_doEE
 
const bool m_doES
 
const bool m_doFastES
 
std::array< std::unique_ptr
< CorrelatedNoisifier
< EcalCorrMatrix > >, 3 > 
m_EBCorrNoise
 
const std::string m_EBdigiCollection
 
const double m_EBs25notCont
 
EBShape m_EBShape
 
std::array< std::unique_ptr
< CorrelatedNoisifier
< EcalCorrMatrix > >, 3 > 
m_EECorrNoise
 
const std::string m_EEdigiCollection
 
const double m_EEs25notCont
 
EEShape m_EEShape
 
std::unique_ptr
< EcalElectronicsSim_Ph1
m_ElectronicsSim
 
std::unique_ptr< EEDigitizerm_EndcapDigitizer
 
const std::string m_ESdigiCollection
 
std::unique_ptr< ESDigitizerm_ESDigitizer
 
std::unique_ptr< ESElectronicsSimm_ESElectronicsSim
 
std::unique_ptr
< ESElectronicsSimFast
m_ESElectronicsSimFast
 
edm::ESGetToken< ESGain,
ESGainRcd
m_esGainToken
 
edm::ESGetToken
< ESIntercalibConstants,
ESIntercalibConstantsRcd
m_esMIPsToken
 
edm::ESGetToken
< ESMIPToGeVConstant,
ESMIPToGeVConstantRcd
m_esMIPToGeVToken
 
std::unique_ptr< ESOldDigitizerm_ESOldDigitizer
 
std::unique_ptr< CaloHitResponsem_ESOldResponse
 
edm::ESGetToken< ESPedestals,
ESPedestalsRcd
m_esPedestalsToken
 
std::unique_ptr< ESHitResponsem_ESResponse
 
ESShape m_ESShape
 
const CaloGeometrym_Geometry
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
m_geometryToken
 
edm::ESWatcher
< CaloGeometryRecord
m_geometryWatcher
 
const edm::ESGetToken
< EcalGainRatios,
EcalGainRatiosRcd
m_grToken
 
const std::string m_hitsProducerTag
 
const edm::ESGetToken
< EcalIntercalibConstantsMC,
EcalIntercalibConstantsMCRcd
m_icalToken
 
const edm::ESGetToken
< EcalLaserDbService,
EcalLaserDbRecord
m_laserToken
 
const edm::ESGetToken
< EcalPedestals,
EcalPedestalsRcd
m_pedestalsToken
 
const bool m_PreMix1
 
const bool m_PreMix2
 
const unsigned int m_readoutFrameSize
 
bool m_useLCcorrection
 
CLHEP::HepRandomEngine * randomEngine_ = nullptr
 

Detailed Description

Definition at line 79 of file EcalDigiProducer.h.

Member Typedef Documentation

Definition at line 178 of file EcalDigiProducer.h.

typedef CaloTSamples<float, 10> EcalDigiProducer::EcalSamples
private

Definition at line 176 of file EcalDigiProducer.h.

typedef edm::Handle<std::vector<PCaloHit> > EcalDigiProducer::HitsHandle
private

Definition at line 99 of file EcalDigiProducer.h.

Constructor & Destructor Documentation

EcalDigiProducer::EcalDigiProducer ( const edm::ParameterSet params,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)

Definition at line 37 of file EcalDigiProducer.cc.

References m_apdDigiTag, m_apdSeparateDigi, m_EBdigiCollection, m_EEdigiCollection, m_ESdigiCollection, and edm::ProducesCollector::produces().

40  : EcalDigiProducer(params, iC) {
42  producesCollector.produces<EBDigiCollection>(m_apdDigiTag);
43 
44  producesCollector.produces<EBDigiCollection>(m_EBdigiCollection);
45  producesCollector.produces<EEDigiCollection>(m_EEdigiCollection);
46  producesCollector.produces<ESDigiCollection>(m_ESdigiCollection);
47 }
const std::string m_ESdigiCollection
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const std::string m_EEdigiCollection
const bool m_apdSeparateDigi
const std::string m_apdDigiTag
EcalDigiProducer(const edm::ParameterSet &params, edm::ProducesCollector, edm::ConsumesCollector &iC)
const std::string m_EBdigiCollection
EcalDigiProducer::EcalDigiProducer ( const edm::ParameterSet params,
edm::ConsumesCollector iC 
)

Definition at line 50 of file EcalDigiProducer.cc.

52  m_APDShape(iC),
53  m_EBShape(iC),
54  m_EEShape(iC),
55  m_ESShape(),
56  m_EBdigiCollection(params.getParameter<std::string>("EBdigiCollection")),
57  m_EEdigiCollection(params.getParameter<std::string>("EEdigiCollection")),
58  m_ESdigiCollection(params.getParameter<std::string>("ESdigiCollection")),
59  m_hitsProducerTag(params.getParameter<std::string>("hitsProducer")),
61  m_icalToken(iC.esConsumes()),
63  m_agcToken(iC.esConsumes()),
64  m_grToken(iC.esConsumes()),
66  m_useLCcorrection(params.getUntrackedParameter<bool>("UseLCcorrection")),
67  m_apdSeparateDigi(params.getParameter<bool>("apdSeparateDigi")),
68 
69  m_EBs25notCont(params.getParameter<double>("EBs25notContainment")),
70  m_EEs25notCont(params.getParameter<double>("EEs25notContainment")),
71 
73  m_ParameterMap(new EcalSimParameterMap(params.getParameter<double>("simHitToPhotoelectronsBarrel"),
74  params.getParameter<double>("simHitToPhotoelectronsEndcap"),
75  params.getParameter<double>("photoelectronsToAnalogBarrel"),
76  params.getParameter<double>("photoelectronsToAnalogEndcap"),
77  params.getParameter<double>("samplingFactor"),
78  params.getParameter<double>("timePhase"),
80  params.getParameter<int>("binOfMaximum"),
81  params.getParameter<bool>("doPhotostatistics"),
82  params.getParameter<bool>("syncPhase"))),
83 
84  m_apdDigiTag(params.getParameter<std::string>("apdDigiTag")),
85  m_apdParameters(new APDSimParameters(params.getParameter<bool>("apdAddToBarrel"),
87  params.getParameter<double>("apdSimToPELow"),
88  params.getParameter<double>("apdSimToPEHigh"),
89  params.getParameter<double>("apdTimeOffset"),
90  params.getParameter<double>("apdTimeOffWidth"),
91  params.getParameter<bool>("apdDoPEStats"),
93  params.getParameter<std::vector<double>>("apdNonlParms"))),
94 
97  ? nullptr
98  : new EBHitResponse(m_ParameterMap.get(), &m_EBShape, true, m_apdParameters.get(), &m_APDShape)),
99 
101  &m_EBShape,
102  false, // barrel
103  m_apdParameters.get(),
104  &m_APDShape)),
105 
109 
110  m_addESNoise(params.getParameter<bool>("doESNoise")),
111  m_PreMix1(params.getParameter<bool>("EcalPreMixStage1")),
112  m_PreMix2(params.getParameter<bool>("EcalPreMixStage2")),
113 
114  m_doFastES(params.getParameter<bool>("doFast")),
115 
116  m_doEB(params.getParameter<bool>("doEB")),
117  m_doEE(params.getParameter<bool>("doEE")),
118  m_doES(params.getParameter<bool>("doES")),
119 
121 
122  m_ESOldDigitizer(m_doFastES ? nullptr
124 
126 
127  m_ESDigitizer(!m_doFastES ? nullptr
129 
130  m_APDDigitizer(nullptr),
131  m_BarrelDigitizer(nullptr),
132  m_EndcapDigitizer(nullptr),
133  m_ElectronicsSim(nullptr),
134  m_Coder(nullptr),
135  m_APDElectronicsSim(nullptr),
136  m_APDCoder(nullptr),
137  m_Geometry(nullptr),
138  m_EBCorrNoise({{nullptr, nullptr, nullptr}}),
std::unique_ptr< EcalCoder > m_APDCoder
T getUntrackedParameter(std::string const &, T const &) const
CaloTDigitizer< ESOldDigitizerTraits > ESOldDigitizer
std::unique_ptr< ESDigitizer > m_ESDigitizer
const std::string m_ESdigiCollection
const edm::ESGetToken< EcalIntercalibConstantsMC, EcalIntercalibConstantsMCRcd > m_icalToken
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
std::unique_ptr< EBHitResponse > m_APDResponse
const edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > m_laserToken
const std::string m_hitsProducerTag
std::unique_ptr< EcalCoder > m_Coder
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
const std::string m_EEdigiCollection
std::unique_ptr< ESHitResponse > m_ESResponse
const bool m_addESNoise
const unsigned int m_readoutFrameSize
std::unique_ptr< EcalElectronicsSim_Ph1 > m_APDElectronicsSim
Creates electronics signals from hits.
const double m_EBs25notCont
std::unique_ptr< EcalElectronicsSim_Ph1 > m_ElectronicsSim
std::unique_ptr< CaloHitResponse > m_ESOldResponse
std::array< std::unique_ptr< CorrelatedNoisifier< EcalCorrMatrix > >, 3 > m_EBCorrNoise
const CaloGeometry * m_Geometry
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
const edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > m_agcToken
std::unique_ptr< EEHitResponse > m_EEResponse
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const bool m_apdSeparateDigi
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
static constexpr unsigned int sampleSize
Definition: EcalConstants.h:28
const std::string m_apdDigiTag
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > m_pedestalsToken
std::unique_ptr< EBHitResponse > m_EBResponse
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
const std::string m_EBdigiCollection
EBHitResponseImpl< ecalPh1 > EBHitResponse
std::unique_ptr< EBDigitizer > m_APDDigitizer
const edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > m_grToken
const double m_EEs25notCont
std::unique_ptr< const EcalSimParameterMap > m_ParameterMap
std::unique_ptr< const APDSimParameters > m_apdParameters
EcalDigiProducer::~EcalDigiProducer ( )
override

Definition at line 260 of file EcalDigiProducer.cc.

260 {}

Member Function Documentation

void EcalDigiProducer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 311 of file EcalDigiProducer.cc.

References accumulateCaloHits(), edm::Event::getByLabel(), m_APDShape, m_doEB, m_doEE, m_doES, m_EBShape, m_EEShape, m_hitsProducerTag, and EcalShapeBase::setEventSetup().

Referenced by PreMixingEcalWorker::addSignals().

311  {
312  // Step A: Get Inputs
314  if (m_doEB) {
315  m_EBShape.setEventSetup(eventSetup);
316  m_APDShape.setEventSetup(eventSetup);
317  edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB");
318  e.getByLabel(ebTag, ebHandle);
319  }
320 
322  if (m_doEE) {
323  m_EEShape.setEventSetup(eventSetup);
324  edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE");
325  e.getByLabel(eeTag, eeHandle);
326  }
327 
329  if (m_doES) {
330  edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES");
331  e.getByLabel(esTag, esHandle);
332  }
333 
334  accumulateCaloHits(ebHandle, eeHandle, esHandle, 0);
335 }
const std::string m_hitsProducerTag
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing)
void setEventSetup(const edm::EventSetup &evtSetup)
void EcalDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 337 of file EcalDigiProducer.cc.

References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), PileUpEventPrincipal::getByLabel(), m_doEB, m_doEE, m_doES, and m_hitsProducerTag.

339  {
340  // Step A: Get Inputs
342  if (m_doEB) {
343  edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB");
344  e.getByLabel(ebTag, ebHandle);
345  }
346 
348  if (m_doEE) {
349  edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE");
350  e.getByLabel(eeTag, eeHandle);
351  }
352 
354  if (m_doES) {
355  edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES");
356  e.getByLabel(esTag, esHandle);
357  }
358 
359  accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing());
360 }
const std::string m_hitsProducerTag
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing)
void EcalDigiProducer::accumulateCaloHits ( HitsHandle const &  ebHandle,
HitsHandle const &  eeHandle,
HitsHandle const &  esHandle,
int  bunchCrossing 
)
private

Definition at line 286 of file EcalDigiProducer.cc.

References edm::HandleBase::isValid(), m_apdSeparateDigi, m_BarrelDigitizer, m_doEB, m_doEE, m_doES, m_doFastES, m_EndcapDigitizer, m_ESDigitizer, m_ESOldDigitizer, edm::Handle< T >::product(), and randomEngine_.

Referenced by accumulate().

289  {
290  if (m_doEB && ebHandle.isValid()) {
291  m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_);
292 
293  if (m_apdSeparateDigi) {
294  m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_);
295  }
296  }
297 
298  if (m_doEE && eeHandle.isValid()) {
299  m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, randomEngine_);
300  }
301 
302  if (m_doES && esHandle.isValid()) {
303  if (m_doFastES) {
304  m_ESDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_);
305  } else {
306  m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_);
307  }
308  }
309 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
CLHEP::HepRandomEngine * randomEngine_
const bool m_apdSeparateDigi
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
std::unique_ptr< EBDigitizer > m_APDDigitizer
void EcalDigiProducer::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overridevirtual

Reimplemented from DigiAccumulatorMixMod.

Definition at line 409 of file EcalDigiProducer.cc.

References Exception, edm::RandomNumberGenerator::getEngine(), edm::LuminosityBlock::index(), edm::Service< T >::isAvailable(), m_APDResponse, m_doEB, and m_EBResponse.

Referenced by PreMixingEcalWorker::beginLuminosityBlock().

409  {
411  if (!rng.isAvailable()) {
412  throw cms::Exception("Configuration") << "RandomNumberGenerator service is not available.\n"
413  "You must add the service in the configuration file\n"
414  "or remove the module that requires it.";
415  }
416  CLHEP::HepRandomEngine *engine = &rng->getEngine(lumi.index());
417 
418  if (m_doEB) {
419  if (nullptr != m_APDResponse)
420  m_APDResponse->initialize(engine);
421  m_EBResponse->initialize(engine);
422  }
423 }
std::unique_ptr< EBHitResponse > m_APDResponse
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
bool isAvailable() const
Definition: Service.h:40
list lumi
Definition: dqmdumpme.py:53
std::unique_ptr< EBHitResponse > m_EBResponse
virtual void EcalDigiProducer::cacheEBDigis ( const EBDigiCollection ebDigiPtr) const
inlineprivatevirtual

Reimplemented in EcalTBDigiProducer.

Definition at line 96 of file EcalDigiProducer.h.

Referenced by finalizeEvent().

96 {}
virtual void EcalDigiProducer::cacheEEDigis ( const EEDigiCollection eeDigiPtr) const
inlineprivatevirtual

Reimplemented in EcalTBDigiProducer.

Definition at line 97 of file EcalDigiProducer.h.

Referenced by finalizeEvent().

97 {}
void EcalDigiProducer::checkCalibrations ( const edm::Event event,
const edm::EventSetup eventSetup 
)
private

Definition at line 425 of file EcalDigiProducer.cc.

References EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), edm::EventSetup::getData(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), ESGain::getESGain(), ESMIPToGeVConstant::getESValueHigh(), ESMIPToGeVConstant::getESValueLow(), EcalCondDBWriter_cfi::laser, LogDebug, m_agcToken, m_APDCoder, m_APDResponse, m_doES, m_doFastES, m_EBResponse, m_EBs25notCont, m_EEResponse, m_EEs25notCont, m_ESDigitizer, m_ESElectronicsSim, m_ESElectronicsSimFast, m_esMIPsToken, m_esMIPToGeVToken, m_esPedestalsToken, m_ESShape, m_grToken, m_icalToken, m_laserToken, m_pedestalsToken, m_useLCcorrection, and ESShape::setGain().

Referenced by initializeEvent().

425  {
426  // Pedestals from event setup
427 
428  const EcalPedestals *pedestals = &eventSetup.getData(m_pedestalsToken);
429 
430  m_Coder->setPedestals(pedestals);
431  if (nullptr != m_APDCoder)
432  m_APDCoder->setPedestals(pedestals);
433 
434  // Ecal Intercalibration Constants
435  const EcalIntercalibConstantsMC *ical = &eventSetup.getData(m_icalToken);
436 
437  m_Coder->setIntercalibConstants(ical);
438  if (nullptr != m_APDCoder)
439  m_APDCoder->setIntercalibConstants(ical);
440 
441  m_EBResponse->setIntercal(ical);
442  if (nullptr != m_APDResponse)
443  m_APDResponse->setIntercal(ical);
444 
445  // Ecal LaserCorrection Constants
446  const EcalLaserDbService *laser = &eventSetup.getData(m_laserToken);
447  const edm::TimeValue_t eventTimeValue = event.time().value();
448 
449  m_EBResponse->setEventTime(eventTimeValue);
450  m_EBResponse->setLaserConstants(laser, m_useLCcorrection);
451 
452  m_EEResponse->setEventTime(eventTimeValue);
453  m_EEResponse->setLaserConstants(laser, m_useLCcorrection);
454 
455  // ADC -> GeV Scale
456  const EcalADCToGeVConstant *agc = &eventSetup.getData(m_agcToken);
457 
458  // Gain Ratios
459  const EcalGainRatios *gr = &eventSetup.getData(m_grToken);
460 
461  m_Coder->setGainRatios(gr);
462  if (nullptr != m_APDCoder)
463  m_APDCoder->setGainRatios(gr);
464 
465  EcalMGPAGainRatio *defaultRatios = new EcalMGPAGainRatio();
466 
467  double theGains[m_Coder->NGAINS + 1];
468  theGains[0] = 0.;
469  theGains[3] = 1.;
470  theGains[2] = defaultRatios->gain6Over1();
471  theGains[1] = theGains[2] * (defaultRatios->gain12Over6());
472 
473  LogDebug("EcalDigi") << " Gains: "
474  << "\n"
475  << " g1 = " << theGains[1] << "\n"
476  << " g2 = " << theGains[2] << "\n"
477  << " g3 = " << theGains[3];
478 
479  delete defaultRatios;
480 
481  const double EBscale((agc->getEBValue()) * theGains[1] * (m_Coder->MAXADC) * m_EBs25notCont);
482 
483  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue() << "\n"
484  << " notCont = " << m_EBs25notCont << "\n"
485  << " saturation for EB = " << EBscale << ", " << m_EBs25notCont;
486 
487  const double EEscale((agc->getEEValue()) * theGains[1] * (m_Coder->MAXADC) * m_EEs25notCont);
488 
489  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue() << "\n"
490  << " notCont = " << m_EEs25notCont << "\n"
491  << " saturation for EB = " << EEscale << ", " << m_EEs25notCont;
492 
493  m_Coder->setFullScaleEnergy(EBscale, EEscale);
494  if (nullptr != m_APDCoder)
495  m_APDCoder->setFullScaleEnergy(EBscale, EEscale);
496 
497  if (m_doES) {
498  // ES condition objects
499  const ESGain *esgain = &eventSetup.getData(m_esGainToken);
500  const ESPedestals *espeds = &eventSetup.getData(m_esPedestalsToken);
501  const ESIntercalibConstants *esmips = &eventSetup.getData(m_esMIPsToken);
502  const ESMIPToGeVConstant *esMipToGeV = &eventSetup.getData(m_esMIPToGeVToken);
503  const int ESGain(1.1 > esgain->getESGain() ? 1 : 2);
504  const double ESMIPToGeV((1 == ESGain) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh());
505 
507  if (!m_doFastES) {
508  m_ESElectronicsSim->setGain(ESGain);
509  m_ESElectronicsSim->setPedestals(espeds);
510  m_ESElectronicsSim->setMIPs(esmips);
511  m_ESElectronicsSim->setMIPToGeV(ESMIPToGeV);
512  } else {
513  m_ESDigitizer->setGain(ESGain);
514  m_ESElectronicsSimFast->setPedestals(espeds);
515  m_ESElectronicsSimFast->setMIPs(esmips);
516  m_ESElectronicsSimFast->setMIPToGeV(ESMIPToGeV);
517  }
518  }
519 }
std::unique_ptr< EcalCoder > m_APDCoder
std::unique_ptr< ESDigitizer > m_ESDigitizer
edm::ESGetToken< ESMIPToGeVConstant, ESMIPToGeVConstantRcd > m_esMIPToGeVToken
const edm::ESGetToken< EcalIntercalibConstantsMC, EcalIntercalibConstantsMCRcd > m_icalToken
Definition: ESGain.h:7
void setGain(const int gain)
Definition: ESShape.h:23
std::unique_ptr< EBHitResponse > m_APDResponse
float getESValueLow() const
const edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > m_laserToken
std::unique_ptr< EcalCoder > m_Coder
edm::ESGetToken< ESGain, ESGainRcd > m_esGainToken
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const double m_EBs25notCont
edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > m_esMIPsToken
float gain6Over1() const
unsigned long long TimeValue_t
Definition: Timestamp.h:28
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
const edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > m_agcToken
float getESGain() const
Definition: ESGain.h:13
std::unique_ptr< EEHitResponse > m_EEResponse
edm::ESGetToken< ESPedestals, ESPedestalsRcd > m_esPedestalsToken
float gain12Over6() const
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > m_pedestalsToken
std::unique_ptr< EBHitResponse > m_EBResponse
float getESValueHigh() const
const edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > m_grToken
const double m_EEs25notCont
#define LogDebug(id)
void EcalDigiProducer::checkGeometry ( const edm::EventSetup eventSetup)
private

Definition at line 521 of file EcalDigiProducer.cc.

References edm::ESWatcher< T >::check(), edm::EventSetup::getData(), m_Geometry, m_geometryToken, m_geometryWatcher, and updateGeometry().

Referenced by initializeEvent().

521  {
522  if (m_geometryWatcher.check(eventSetup)) {
523  m_Geometry = &eventSetup.getData(m_geometryToken);
524  updateGeometry();
525  }
526 }
edm::ESWatcher< CaloGeometryRecord > m_geometryWatcher
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const CaloGeometry * m_Geometry
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void EcalDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Reimplemented in EcalTBDigiProducer.

Definition at line 362 of file EcalDigiProducer.cc.

References cacheEBDigis(), cacheEEDigis(), m_apdSeparateDigi, m_BarrelDigitizer, m_doEB, m_doEE, m_doES, m_doFastES, m_EBdigiCollection, m_EEdigiCollection, m_EndcapDigitizer, m_ESdigiCollection, m_ESDigitizer, m_ESOldDigitizer, eostools::move(), and randomEngine_.

Referenced by EcalTBDigiProducer::finalizeEvent(), and PreMixingEcalWorker::put().

362  {
363  // Step B: Create empty output
364  std::unique_ptr<EBDigiCollection> apdResult(!m_apdSeparateDigi || !m_doEB ? nullptr : new EBDigiCollection());
365  std::unique_ptr<EBDigiCollection> barrelResult(new EBDigiCollection());
366  std::unique_ptr<EEDigiCollection> endcapResult(new EEDigiCollection());
367  std::unique_ptr<ESDigiCollection> preshowerResult(new ESDigiCollection());
368 
369  // run the algorithm
370 
371  if (m_doEB) {
372  m_BarrelDigitizer->run(*barrelResult, randomEngine_);
373  cacheEBDigis(&*barrelResult);
374 
375  edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size();
376 
377  if (m_apdSeparateDigi) {
378  m_APDDigitizer->run(*apdResult, randomEngine_);
379  edm::LogInfo("DigiInfo") << "APD Digis: " << apdResult->size();
380  }
381  }
382 
383  if (m_doEE) {
384  m_EndcapDigitizer->run(*endcapResult, randomEngine_);
385  edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size();
386  cacheEEDigis(&*endcapResult);
387  }
388  if (m_doES) {
389  if (m_doFastES) {
390  m_ESDigitizer->run(*preshowerResult, randomEngine_);
391  } else {
392  m_ESOldDigitizer->run(*preshowerResult, randomEngine_);
393  }
394  edm::LogInfo("EcalDigi") << "ES Digis: " << preshowerResult->size();
395  }
396 
397  // Step D: Put outputs into event
398  if (m_apdSeparateDigi) {
399  // event.put(std::move(apdResult), m_apdDigiTag ) ;
400  }
401 
402  event.put(std::move(barrelResult), m_EBdigiCollection);
403  event.put(std::move(endcapResult), m_EEdigiCollection);
404  event.put(std::move(preshowerResult), m_ESdigiCollection);
405 
406  randomEngine_ = nullptr; // to prevent access outside event
407 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
const std::string m_ESdigiCollection
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
const std::string m_EEdigiCollection
def move
Definition: eostools.py:511
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
Log< level::Info, false > LogInfo
CLHEP::HepRandomEngine * randomEngine_
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const
const bool m_apdSeparateDigi
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const
const std::string m_EBdigiCollection
std::unique_ptr< EBDigitizer > m_APDDigitizer
void EcalDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Reimplemented in EcalTBDigiProducer.

Definition at line 262 of file EcalDigiProducer.cc.

References checkCalibrations(), checkGeometry(), edm::RandomNumberGenerator::getEngine(), m_apdSeparateDigi, m_BarrelDigitizer, m_doEB, m_doEE, m_doES, m_doFastES, m_EndcapDigitizer, m_ESDigitizer, m_ESOldDigitizer, randomEngine_, and edm::Event::streamID().

Referenced by EcalTBDigiProducer::initializeEvent(), and PreMixingEcalWorker::initializeEvent().

262  {
264  randomEngine_ = &rng->getEngine(event.streamID());
265 
266  checkGeometry(eventSetup);
267  checkCalibrations(event, eventSetup);
268  if (m_doEB) {
269  m_BarrelDigitizer->initializeHits();
270  if (m_apdSeparateDigi) {
271  m_APDDigitizer->initializeHits();
272  }
273  }
274  if (m_doEE) {
275  m_EndcapDigitizer->initializeHits();
276  }
277  if (m_doES) {
278  if (m_doFastES) {
279  m_ESDigitizer->initializeHits();
280  } else {
281  m_ESOldDigitizer->initializeHits();
282  }
283  }
284 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
void checkCalibrations(const edm::Event &event, const edm::EventSetup &eventSetup)
void checkGeometry(const edm::EventSetup &eventSetup)
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
CLHEP::HepRandomEngine * randomEngine_
const bool m_apdSeparateDigi
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
std::unique_ptr< EBDigitizer > m_APDDigitizer
void EcalDigiProducer::setEBNoiseSignalGenerator ( EcalBaseSignalGenerator noiseGenerator)

Definition at line 556 of file EcalDigiProducer.cc.

References m_BarrelDigitizer.

Referenced by PreMixingEcalWorker::PreMixingEcalWorker().

556  {
557  // noiseGenerator->setParameterMap(theParameterMap);
558  if (nullptr != m_BarrelDigitizer)
559  m_BarrelDigitizer->setNoiseSignalGenerator(noiseGenerator);
560 }
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
void EcalDigiProducer::setEENoiseSignalGenerator ( EcalBaseSignalGenerator noiseGenerator)

Definition at line 562 of file EcalDigiProducer.cc.

References m_EndcapDigitizer.

Referenced by PreMixingEcalWorker::PreMixingEcalWorker().

562  {
563  // noiseGenerator->setParameterMap(theParameterMap);
564  if (nullptr != m_EndcapDigitizer)
565  m_EndcapDigitizer->setNoiseSignalGenerator(noiseGenerator);
566 }
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
void EcalDigiProducer::setESNoiseSignalGenerator ( EcalBaseSignalGenerator noiseGenerator)

Definition at line 568 of file EcalDigiProducer.cc.

References m_ESDigitizer.

Referenced by PreMixingEcalWorker::PreMixingEcalWorker().

568  {
569  // noiseGenerator->setParameterMap(theParameterMap);
570  if (nullptr != m_ESDigitizer)
571  m_ESDigitizer->setNoiseSignalGenerator(noiseGenerator);
572 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
void EcalDigiProducer::updateGeometry ( )
private

Definition at line 528 of file EcalDigiProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, CaloGeometry::getSubdetectorGeometry(), CaloSubdetectorGeometry::getValidDetIds(), m_APDResponse, m_doEB, m_doEE, m_doES, m_doFastES, m_EBResponse, m_EEResponse, m_ESDigitizer, m_ESOldDigitizer, m_ESOldResponse, m_ESResponse, and m_Geometry.

Referenced by checkGeometry().

528  {
529  if (m_doEB) {
530  if (nullptr != m_APDResponse)
533  }
534  if (m_doEE) {
536  }
537  if (m_doES) {
539  m_ESOldResponse->setGeometry(m_Geometry);
540 
541  const std::vector<DetId> *theESDets(
544  : nullptr);
545 
546  if (!m_doFastES) {
547  if (nullptr != m_ESOldDigitizer && nullptr != theESDets)
548  m_ESOldDigitizer->setDetIds(*theESDets);
549  } else {
550  if (nullptr != m_ESDigitizer && nullptr != theESDets)
551  m_ESDigitizer->setDetIds(*theESDets);
552  }
553  }
554 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
std::unique_ptr< ESDigitizer > m_ESDigitizer
std::unique_ptr< EBHitResponse > m_APDResponse
std::unique_ptr< ESHitResponse > m_ESResponse
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)
std::unique_ptr< CaloHitResponse > m_ESOldResponse
const CaloGeometry * m_Geometry
std::unique_ptr< EEHitResponse > m_EEResponse
std::unique_ptr< EBHitResponse > m_EBResponse
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer

Member Data Documentation

const bool EcalDigiProducer::m_addESNoise
private

Definition at line 159 of file EcalDigiProducer.h.

const edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> EcalDigiProducer::m_agcToken
private

Definition at line 124 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

std::unique_ptr<EcalCoder> EcalDigiProducer::m_APDCoder
private

Definition at line 183 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const std::string EcalDigiProducer::m_apdDigiTag
private

Definition at line 146 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

std::unique_ptr<EBDigitizer> EcalDigiProducer::m_APDDigitizer
private

Definition at line 172 of file EcalDigiProducer.h.

std::unique_ptr<EcalElectronicsSim_Ph1> EcalDigiProducer::m_APDElectronicsSim
private

Definition at line 182 of file EcalDigiProducer.h.

std::unique_ptr<const APDSimParameters> EcalDigiProducer::m_apdParameters
private

Definition at line 147 of file EcalDigiProducer.h.

std::unique_ptr<EBHitResponse> EcalDigiProducer::m_APDResponse
private

Definition at line 149 of file EcalDigiProducer.h.

Referenced by beginLuminosityBlock(), checkCalibrations(), and updateGeometry().

const bool EcalDigiProducer::m_apdSeparateDigi
private
APDShape EcalDigiProducer::m_APDShape
private

Definition at line 111 of file EcalDigiProducer.h.

Referenced by accumulate().

std::unique_ptr<EBDigitizer> EcalDigiProducer::m_BarrelDigitizer
private
std::unique_ptr<EcalCoder> EcalDigiProducer::m_Coder
private

Definition at line 180 of file EcalDigiProducer.h.

const bool EcalDigiProducer::m_doEB
private
const bool EcalDigiProducer::m_doEE
private
const bool EcalDigiProducer::m_doES
private
const bool EcalDigiProducer::m_doFastES
private
std::array<std::unique_ptr<CorrelatedNoisifier<EcalCorrMatrix> >, 3> EcalDigiProducer::m_EBCorrNoise
private

Definition at line 187 of file EcalDigiProducer.h.

const std::string EcalDigiProducer::m_EBdigiCollection
private

Definition at line 116 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and finalizeEvent().

std::unique_ptr<EBHitResponse> EcalDigiProducer::m_EBResponse
protected
const double EcalDigiProducer::m_EBs25notCont
private

Definition at line 137 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

EBShape EcalDigiProducer::m_EBShape
private

Definition at line 112 of file EcalDigiProducer.h.

Referenced by accumulate().

std::array<std::unique_ptr<CorrelatedNoisifier<EcalCorrMatrix> >, 3> EcalDigiProducer::m_EECorrNoise
private

Definition at line 188 of file EcalDigiProducer.h.

const std::string EcalDigiProducer::m_EEdigiCollection
private

Definition at line 117 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and finalizeEvent().

std::unique_ptr<EEHitResponse> EcalDigiProducer::m_EEResponse
protected
const double EcalDigiProducer::m_EEs25notCont
private

Definition at line 138 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

EEShape EcalDigiProducer::m_EEShape
private

Definition at line 113 of file EcalDigiProducer.h.

Referenced by accumulate().

std::unique_ptr<EcalElectronicsSim_Ph1> EcalDigiProducer::m_ElectronicsSim
private

Definition at line 179 of file EcalDigiProducer.h.

std::unique_ptr<EEDigitizer> EcalDigiProducer::m_EndcapDigitizer
private
const std::string EcalDigiProducer::m_ESdigiCollection
private

Definition at line 118 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and finalizeEvent().

std::unique_ptr<ESDigitizer> EcalDigiProducer::m_ESDigitizer
private
std::unique_ptr<ESElectronicsSim> EcalDigiProducer::m_ESElectronicsSim
private

Definition at line 167 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

std::unique_ptr<ESElectronicsSimFast> EcalDigiProducer::m_ESElectronicsSimFast
private

Definition at line 169 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

edm::ESGetToken<ESGain, ESGainRcd> EcalDigiProducer::m_esGainToken
private

Definition at line 127 of file EcalDigiProducer.h.

edm::ESGetToken<ESIntercalibConstants, ESIntercalibConstantsRcd> EcalDigiProducer::m_esMIPsToken
private

Definition at line 130 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

edm::ESGetToken<ESMIPToGeVConstant, ESMIPToGeVConstantRcd> EcalDigiProducer::m_esMIPToGeVToken
private

Definition at line 128 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

std::unique_ptr<ESOldDigitizer> EcalDigiProducer::m_ESOldDigitizer
private
std::unique_ptr<CaloHitResponse> EcalDigiProducer::m_ESOldResponse
private

Definition at line 157 of file EcalDigiProducer.h.

Referenced by updateGeometry().

edm::ESGetToken<ESPedestals, ESPedestalsRcd> EcalDigiProducer::m_esPedestalsToken
private

Definition at line 129 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

std::unique_ptr<ESHitResponse> EcalDigiProducer::m_ESResponse
private

Definition at line 156 of file EcalDigiProducer.h.

Referenced by updateGeometry().

ESShape EcalDigiProducer::m_ESShape
private

Definition at line 114 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const CaloGeometry* EcalDigiProducer::m_Geometry
private

Definition at line 185 of file EcalDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EcalDigiProducer::m_geometryToken
private

Definition at line 126 of file EcalDigiProducer.h.

Referenced by checkGeometry().

edm::ESWatcher<CaloGeometryRecord> EcalDigiProducer::m_geometryWatcher
private

Definition at line 131 of file EcalDigiProducer.h.

Referenced by checkGeometry().

const edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> EcalDigiProducer::m_grToken
private

Definition at line 125 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const std::string EcalDigiProducer::m_hitsProducerTag
private

Definition at line 119 of file EcalDigiProducer.h.

Referenced by accumulate().

const edm::ESGetToken<EcalIntercalibConstantsMC, EcalIntercalibConstantsMCRcd> EcalDigiProducer::m_icalToken
private

Definition at line 122 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> EcalDigiProducer::m_laserToken
private

Definition at line 123 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

std::unique_ptr<const EcalSimParameterMap> EcalDigiProducer::m_ParameterMap
protected

Definition at line 143 of file EcalDigiProducer.h.

Referenced by EcalTBDigiProducer::setPhaseShift().

const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> EcalDigiProducer::m_pedestalsToken
private

Definition at line 121 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const bool EcalDigiProducer::m_PreMix1
private

Definition at line 160 of file EcalDigiProducer.h.

const bool EcalDigiProducer::m_PreMix2
private

Definition at line 161 of file EcalDigiProducer.h.

const unsigned int EcalDigiProducer::m_readoutFrameSize
private

Definition at line 140 of file EcalDigiProducer.h.

bool EcalDigiProducer::m_useLCcorrection
private

Definition at line 133 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

CLHEP::HepRandomEngine* EcalDigiProducer::randomEngine_ = nullptr
private

Definition at line 190 of file EcalDigiProducer.h.

Referenced by accumulateCaloHits(), finalizeEvent(), and initializeEvent().