CMS 3D CMS Logo

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

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
 EcalDigiProducer (const edm::ParameterSet &params, edm::stream::EDProducerBase &mixMod, edm::ConsumesCollector &iC)
 
 EcalDigiProducer (const edm::ParameterSet &params, edm::ConsumesCollector &iC)
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
void setEBNoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
void setEENoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
void setESNoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
virtual ~EcalDigiProducer ()
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
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)
 
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 EcalSimParameterMapm_ParameterMap
 

Private Types

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

Private Member Functions

void accumulateCaloHits (HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing, CLHEP::HepRandomEngine *)
 
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)
 
CLHEP::HepRandomEngine * randomEngine (edm::StreamID const &streamID)
 
void updateGeometry ()
 

Private Attributes

const bool m_addESNoise
 
std::unique_ptr< EcalCoderm_APDCoder
 
const std::string m_apdDigiTag
 
std::unique_ptr< EBDigitizerm_APDDigitizer
 
std::unique_ptr< EcalElectronicsSimm_APDElectronicsSim
 
std::unique_ptr< const APDSimParametersm_apdParameters
 
std::unique_ptr< EBHitResponsem_APDResponse
 
const bool m_apdSeparateDigi
 
const 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
 
const EBShape m_EBShape
 
std::array< std::unique_ptr< CorrelatedNoisifier< EcalCorrMatrix > >, 3 > m_EECorrNoise
 
const std::string m_EEdigiCollection
 
const double m_EEs25notCont
 
const EEShape m_EEShape
 
std::unique_ptr< EcalElectronicsSimm_ElectronicsSim
 
std::unique_ptr< EEDigitizerm_EndcapDigitizer
 
const std::string m_ESdigiCollection
 
std::unique_ptr< ESDigitizerm_ESDigitizer
 
std::unique_ptr< ESElectronicsSimm_ESElectronicsSim
 
std::unique_ptr< ESElectronicsSimFastm_ESElectronicsSimFast
 
std::unique_ptr< ESOldDigitizerm_ESOldDigitizer
 
std::unique_ptr< CaloHitResponsem_ESOldResponse
 
std::unique_ptr< ESHitResponsem_ESResponse
 
ESShape m_ESShape
 
const CaloGeometrym_Geometry
 
const std::string m_hitsProducerTag
 
const bool m_PreMix1
 
const bool m_PreMix2
 
const unsigned int m_readoutFrameSize
 
bool m_useLCcorrection
 
std::vector< CLHEP::HepRandomEngine * > randomEngines_
 

Detailed Description

Definition at line 60 of file EcalDigiProducer.h.

Member Typedef Documentation

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

Definition at line 82 of file EcalDigiProducer.h.

Constructor & Destructor Documentation

EcalDigiProducer::EcalDigiProducer ( const edm::ParameterSet params,
edm::stream::EDProducerBase mixMod,
edm::ConsumesCollector iC 
)

Definition at line 57 of file EcalDigiProducer.cc.

References ecalElectronicsSim_cff::applyConstantTerm, ecalCosmicsSim_cff::cosmicsPhase, ecalCosmicsSim_cff::cosmicsShift, MillePedeFileConverter_cfg::e, funct::false, diffTreeTool::index, m_APDCoder, m_apdDigiTag, m_APDDigitizer, m_APDElectronicsSim, m_APDResponse, m_apdSeparateDigi, m_BarrelDigitizer, m_Coder, m_doEB, m_doEE, m_doES, m_EBCorrNoise, m_EBdigiCollection, m_EBResponse, m_EECorrNoise, m_EEdigiCollection, m_EEResponse, m_ElectronicsSim, m_EndcapDigitizer, m_ESdigiCollection, m_hitsProducerTag, m_ParameterMap, m_PreMix1, and m_readoutFrameSize.

