CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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> class CorrelatedNoisifier ;
12 class EcalMGPASample;
13 class EcalDataFrame;
14 class DetId;
15 
16 #include<vector>
17 
18 /* \class EEDigitizerTraits
19  * \brief Converts CaloDataFrame in CaloTimeSample and vice versa.
20  *
21  */
22 class EcalCoder
23 {
24  public:
25 
27 
29 
30  enum { NBITS = 12 , // number of available bits
31  MAXADC = 4095 , // 2^12 -1, adc max range
32  ADCGAINSWITCH = 4079 , // adc gain switch
33  NGAINS = 3 // number of electronic gains
34  };
35 
37  EcalCoder( bool addNoise ,
38  Noisifier* ebCorrNoise0 ,
39  Noisifier* eeCorrNoise0 = 0 ,
40  Noisifier* ebCorrNoise1 = 0 ,
41  Noisifier* eeCorrNoise1 = 0 ,
42  Noisifier* ebCorrNoise2 = 0 ,
43  Noisifier* eeCorrNoise2 = 0 ) ; // make EE version optional for tb compatibility
45  virtual ~EcalCoder() ;
46 
48  void setPedestals( const EcalPedestals* pedestals ) ;
49 
50  void setGainRatios( const EcalGainRatios* gainRatios ) ;
51 
52  void setFullScaleEnergy( double EBscale ,
53  double EEscale ) ;
54 
56 
57 
59  virtual void analogToDigital( const EcalSamples& clf ,
60  EcalDataFrame& df ) const;
61 
62  private:
63 
65  double fullScaleEnergy( const DetId & did ) const ;
66 
68  void encode( const EcalSamples& ecalSamples ,
69  EcalDataFrame& df ) 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 ,
79  int gainId ,
80  double& pedestal ,
81  double& width ) const ;
82 
83  void findGains( const DetId& detId,
84  double theGains[] ) const ;
85 
86  void findIntercalibConstant( const DetId& detId ,
87  double& icalconst ) const ;
88 
90 
91  const EcalGainRatios* m_gainRatios ; // the electronics gains
92 
93  const EcalIntercalibConstantsMC* m_intercals ; //record specific for simulation of gain variation in MC
94 
95  double m_maxEneEB ; // max attainable energy in the ecal barrel
96  double m_maxEneEE ; // max attainable energy in the ecal endcap
97 
98  bool m_addNoise ; // whether add noise to the pedestals and the gains
99 
102 };
103 
104 #endif
bool m_addNoise
Definition: EcalCoder.h:98
const EcalGainRatios * m_gainRatios
Definition: EcalCoder.h:91
adds noise to the given frame.
Definition: EcalCoder.h:11
CaloTSamples< float, 10 > EcalSamples
Definition: EcalCoder.h:26
int gainId(sample_type sample)
get the gainId (2 bits)
CorrelatedNoisifier< EcalCorrMatrix > Noisifier
Definition: EcalCoder.h:28
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
Definition: EcalCoder.cc:61
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
Definition: EcalCoder.cc:67
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:93
double m_maxEneEE
Definition: EcalCoder.h:96
const Noisifier * m_ebCorrNoise[3]
Definition: EcalCoder.h:100
const Noisifier * m_eeCorrNoise[3]
Definition: EcalCoder.h:101
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalCoder.cc:49
virtual void analogToDigital(const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:73
void findGains(const DetId &detId, double theGains[]) const
Definition: EcalCoder.cc:323
const EcalPedestals * m_peds
Definition: EcalCoder.h:89
void setGainRatios(const EcalGainRatios *gainRatios)
Definition: EcalCoder.cc:55
Definition: DetId.h:20
void setFullScaleEnergy(double EBscale, double EEscale)
Definition: EcalCoder.cc:40
virtual ~EcalCoder()
dtor
Definition: EcalCoder.cc:35
double m_maxEneEB
Definition: EcalCoder.h:95
void findIntercalibConstant(const DetId &detId, double &icalconst) const
Definition: EcalCoder.cc:356
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
Definition: EcalCoder.cc:265
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df) const
produce the pulse-shape
Definition: EcalCoder.cc:96
EcalCoder(bool addNoise, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=0, Noisifier *ebCorrNoise1=0, Noisifier *eeCorrNoise1=0, Noisifier *ebCorrNoise2=0, Noisifier *eeCorrNoise2=0)
ctor
Definition: EcalCoder.cc:12