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> class CorrelatedNoisifier ;
12 class EcalMGPASample;
13 class EcalDataFrame;
14 class DetId;
15 
16 #include<vector>
17 
18 namespace CLHEP {
19  class HepRandomEngine;
20 }
21 
22 /* \class EEDigitizerTraits
23  * \brief Converts CaloDataFrame in CaloTimeSample and vice versa.
24  *
25  */
26 class EcalCoder
27 {
28  public:
29 
31 
33 
34  enum { 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 = 0 ,
45  Noisifier* ebCorrNoise1 = 0 ,
46  Noisifier* eeCorrNoise1 = 0 ,
47  Noisifier* ebCorrNoise2 = 0 ,
48  Noisifier* eeCorrNoise2 = 0 ) ; // 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 ,
58  double EEscale ) ;
59 
60  void setIntercalibConstants( const EcalIntercalibConstantsMC* ical ) ;
61 
62 
64  virtual void analogToDigital( CLHEP::HepRandomEngine*,
65  const EcalSamples& clf ,
66  EcalDataFrame& df ) const;
67 
68  private:
69 
71  double fullScaleEnergy( const DetId & did ) const ;
72 
74  void encode( const EcalSamples& ecalSamples ,
75  EcalDataFrame& df,
76  CLHEP::HepRandomEngine* ) const ;
77 
78 // double decode( const EcalMGPASample& sample ,
79 // const DetId& detId ) const ;
80 
82  // void noisify( const EcalIntercalibConstantsMC* values ,
83  // int size ) const ;
84 
85  void findPedestal( const DetId& detId ,
86  int gainId ,
87  double& pedestal ,
88  double& width ) const ;
89 
90  void findGains( const DetId& detId,
91  double theGains[] ) const ;
92 
93  void findIntercalibConstant( const DetId& detId ,
94  double& icalconst ) const ;
95 
97 
98  const EcalGainRatios* m_gainRatios ; // the electronics gains
99 
100  const EcalIntercalibConstantsMC* m_intercals ; //record specific for simulation of gain variation in MC
101 
102  double m_maxEneEB ; // max attainable energy in the ecal barrel
103  double m_maxEneEE ; // max attainable energy in the ecal endcap
104 
105  bool m_addNoise ; // whether add noise to the pedestals and the gains
106  bool m_PreMix1 ; // Follow necessary steps for PreMixing input
107 
108  const Noisifier* m_ebCorrNoise[3] ;
109  const Noisifier* m_eeCorrNoise[3] ;
110 };
111 
112 #endif
bool m_addNoise
Definition: EcalCoder.h:105
const EcalGainRatios * m_gainRatios
Definition: EcalCoder.h:98
adds noise to the given frame.
Definition: EcalCoder.h:11
CaloTSamples< float, 10 > EcalSamples
Definition: EcalCoder.h:30
int gainId(sample_type sample)
get the gainId (2 bits)
CorrelatedNoisifier< EcalCorrMatrix > Noisifier
Definition: EcalCoder.h:32
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:100
double m_maxEneEE
Definition: EcalCoder.h:103
bool m_PreMix1
Definition: EcalCoder.h:106
const EcalPedestals * m_peds
Definition: EcalCoder.h:96
Definition: DetId.h:18
def encode(args, files)
double m_maxEneEB
Definition: EcalCoder.h:102