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  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 
59  void setIntercalibConstants(const EcalIntercalibConstantsMC* ical);
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 
96  const Noisifier* m_ebCorrNoise[3];
97  const Noisifier* m_eeCorrNoise[3];
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
CaloTSamples< float, 10 > EcalSamples
Definition: EcalCoder.h:29
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:88
double m_maxEneEE
Definition: EcalCoder.h:91
bool m_PreMix1
Definition: EcalCoder.h:94
const EcalPedestals * m_peds
Definition: EcalCoder.h:84
Definition: DetId.h:18
def encode(args, files)
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
double m_maxEneEB
Definition: EcalCoder.h:90