1#include "TrigScint/SimQIE.h"
6#include "Framework/Exception/Exception.h"
16 EXCEPTION_RAISE(
"RandomSeedException",
17 "QIE Noise generator not seeded (seed=0)");
19 rand_ptr = std::make_unique<TRandom3>(seed);
30 float qq =
gain_ * Charge;
33 if (qq <=
edges_[0])
return 0;
34 if (qq >=
edges_[16])
return 255;
41 if (qq >
edges_[(a + b) / 2]) {
53 if (ADC <= 0)
return -16;
54 if (ADC >= 255)
return 350000;
60 for (
int i = 1; i < 4; i++) {
67 return (temp /
gain_);
72 if (Q <=
edges_[0])
return 0;
73 if (Q >=
edges_[16])
return 0;
78 if (Q >
edges_[(a + b) / 2])
83 return (
sense_[a] / (sqrt(12) * Q));
91 for (
int i = 0; i <
maxts_; i++) {
93 OP.push_back(
Q2ADC(QQ));
102 if (pp->
Eval(T0) > thr2)
return 62;
104 while (tt < T0 +
tau_) {
105 if (pp->
Eval(tt) >= thr2)
return ((
int)(2 * (tt - T0)));
116 for (
int i = 0; i <
maxts_; i++) {
117 OP.push_back(
TDC(pp,
tau_ * i));
127 OP.push_back(trg_->Integer(4));
128 for (
int i = 0; i <
maxts_; i++) {
129 OP.push_back((OP[i] + 1) % 4);
142 for (
int i = 0; i <
maxts_; i++) {
147 if (integral >= cut)
return true;
float edges_[17]
Charge lower limit of all the 16 subranges.
std::vector< int > Out_ADC(QIEInputPulse *pp)
Complete set of ADCs for the pulse.
int nbins_[5]
Indices of first bin of each subrange.
int TDC(QIEInputPulse *pp, float T0)
TDC of the input pulse.
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]
int Q2ADC(float Charge)
Digitizing input charge.
std::unique_ptr< TRandom3 > rand_ptr
Random number generator (required for noise simulation)
float tdc_thr_
TDC threshold (default 3.74 microAmpere)
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)
float ADC2Q(int ADC)
Converting ADC back to charge.
float mu_
mean of gaussian noise (Pedestal)
bool isnoise_
Whether noise is added to the system.
int maxts_
No. of time samples to analyze.
std::vector< int > CapID(QIEInputPulse *pp)
Complete set of Capacitor IDs for the pulse.
SimQIE()
Defaut constructor.
float gain_
QIE gain -> to convert from no. of e- to charge in fC.
std::vector< int > Out_TDC(QIEInputPulse *pp)
Complete set of TDCs for the pulse.