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 
11 
17 namespace hgc = hgc_digi;
18 
19 template <class DFr>
21 {
22  public:
23 
26 
31 
35  inline void runShaper(DFr &dataFrame, hgc::HGCSimHitData& chargeColl,
36  hgc::HGCSimHitData& toa, int thickness, CLHEP::HepRandomEngine* engine, float cce = 1.0)
37  {
38  switch(fwVersion_)
39  {
40  case SIMPLE : { runSimpleShaper(dataFrame,chargeColl, thickness, cce); break; }
41  case WITHTOT : { runShaperWithToT(dataFrame,chargeColl,toa, thickness, engine, cce); break; }
42  default : { runTrivialShaper(dataFrame,chargeColl, thickness, cce); break; }
43  }
44  }
45 
46 
47  void SetNoiseValues(const std::vector<float>& noise_fC){
48  noise_fC_.insert(noise_fC_.end(), noise_fC.begin(), noise_fC.end());
49  };
50 
51  float getTimeJitter(float totalCharge, int thickness){
52  float A2 = jitterNoise2_ns_.at(thickness-1);
53  float C2 = jitterConstant2_ns_.at(thickness-1);
54  float X2 = pow((totalCharge/noise_fC_.at(thickness-1)), 2.);
55  float jitter2 = A2 / X2 + C2;
56  return sqrt(jitter2);
57  };
58 
62  float getADClsb() { return adcLSB_fC_; }
63  float getTDClsb() { return tdcLSB_fC_; }
64  float getADCThreshold() { return adcThreshold_fC_; }
65  float getTDCOnset() { return tdcOnset_fC_; }
66  std::array<float,3> getTDCForToAOnset() { return tdcForToAOnset_fC_; }
67  void setADClsb(float newLSB) { adcLSB_fC_=newLSB; }
68 
72  void runTrivialShaper(DFr &dataFrame, hgc::HGCSimHitData& chargeColl, int thickness, float cce = 1.0);
73 
77  void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData& chargeColl, int thickness, float cce = 1.0);
78 
82  void runShaperWithToT(DFr &dataFrame, hgc::HGCSimHitData& chargeColl,
83  hgc::HGCSimHitData& toa, int thickness, CLHEP::HepRandomEngine* engine, float cce = 1.0);
84 
88  uint32_t toaMode() const { return toaMode_; }
89 
94 
95  private:
96 
97  //private members
98  uint32_t fwVersion_;
99  std::array<float,6> adcPulse_, pulseAvgT_;
100  std::array<float,3> tdcForToAOnset_fC_;
104  std::array<float,3> jitterNoise2_ns_, jitterConstant2_ns_;
105  std::vector<float> noise_fC_;
106  uint32_t toaMode_;
108  //caches
109  std::array<bool,hgc::nSamples> busyFlags, totFlags, toaFlags;
111 };
112 
113 #endif
std::array< float, 3 > tdcForToAOnset_fC_
void runShaperWithToT(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, int thickness, CLHEP::HepRandomEngine *engine, float cce=1.0)
implements pulse shape and switch to time over threshold including deadtime
std::array< bool, hgc::nSamples > toaFlags
hgc::HGCSimHitData toaFromToT
std::array< bool, hgc::nSamples > totFlags
std::array< HGCSimData_t, nSamples > HGCSimHitData
float getTimeJitter(float totalCharge, int thickness)
HGCFEElectronics(const edm::ParameterSet &ps)
CTOR.
T sqrt(T t)
Definition: SSEVec.h:18
std::array< bool, hgc::nSamples > busyFlags
std::vector< float > noise_fC_
void runSimpleShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, int thickness, float cce=1.0)
applies a shape to each time sample and propagates the tails to the subsequent time samples ...
float getADClsb()
returns the LSB in MIP currently configured
uint32_t toaMode() const
returns how ToT will be computed
void setADClsb(float newLSB)
void SetNoiseValues(const std::vector< float > &noise_fC)
std::array< float, 6 > adcPulse_
std::array< float, 3 > jitterNoise2_ns_
void runTrivialShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, int thickness, float cce=1.0)
converts charge to digis without pulse shape
std::vector< float > tdcChargeDrainParameterisation_
void runShaper(DFr &dataFrame, hgc::HGCSimHitData &chargeColl, hgc::HGCSimHitData &toa, int thickness, CLHEP::HepRandomEngine *engine, float cce=1.0)
switches according to the firmware version
models the behavior of the front-end electronics
std::array< float, 3 > getTDCForToAOnset()
std::array< float, 6 > pulseAvgT_
hgc::HGCSimHitData newCharge
std::array< float, 3 > jitterConstant2_ns_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40