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  switch (fwVersion_) {
48  case SIMPLE: {
49  runSimpleShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC, adcPulse);
50  break;
51  }
52  case WITHTOT: {
53  runShaperWithToT(dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC, thickness, adcPulse);
54  break;
55  }
56  default: {
57  runTrivialShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC);
58  break;
59  }
60  }
61  }
62  inline void runShaper(DFr& dataFrame,
63  hgc::HGCSimHitData& chargeColl,
64  hgc::HGCSimHitData& toa,
65  CLHEP::HepRandomEngine* engine,
66  uint32_t thrADC = 0,
67  float lsbADC = -1,
68  uint32_t gainIdx = 0,
69  float maxADC = -1,
70  int thickness = 1) {
71  runShaper(dataFrame, chargeColl, toa, adcPulse_, engine, thrADC, lsbADC, gainIdx, maxADC, thickness);
72  }
73 
74  void SetNoiseValues(const std::vector<float>& noise_fC) {
75  noise_fC_.insert(noise_fC_.end(), noise_fC.begin(), noise_fC.end());
76  };
77 
78  float getTimeJitter(float totalCharge, int thickness) {
79  float A2 = jitterNoise2_ns_.at(thickness - 1);
80  float C2 = jitterConstant2_ns_.at(thickness - 1);
81  float X2 = pow((totalCharge / noise_fC_.at(thickness - 1)), 2.);
82  float jitter2 = A2 / X2 + C2;
83  return sqrt(jitter2);
84  };
85 
89  float getADClsb() { return adcLSB_fC_; }
90  float getTDClsb() { return tdcLSB_fC_; }
92  float getADCThreshold() { return adcThreshold_fC_; }
93  float getTDCOnset() { return tdcOnset_fC_; }
94  std::array<float, 3> getTDCForToAOnset() { return tdcForToAOnset_fC_; }
95  void setADClsb(float newLSB) { adcLSB_fC_ = newLSB; }
96 
100  void runTrivialShaper(
101  DFr& dataFrame, hgc::HGCSimHitData& chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC);
102 
106  void runSimpleShaper(DFr& dataFrame,
107  hgc::HGCSimHitData& chargeColl,
108  uint32_t thrADC,
109  float lsbADC,
110  uint32_t gainIdx,
111  float maxADC,
114  DFr& dataFrame, hgc::HGCSimHitData& chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC) {
115  runSimpleShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC, adcPulse_);
116  }
117 
121  void runShaperWithToT(DFr& dataFrame,
122  hgc::HGCSimHitData& chargeColl,
123  hgc::HGCSimHitData& toa,
124  CLHEP::HepRandomEngine* engine,
125  uint32_t thrADC,
126  float lsbADC,
127  uint32_t gainIdx,
128  float maxADC,
129  int thickness,
131  void runShaperWithToT(DFr& dataFrame,
132  hgc::HGCSimHitData& chargeColl,
133  hgc::HGCSimHitData& toa,
134  CLHEP::HepRandomEngine* engine,
135  uint32_t thrADC,
136  float lsbADC,
137  uint32_t gainIdx,
138  float maxADC,
139  int thickness) {
140  runShaperWithToT(dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC, thickness, adcPulse_);
141  }
142 
146  uint32_t toaMode() const { return toaMode_; }
147 
152 
157 
158 private:
159  //private members
160  uint32_t fwVersion_;
162  std::array<float, 3> tdcForToAOnset_fC_;
167  std::array<float, 3> jitterNoise2_ns_, jitterConstant2_ns_;
168  std::vector<float> noise_fC_;
169  uint32_t toaMode_;
171  //caches
172  std::array<bool, hgc::nSamples> busyFlags, totFlags, toaFlags;
174 };
175 
176 #endif
HGCFEElectronics::getADCThreshold
float getADCThreshold()
Definition: HGCFEElectronics.h:92
HGCFEElectronics::HGCFEElectronics
HGCFEElectronics(const edm::ParameterSet &ps)
CTOR.
Definition: HGCFEElectronics.cc:11
MessageLogger.h
HGCFEElectronics::adcSaturation_fC_
float adcSaturation_fC_
Definition: HGCFEElectronics.h:164
HGCFEElectronics::jitterNoise2_ns_
std::array< float, 3 > jitterNoise2_ns_
Definition: HGCFEElectronics.h:167
HGCFEElectronics::toaFromToT
hgc::HGCSimHitData toaFromToT
Definition: HGCFEElectronics.h:173
HGCFEElectronics::tdcChargeDrainParameterisation_
std::vector< float > tdcChargeDrainParameterisation_
Definition: HGCFEElectronics.h:163
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:62
HGCFEElectronics::WITHTOT
Definition: HGCFEElectronics.h:26
HGCFEElectronics::HGCFEElectronicsTOTMode
HGCFEElectronicsTOTMode
Definition: HGCFEElectronics.h:27
HGCFEElectronics::totFlags
std::array< bool, hgc::nSamples > totFlags
Definition: HGCFEElectronics.h:172
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)
switches according to the firmware version
Definition: HGCFEElectronics.h:37
HGCFEElectronics::toaLSB_ns_
float toaLSB_ns_
Definition: HGCFEElectronics.h:164
HGCFEElectronics::tdcResolutionInNs_
float tdcResolutionInNs_
Definition: HGCFEElectronics.h:164
HGCFEElectronics::TRIVIAL
Definition: HGCFEElectronics.h:26
HGCFEElectronics::toaFlags
std::array< bool, hgc::nSamples > toaFlags
Definition: HGCFEElectronics.h:172
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::tdcOnset_fC_
float tdcOnset_fC_
Definition: HGCFEElectronics.h:164
HGCFEElectronics::WEIGHTEDBYE
Definition: HGCFEElectronics.h:27
HGCFEElectronics::getTimeJitter
float getTimeJitter(float totalCharge, int thickness)
Definition: HGCFEElectronics.h:78
HGCFEElectronics::toaMode
uint32_t toaMode() const
returns how ToT will be computed
Definition: HGCFEElectronics.h:146
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
HGCFEElectronics::toaMode_
uint32_t toaMode_
Definition: HGCFEElectronics.h:169
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:74
HGCFEElectronics::adcLSB_fC_
float adcLSB_fC_
Definition: HGCFEElectronics.h:164
edm::ParameterSet
Definition: ParameterSet.h:47
hgcalDigitizer_cfi.noise_fC
noise_fC
Definition: hgcalDigitizer_cfi.py:96
HGCFEElectronics::thresholdFollowsMIP_
bool thresholdFollowsMIP_
Definition: HGCFEElectronics.h:170
HGCFEElectronics::runSimpleShaper
void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC)
Definition: HGCFEElectronics.h:113
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, 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:94
HGCFEElectronics::setADClsb
void setADClsb(float newLSB)
Definition: HGCFEElectronics.h:95
HGCFEElectronics::noise_fC_
std::vector< float > noise_fC_
Definition: HGCFEElectronics.h:168
HGCFEElectronics::newCharge
hgc::HGCSimHitData newCharge
Definition: HGCFEElectronics.h:173
HGCFEElectronics::jitterConstant2_ns_
std::array< float, 3 > jitterConstant2_ns_
Definition: HGCFEElectronics.h:167
HGCFEElectronics::pulseAvgT_
hgc_digi::FEADCPulseShape pulseAvgT_
Definition: HGCFEElectronics.h:161
HGCDigitizerTypes.h
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)
Definition: HGCFEElectronics.h:131
HGCFEElectronics::targetMIPvalue_ADC_
uint32_t targetMIPvalue_ADC_
Definition: HGCFEElectronics.h:166
HGCFEElectronics::tdcLSB_fC_
float tdcLSB_fC_
Definition: HGCFEElectronics.h:164
HGCFEElectronics::tdcForToAOnset_fC_
std::array< float, 3 > tdcForToAOnset_fC_
Definition: HGCFEElectronics.h:162
HGCFEElectronics::adcThreshold_fC_
float adcThreshold_fC_
Definition: HGCFEElectronics.h:164
HGCFEElectronics::HGCFEElectronicsFirmwareVersion
HGCFEElectronicsFirmwareVersion
Definition: HGCFEElectronics.h:26
HGCFEElectronics::getTDClsb
float getTDClsb()
Definition: HGCFEElectronics.h:90
HGCFEElectronics::getTargetMipValue
int getTargetMipValue()
Definition: HGCFEElectronics.h:91
HGCFEElectronics::~HGCFEElectronics
~HGCFEElectronics()
DTOR.
Definition: HGCFEElectronics.h:156
HGCFEElectronics::tdcSaturation_fC_
float tdcSaturation_fC_
Definition: HGCFEElectronics.h:164
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:89
HGCFEElectronics::fwVersion_
uint32_t fwVersion_
Definition: HGCFEElectronics.h:160
HGCFEElectronics::getTDCOnset
float getTDCOnset()
Definition: HGCFEElectronics.h:93
HGCFEElectronics::busyFlags
std::array< bool, hgc::nSamples > busyFlags
Definition: HGCFEElectronics.h:172
HGCFEElectronics::adcPulse_
hgc_digi::FEADCPulseShape adcPulse_
Definition: HGCFEElectronics.h:161
HGCFEElectronics::getDefaultADCPulse
hgc_digi::FEADCPulseShape & getDefaultADCPulse()
getter for the default ADC pulse configured by python
Definition: HGCFEElectronics.h:151