57  :
59  m_APDShape ( params.getParameter<double>( "apdShapeTstart" ) ,
60  params.getParameter<double>( "apdShapeTau" ) ) ,
61  m_EBShape ( ) ,
62  m_EEShape ( ) ,
63  m_ESShape ( ) ,
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") ) ,
70 
71  m_EBs25notCont ( params.getParameter<double> ("EBs25notContainment") ) ,
72  m_EEs25notCont ( params.getParameter<double> ("EEs25notContainment") ) ,
73 
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") ) ) ,
86 
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" ) ,
96  m_apdDigiTag ,
97  params.getParameter<std::vector<double> > ( "apdNonlParms" ) ) ) ,
98 
99  m_APDResponse ( !m_apdSeparateDigi ? nullptr :
100  new EBHitResponse( m_ParameterMap.get() ,
101  &m_EBShape ,
102  true ,
103  m_apdParameters.get() ,
104  &m_APDShape ) ) ,
105 
107  &m_EBShape ,
108  false , // barrel
109  m_apdParameters.get() ,
110  &m_APDShape ) ) ,
111 
113  &m_EEShape ) ) ,
116 
117  m_addESNoise ( params.getParameter<bool> ("doESNoise") ) ,
118  m_PreMix1 ( params.getParameter<bool> ("EcalPreMixStage1") ) ,
119  m_PreMix2 ( params.getParameter<bool> ("EcalPreMixStage2") ) ,
120 
121  m_doFastES ( params.getParameter<bool> ("doFast" ) ) ,
122 
123  m_doEB ( params.getParameter<bool> ("doEB" ) ) ,
124  m_doEE ( params.getParameter<bool> ("doEE" ) ) ,
125  m_doES ( params.getParameter<bool> ("doES" ) ) ,
126 
127  m_ESElectronicsSim ( m_doFastES ? nullptr :
128  new ESElectronicsSim( m_addESNoise ) ) ,
129 
130  m_ESOldDigitizer ( m_doFastES ? nullptr :
131  new ESOldDigitizer( m_ESOldResponse.get() ,
132  m_ESElectronicsSim.get() ,
133  m_addESNoise ) ) ,
134 
135  m_ESElectronicsSimFast ( !m_doFastES ? nullptr :
137  m_PreMix1) ) ,
138 
139  m_ESDigitizer ( !m_doFastES ? nullptr :
140  new ESDigitizer( m_ESResponse.get() ,
141  m_ESElectronicsSimFast.get() ,
142  m_addESNoise ) ) ,
143 
144  m_APDDigitizer ( nullptr ) ,
145  m_BarrelDigitizer ( nullptr ) ,
146  m_EndcapDigitizer ( nullptr ) ,
147  m_ElectronicsSim ( nullptr ) ,
148  m_Coder ( nullptr ) ,
149  m_APDElectronicsSim ( nullptr ) ,
150  m_APDCoder ( nullptr ) ,
151  m_Geometry ( nullptr ) ,
152  m_EBCorrNoise ( { {nullptr, nullptr, nullptr} } ) ,
153  m_EECorrNoise ( { {nullptr, nullptr, nullptr} } )
154 {
155  if(m_apdSeparateDigi) mixMod.produces<EBDigiCollection>(m_apdDigiTag);
156 
157  mixMod.produces<EBDigiCollection>(m_EBdigiCollection);
158  mixMod.produces<EEDigiCollection>(m_EEdigiCollection);
159  mixMod.produces<ESDigiCollection>(m_ESdigiCollection);
160 
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"));
164 
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");
171 
172  const bool applyConstantTerm = params.getParameter<bool> ("applyConstantTerm");
173  const double rmsConstantTerm = params.getParameter<double> ("ConstantTerm");
174 
175  const bool addNoise = params.getParameter<bool> ("doENoise");
176  const bool cosmicsPhase = params.getParameter<bool> ("cosmicsPhase");
177  const double cosmicsShift = params.getParameter<double> ("cosmicsShift");
178 
179 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
180 
181  // further phase for cosmics studies
182  if( cosmicsPhase )
183  {
184  if( m_doEB ) m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ;
185  if( m_doEE ) m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ;
186  }
187 
188  EcalCorrMatrix ebMatrix[ 3 ] ;
189  EcalCorrMatrix eeMatrix[ 3 ] ;
190 
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 ) ;
197 
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 ) ) ;
204 
205  for ( unsigned int row ( 0 ) ; row != m_readoutFrameSize ; ++row )
206  {
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 )
214  {
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 ] ;
222  }
223  }
224 
225  m_EBCorrNoise[0].reset( new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[0] ) );
226  m_EECorrNoise[0].reset( new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[0] ) );
227  m_EBCorrNoise[1].reset( new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[1] ) );
228  m_EECorrNoise[1].reset( new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[1] ) );
229  m_EBCorrNoise[2].reset( new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[2] ) );
230  m_EECorrNoise[2].reset( new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[2] ) );
231 
232  m_Coder.reset( new EcalCoder( addNoise ,
233  m_PreMix1 ,
234  m_EBCorrNoise[0].get() ,
235  m_EECorrNoise[0].get() ,
236  m_EBCorrNoise[1].get() ,
237  m_EECorrNoise[1].get() ,
238  m_EBCorrNoise[2].get() ,
239  m_EECorrNoise[2].get() ) );
240 
242  m_Coder.get() ,
244  rmsConstantTerm ) );
245 
246  if( m_apdSeparateDigi )
247  {
248  m_APDCoder.reset( new EcalCoder( false ,
249  m_PreMix1 ,
250  m_EBCorrNoise[0].get() ,
251  m_EECorrNoise[0].get() ,
252  m_EBCorrNoise[1].get() ,
253  m_EECorrNoise[1].get() ,
254  m_EBCorrNoise[2].get() ,
255  m_EECorrNoise[2].get() ) );
256 
258  m_APDCoder.get() ,
260  rmsConstantTerm ) );
261 
262  m_APDDigitizer.reset( new EBDigitizer( m_APDResponse.get() ,
263  m_APDElectronicsSim.get() ,
264  false ) );
265  }
266 
267  if( m_doEB ) {
268  m_BarrelDigitizer.reset( new EBDigitizer( m_EBResponse.get() ,
269  m_ElectronicsSim.get() ,
270  addNoise ) );
271  }
272 
273  if ( m_doEE ) {
274  m_EndcapDigitizer.reset( new EEDigitizer( m_EEResponse.get() ,
275  m_ElectronicsSim.get() ,
276  addNoise ) );
277  }
278 }
std::unique_ptr< EcalCoder > m_APDCoder
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::unique_ptr< EcalElectronicsSim > m_ElectronicsSim
T getUntrackedParameter(std::string const &, T const &) const
adds noise to the given frame.
Definition: EcalCoder.h:11
CaloTDigitizer< ESOldDigitizerTraits > ESOldDigitizer
EcalTDigitizer< EEDigitizerTraits > EEDigitizer
std::unique_ptr< ESDigitizer > m_ESDigitizer
const APDShape m_APDShape
const std::string m_ESdigiCollection
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
std::unique_ptr< EBHitResponse > m_APDResponse
const std::string m_hitsProducerTag
std::unique_ptr< EcalCoder > m_Coder
std::array< std::unique_ptr< CorrelatedNoisifier< EcalCorrMatrix > >, 3 > m_EBCorrNoise
const std::string m_EEdigiCollection
std::unique_ptr< ESHitResponse > m_ESResponse
const bool m_addESNoise
const unsigned int m_readoutFrameSize
Creates electronics signals from hits.
const double m_EBs25notCont
std::unique_ptr< CaloHitResponse > m_ESOldResponse
math::ErrorD< CaloSamples::MAXSAMPLES >::type EcalCorrMatrix
const CaloGeometry * m_Geometry
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
std::unique_ptr< EEHitResponse > m_EEResponse
EcalTDigitizer< EBDigitizerTraits > EBDigitizer
std::array< std::unique_ptr< CorrelatedNoisifier< EcalCorrMatrix > >, 3 > m_EECorrNoise
const bool m_apdSeparateDigi
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
const std::string m_apdDigiTag
std::unique_ptr< EBHitResponse > m_EBResponse
const EEShape m_EEShape
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
std::unique_ptr< EcalElectronicsSim > m_APDElectronicsSim
const EBShape m_EBShape
const std::string m_EBdigiCollection
std::unique_ptr< EBDigitizer > m_APDDigitizer
const double m_EEs25notCont
std::unique_ptr< const EcalSimParameterMap > m_ParameterMap
std::unique_ptr< const APDSimParameters > m_apdParameters
EcalDigiProducer::EcalDigiProducer ( const edm::ParameterSet params,
edm::ConsumesCollector iC 
)

