CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalCoder.h
Go to the documentation of this file.
1 
2 #ifndef EcalSimAlgos_EcalCoder_h
3 #define EcalSimAlgos_EcalCoder_h 1
4 
10 
11 template <typename M>
13 class EcalMGPASample;
14 class EcalDataFrame;
15 class DetId;
16 
17 #include <vector>
18 
19 namespace CLHEP {
20  class HepRandomEngine;
21 }
22 
23 /* \class EEDigitizerTraits
24  * \brief Converts CaloDataFrame in CaloTimeSample and vice versa.
25  *
26  */
27 class EcalCoder {
28 public:
30 
32 
33  enum {
34  NBITS = 12, // number of available bits
35  MAXADC = 4095, // 2^12 -1, adc max range
36  ADCGAINSWITCH = 4079, // adc gain switch
37  NGAINS = 3 // number of electronic gains
38  };
39 
41  EcalCoder(bool addNoise,
42  bool PreMix1,
43  Noisifier* ebCorrNoise0,
44  Noisifier* eeCorrNoise0 = nullptr,
45  Noisifier* ebCorrNoise1 = nullptr,
46  Noisifier* eeCorrNoise1 = nullptr,
47  Noisifier* ebCorrNoise2 = nullptr,
48  Noisifier* eeCorrNoise2 = nullptr); // make EE version optional for tb compatibility
50  virtual ~EcalCoder();
51 
53  void setPedestals(const EcalPedestals* pedestals);
54 
55  void setGainRatios(const EcalGainRatios* gainRatios);
56 
57  void setFullScaleEnergy(double EBscale, double EEscale);
58 
60 
62  virtual void analogToDigital(CLHEP::HepRandomEngine*, const EcalSamples& clf, EcalDataFrame& df) const;
63 
64 private:
66  double fullScaleEnergy(const DetId& did) const;
67 
69  void encode(const EcalSamples& ecalSamples, EcalDataFrame& df, CLHEP::HepRandomEngine*) const;
70 
71  // double decode( const EcalMGPASample& sample ,
72  // const DetId& detId ) const ;
73 
75  // void noisify( const EcalIntercalibConstantsMC* values ,
76  // int size ) const ;
77 
78  void findPedestal(const DetId& detId, int gainId, double& pedestal, double& width) const;
79 
80  void findGains(const DetId& detId, double theGains[]) const;
81 
82  void findIntercalibConstant(const DetId& detId, double& icalconst) const;
83 
85 
86  const EcalGainRatios* m_gainRatios; // the electronics gains
87 
88  const EcalIntercalibConstantsMC* m_intercals; //record specific for simulation of gain variation in MC
89 
90  double m_maxEneEB; // max attainable energy in the ecal barrel
91  double m_maxEneEE; // max attainable energy in the ecal endcap
92 
93  bool m_addNoise; // whether add noise to the pedestals and the gains
94  bool m_PreMix1; // Follow necessary steps for PreMixing input
95 
98 };
99 
100 #endif
bool m_addNoise
Definition: EcalCoder.h:93
const EcalGainRatios * m_gainRatios
Definition: EcalCoder.h:86
adds noise to the given frame.
Definition: EcalCoder.h:12
CorrelatedNoisifier< EcalCorrMatrix > Noisifier
Definition: EcalCoder.h:31
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
Definition: EcalCoder.cc:47
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:53
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
Definition: EcalCoder.cc:49
CaloTSamples< float, 10 > EcalSamples
Definition: EcalCoder.h:29
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:88
double m_maxEneEE
Definition: EcalCoder.h:91
const Noisifier * m_ebCorrNoise[3]
Definition: EcalCoder.h:96
const Noisifier * m_eeCorrNoise[3]
Definition: EcalCoder.h:97
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalCoder.cc:43
void findGains(const DetId &detId, double theGains[]) const
Definition: EcalCoder.cc:296
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
Definition: EcalCoder.cc:73
bool m_PreMix1
Definition: EcalCoder.h:94
const EcalPedestals * m_peds
Definition: EcalCoder.h:84
void setGainRatios(const EcalGainRatios *gainRatios)
Definition: EcalCoder.cc:45
Definition: DetId.h:17
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
void setFullScaleEnergy(double EBscale, double EEscale)
Definition: EcalCoder.cc:38
virtual ~EcalCoder()
dtor
Definition: EcalCoder.cc:36
double m_maxEneEB
Definition: EcalCoder.h:90
const bool addNoise
void findIntercalibConstant(const DetId &detId, double &icalconst) const
Definition: EcalCoder.cc:324
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
Definition: EcalCoder.cc:243
EcalCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=nullptr, Noisifier *ebCorrNoise1=nullptr, Noisifier *eeCorrNoise1=nullptr, Noisifier *ebCorrNoise2=nullptr, Noisifier *eeCorrNoise2=nullptr)
ctor
Definition: EcalCoder.cc:12