CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
const bool applyConstantTerm
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
void setNoiseSignalGenerator(const CaloVNoiseSignalGenerator *noiseSignalGenerator)
void amplify(SamplesType &clf, CLHEP::HepRandomEngine *engine) const
input signal is in pe. Converted in GeV
const EcalSimParameterMap * m_simMap
map of parameters
void analogToDigital(CLHEP::HepRandomEngine *engine, SamplesType &clf, DataFrameType &df) const
from EcalSamples to EcalDataFrame
const double rmsConstantTerm
EcalElectronicsSim(const EcalSimParameterMap *parameterMap, CoderType *coder, bool applyConstantTerm, double rmsConstantTerm)
const CaloVNoiseSignalGenerator * theNoiseSignalGenerator
const bool m_applyConstantTerm