Definition at line 282 of file EcalDigiProducer.cc.

References ecalElectronicsSim_cff::applyConstantTerm, ecalCosmicsSim_cff::cosmicsPhase, ecalCosmicsSim_cff::cosmicsShift, MillePedeFileConverter_cfg::e, funct::false, diffTreeTool::index, m_APDCoder, m_APDDigitizer, m_APDElectronicsSim, m_APDResponse, m_apdSeparateDigi, m_BarrelDigitizer, m_Coder, m_doEB, m_doEE, m_doES, m_EBCorrNoise, m_EBResponse, m_EECorrNoise, m_EEResponse, m_ElectronicsSim, m_EndcapDigitizer, m_hitsProducerTag, m_ParameterMap, m_PreMix1, and m_readoutFrameSize.

282  :
284  m_APDShape ( params.getParameter<double>( "apdShapeTstart" ) ,
285  params.getParameter<double>( "apdShapeTau" ) ) ,
286  m_EBShape ( ) ,
287  m_EEShape ( ) ,
288  m_ESShape ( ) ,
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") ) ,
295 
296  m_EBs25notCont ( params.getParameter<double> ("EBs25notContainment") ) ,
297  m_EEs25notCont ( params.getParameter<double> ("EEs25notContainment") ) ,
298 
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") ) ) ,
311 
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" ) ,
321  m_apdDigiTag ,
322  params.getParameter<std::vector<double> > ( "apdNonlParms" ) ) ) ,
323 
324  m_APDResponse ( !m_apdSeparateDigi ? nullptr :
325  new EBHitResponse( m_ParameterMap.get() ,
326  &m_EBShape ,
327  true ,
328  m_apdParameters.get() ,
329  &m_APDShape ) ) ,
330 
332  &m_EBShape ,
333  false , // barrel
334  m_apdParameters.get() ,
335  &m_APDShape ) ) ,
336 
338  &m_EEShape ) ) ,
341 
342  m_addESNoise ( params.getParameter<bool> ("doESNoise") ) ,
343  m_PreMix1 ( params.getParameter<bool> ("EcalPreMixStage1") ) ,
344  m_PreMix2 ( params.getParameter<bool> ("EcalPreMixStage2") ) ,
345 
346  m_doFastES ( params.getParameter<bool> ("doFast" ) ) ,
347 
348  m_doEB ( params.getParameter<bool> ("doEB" ) ) ,
349  m_doEE ( params.getParameter<bool> ("doEE" ) ) ,
350  m_doES ( params.getParameter<bool> ("doES" ) ) ,
351 
352  m_ESElectronicsSim ( m_doFastES ? nullptr :
353  new ESElectronicsSim( m_addESNoise ) ) ,
354 
355  m_ESOldDigitizer ( m_doFastES ? nullptr :
356  new ESOldDigitizer( m_ESOldResponse.get() ,
357  m_ESElectronicsSim.get() ,
358  m_addESNoise ) ) ,
359 
360  m_ESElectronicsSimFast ( !m_doFastES ? nullptr :
362  m_PreMix1 ) ) ,
363 
364  m_ESDigitizer ( !m_doFastES ? nullptr :
365  new ESDigitizer( m_ESResponse.get() ,
366  m_ESElectronicsSimFast.get() ,
367  m_addESNoise ) ) ,
368 
369  m_APDDigitizer ( nullptr ) ,
370  m_BarrelDigitizer ( nullptr ) ,
371  m_EndcapDigitizer ( nullptr ) ,
372  m_ElectronicsSim ( nullptr ) ,
373  m_Coder ( nullptr ) ,
374  m_APDElectronicsSim ( nullptr ) ,
375  m_APDCoder ( nullptr ) ,
376  m_Geometry ( nullptr ) ,
377  m_EBCorrNoise ( { {nullptr, nullptr, nullptr} } ) ,
378  m_EECorrNoise ( { {nullptr, nullptr, nullptr} } )
379 {
380  // "produces" statements taken care of elsewhere.
381  // if(m_apdSeparateDigi) mixMod.produces<EBDigiCollection>(m_apdDigiTag);
382  // mixMod.produces<EBDigiCollection>(m_EBdigiCollection);
383  // mixMod.produces<EEDigiCollection>(m_EEdigiCollection);
384  // mixMod.produces<ESDigiCollection>(m_ESdigiCollection);
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"));
388 
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");
395 
396  const bool applyConstantTerm = params.getParameter<bool> ("applyConstantTerm");
397  const double rmsConstantTerm = params.getParameter<double> ("ConstantTerm");
398 
399  const bool addNoise = params.getParameter<bool> ("doENoise");
400  const bool cosmicsPhase = params.getParameter<bool> ("cosmicsPhase");
401  const double cosmicsShift = params.getParameter<double> ("cosmicsShift");
402 
403 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
404 
405  // further phase for cosmics studies
406  if( cosmicsPhase )
407  {
408  if( m_doEB ) m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ;
409  if( m_doEE ) m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ;
410  }
411 
412  EcalCorrMatrix ebMatrix[ 3 ] ;
413  EcalCorrMatrix eeMatrix[ 3 ] ;
414 
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 ) ;
421 
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 ) ) ;
428 
429  for ( unsigned int row ( 0 ) ; row != m_readoutFrameSize ; ++row )
430  {
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 )
438  {
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 ] ;
446  }
447  }
448 
449  m_EBCorrNoise[0].reset( new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[0] ) );
450  m_EECorrNoise[0].reset( new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[0] ) );
451  m_EBCorrNoise[1].reset( new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[1] ) );
452  m_EECorrNoise[1].reset( new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[1] ) );
453  m_EBCorrNoise[2].reset( new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[2] ) );
454  m_EECorrNoise[2].reset( new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[2] ) );
455 
456  m_Coder.reset( new EcalCoder( addNoise ,
457  m_PreMix1 ,
458  m_EBCorrNoise[0].get() ,
459  m_EECorrNoise[0].get() ,
460  m_EBCorrNoise[1].get() ,
461  m_EECorrNoise[1].get() ,
462  m_EBCorrNoise[2].get() ,
463  m_EECorrNoise[2].get() ) );
464 
466  m_Coder.get() ,
468  rmsConstantTerm ) );
469 
470  if( m_apdSeparateDigi )
471  {
472  m_APDCoder.reset( new EcalCoder( false ,
473  m_EBCorrNoise[0].get() ,
474  m_EECorrNoise[0].get() ,
475  m_EBCorrNoise[1].get() ,
476  m_EECorrNoise[1].get() ,
477  m_EBCorrNoise[2].get() ,
478  m_EECorrNoise[2].get() ) );
479 
481  m_APDCoder.get() ,
483  rmsConstantTerm ) );
484 
485  m_APDDigitizer.reset( new EBDigitizer( m_APDResponse.get() ,
486  m_APDElectronicsSim.get() ,
487  false ) );
488  }
489 
490  if( m_doEB ) {
491  m_BarrelDigitizer.reset( new EBDigitizer( m_EBResponse.get() ,
492  m_ElectronicsSim.get() ,
493  addNoise ) );
494  }
495 
496  if( m_doEE ) {
497  m_EndcapDigitizer.reset( new EEDigitizer( m_EEResponse.get() ,
498  m_ElectronicsSim.get() ,
499  addNoise ) );
500  }
501 }
std::unique_ptr< EcalCoder > m_APDCoder
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::unique_ptr< EcalElectronicsSim > m_ElectronicsSim
T getUntrackedParameter(std::string const &, T const &) const
adds noise to the given frame.
Definition: EcalCoder.h:11
CaloTDigitizer< ESOldDigitizerTraits > ESOldDigitizer
EcalTDigitizer< EEDigitizerTraits > EEDigitizer
std::unique_ptr< ESDigitizer > m_ESDigitizer
const APDShape m_APDShape
const std::string m_ESdigiCollection
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
std::unique_ptr< EBHitResponse > m_APDResponse
const std::string m_hitsProducerTag
std::unique_ptr< EcalCoder > m_Coder
std::array< std::unique_ptr< CorrelatedNoisifier< EcalCorrMatrix > >, 3 > m_EBCorrNoise
const std::string m_EEdigiCollection
std::unique_ptr< ESHitResponse > m_ESResponse
const bool m_addESNoise
const unsigned int m_readoutFrameSize
Creates electronics signals from hits.
const double m_EBs25notCont
std::unique_ptr< CaloHitResponse > m_ESOldResponse
math::ErrorD< CaloSamples::MAXSAMPLES >::type EcalCorrMatrix
const CaloGeometry * m_Geometry
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
std::unique_ptr< EEHitResponse > m_EEResponse
EcalTDigitizer< EBDigitizerTraits > EBDigitizer
std::array< std::unique_ptr< CorrelatedNoisifier< EcalCorrMatrix > >, 3 > m_EECorrNoise
const bool m_apdSeparateDigi
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
const std::string m_apdDigiTag
std::unique_ptr< EBHitResponse > m_EBResponse
const EEShape m_EEShape
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
std::unique_ptr< EcalElectronicsSim > m_APDElectronicsSim
const EBShape m_EBShape
const std::string m_EBdigiCollection
std::unique_ptr< EBDigitizer > m_APDDigitizer
const double m_EEs25notCont
std::unique_ptr< const EcalSimParameterMap > m_ParameterMap
std::unique_ptr< const APDSimParameters > m_apdParameters
EcalDigiProducer::~EcalDigiProducer ( )
virtual

