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 template <class DFr>
21 public:
24 
29 
33  inline void runShaper(DFr& dataFrame,
34  hgc::HGCSimHitData& chargeColl,
35  hgc::HGCSimHitData& toa,
36  CLHEP::HepRandomEngine* engine,
37  uint32_t thrADC = 0,
38  float lsbADC = -1,
39  uint32_t gainIdx = 0,
40  float maxADC = -1,
41  int thickness = 1) {
42  switch (fwVersion_) {
43  case SIMPLE: {
44  runSimpleShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC);
45  break;
46  }
47  case WITHTOT: {
48  runShaperWithToT(dataFrame, chargeColl, toa, engine, thrADC, lsbADC, gainIdx, maxADC, thickness);
49  break;
50  }
51  default: {
52  runTrivialShaper(dataFrame, chargeColl, thrADC, lsbADC, gainIdx, maxADC);
53  break;
54  }
55  }
56  }
57 
58  void SetNoiseValues(const std::vector<float>& noise_fC) {
59  noise_fC_.insert(noise_fC_.end(), noise_fC.begin(), noise_fC.end());
60  };
61 
62  float getTimeJitter(float totalCharge, int thickness) {
63  float A2 = jitterNoise2_ns_.at(thickness - 1);
64  float C2 = jitterConstant2_ns_.at(thickness - 1);
65  float X2 = pow((totalCharge / noise_fC_.at(thickness - 1)), 2.);
66  float jitter2 = A2 / X2 + C2;
67  return sqrt(jitter2);
68  };
69 
73  float getADClsb() { return adcLSB_fC_; }
74  float getTDClsb() { return tdcLSB_fC_; }
76  float getADCThreshold() { return adcThreshold_fC_; }
77  float getTDCOnset() { return tdcOnset_fC_; }
78  std::array<float, 3> getTDCForToAOnset() { return tdcForToAOnset_fC_; }
79  void setADClsb(float newLSB) { adcLSB_fC_ = newLSB; }
80 
84  void runTrivialShaper(
85  DFr& dataFrame, hgc::HGCSimHitData& chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC);
86 
90  void runSimpleShaper(
91  DFr& dataFrame, hgc::HGCSimHitData& chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC);
92 
96  void runShaperWithToT(DFr& dataFrame,
97  hgc::HGCSimHitData& chargeColl,
98  hgc::HGCSimHitData& toa,
99  CLHEP::HepRandomEngine* engine,
100  uint32_t thrADC,
101  float lsbADC,
102  uint32_t gainIdx,
103  float maxADC,
104  int thickness);
105 
109  uint32_t toaMode() const { return toaMode_; }
110 
115 
116 private:
117  //private members
118  uint32_t fwVersion_;
119  std::array<float, 6> adcPulse_, pulseAvgT_;
120  std::array<float, 3> tdcForToAOnset_fC_;
125  std::array<float, 3> jitterNoise2_ns_, jitterConstant2_ns_;
126  std::vector<float> noise_fC_;
127  uint32_t toaMode_;
129  //caches
130  std::array<bool, hgc::nSamples> busyFlags, totFlags, toaFlags;
132 };
133 
134 #endif
HGCFEElectronics::getADCThreshold
float getADCThreshold()
Definition: HGCFEElectronics.h:76
HGCFEElectronics::HGCFEElectronics
HGCFEElectronics(const edm::ParameterSet &ps)
CTOR.
Definition: HGCFEElectronics.cc:11
MessageLogger.h
HGCFEElectronics::adcSaturation_fC_
float adcSaturation_fC_
Definition: HGCFEElectronics.h:122
HGCFEElectronics::jitterNoise2_ns_
std::array< float, 3 > jitterNoise2_ns_
Definition: HGCFEElectronics.h:125
HGCFEElectronics::toaFromToT
hgc::HGCSimHitData toaFromToT
Definition: HGCFEElectronics.h:131
HGCFEElectronics::tdcChargeDrainParameterisation_
std::vector< float > tdcChargeDrainParameterisation_
Definition: HGCFEElectronics.h:121
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)
switches according to the firmware version
Definition: HGCFEElectronics.h:33
HGCFEElectronics::WITHTOT
Definition: HGCFEElectronics.h:22
HGCFEElectronics::HGCFEElectronicsTOTMode
HGCFEElectronicsTOTMode
Definition: HGCFEElectronics.h:23
HGCFEElectronics::totFlags
std::array< bool, hgc::nSamples > totFlags
Definition: HGCFEElectronics.h:130
HGCFEElectronics::toaLSB_ns_
float toaLSB_ns_
Definition: HGCFEElectronics.h:122
HGCFEElectronics::tdcResolutionInNs_
float tdcResolutionInNs_
Definition: HGCFEElectronics.h:122
HGCFEElectronics::TRIVIAL
Definition: HGCFEElectronics.h:22
HGCFEElectronics::toaFlags
std::array< bool, hgc::nSamples > toaFlags
Definition: HGCFEElectronics.h:130
HGCFEElectronics::SIMPLE
Definition: HGCFEElectronics.h:22
hgc_digi
Definition: HGCDigitizerTypes.h:10
HGCFEElectronics::tdcOnset_fC_
float tdcOnset_fC_
Definition: HGCFEElectronics.h:122
HGCFEElectronics::WEIGHTEDBYE
Definition: HGCFEElectronics.h:23
HGCFEElectronics::getTimeJitter
float getTimeJitter(float totalCharge, int thickness)
Definition: HGCFEElectronics.h:62
HGCFEElectronics::toaMode
uint32_t toaMode() const
returns how ToT will be computed
Definition: HGCFEElectronics.h:109
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
HGCFEElectronics::toaMode_
uint32_t toaMode_
Definition: HGCFEElectronics.h:127
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
HGCFEElectronics
models the behavior of the front-end electronics
Definition: HGCFEElectronics.h:20
HGCFEElectronics::SIMPLETHRESHOLD
Definition: HGCFEElectronics.h:23
HGCFEElectronics::SetNoiseValues
void SetNoiseValues(const std::vector< float > &noise_fC)
Definition: HGCFEElectronics.h:58
HGCFEElectronics::adcLSB_fC_
float adcLSB_fC_
Definition: HGCFEElectronics.h:122
edm::ParameterSet
Definition: ParameterSet.h:36
hgcalDigitizer_cfi.noise_fC
noise_fC
Definition: hgcalDigitizer_cfi.py:91
HGCFEElectronics::thresholdFollowsMIP_
bool thresholdFollowsMIP_
Definition: HGCFEElectronics.h:128
HGCFEElectronics::runSimpleShaper
void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, uint32_t thrADC, float lsbADC, uint32_t gainIdx, float maxADC)
applies a shape to each time sample and propagates the tails to the subsequent time samples
Definition: HGCFEElectronics.cc:149
HGCFEElectronics::getTDCForToAOnset
std::array< float, 3 > getTDCForToAOnset()
Definition: HGCFEElectronics.h:78
HGCFEElectronics::setADClsb
void setADClsb(float newLSB)
Definition: HGCFEElectronics.h:79
HGCFEElectronics::adcPulse_
std::array< float, 6 > adcPulse_
Definition: HGCFEElectronics.h:119
HGCFEElectronics::noise_fC_
std::vector< float > noise_fC_
Definition: HGCFEElectronics.h:126
HGCFEElectronics::newCharge
hgc::HGCSimHitData newCharge
Definition: HGCFEElectronics.h:131
HGCFEElectronics::jitterConstant2_ns_
std::array< float, 3 > jitterConstant2_ns_
Definition: HGCFEElectronics.h:125
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)
implements pulse shape and switch to time over threshold including deadtime
Definition: HGCFEElectronics.cc:202
HGCFEElectronics::targetMIPvalue_ADC_
uint32_t targetMIPvalue_ADC_
Definition: HGCFEElectronics.h:124
HGCFEElectronics::tdcLSB_fC_
float tdcLSB_fC_
Definition: HGCFEElectronics.h:122
HGCFEElectronics::tdcForToAOnset_fC_
std::array< float, 3 > tdcForToAOnset_fC_
Definition: HGCFEElectronics.h:120
HGCFEElectronics::adcThreshold_fC_
float adcThreshold_fC_
Definition: HGCFEElectronics.h:122
HGCFEElectronics::HGCFEElectronicsFirmwareVersion
HGCFEElectronicsFirmwareVersion
Definition: HGCFEElectronics.h:22
HGCFEElectronics::getTDClsb
float getTDClsb()
Definition: HGCFEElectronics.h:74
HGCFEElectronics::getTargetMipValue
int getTargetMipValue()
Definition: HGCFEElectronics.h:75
HGCFEElectronics::~HGCFEElectronics
~HGCFEElectronics()
DTOR.
Definition: HGCFEElectronics.h:114
HGCFEElectronics::tdcSaturation_fC_
float tdcSaturation_fC_
Definition: HGCFEElectronics.h:122
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
ParameterSet.h
HGCFEElectronics::getADClsb
float getADClsb()
returns the LSB in MIP currently configured
Definition: HGCFEElectronics.h:73
HGCFEElectronics::fwVersion_
uint32_t fwVersion_
Definition: HGCFEElectronics.h:118
HGCFEElectronics::getTDCOnset
float getTDCOnset()
Definition: HGCFEElectronics.h:77
HGCFEElectronics::busyFlags
std::array< bool, hgc::nSamples > busyFlags
Definition: HGCFEElectronics.h:130
HGCFEElectronics::pulseAvgT_
std::array< float, 6 > pulseAvgT_
Definition: HGCFEElectronics.h:119