CMS 3D CMS Logo

HGCFEElectronics.h
Go to the documentation of this file.
1 #ifndef _hgcfeelectronics_h_
2 #define _hgcfeelectronics_h_
3 
6 
7 #include "CLHEP/Random/RandGauss.h"
8 #include "CLHEP/Random/RandGaussQ.h"
9 #include "CLHEP/Random/RandFlat.h"
11 
17 namespace hgc = hgc_digi;
18 
19 namespace hgc_digi {
20  typedef std::array<float, 6> FEADCPulseShape;
21 }
22 
23 template <class DFr>
25 public:
28 
33 
37  inline void runShaper(DFr& dataFrame,
38  hgc::HGCSimHitData& chargeColl,
39  hgc::HGCSimHitData& toa,
41  CLHEP::HepRandomEngine* engine,
42  uint32_t thrADC = 0,
43  float lsbADC = -1,
44  uint32_t gainIdx = 0,
45  float maxADC = -1,
46  int thickness = 1,
47  float tdcOnsetAuto = -1) {
48  switch (fwVersion_) {
49  case SIMPLE: {
50  runSimpleShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC, adcPulse);
51  break;
52  }
53  case WITHTOT: {
55  dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC, thickness, tdcOnsetAuto, adcPulse);
56  break;
57  }
58  default: {
59  runTrivialShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC);
60  break;
61  }
62  }
63  }
64  inline void runShaper(DFr& dataFrame,
65  hgc::HGCSimHitData& chargeColl,
66  hgc::HGCSimHitData& toa,
67  CLHEP::HepRandomEngine* engine,
68  uint32_t thrADC = 0,
69  float lsbADC = -1,
70  uint32_t gainIdx = 0,
71  float maxADC = -1,
72  int thickness = 1) {
73  runShaper(dataFrame, chargeColl, toa, adcPulse_, engine, thrADC, lsbADC, gainIdx, maxADC, thickness);
74  }
75 
76  void SetNoiseValues(const std::vector<float>& noise_fC) {
77  noise_fC_.insert(noise_fC_.end(), noise_fC.begin(), noise_fC.end());
78  };
79 
80  float getTimeJitter(float totalCharge, int thickness) {
81  float A2 = jitterNoise2_ns_.at(thickness - 1);
82  float C2 = jitterConstant2_ns_.at(thickness - 1);
83  float X2 = pow((totalCharge / noise_fC_.at(thickness - 1)), 2.);
84  float jitter2 = A2 / X2 + C2;
85  return sqrt(jitter2);
86  };
87 
91  float getADClsb() { return adcLSB_fC_; }
92  float getTDClsb() { return tdcLSB_fC_; }
94  float getADCThreshold() { return adcThreshold_fC_; }
95  float getTDCOnset() { return tdcOnset_fC_; }
96  std::array<float, 3> getTDCForToAOnset() { return tdcForToAOnset_fC_; }
97  void setADClsb(float newLSB) { adcLSB_fC_ = newLSB; }
98 
102  void runTrivialShaper(
103  DFr& dataFrame, hgc::HGCSimHitData& chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC);
104 
108  void runSimpleShaper(DFr& dataFrame,
109  hgc::HGCSimHitData& chargeColl,
110  uint32_t thrADC,
111  float lsbADC,
112  uint32_t gainIdx,
113  float maxADC,
116  DFr& dataFrame, hgc::HGCSimHitData& chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC) {
117  runSimpleShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC, adcPulse_);
118  }
119 
123  void runShaperWithToT(DFr& dataFrame,
124  hgc::HGCSimHitData& chargeColl,
125  hgc::HGCSimHitData& toa,
126  CLHEP::HepRandomEngine* engine,
127  uint32_t thrADC,
128  float lsbADC,
129  uint32_t gainIdx,
130  float maxADC,
131  int thickness,
132  float tdcOnsetAuto,
134  void runShaperWithToT(DFr& dataFrame,
135  hgc::HGCSimHitData& chargeColl,
136  hgc::HGCSimHitData& toa,
137  CLHEP::HepRandomEngine* engine,
138  uint32_t thrADC,
139  float lsbADC,
140  uint32_t gainIdx,
141  float maxADC,
142  int thickness,
143  float tdcOnsetAuto) {
145  dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC, thickness, tdcOnsetAuto, adcPulse_);
146  }
147 
151  uint32_t toaMode() const { return toaMode_; }
152 
157 
162 
163 private:
164  //private members
165  uint32_t fwVersion_;
167  std::array<float, 3> tdcForToAOnset_fC_;
172  std::array<float, 3> jitterNoise2_ns_, jitterConstant2_ns_;
173  std::vector<float> noise_fC_;
174  uint32_t toaMode_;
176  //caches
177  std::array<bool, hgc::nSamples> busyFlags, totFlags, toaFlags;
179 };
180 
181 #endif
HGCFEElectronics::getADCThreshold
float getADCThreshold()
Definition: HGCFEElectronics.h:94
HGCFEElectronics::HGCFEElectronics
HGCFEElectronics(const edm::ParameterSet &ps)
CTOR.
Definition: HGCFEElectronics.cc:11
MessageLogger.h
HGCFEElectronics::adcSaturation_fC_
float adcSaturation_fC_
Definition: HGCFEElectronics.h:169
HGCFEElectronics::jitterNoise2_ns_
std::array< float, 3 > jitterNoise2_ns_
Definition: HGCFEElectronics.h:172
HGCFEElectronics::toaFromToT
hgc::HGCSimHitData toaFromToT
Definition: HGCFEElectronics.h:178
HGCFEElectronics::tdcChargeDrainParameterisation_
std::vector< float > tdcChargeDrainParameterisation_
Definition: HGCFEElectronics.h:168
HGCFEElectronics::runShaper
void runShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC=0, float lsbADC=-1, uint32_t gainIdx=0, float maxADC=-1, int thickness=1)
Definition: HGCFEElectronics.h:64
HGCFEElectronics::WITHTOT
Definition: HGCFEElectronics.h:26
HGCFEElectronics::HGCFEElectronicsTOTMode
HGCFEElectronicsTOTMode
Definition: HGCFEElectronics.h:27
HGCFEElectronics::totFlags
std::array< bool, hgc::nSamples > totFlags
Definition: HGCFEElectronics.h:177
HGCFEElectronics::toaLSB_ns_
float toaLSB_ns_
Definition: HGCFEElectronics.h:169
HGCFEElectronics::tdcResolutionInNs_
float tdcResolutionInNs_
Definition: HGCFEElectronics.h:169
HGCFEElectronics::runShaperWithToT
void runShaperWithToT(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, int thickness, float tdcOnsetAuto)
Definition: HGCFEElectronics.h:134
HGCFEElectronics::TRIVIAL
Definition: HGCFEElectronics.h:26
HGCFEElectronics::toaFlags
std::array< bool, hgc::nSamples > toaFlags
Definition: HGCFEElectronics.h:177
HGCFEElectronics::runSimpleShaper
void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, const hgc_digi::FEADCPulseShape &adcPulse)
applies a shape to each time sample and propagates the tails to the subsequent time samples
Definition: HGCFEElectronics.cc:149
hgc_digi::FEADCPulseShape
std::array< float, 6 > FEADCPulseShape
Definition: HGCFEElectronics.h:20
HGCFEElectronics::SIMPLE
Definition: HGCFEElectronics.h:26
hgc_digi
Definition: HGCDigitizerTypes.h:10
HGCFEElectronics::runShaper
void runShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, const hgc_digi::FEADCPulseShape &adcPulse, CLHEP::HepRandomEngine *engine, uint32_t thrADC=0, float lsbADC=-1, uint32_t gainIdx=0, float maxADC=-1, int thickness=1, float tdcOnsetAuto=-1)
switches according to the firmware version
Definition: HGCFEElectronics.h:37
HGCFEElectronics::tdcOnset_fC_
float tdcOnset_fC_
Definition: HGCFEElectronics.h:169
HGCFEElectronics::WEIGHTEDBYE
Definition: HGCFEElectronics.h:27
HGCFEElectronics::getTimeJitter
float getTimeJitter(float totalCharge, int thickness)
Definition: HGCFEElectronics.h:80
HGCFEElectronics::toaMode
uint32_t toaMode() const
returns how ToT will be computed
Definition: HGCFEElectronics.h:151
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
HGCFEElectronics::toaMode_
uint32_t toaMode_
Definition: HGCFEElectronics.h:174
HGCFEElectronics::runTrivialShaper
void runTrivialShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC)
converts charge to digis without pulse shape
Definition: HGCFEElectronics.cc:110
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
hgc_digi::HGCSimHitData
std::array< HGCSimData_t, nSamples > HGCSimHitData
Definition: HGCDigitizerTypes.h:17
hgcROCParameters_cfi.adcPulse
adcPulse
Definition: hgcROCParameters_cfi.py:10
HGCFEElectronics
models the behavior of the front-end electronics
Definition: HGCFEElectronics.h:24
HGCFEElectronics::SIMPLETHRESHOLD
Definition: HGCFEElectronics.h:27
HGCFEElectronics::SetNoiseValues
void SetNoiseValues(const std::vector< float > &noise_fC)
Definition: HGCFEElectronics.h:76
HGCFEElectronics::adcLSB_fC_
float adcLSB_fC_
Definition: HGCFEElectronics.h:169
edm::ParameterSet
Definition: ParameterSet.h:47
hgcalDigitizer_cfi.noise_fC
noise_fC
Definition: hgcalDigitizer_cfi.py:98
HGCFEElectronics::thresholdFollowsMIP_
bool thresholdFollowsMIP_
Definition: HGCFEElectronics.h:175
HGCFEElectronics::runSimpleShaper
void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC)
Definition: HGCFEElectronics.h:115
HGCFEElectronics::runShaperWithToT
void runShaperWithToT(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, CLHEP::HepRandomEngine *engine, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC, int thickness, float tdcOnsetAuto, const hgc_digi::FEADCPulseShape &adcPulse)
implements pulse shape and switch to time over threshold including deadtime
Definition: HGCFEElectronics.cc:207
HGCFEElectronics::getTDCForToAOnset
std::array< float, 3 > getTDCForToAOnset()
Definition: HGCFEElectronics.h:96
HGCFEElectronics::setADClsb
void setADClsb(float newLSB)
Definition: HGCFEElectronics.h:97
HGCFEElectronics::noise_fC_
std::vector< float > noise_fC_
Definition: HGCFEElectronics.h:173
HGCFEElectronics::newCharge
hgc::HGCSimHitData newCharge
Definition: HGCFEElectronics.h:178
HGCFEElectronics::jitterConstant2_ns_
std::array< float, 3 > jitterConstant2_ns_
Definition: HGCFEElectronics.h:172
HGCFEElectronics::pulseAvgT_
hgc_digi::FEADCPulseShape pulseAvgT_
Definition: HGCFEElectronics.h:166
HGCDigitizerTypes.h
HGCFEElectronics::targetMIPvalue_ADC_
uint32_t targetMIPvalue_ADC_
Definition: HGCFEElectronics.h:171
HGCFEElectronics::tdcLSB_fC_
float tdcLSB_fC_
Definition: HGCFEElectronics.h:169
HGCFEElectronics::tdcForToAOnset_fC_
std::array< float, 3 > tdcForToAOnset_fC_
Definition: HGCFEElectronics.h:167
HGCFEElectronics::adcThreshold_fC_
float adcThreshold_fC_
Definition: HGCFEElectronics.h:169
HGCFEElectronics::HGCFEElectronicsFirmwareVersion
HGCFEElectronicsFirmwareVersion
Definition: HGCFEElectronics.h:26
HGCFEElectronics::getTDClsb
float getTDClsb()
Definition: HGCFEElectronics.h:92
HGCFEElectronics::getTargetMipValue
int getTargetMipValue()
Definition: HGCFEElectronics.h:93
HGCFEElectronics::~HGCFEElectronics
~HGCFEElectronics()
DTOR.
Definition: HGCFEElectronics.h:161
HGCFEElectronics::tdcSaturation_fC_
float tdcSaturation_fC_
Definition: HGCFEElectronics.h:169
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ParameterSet.h
HGCFEElectronics::getADClsb
float getADClsb()
returns the LSB in MIP currently configured
Definition: HGCFEElectronics.h:91
HGCFEElectronics::fwVersion_
uint32_t fwVersion_
Definition: HGCFEElectronics.h:165
HGCFEElectronics::getTDCOnset
float getTDCOnset()
Definition: HGCFEElectronics.h:95
HGCFEElectronics::busyFlags
std::array< bool, hgc::nSamples > busyFlags
Definition: HGCFEElectronics.h:177
HGCFEElectronics::adcPulse_
hgc_digi::FEADCPulseShape adcPulse_
Definition: HGCFEElectronics.h:166
HGCFEElectronics::getDefaultADCPulse
hgc_digi::FEADCPulseShape & getDefaultADCPulse()
getter for the default ADC pulse configured by python
Definition: HGCFEElectronics.h:156