Definition at line 504 of file EcalDigiProducer.cc.

505 {}

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 553 of file EcalDigiProducer.cc.

References accumulateCaloHits(), edm::Event::getByLabel(), m_hitsProducerTag, randomEngine(), and edm::Event::streamID().

Referenced by edm::DataMixingEcalDigiWorkerProd::addEcalSignals().

553  {
554  // Step A: Get Inputs
555  edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB");
557  e.getByLabel(ebTag, ebHandle);
558 
559  edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE");
561  e.getByLabel(eeTag, eeHandle);
562 
563  edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES");
565  e.getByLabel(esTag, esHandle);
566 
567  accumulateCaloHits(ebHandle, eeHandle, esHandle, 0, randomEngine(e.streamID()));
568 }
const std::string m_hitsProducerTag
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing, CLHEP::HepRandomEngine *)
void EcalDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 571 of file EcalDigiProducer.cc.

References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), PileUpEventPrincipal::getByLabel(), m_hitsProducerTag, and randomEngine().

571  {
572  // Step A: Get Inputs
573  edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB");
575  e.getByLabel(ebTag, ebHandle);
576 
577  edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE");
579  e.getByLabel(eeTag, eeHandle);
580 
581  edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES");
583  e.getByLabel(esTag, esHandle);
584 
585  accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing(), randomEngine(streamID));
586 }
const std::string m_hitsProducerTag
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing, CLHEP::HepRandomEngine *)
void EcalDigiProducer::accumulateCaloHits ( HitsHandle const &  ebHandle,
HitsHandle const &  eeHandle,
HitsHandle const &  esHandle,
int  bunchCrossing,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 530 of file EcalDigiProducer.cc.

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

Referenced by accumulate().

530  {
531  if(m_doEB && ebHandle.isValid()) {
532  m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, engine);
533 
534  if(m_apdSeparateDigi) {
535  m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, engine);
536  }
537  }
538 
539  if(m_doEE && eeHandle.isValid()) {
540  m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, engine);
541  }
542 
543  if(m_doES && esHandle.isValid()) {
544  if(m_doFastES) {
545  m_ESDigitizer->add(*esHandle.product(), bunchCrossing, engine);
546  } else {
547  m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, engine);
548  }
549  }
550 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
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 637 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 edm::DataMixingEcalDigiWorkerProd::beginLuminosityBlock().

