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  bool PreMix1 ,
39  Noisifier* ebCorrNoise0 ,
40  Noisifier* eeCorrNoise0 = 0 ,
41  Noisifier* ebCorrNoise1 = 0 ,
42  Noisifier* eeCorrNoise1 = 0 ,
43  Noisifier* ebCorrNoise2 = 0 ,
44  Noisifier* eeCorrNoise2 = 0 ) ; // make EE version optional for tb compatibility
46  virtual ~EcalCoder() ;
47 
49  void setPedestals( const EcalPedestals* pedestals ) ;
50 
51  void setGainRatios( const EcalGainRatios* gainRatios ) ;
52 
53  void setFullScaleEnergy( double EBscale ,
54  double EEscale ) ;
55 
57 
58 
60  virtual void analogToDigital( const EcalSamples& clf ,
61  EcalDataFrame& df ) const;
62 
63  private:
64 
66  double fullScaleEnergy( const DetId & did ) const ;
67 
69  void encode( const EcalSamples& ecalSamples ,
70  EcalDataFrame& df ) const ;
71 
72 // double decode( const EcalMGPASample& sample ,
73 // const DetId& detId ) const ;
74 
76  // void noisify( const EcalIntercalibConstantsMC* values ,
77  // int size ) const ;
78 
79  void findPedestal( const DetId& detId ,
80  int gainId ,
81  double& pedestal ,
82  double& width ) const ;
83 
84  void findGains( const DetId& detId,
85  double theGains[] ) const ;
86 
87  void findIntercalibConstant( const DetId& detId ,
88  double& icalconst ) const ;
89 
91 
92  const EcalGainRatios* m_gainRatios ; // the electronics gains
93 
94  const EcalIntercalibConstantsMC* m_intercals ; //record specific for simulation of gain variation in MC
95 
96  double m_maxEneEB ; // max attainable energy in the ecal barrel
97  double m_maxEneEE ; // max attainable energy in the ecal endcap
98 
99  bool m_addNoise ; // whether add noise to the pedestals and the gains
100  bool m_PreMix1 ; // Follow necessary steps for PreMixing input
101 
104 };
105 
106 #endif
bool m_addNoise
Definition: EcalCoder.h:99
const EcalGainRatios * m_gainRatios
Definition: EcalCoder.h:92
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:63
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
Definition: EcalCoder.cc:69
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:94
double m_maxEneEE
Definition: EcalCoder.h:97
const Noisifier * m_ebCorrNoise[3]
Definition: EcalCoder.h:102
const Noisifier * m_eeCorrNoise[3]
Definition: EcalCoder.h:103
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalCoder.cc:51
virtual void analogToDigital(const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:75
void findGains(const DetId &detId, double theGains[]) const
Definition: EcalCoder.cc:343
bool m_PreMix1
Definition: EcalCoder.h:100
const EcalPedestals * m_peds
Definition: EcalCoder.h:90
void setGainRatios(const EcalGainRatios *gainRatios)
Definition: EcalCoder.cc:57
Definition: DetId.h:18
void setFullScaleEnergy(double EBscale, double EEscale)
Definition: EcalCoder.cc:42
virtual ~EcalCoder()
dtor
Definition: EcalCoder.cc:37
double m_maxEneEB
Definition: EcalCoder.h:96
void findIntercalibConstant(const DetId &detId, double &icalconst) const
Definition: EcalCoder.cc:376
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
Definition: EcalCoder.cc:285
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df) const
produce the pulse-shape
Definition: EcalCoder.cc:98
EcalCoder(bool addNoise, bool PreMix1, Noisifier *ebCorrNoise0, Noisifier *eeCorrNoise0=0, Noisifier *ebCorrNoise1=0, Noisifier *eeCorrNoise1=0, Noisifier *ebCorrNoise2=0, Noisifier *eeCorrNoise2=0)
ctor
Definition: EcalCoder.cc:12