1#include "TrigScint/SimQIE.h"
5#include "Framework/Exception/Exception.h"
14 EXCEPTION_RAISE(
"RandomSeedException",
15 "QIE Noise generator not seeded (seed=0)");
17 rand_ptr_ = std::make_unique<TRandom3>(seed);
28 float qq =
gain_ * charge;
31 if (qq <=
edges_[0])
return 0;
32 if (qq >=
edges_[16])
return 255;
39 if (qq >
edges_[(a + b) / 2]) {
51 if (ADC <= 0)
return -16;
52 if (ADC >= 255)
return 350000;
58 for (
int i = 1; i < 4; i++) {
65 return (temp /
gain_);
70 if (Q <=
edges_[0])
return 0;
71 if (Q >=
edges_[16])
return 0;
76 if (Q >
edges_[(a + b) / 2])
81 return (
sense_[a] / (sqrt(12) * Q));
89 for (
int i = 0; i <
maxts_; i++) {
91 op.push_back(
q2Adc(qq));
100 if (pp->
eval(T0) > thr2)
return 62;
102 while (tt < T0 +
tau_) {
103 if (pp->
eval(tt) >= thr2)
return ((
int)(2 * (tt - T0)));
114 for (
int i = 0; i <
maxts_; i++) {
115 op.push_back(
tdc(pp,
tau_ * i));
125 op.push_back(trg_->Integer(4));
126 for (
int i = 0; i <
maxts_; i++) {
127 op.push_back((op[i] + 1) % 4);
140 for (
int i = 0; i <
maxts_; i++) {
145 if (integral >= cut)
return true;
float edges_[17]
Charge lower limit of all the 16 subranges.
int nbins_[5]
Indices of first bin of each subrange.
bool pulseCut(QIEInputPulse *pulse, float cut)
Method to check if the pulse is good to be stored.
float tau_
time period of one time sample [in ns]
std::vector< int > outAdc(QIEInputPulse *pp)
Complete set of ADCs for the pulse.
float adc2Q(int ADC)
Converting ADC back to charge.
float tdc_thr_
TDC threshold (default 3.74 microAmpere)
int q2Adc(float Charge)
Digitizing input charge.
float qErr(float Q)
Quantization error.
float sg_
std. dev. of gaussian noise (Actual noise level)
float sense_[16]
sensitivity of the subranges (Total charge/no. of bins)
std::vector< int > outTdc(QIEInputPulse *pp)
Complete set of TDCs for the pulse.
float mu_
mean of gaussian noise (Pedestal)
bool isnoise_
Whether noise is added to the system.
int maxts_
No. of time samples to analyze.
int tdc(QIEInputPulse *pp, float T0)
TDC of the input pulse.
SimQIE()
Defaut constructor.
float gain_
QIE gain -> to convert from no. of e- to charge in fC.
std::unique_ptr< TRandom3 > rand_ptr_
Random number generator (required for noise simulation)
std::vector< int > capId(QIEInputPulse *pp)
Complete set of Capacitor IDs for the pulse.