638 {
640  if ( ! rng.isAvailable() ) {
641  throw cms::Exception("Configuration") <<
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.";
645  }
646  CLHEP::HepRandomEngine* engine = &rng->getEngine(lumi.index());
647 
648  if( m_doEB ) {
649  if( nullptr != m_APDResponse ) m_APDResponse->initialize(engine);
650  m_EBResponse->initialize(engine);
651  }
652 }
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:46
std::unique_ptr< EBHitResponse > m_EBResponse
virtual void EcalDigiProducer::cacheEBDigis ( const EBDigiCollection ebDigiPtr) const
inlineprivatevirtual

Reimplemented in EcalTBDigiProducer.

Definition at line 79 of file EcalDigiProducer.h.

Referenced by finalizeEvent().

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

Reimplemented in EcalTBDigiProducer.

Definition at line 80 of file EcalDigiProducer.h.

Referenced by finalizeEvent().

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

Definition at line 655 of file EcalDigiProducer.cc.

References EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), LogDebug, m_APDCoder, m_APDResponse, m_Coder, m_doES, m_doFastES, m_EBResponse, m_EBs25notCont, m_EEResponse, m_EEs25notCont, m_ESDigitizer, m_ESElectronicsSim, m_ESElectronicsSimFast, m_ESOldDigitizer, m_ESShape, m_useLCcorrection, edm::ESHandle< T >::product(), and ESShape::setGain().

Referenced by initializeEvent().

