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 
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 
98 };
99 
100 #endif
EcalIntercalibConstantsMC.h
ecalLiteDTU::gainId
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
Definition: EcalLiteDTUSample.h:14
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
EcalCoder::findPedestal
void findPedestal(const DetId &detId, int gainId, double &pedestal, double &width) const
not yet implemented
Definition: EcalCoder.cc:243
EcalPedestals.h
EcalCoder::~EcalCoder
virtual ~EcalCoder()
dtor
Definition: EcalCoder.cc:36
EcalCoder::m_gainRatios
const EcalGainRatios * m_gainRatios
Definition: EcalCoder.h:86
EcalCoder::MAXADC
Definition: EcalCoder.h:35
EcalCoder::setFullScaleEnergy
void setFullScaleEnergy(double EBscale, double EEscale)
Definition: EcalCoder.cc:38
EcalCoder::analogToDigital
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:53
EcalCoder::m_PreMix1
bool m_PreMix1
Definition: EcalCoder.h:94
EcalDataFrame
Definition: EcalDataFrame.h:16
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalCoder::m_maxEneEB
double m_maxEneEB
Definition: EcalCoder.h:90
EcalCoder::m_intercals
const EcalIntercalibConstantsMC * m_intercals
Definition: EcalCoder.h:88
EcalCoder::m_maxEneEE
double m_maxEneEE
Definition: EcalCoder.h:91
EcalCoder::ADCGAINSWITCH
Definition: EcalCoder.h:36
EcalCoder::encode
void encode(const EcalSamples &ecalSamples, EcalDataFrame &df, CLHEP::HepRandomEngine *) const
produce the pulse-shape
Definition: EcalCoder.cc:73
EcalCoder::m_eeCorrNoise
const Noisifier * m_eeCorrNoise[3]
Definition: EcalCoder.h:97
DetId
Definition: DetId.h:17
EcalCoder::findGains
void findGains(const DetId &detId, double theGains[]) const
Definition: EcalCoder.cc:296
EcalCoder::setGainRatios
void setGainRatios(const EcalGainRatios *gainRatios)
Definition: EcalCoder.cc:45
CaloTSamples
Definition: CaloTSamples.h:14
EcalCoder::m_ebCorrNoise
const Noisifier * m_ebCorrNoise[3]
Definition: EcalCoder.h:96
EcalCoder::NGAINS
Definition: EcalCoder.h:37
CLHEP
Definition: CocoaGlobals.h:27
CaloTSamples.h
EcalCoder::m_addNoise
bool m_addNoise
Definition: EcalCoder.h:93
EcalCoder::setPedestals
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalCoder.cc:43
EcalCoder::fullScaleEnergy
double fullScaleEnergy(const DetId &did) const
limit on the energy scale due to the electronics range
Definition: EcalCoder.cc:49
EcalCoder::Noisifier
CorrelatedNoisifier< EcalCorrMatrix > Noisifier
Definition: EcalCoder.h:31
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
EcalGainRatios.h
EcalMGPASample
Definition: EcalMGPASample.h:22
CorrelatedNoisifier
adds noise to the given frame.
Definition: EcalCoder.h:12
EcalCoder::EcalCoder
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
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:640
EcalCoder::NBITS
Definition: EcalCoder.h:34
EcalCoder
Definition: EcalCoder.h:27
EcalCoder::EcalSamples
CaloTSamples< float, 10 > EcalSamples
Definition: EcalCoder.h:29
EcalCoder::m_peds
const EcalPedestals * m_peds
Definition: EcalCoder.h:84
EcalCorrelatedNoiseMatrix.h
EcalCoder::findIntercalibConstant
void findIntercalibConstant(const DetId &detId, double &icalconst) const
Definition: EcalCoder.cc:324
EcalCoder::setIntercalibConstants
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
Definition: EcalCoder.cc:47