59 m_APDShape ( params.getParameter<double>(
"apdShapeTstart" ) ,
60 params.getParameter<double>(
"apdShapeTau" ) ) ,
64 m_EBdigiCollection ( params.getParameter<std::
string>(
"EBdigiCollection") ) ,
65 m_EEdigiCollection ( params.getParameter<std::
string>(
"EEdigiCollection") ) ,
66 m_ESdigiCollection ( params.getParameter<std::
string>(
"ESdigiCollection") ) ,
67 m_hitsProducerTag ( params.getParameter<std::
string>(
"hitsProducer" ) ) ,
68 m_useLCcorrection ( params.getUntrackedParameter<bool>(
"UseLCcorrection") ) ,
69 m_apdSeparateDigi ( params.getParameter<bool> (
"apdSeparateDigi") ) ,
71 m_EBs25notCont ( params.getParameter<double> (
"EBs25notContainment") ) ,
72 m_EEs25notCont ( params.getParameter<double> (
"EEs25notContainment") ) ,
74 m_readoutFrameSize ( params.getParameter<int> (
"readoutFrameSize") ) ,
76 params.getParameter<double> (
"simHitToPhotoelectronsBarrel") ,
77 params.getParameter<double> (
"simHitToPhotoelectronsEndcap") ,
78 params.getParameter<double> (
"photoelectronsToAnalogBarrel") ,
79 params.getParameter<double> (
"photoelectronsToAnalogEndcap") ,
80 params.getParameter<double> (
"samplingFactor") ,
81 params.getParameter<double> (
"timePhase") ,
83 params.getParameter<int> (
"binOfMaximum") ,
84 params.getParameter<bool> (
"doPhotostatistics") ,
85 params.getParameter<bool> (
"syncPhase") ) ) ,
87 m_apdDigiTag ( params.getParameter<std::
string> (
"apdDigiTag" ) ) ,
89 params.getParameter<bool> (
"apdAddToBarrel" ) ,
91 params.getParameter<double> (
"apdSimToPELow" ) ,
92 params.getParameter<double> (
"apdSimToPEHigh" ) ,
93 params.getParameter<double> (
"apdTimeOffset" ) ,
94 params.getParameter<double> (
"apdTimeOffWidth" ) ,
95 params.getParameter<bool> (
"apdDoPEStats" ) ,
97 params.getParameter<std::vector<double> > (
"apdNonlParms" ) ) ) ,
99 m_APDResponse ( !m_apdSeparateDigi ?
nullptr :
103 m_apdParameters.
get() ,
109 m_apdParameters.
get() ,
117 m_addESNoise ( params.getParameter<bool> (
"doESNoise") ) ,
118 m_PreMix1 ( params.getParameter<bool> (
"EcalPreMixStage1") ) ,
119 m_PreMix2 ( params.getParameter<bool> (
"EcalPreMixStage2") ) ,
121 m_doFastES ( params.getParameter<bool> (
"doFast" ) ) ,
123 m_doEB ( params.getParameter<bool> (
"doEB" ) ) ,
124 m_doEE ( params.getParameter<bool> (
"doEE" ) ) ,
125 m_doES ( params.getParameter<bool> (
"doES" ) ) ,
127 m_ESElectronicsSim ( m_doFastES ?
nullptr :
130 m_ESOldDigitizer ( m_doFastES ?
nullptr :
132 m_ESElectronicsSim.
get() ,
135 m_ESElectronicsSimFast ( !m_doFastES ?
nullptr :
139 m_ESDigitizer ( !m_doFastES ?
nullptr :
141 m_ESElectronicsSimFast.
get() ,
145 m_BarrelDigitizer (
nullptr ) ,
146 m_EndcapDigitizer (
nullptr ) ,
149 m_APDElectronicsSim (
nullptr ) ,
152 m_EBCorrNoise ( { {
nullptr,
nullptr,
nullptr} } ) ,
161 if( m_doEB ) iC.consumes<std::vector<PCaloHit> >(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEB"));
162 if( m_doEE ) iC.consumes<std::vector<PCaloHit> >(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEE"));
163 if( m_doES ) iC.consumes<std::vector<PCaloHit> >(
edm::InputTag(m_hitsProducerTag,
"EcalHitsES"));
165 const std::vector<double> ebCorMatG12 = params.getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG12");
166 const std::vector<double> eeCorMatG12 = params.getParameter< std::vector<double> >(
"EECorrNoiseMatrixG12");
167 const std::vector<double> ebCorMatG06 = params.getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG06");
168 const std::vector<double> eeCorMatG06 = params.getParameter< std::vector<double> >(
"EECorrNoiseMatrixG06");
169 const std::vector<double> ebCorMatG01 = params.getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG01");
170 const std::vector<double> eeCorMatG01 = params.getParameter< std::vector<double> >(
"EECorrNoiseMatrixG01");
172 const bool applyConstantTerm = params.getParameter<
bool> (
"applyConstantTerm");
173 const double rmsConstantTerm = params.getParameter<
double> (
"ConstantTerm");
175 const bool addNoise = params.getParameter<
bool> (
"doENoise");
176 const bool cosmicsPhase = params.getParameter<
bool> (
"cosmicsPhase");
177 const double cosmicsShift = params.getParameter<
double> (
"cosmicsShift");
184 if( m_doEB ) m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ;
185 if( m_doEE ) m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ;
191 assert( ebCorMatG12.size() == m_readoutFrameSize ) ;
192 assert( eeCorMatG12.size() == m_readoutFrameSize ) ;
193 assert( ebCorMatG06.size() == m_readoutFrameSize ) ;
194 assert( eeCorMatG06.size() == m_readoutFrameSize ) ;
195 assert( ebCorMatG01.size() == m_readoutFrameSize ) ;
196 assert( eeCorMatG01.size() == m_readoutFrameSize ) ;
198 assert( 1.
e-7 > fabs( ebCorMatG12[0] - 1.0 ) ) ;
199 assert( 1.
e-7 > fabs( ebCorMatG06[0] - 1.0 ) ) ;
200 assert( 1.
e-7 > fabs( ebCorMatG01[0] - 1.0 ) ) ;
201 assert( 1.
e-7 > fabs( eeCorMatG12[0] - 1.0 ) ) ;
202 assert( 1.
e-7 > fabs( eeCorMatG06[0] - 1.0 ) ) ;
203 assert( 1.
e-7 > fabs( eeCorMatG01[0] - 1.0 ) ) ;
205 for (
unsigned int row ( 0 ) ; row != m_readoutFrameSize ; ++row )
207 assert( 0 == row || 1. >= ebCorMatG12[row] ) ;
208 assert( 0 == row || 1. >= ebCorMatG06[row] ) ;
209 assert( 0 == row || 1. >= ebCorMatG01[row] ) ;
210 assert( 0 == row || 1. >= eeCorMatG12[row] ) ;
211 assert( 0 == row || 1. >= eeCorMatG06[row] ) ;
212 assert( 0 == row || 1. >= eeCorMatG01[row] ) ;
213 for (
unsigned int column ( 0 ) ; column <= row ; ++column )
215 const unsigned int index ( row - column ) ;
216 ebMatrix[0]( row, column ) = ebCorMatG12[
index ] ;
217 eeMatrix[0]( row, column ) = eeCorMatG12[
index ] ;
218 ebMatrix[1]( row, column ) = ebCorMatG06[
index ] ;
219 eeMatrix[1]( row, column ) = eeCorMatG06[
index ] ;
220 ebMatrix[2]( row, column ) = ebCorMatG01[
index ] ;
221 eeMatrix[2]( row, column ) = eeCorMatG01[
index ] ;
234 m_EBCorrNoise[0].
get() ,
236 m_EBCorrNoise[1].
get() ,
238 m_EBCorrNoise[2].
get() ,
246 if( m_apdSeparateDigi )
250 m_EBCorrNoise[0].
get() ,
252 m_EBCorrNoise[1].
get() ,
254 m_EBCorrNoise[2].
get() ,
262 m_APDDigitizer.reset(
new EBDigitizer( m_APDResponse.get() ,
263 m_APDElectronicsSim.get() ,
268 m_BarrelDigitizer.reset(
new EBDigitizer( m_EBResponse.get() ,
269 m_ElectronicsSim.get() ,
274 m_EndcapDigitizer.reset(
new EEDigitizer( m_EEResponse.get() ,
275 m_ElectronicsSim.get() ,
284 m_APDShape ( params.getParameter<double>(
"apdShapeTstart" ) ,
285 params.getParameter<double>(
"apdShapeTau" ) ) ,
289 m_EBdigiCollection ( params.getParameter<std::
string>(
"EBdigiCollection") ) ,
290 m_EEdigiCollection ( params.getParameter<std::
string>(
"EEdigiCollection") ) ,
291 m_ESdigiCollection ( params.getParameter<std::
string>(
"ESdigiCollection") ) ,
292 m_hitsProducerTag ( params.getParameter<std::
string>(
"hitsProducer" ) ) ,
293 m_useLCcorrection ( params.getUntrackedParameter<bool>(
"UseLCcorrection") ) ,
294 m_apdSeparateDigi ( params.getParameter<bool> (
"apdSeparateDigi") ) ,
296 m_EBs25notCont ( params.getParameter<double> (
"EBs25notContainment") ) ,
297 m_EEs25notCont ( params.getParameter<double> (
"EEs25notContainment") ) ,
299 m_readoutFrameSize ( params.getParameter<int> (
"readoutFrameSize") ) ,
301 params.getParameter<double> (
"simHitToPhotoelectronsBarrel") ,
302 params.getParameter<double> (
"simHitToPhotoelectronsEndcap") ,
303 params.getParameter<double> (
"photoelectronsToAnalogBarrel") ,
304 params.getParameter<double> (
"photoelectronsToAnalogEndcap") ,
305 params.getParameter<double> (
"samplingFactor") ,
306 params.getParameter<double> (
"timePhase") ,
308 params.getParameter<int> (
"binOfMaximum") ,
309 params.getParameter<bool> (
"doPhotostatistics") ,
310 params.getParameter<bool> (
"syncPhase") ) ) ,
312 m_apdDigiTag ( params.getParameter<std::
string> (
"apdDigiTag" ) ) ,
314 params.getParameter<bool> (
"apdAddToBarrel" ) ,
316 params.getParameter<double> (
"apdSimToPELow" ) ,
317 params.getParameter<double> (
"apdSimToPEHigh" ) ,
318 params.getParameter<double> (
"apdTimeOffset" ) ,
319 params.getParameter<double> (
"apdTimeOffWidth" ) ,
320 params.getParameter<bool> (
"apdDoPEStats" ) ,
322 params.getParameter<std::vector<double> > (
"apdNonlParms" ) ) ) ,
324 m_APDResponse ( !m_apdSeparateDigi ?
nullptr :
328 m_apdParameters.
get() ,
334 m_apdParameters.
get() ,
342 m_addESNoise ( params.getParameter<bool> (
"doESNoise") ) ,
343 m_PreMix1 ( params.getParameter<bool> (
"EcalPreMixStage1") ) ,
344 m_PreMix2 ( params.getParameter<bool> (
"EcalPreMixStage2") ) ,
346 m_doFastES ( params.getParameter<bool> (
"doFast" ) ) ,
348 m_doEB ( params.getParameter<bool> (
"doEB" ) ) ,
349 m_doEE ( params.getParameter<bool> (
"doEE" ) ) ,
350 m_doES ( params.getParameter<bool> (
"doES" ) ) ,
352 m_ESElectronicsSim ( m_doFastES ?
nullptr :
355 m_ESOldDigitizer ( m_doFastES ?
nullptr :
357 m_ESElectronicsSim.
get() ,
360 m_ESElectronicsSimFast ( !m_doFastES ?
nullptr :
364 m_ESDigitizer ( !m_doFastES ?
nullptr :
366 m_ESElectronicsSimFast.
get() ,
370 m_BarrelDigitizer (
nullptr ) ,
371 m_EndcapDigitizer (
nullptr ) ,
374 m_APDElectronicsSim (
nullptr ) ,
377 m_EBCorrNoise ( { {
nullptr,
nullptr,
nullptr} } ) ,
385 if ( m_doEB ) iC.consumes<std::vector<PCaloHit> >(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEB"));
386 if ( m_doEE ) iC.consumes<std::vector<PCaloHit> >(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEE"));
387 if ( m_doES ) iC.consumes<std::vector<PCaloHit> >(
edm::InputTag(m_hitsProducerTag,
"EcalHitsES"));
389 const std::vector<double> ebCorMatG12 = params.getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG12");
390 const std::vector<double> eeCorMatG12 = params.getParameter< std::vector<double> >(
"EECorrNoiseMatrixG12");
391 const std::vector<double> ebCorMatG06 = params.getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG06");
392 const std::vector<double> eeCorMatG06 = params.getParameter< std::vector<double> >(
"EECorrNoiseMatrixG06");
393 const std::vector<double> ebCorMatG01 = params.getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG01");
394 const std::vector<double> eeCorMatG01 = params.getParameter< std::vector<double> >(
"EECorrNoiseMatrixG01");
396 const bool applyConstantTerm = params.getParameter<
bool> (
"applyConstantTerm");
397 const double rmsConstantTerm = params.getParameter<
double> (
"ConstantTerm");
399 const bool addNoise = params.getParameter<
bool> (
"doENoise");
400 const bool cosmicsPhase = params.getParameter<
bool> (
"cosmicsPhase");
401 const double cosmicsShift = params.getParameter<
double> (
"cosmicsShift");
408 if( m_doEB ) m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ;
409 if( m_doEE ) m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ;
415 assert( ebCorMatG12.size() == m_readoutFrameSize ) ;
416 assert( eeCorMatG12.size() == m_readoutFrameSize ) ;
417 assert( ebCorMatG06.size() == m_readoutFrameSize ) ;
418 assert( eeCorMatG06.size() == m_readoutFrameSize ) ;
419 assert( ebCorMatG01.size() == m_readoutFrameSize ) ;
420 assert( eeCorMatG01.size() == m_readoutFrameSize ) ;
422 assert( 1.
e-7 > fabs( ebCorMatG12[0] - 1.0 ) ) ;
423 assert( 1.
e-7 > fabs( ebCorMatG06[0] - 1.0 ) ) ;
424 assert( 1.
e-7 > fabs( ebCorMatG01[0] - 1.0 ) ) ;
425 assert( 1.
e-7 > fabs( eeCorMatG12[0] - 1.0 ) ) ;
426 assert( 1.
e-7 > fabs( eeCorMatG06[0] - 1.0 ) ) ;
427 assert( 1.
e-7 > fabs( eeCorMatG01[0] - 1.0 ) ) ;
429 for (
unsigned int row ( 0 ) ; row != m_readoutFrameSize ; ++row )
431 assert( 0 == row || 1. >= ebCorMatG12[row] ) ;
432 assert( 0 == row || 1. >= ebCorMatG06[row] ) ;
433 assert( 0 == row || 1. >= ebCorMatG01[row] ) ;
434 assert( 0 == row || 1. >= eeCorMatG12[row] ) ;
435 assert( 0 == row || 1. >= eeCorMatG06[row] ) ;
436 assert( 0 == row || 1. >= eeCorMatG01[row] ) ;
437 for (
unsigned int column ( 0 ) ; column <= row ; ++column )
439 const unsigned int index ( row - column ) ;
440 ebMatrix[0]( row, column ) = ebCorMatG12[
index ] ;
441 eeMatrix[0]( row, column ) = eeCorMatG12[
index ] ;
442 ebMatrix[1]( row, column ) = ebCorMatG06[
index ] ;
443 eeMatrix[1]( row, column ) = eeCorMatG06[
index ] ;
444 ebMatrix[2]( row, column ) = ebCorMatG01[
index ] ;
445 eeMatrix[2]( row, column ) = eeCorMatG01[
index ] ;
458 m_EBCorrNoise[0].
get() ,
460 m_EBCorrNoise[1].
get() ,
462 m_EBCorrNoise[2].
get() ,
470 if( m_apdSeparateDigi )
473 m_EBCorrNoise[0].
get() ,
475 m_EBCorrNoise[1].
get() ,
477 m_EBCorrNoise[2].
get() ,
485 m_APDDigitizer.reset(
new EBDigitizer( m_APDResponse.get() ,
486 m_APDElectronicsSim.get() ,
491 m_BarrelDigitizer.reset(
new EBDigitizer( m_EBResponse.get() ,
492 m_ElectronicsSim.get() ,
497 m_EndcapDigitizer.reset(
new EEDigitizer( m_EEResponse.get() ,
498 m_ElectronicsSim.get() ,
595 std::unique_ptr<ESDigiCollection> preshowerResult(
new ESDigiCollection() ) ;
603 edm::LogInfo(
"DigiInfo") <<
"EB Digis: " << barrelResult->size() ;
607 edm::LogInfo(
"DigiInfo") <<
"APD Digis: " << apdResult->size() ;
613 edm::LogInfo(
"EcalDigi") <<
"EE Digis: " << endcapResult->size() ;
622 edm::LogInfo(
"EcalDigi") <<
"ES Digis: " << preshowerResult->size();
642 "RandomNumberGenerator service is not available.\n"
643 "You must add the service in the configuration file\n"
644 "or remove the module that requires it.";
663 m_Coder->setPedestals( pedestals ) ;
671 m_Coder->setIntercalibConstants( ical ) ;
703 double theGains[
m_Coder->NGAINS+1];
707 theGains[1] = theGains[2]*(defaultRatios->
gain12Over6()) ;
709 LogDebug(
"EcalDigi") <<
" Gains: " <<
"\n" <<
" g1 = " << theGains[1]
710 <<
"\n" <<
" g2 = " << theGains[2]
711 <<
"\n" <<
" g3 = " << theGains[3] ;
713 delete defaultRatios;
715 const double EBscale (
720 <<
"\n" <<
" saturation for EB = " << EBscale
723 const double EEscale (
728 <<
"\n" <<
" saturation for EB = " << EEscale
731 m_Coder->setFullScaleEnergy( EBscale ,
754 const int ESGain ( 1.1 > esgain->getESGain() ? 1 : 2 ) ;
755 const double ESMIPToGeV ( ( 1 ==
ESGain ) ?
756 esMipToGeV->getESValueLow() :
757 esMipToGeV->getESValueHigh() ) ;
813 const std::vector<DetId>* theESDets (
820 nullptr != theESDets )
826 nullptr != theESDets )
std::unique_ptr< EcalCoder > m_APDCoder
int bunchCrossing() const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
virtual ~EcalDigiProducer()
EcalTDigitizer< EEDigitizerTraits > EEDigitizer
std::unique_ptr< ESDigitizer > m_ESDigitizer
edm::Service< edm::RandomNumberGenerator > rng
LuminosityBlockIndex index() const
const std::string m_ESdigiCollection
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
void setGain(const int gain)
std::unique_ptr< EBHitResponse > m_APDResponse
const std::string m_hitsProducerTag
std::unique_ptr< EcalCoder > m_Coder
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const std::string m_EEdigiCollection
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)
void setEENoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
virtual void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
void setEBNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void setESNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
virtual void accumulate(edm::Event const &e, edm::EventSetup const &c) override
Creates electronics signals from hits.
const double m_EBs25notCont
std::unique_ptr< CaloHitResponse > m_ESOldResponse
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
EcalDigiProducer(const edm::ParameterSet ¶ms, edm::stream::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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
unsigned int value() const
T const * product() const
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const
std::unique_ptr< EEHitResponse > m_EEResponse
EcalTDigitizer< EBDigitizerTraits > EBDigitizer
T const * product() const
m_EECorrNoise({{0, 0, 0}})
float gain12Over6() const
const bool m_apdSeparateDigi
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing, CLHEP::HepRandomEngine *)
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
StreamID streamID() const
std::unique_ptr< EBHitResponse > m_EBResponse
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
std::vector< CLHEP::HepRandomEngine * > randomEngines_
volatile std::atomic< bool > shutdown_flag false
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const
const std::string m_EBdigiCollection
std::unique_ptr< EBDigitizer > m_APDDigitizer
virtual void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
T get(const Candidate &c)
const double m_EEs25notCont