656 {
657  // Pedestals from event setup
658 
660  eventSetup.get<EcalPedestalsRcd>().get( dbPed ) ;
661  const EcalPedestals* pedestals ( dbPed.product() ) ;
662 
663  m_Coder->setPedestals( pedestals ) ;
664  if( nullptr != m_APDCoder ) m_APDCoder->setPedestals( pedestals ) ;
665 
666  // Ecal Intercalibration Constants
668  eventSetup.get<EcalIntercalibConstantsMCRcd>().get( pIcal ) ;
669  const EcalIntercalibConstantsMC* ical ( pIcal.product() ) ;
670 
671  m_Coder->setIntercalibConstants( ical ) ;
672  if( nullptr != m_APDCoder) m_APDCoder->setIntercalibConstants( ical ) ;
673 
674  m_EBResponse->setIntercal( ical ) ;
675  if( nullptr != m_APDResponse ) m_APDResponse->setIntercal( ical ) ;
676 
677  // Ecal LaserCorrection Constants
679  eventSetup.get<EcalLaserDbRecord>().get(laser);
680  const edm::TimeValue_t eventTimeValue = event.time().value();
681 
682  m_EBResponse->setEventTime(eventTimeValue);
683  m_EBResponse->setLaserConstants(laser.product(), m_useLCcorrection);
684 
685  m_EEResponse->setEventTime(eventTimeValue);
686  m_EEResponse->setLaserConstants(laser.product(), m_useLCcorrection);
687 
688  // ADC -> GeV Scale
690  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
691  const EcalADCToGeVConstant* agc = pAgc.product();
692 
693  // Gain Ratios
695  eventSetup.get<EcalGainRatiosRcd>().get(pRatio);
696  const EcalGainRatios* gr = pRatio.product();
697 
698  m_Coder->setGainRatios( gr );
699  if( nullptr != m_APDCoder) m_APDCoder->setGainRatios( gr );
700 
701  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
702 
703  double theGains[m_Coder->NGAINS+1];
704  theGains[0] = 0.;
705  theGains[3] = 1.;
706  theGains[2] = defaultRatios->gain6Over1() ;
707  theGains[1] = theGains[2]*(defaultRatios->gain12Over6()) ;
708 
709  LogDebug("EcalDigi") << " Gains: " << "\n" << " g1 = " << theGains[1]
710  << "\n" << " g2 = " << theGains[2]
711  << "\n" << " g3 = " << theGains[3] ;
712 
713  delete defaultRatios;
714 
715  const double EBscale (
716  ( agc->getEBValue())*theGains[1]*(m_Coder->MAXADC)*m_EBs25notCont ) ;
717 
718  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue()
719  << "\n" << " notCont = " << m_EBs25notCont
720  << "\n" << " saturation for EB = " << EBscale
721  << ", " << m_EBs25notCont ;
722 
723  const double EEscale (
724  (agc->getEEValue())*theGains[1]*(m_Coder->MAXADC)*m_EEs25notCont ) ;
725 
726  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue()
727  << "\n" << " notCont = " << m_EEs25notCont
728  << "\n" << " saturation for EB = " << EEscale
729  << ", " << m_EEs25notCont ;
730 
731  m_Coder->setFullScaleEnergy( EBscale ,
732  EEscale ) ;
733  if( nullptr != m_APDCoder ) m_APDCoder->setFullScaleEnergy( EBscale ,
734  EEscale ) ;
735 
736  if( nullptr != m_ESOldDigitizer ||
737  nullptr != m_ESDigitizer )
738  {
739  // ES condition objects
740  edm::ESHandle<ESGain> hesgain ;
742  edm::ESHandle<ESPedestals> hesPedestals ;
744 
745  eventSetup.get<ESGainRcd>(). get( hesgain ) ;
746  eventSetup.get<ESMIPToGeVConstantRcd>(). get( hesMIPToGeV ) ;
747  eventSetup.get<ESPedestalsRcd>(). get( hesPedestals ) ;
748  eventSetup.get<ESIntercalibConstantsRcd>().get( hesMIPs ) ;
749 
750  const ESGain* esgain ( hesgain.product() ) ;
751  const ESPedestals* espeds ( hesPedestals.product() ) ;
752  const ESIntercalibConstants* esmips ( hesMIPs.product() ) ;
753  const ESMIPToGeVConstant* esMipToGeV ( hesMIPToGeV.product() ) ;
754  const int ESGain ( 1.1 > esgain->getESGain() ? 1 : 2 ) ;
755  const double ESMIPToGeV ( ( 1 == ESGain ) ?
756  esMipToGeV->getESValueLow() :
757  esMipToGeV->getESValueHigh() ) ;
758 
759  if( m_doES ) {
761  if( !m_doFastES )
762  {
763  m_ESElectronicsSim->setGain( ESGain ) ;
764  m_ESElectronicsSim->setPedestals( espeds ) ;
765  m_ESElectronicsSim->setMIPs( esmips ) ;
766  m_ESElectronicsSim->setMIPToGeV( ESMIPToGeV ) ;
767  }
768  else
769  {
770  m_ESDigitizer->setGain( ESGain ) ;
771  m_ESElectronicsSimFast->setPedestals( espeds ) ;
772  m_ESElectronicsSimFast->setMIPs( esmips ) ;
773  m_ESElectronicsSimFast->setMIPToGeV( ESMIPToGeV ) ;
774  }
775  }
776  }
777 }
#define LogDebug(id)
std::unique_ptr< EcalCoder > m_APDCoder
std::unique_ptr< ESDigitizer > m_ESDigitizer
Definition: ESGain.h:7
void setGain(const int gain)
Definition: ESShape.h:26
std::unique_ptr< EBHitResponse > m_APDResponse
std::unique_ptr< EcalCoder > m_Coder
const double m_EBs25notCont
float gain6Over1() const
unsigned long long TimeValue_t
Definition: Timestamp.h:28
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
std::unique_ptr< EEHitResponse > m_EEResponse
const T & get() const
Definition: EventSetup.h:56
float gain12Over6() const
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
std::unique_ptr< EBHitResponse > m_EBResponse
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
T const * product() const
Definition: ESHandle.h:86
const double m_EEs25notCont
void EcalDigiProducer::checkGeometry ( const edm::EventSetup eventSetup)
private

Definition at line 780 of file EcalDigiProducer.cc.

