LDMX Software
SimQIE.h
1#ifndef TRIGSCINT_SIMQIE_H
2#define TRIGSCINT_SIMQIE_H
3
4#include "TRandom3.h"
5#include "TrigScint/QIEInputPulse.h"
6
7namespace trigscint {
8
14class SimQIE {
15 public:
20 SimQIE();
21
28 SimQIE(float pd, float sg, uint64_t seed);
29
35 void setTDCThreshold(const float thr) { tdc_thr_ = thr; }
36
43 void setGain(const float gg = 1e+6) { gain_ = gg * 16e-5; }
44
50 void setFreq(const float sf = 40) { tau_ = 1000 / sf; }
51
57 void setNTimeSamples(const int maxts = 5) { maxts_ = maxts; }
58
62 float qErr(float Q);
63
69 int q2Adc(float Charge);
70
75 float adc2Q(int ADC);
76
82 int tdc(QIEInputPulse* pp, float T0);
83
88 std::vector<int> outAdc(QIEInputPulse* pp);
89
94 std::vector<int> outTdc(QIEInputPulse* pp);
95
100 std::vector<int> capId(QIEInputPulse* pp);
101
107 bool pulseCut(QIEInputPulse* pulse, float cut);
108
109 private:
111 int nbins_[5] = {0, 16, 36, 57, 64};
113 float edges_[17] = {-16, 34, 158, 419, 517, 915,
114 1910, 3990, 4780, 7960, 15900, 32600,
115 38900, 64300, 128000, 261000, 350000};
117 float sense_[16] = {3.1, 6.2, 12.4, 24.8, 24.8, 49.6, 99.2, 198.4,
118 198.4, 396.8, 793.6, 1587, 1587, 3174, 6349, 12700};
119
121 float gain_{1};
123 float tau_{25};
125 int maxts_{0};
126
128 float tdc_thr_{3.74};
129
131 std::unique_ptr<TRandom3> rand_ptr_{nullptr};
132 TRandom3* trg_;
133
135 float mu_{0};
137 float sg_{0};
139 bool isnoise_{false};
140};
141} // namespace trigscint
142#endif
The base class to store the most important functions.
class for simulating QIE chip output
Definition SimQIE.h:14
float edges_[17]
Charge lower limit of all the 16 subranges.
Definition SimQIE.h:113
int nbins_[5]
Indices of first bin of each subrange.
Definition SimQIE.h:111
bool pulseCut(QIEInputPulse *pulse, float cut)
Method to check if the pulse is good to be stored.
Definition SimQIE.cxx:132
float tau_
time period of one time sample [in ns]
Definition SimQIE.h:123
std::vector< int > outAdc(QIEInputPulse *pp)
Complete set of ADCs for the pulse.
Definition SimQIE.cxx:86
void setGain(const float gg=1e+6)
Set gain of SiPM.
Definition SimQIE.h:43
float adc2Q(int ADC)
Converting ADC back to charge.
Definition SimQIE.cxx:50
float tdc_thr_
TDC threshold (default 3.74 microAmpere)
Definition SimQIE.h:128
int q2Adc(float Charge)
Digitizing input charge.
Definition SimQIE.cxx:27
float qErr(float Q)
Quantization error.
Definition SimQIE.cxx:69
float sg_
std. dev. of gaussian noise (Actual noise level)
Definition SimQIE.h:137
float sense_[16]
sensitivity of the subranges (Total charge/no. of bins)
Definition SimQIE.h:117
void setNTimeSamples(const int maxts=5)
Set the number of time samples to analyze.
Definition SimQIE.h:57
std::vector< int > outTdc(QIEInputPulse *pp)
Complete set of TDCs for the pulse.
Definition SimQIE.cxx:111
float mu_
mean of gaussian noise (Pedestal)
Definition SimQIE.h:135
bool isnoise_
Whether noise is added to the system.
Definition SimQIE.h:139
int maxts_
No. of time samples to analyze.
Definition SimQIE.h:125
int tdc(QIEInputPulse *pp, float T0)
TDC of the input pulse.
Definition SimQIE.cxx:98
SimQIE()
Defaut constructor.
Definition SimQIE.cxx:9
void setFreq(const float sf=40)
Set sampling frequency of QIE.
Definition SimQIE.h:50
float gain_
QIE gain -> to convert from no. of e- to charge in fC.
Definition SimQIE.h:121
std::unique_ptr< TRandom3 > rand_ptr_
Random number generator (required for noise simulation)
Definition SimQIE.h:131
std::vector< int > capId(QIEInputPulse *pp)
Complete set of Capacitor IDs for the pulse.
Definition SimQIE.cxx:122
void setTDCThreshold(const float thr)
Set current threshold for TDC latch.
Definition SimQIE.h:35