CMS 3D CMS Logo

EcalElectronicsSim.h
Go to the documentation of this file.
1 #ifndef EcalSimAlgos_EcalElectronicsSim_h
2 #define EcalSimAlgos_EcalElectronicsSim_h
3 
5 #include "CLHEP/Random/RandGaussQ.h"
7 
9 
10 namespace CLHEP {
11  class HepRandomEngine;
12 }
13 
14 /* \class EcalElectronicsSim
15  * \brief Converts CaloDataFrame in CaloTimeSample and vice versa.
16  *
17  */
18 
19 template <typename CoderType, typename SamplesType, typename DataFrameType>
21 public:
23  CoderType* coder,
24  bool applyConstantTerm,
25  double rmsConstantTerm)
26  : m_simMap(parameterMap), m_theCoder(coder), m_thisCT(rmsConstantTerm), m_applyConstantTerm(applyConstantTerm) {}
27 
29 
30  void analogToDigital(CLHEP::HepRandomEngine* engine, SamplesType& clf, DataFrameType& df) const {
31  // input signal is in pe. Converted in GeV
32  amplify(clf, engine);
33  m_theCoder->analogToDigital(engine, clf, df);
34  }
35 
36  void newEvent() {}
37 
38  void setNoiseSignalGenerator(const CaloVNoiseSignalGenerator* noiseSignalGenerator) {
39  theNoiseSignalGenerator = noiseSignalGenerator;
40  }
41 
42 private:
44  void amplify(SamplesType& clf, CLHEP::HepRandomEngine* engine) const {
45  const double fac(m_simMap->simParameters(clf.id()).photoelectronsToAnalog());
46  if (m_applyConstantTerm) {
47  clf *= fac * CLHEP::RandGaussQ::shoot(engine, 1.0, m_thisCT);
48  } else {
49  clf *= fac;
50  }
51  }
52 
54 
56 
58 
59  CoderType* m_theCoder;
60 
61  const double m_thisCT;
62  const bool m_applyConstantTerm;
63 };
64 
65 #endif
EcalElectronicsSim::m_theCoder
CoderType * m_theCoder
Definition: EcalElectronicsSim.h:59
ecalElectronicsSim_cff.applyConstantTerm
applyConstantTerm
Definition: ecalElectronicsSim_cff.py:6
EcalElectronicsSim::m_simMap
const EcalSimParameterMap * m_simMap
map of parameters
Definition: EcalElectronicsSim.h:55
EcalElectronicsSim::m_applyConstantTerm
const bool m_applyConstantTerm
Definition: EcalElectronicsSim.h:62
EcalElectronicsSim::amplify
void amplify(SamplesType &clf, CLHEP::HepRandomEngine *engine) const
input signal is in pe. Converted in GeV
Definition: EcalElectronicsSim.h:44
EcalSimParameterMap.h
EcalElectronicsSim::EcalElectronicsSim
EcalElectronicsSim(const EcalSimParameterMap *parameterMap, CoderType *coder, bool applyConstantTerm, double rmsConstantTerm)
Definition: EcalElectronicsSim.h:22
CaloVNoiseSignalGenerator.h
EcalSimParameterMap
Definition: EcalSimParameterMap.h:11
EcalElectronicsSim::setNoiseSignalGenerator
void setNoiseSignalGenerator(const CaloVNoiseSignalGenerator *noiseSignalGenerator)
Definition: EcalElectronicsSim.h:38
CaloVNoiseSignalGenerator
Definition: CaloVNoiseSignalGenerator.h:11
CLHEP
Definition: CocoaGlobals.h:27
EcalElectronicsSim::newEvent
void newEvent()
Definition: EcalElectronicsSim.h:36
EcalElectronicsSim
Definition: EcalElectronicsSim.h:20
EcalSimParameterMap::simParameters
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
Definition: EcalSimParameterMap.cc:52
EcalElectronicsSim::analogToDigital
void analogToDigital(CLHEP::HepRandomEngine *engine, SamplesType &clf, DataFrameType &df) const
from EcalSamples to EcalDataFrame
Definition: EcalElectronicsSim.h:30
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:640
EcalElectronicsSim::theNoiseSignalGenerator
const CaloVNoiseSignalGenerator * theNoiseSignalGenerator
Definition: EcalElectronicsSim.h:57
hcalSimParameters_cfi.photoelectronsToAnalog
photoelectronsToAnalog
Definition: hcalSimParameters_cfi.py:18
EcalElectronicsSim::m_thisCT
const double m_thisCT
Definition: EcalElectronicsSim.h:61