References edm::EventSetup::get(), m_Geometry, and updateGeometry().

Referenced by initializeEvent().

781 {
782  // TODO find a way to avoid doing this every event
783  edm::ESHandle<CaloGeometry> hGeometry ;
784  eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ;
785 
786  const CaloGeometry* pGeometry = &*hGeometry;
787 
788  if( pGeometry != m_Geometry )
789  {
790  m_Geometry = pGeometry;
791  updateGeometry();
792  }
793 }
const CaloGeometry * m_Geometry
const T & get() const
Definition: EventSetup.h:56
void EcalDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Reimplemented in EcalTBDigiProducer.

Definition at line 589 of file EcalDigiProducer.cc.

References cacheEBDigis(), cacheEEDigis(), m_APDDigitizer, 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(), randomEngine(), and edm::Event::streamID().

Referenced by EcalTBDigiProducer::finalizeEvent(), and edm::DataMixingEcalDigiWorkerProd::putEcal().

589  {
590  // Step B: Create empty output
591  std::unique_ptr<EBDigiCollection> apdResult ( !m_apdSeparateDigi || !m_doEB ? nullptr :
592  new EBDigiCollection() ) ;
593  std::unique_ptr<EBDigiCollection> barrelResult ( new EBDigiCollection() ) ;
594  std::unique_ptr<EEDigiCollection> endcapResult ( new EEDigiCollection() ) ;
595  std::unique_ptr<ESDigiCollection> preshowerResult( new ESDigiCollection() ) ;
596 
597  // run the algorithm
598 
599  if( m_doEB ) {
600  m_BarrelDigitizer->run( *barrelResult, randomEngine(event.streamID()) ) ;
601  cacheEBDigis( &*barrelResult ) ;
602 
603  edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size() ;
604 
605  if( m_apdSeparateDigi ) {
606  m_APDDigitizer->run( *apdResult, randomEngine(event.streamID()) ) ;
607  edm::LogInfo("DigiInfo") << "APD Digis: " << apdResult->size() ;
608  }
609  }
610 
611  if( m_doEE ) {
612  m_EndcapDigitizer->run( *endcapResult, randomEngine(event.streamID()) ) ;
613  edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size() ;
614  cacheEEDigis( &*endcapResult ) ;
615  }
616  if( m_doES ) {
617  if(m_doFastES) {
618  m_ESDigitizer->run( *preshowerResult, randomEngine(event.streamID()) ) ;
619  } else {
620  m_ESOldDigitizer->run( *preshowerResult, randomEngine(event.streamID()) ) ;
621  }
622  edm::LogInfo("EcalDigi") << "ES Digis: " << preshowerResult->size();
623  }
624 
625 
626  // Step D: Put outputs into event
627  if( m_apdSeparateDigi ) {
628  //event.put(std::move(apdResult), m_apdDigiTag ) ;
629  }
630 
631  event.put(std::move(barrelResult), m_EBdigiCollection ) ;
632  event.put(std::move(endcapResult), m_EEdigiCollection ) ;
633  event.put(std::move(preshowerResult), m_ESdigiCollection ) ;
634 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
const std::string m_ESdigiCollection
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
const std::string m_EEdigiCollection
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const
const bool m_apdSeparateDigi
CLHEP::HepRandomEngine * randomEngine(edm::StreamID const &streamID)
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const
const std::string m_EBdigiCollection
std::unique_ptr< EBDigitizer > m_APDDigitizer
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1
void EcalDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Reimplemented in EcalTBDigiProducer.

Definition at line 508 of file EcalDigiProducer.cc.

References checkCalibrations(), checkGeometry(), m_APDDigitizer, m_apdSeparateDigi, m_BarrelDigitizer, m_doEB, m_doEE, m_doES, m_doFastES, m_EndcapDigitizer, m_ESDigitizer, and m_ESOldDigitizer.

Referenced by EcalTBDigiProducer::initializeEvent(), and edm::DataMixingEcalDigiWorkerProd::initializeEvent().

508  {
509  checkGeometry( eventSetup );
510  checkCalibrations( event, eventSetup );
511  if( m_doEB ) {
512  m_BarrelDigitizer->initializeHits();
513  if(m_apdSeparateDigi) {
514  m_APDDigitizer->initializeHits();
515  }
516  }
517  if( m_doEE ) {
518  m_EndcapDigitizer->initializeHits();
519  }
520  if( m_doES ) {
521  if(m_doFastES) {
522  m_ESDigitizer->initializeHits();
523  } else {
524  m_ESOldDigitizer->initializeHits();
525  }
526  }
527 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
void checkCalibrations(const edm::Event &event, const edm::EventSetup &eventSetup)
void checkGeometry(const edm::EventSetup &eventSetup)
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
const bool m_apdSeparateDigi
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
std::unique_ptr< EBDigitizer > m_APDDigitizer
Definition: event.py:1
CLHEP::HepRandomEngine * EcalDigiProducer::randomEngine ( edm::StreamID const &  streamID)
private

Definition at line 832 of file EcalDigiProducer.cc.

References edm::RandomNumberGenerator::getEngine(), diffTreeTool::index, randomEngines_, and edm::StreamID::value().

Referenced by accumulate(), and finalizeEvent().

832  {
833  unsigned int index = streamID.value();
834  if(index >= randomEngines_.size()) {
835  randomEngines_.resize(index + 1, nullptr);
836  }
837  CLHEP::HepRandomEngine* ptr = randomEngines_[index];
838  if(!ptr) {
840  ptr = &rng->getEngine(streamID);
841  randomEngines_[index] = ptr;
842  }
843  return ptr;
844 }
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::vector< CLHEP::HepRandomEngine * > randomEngines_
void EcalDigiProducer::setEBNoiseSignalGenerator ( EcalBaseSignalGenerator noiseGenerator)

Definition at line 846 of file EcalDigiProducer.cc.

References m_BarrelDigitizer.

846  {
847  //noiseGenerator->setParameterMap(theParameterMap);
848  if(nullptr != m_BarrelDigitizer) m_BarrelDigitizer->setNoiseSignalGenerator(noiseGenerator);
849 }
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
void EcalDigiProducer::setEENoiseSignalGenerator ( EcalBaseSignalGenerator noiseGenerator)

Definition at line 851 of file EcalDigiProducer.cc.

References m_EndcapDigitizer.

851  {
852  //noiseGenerator->setParameterMap(theParameterMap);
853  if(nullptr != m_EndcapDigitizer) m_EndcapDigitizer->setNoiseSignalGenerator(noiseGenerator);
854 }
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
void EcalDigiProducer::setESNoiseSignalGenerator ( EcalBaseSignalGenerator noiseGenerator)

Definition at line 856 of file EcalDigiProducer.cc.

References m_ESDigitizer.

856  {
857  //noiseGenerator->setParameterMap(theParameterMap);
858  if(nullptr != m_ESDigitizer) m_ESDigitizer->setNoiseSignalGenerator(noiseGenerator);
859 }
std::unique_ptr< ESDigitizer > m_ESDigitizer
void EcalDigiProducer::updateGeometry ( )
private

Definition at line 796 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, m_Geometry, and nullptr.

Referenced by checkGeometry().

797 {
798  if( m_doEB ) {
799  if( nullptr != m_APDResponse ) m_APDResponse->setGeometry(
801  m_EBResponse->setGeometry(
803  }
804  if( m_doEE ) {
805  m_EEResponse->setGeometry(
807  }
808  if( m_doES ) {
809  m_ESResponse->setGeometry(
811  m_ESOldResponse->setGeometry( m_Geometry ) ;
812 
813  const std::vector<DetId>* theESDets (
816 
817  if( !m_doFastES )
818  {
819  if( nullptr != m_ESOldDigitizer &&
820  nullptr != theESDets )
821  m_ESOldDigitizer->setDetIds( *theESDets ) ;
822  }
823  else
824  {
825  if( nullptr != m_ESDigitizer &&
826  nullptr != theESDets )
827  m_ESDigitizer->setDetIds( *theESDets ) ;
828  }
829  }
830 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
std::unique_ptr< ESDigitizer > m_ESDigitizer
std::unique_ptr< EBHitResponse > m_APDResponse
#define nullptr
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 125 of file EcalDigiProducer.h.

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

Definition at line 146 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), and EcalDigiProducer().

const std::string EcalDigiProducer::m_apdDigiTag
private

Definition at line 114 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

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

Definition at line 145 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

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

Definition at line 115 of file EcalDigiProducer.h.

std::unique_ptr<EBHitResponse> EcalDigiProducer::m_APDResponse
private
const bool EcalDigiProducer::m_apdSeparateDigi
private
const APDShape EcalDigiProducer::m_APDShape
private

Definition at line 93 of file EcalDigiProducer.h.

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

Definition at line 143 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), and EcalDigiProducer().

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 150 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

const std::string EcalDigiProducer::m_EBdigiCollection
private

Definition at line 98 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 107 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const EBShape EcalDigiProducer::m_EBShape
private

Definition at line 94 of file EcalDigiProducer.h.

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

Definition at line 151 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

const std::string EcalDigiProducer::m_EEdigiCollection
private

Definition at line 99 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 108 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const EEShape EcalDigiProducer::m_EEShape
private

Definition at line 95 of file EcalDigiProducer.h.

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

Definition at line 142 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

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

Definition at line 100 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 133 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

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

Definition at line 135 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 123 of file EcalDigiProducer.h.

Referenced by updateGeometry().

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

Definition at line 122 of file EcalDigiProducer.h.

Referenced by updateGeometry().

ESShape EcalDigiProducer::m_ESShape
private

Definition at line 96 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

const CaloGeometry* EcalDigiProducer::m_Geometry
private

Definition at line 148 of file EcalDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

const std::string EcalDigiProducer::m_hitsProducerTag
private

Definition at line 101 of file EcalDigiProducer.h.

Referenced by accumulate(), and EcalDigiProducer().

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

Definition at line 112 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and EcalTBDigiProducer::setPhaseShift().

const bool EcalDigiProducer::m_PreMix1
private

Definition at line 126 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

const bool EcalDigiProducer::m_PreMix2
private

Definition at line 127 of file EcalDigiProducer.h.

const unsigned int EcalDigiProducer::m_readoutFrameSize
private

Definition at line 110 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

bool EcalDigiProducer::m_useLCcorrection
private

Definition at line 103 of file EcalDigiProducer.h.

Referenced by checkCalibrations().

std::vector<CLHEP::HepRandomEngine*> EcalDigiProducer::randomEngines_
private

Definition at line 153 of file EcalDigiProducer.h.

Referenced by randomEngine().