CMS 3D CMS Logo

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  static constexpr int NBITS = 12, // number of available bits
34  MAXADC = 4095, // 2^12 -1, adc max range
35  ADCGAINSWITCH = 4079, // adc gain switch
36  NGAINS = 3 // number of electronic gains
37  ;
38 
40  EcalCoder(bool addNoise,
41  bool PreMix1,
42  Noisifier* ebCorrNoise0,
43  Noisifier* eeCorrNoise0 = nullptr,
44  Noisifier* ebCorrNoise1 = nullptr,
45  Noisifier* eeCorrNoise1 = nullptr,
46  Noisifier* ebCorrNoise2 = nullptr,
47  Noisifier* eeCorrNoise2 = nullptr); // make EE version optional for tb compatibility
49  virtual ~EcalCoder();
50 
52  void setPedestals(const EcalPedestals* pedestals);
53 
54  void setGainRatios(const EcalGainRatios* gainRatios);
55 
56  void setFullScaleEnergy(double EBscale, double EEscale);
57 
59 
61  virtual void analogToDigital(CLHEP::HepRandomEngine*, const EcalSamples& clf, EcalDataFrame& df) const;
62 
63 private:
65  double fullScaleEnergy(const DetId& did) const;
66 
68  void encode(const EcalSamples& ecalSamples, EcalDataFrame& df, CLHEP::HepRandomEngine*) const;
69 
70  // double decode( const EcalMGPASample& sample ,
71  // const DetId& detId ) const ;
72 
74  // void noisify( const EcalIntercalibConstantsMC* values ,
75  // int size ) const ;
76 
77  void findPedestal(const DetId& detId, int gainId, double& pedestal, double& width) const;
78 
79  void findGains(const DetId& detId, double theGains[]) const;
80 
81  void findIntercalibConstant(const DetId& detId, double& icalconst) const;
82 
84 
85  const EcalGainRatios* m_gainRatios; // the electronics gains
86 
87  const EcalIntercalibConstantsMC* m_intercals; //record specific for simulation of gain variation in MC
88 
89  double m_maxEneEB; // max attainable energy in the ecal barrel
90  double m_maxEneEE; // max attainable energy in the ecal endcap
91 
92  bool m_addNoise; // whether add noise to the pedestals and the gains
93  bool m_PreMix1; // Follow necessary steps for PreMixing input
94 
97 };
98 
99 #endif
bool m_addNoise
Definition: EcalCoder.h:92
const EcalGainRatios * m_gainRatios
Definition: EcalCoder.h:85
adds noise to the given frame.
Definition: EcalCoder.h:12
static constexpr int NBITS
Definition: EcalCoder.h:33
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
Definition: EcalCoder.cc:49
CorrelatedNoisifier< EcalCorrMatrix > Noisifier
Definition: EcalCoder.h:31
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:53
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
Definition: EcalCoder.cc:73
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
Definition: EcalCoder.cc:47
void findIntercalibConstant(const DetId &detId, double &icalconst) const
Definition: EcalCoder.cc:324
CaloTSamples< float, 10 > EcalSamples
Definition: EcalCoder.h:29
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:87
double m_maxEneEE
Definition: EcalCoder.h:90
const Noisifier * m_ebCorrNoise[3]
Definition: EcalCoder.h:95
const Noisifier * m_eeCorrNoise[3]
Definition: EcalCoder.h:96
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
Definition: EcalCoder.cc:243
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalCoder.cc:43
bool m_PreMix1
Definition: EcalCoder.h:93
void findGains(const DetId &detId, double theGains[]) const
Definition: EcalCoder.cc:296
const EcalPedestals * m_peds
Definition: EcalCoder.h:83
void setGainRatios(const EcalGainRatios *gainRatios)
Definition: EcalCoder.cc:45
static constexpr int MAXADC
Definition: EcalCoder.h:34
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
static constexpr int ADCGAINSWITCH
Definition: EcalCoder.h:35
virtual ~EcalCoder()
dtor
Definition: EcalCoder.cc:36
double m_maxEneEB
Definition: EcalCoder.h:89
static constexpr int NGAINS
Definition: EcalCoder.h:36
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