ATLAS Offline Software
Loading...
Searching...
No Matches
Amplifier.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <cmath>
8
16
18= default;
19
21{
22 m_threshold = 0.;
23 m_responseMax = 0.;
25 m_adcOffset = 35.; // determined from Z -> mumu data as of 2025
26 m_adcFactor = 150.; // determined from Z -> mumu data as of 2025
27 m_adcFraction = 10.;
28 m_binsize = 1.;
30}
31
32double Amplifier::ResponseFunction(double time)
33{
34 /*
35 amplifier f(t) = (t/tau)**3 exp(-t/tau) u(t)
36
37 signal I(t) = I0/(t+t0) u(t)
38
39 u(t) step function
40 tau 15 ns, t0=12 nsec, I0=1
41
42 */
43 //double TP=20.;
44 double TP=15.;
45 double T0=12./2.;
46 /*
47 FI1=1./3.
48 FI2=2./3.
49 signal = ( FI1 exp(t/t0)/t0 + FI2 exp(-t/(9*t0))/(9*t0))
50 ion/electron fraction electron delta function ion signal
51 */
52 double FI1=1./3.;
53 double FI2=2./3.;
54 double face=2.0;
55
56 /* third order amplifier
57
58 f(t)= u(t) * t/tau**3* exp(-t/tau)/3!/tau
59 I(t)= u(t) * exp(-t/t0)/ t0
60
61 */
62 double TAU=TP/3.;
63 double a=1./TAU;
64 double b =1./T0;
65 double a4 = a*a*a*a;
66 double ab4 = a-b;
67 ab4 = ab4*ab4*ab4*ab4;
68 double dt = (a-b)*time;
69 double dt2 = dt*dt;
70 double dt3 = dt2*dt;
71 // double dt4 = dt2*dt2; // not used
72
73 double F3 = a4*time*time*time*exp(-a*time)/6.;
74 double xnor = b*a4/ab4;
75 double res31= xnor*(exp(-b*time) - exp(-a*time)
76 -dt*exp(-a*time)
77 -dt2/2.*exp(-a*time)
78 -dt3/6.*exp(-a*time));
79
80 b =1./T0/9.;
81 ab4 = a-b;
82 ab4 = ab4*ab4*ab4*ab4;
83 dt = (a-b)*time;
84 dt2 = dt*dt;
85 dt3 = dt2*dt;
86 // dt4 = dt2*dt2; // not used
87 xnor = b*a4/ ab4;
88 double res32= xnor*(exp(-b*time) - exp(-a*time)
89 -dt*exp(-a*time)
90 -dt2/2.*exp(-a*time)
91 -dt3/6.*exp(-a*time));
92 double resolution=(face*(res31*FI1+res32*FI2)+F3)/(1.+face);
93
94 return resolution;
95}
96
97void Amplifier::InitResponse(unsigned int bins, double binsize)
98{
99 m_binsize = binsize;
101
102 m_response.resize(bins);
103 m_signal.resize(bins);
104
105 cluster_vec_it it = m_response.begin();
106 double i(0.);
107 double resp(0),max(0.);//,integral(0.);
108 while( it != m_response.end() ){
110 if(resp>max) max = resp;
111 *it = resp;
112 ++it;++i;
113 }
116 Reset();
117}
118
120{
121 m_integral = -10000.;
122 std::vector<double>::iterator dit = m_signal.begin();
123 for( ; dit != m_signal.end(); ++dit)
124 *dit = 0.;
125 m_signal_th = m_signal.begin();
126 m_signal_stop = m_signal.end();
127}
128
129bool Amplifier::AddClusters(const std::vector<double>& clusters)
130{
131 if(clusters.empty()){ // no clusters, no signal!
132 return false;
133 }
134
135 // reset cluster iterators
136 m_cluster_begin = clusters.begin();
137 m_cluster_stop = clusters.end(); // stop iterator can be changed in the AddCluster-routine
139 int bin(0);
140 for( ; cit!=m_cluster_stop;++cit){ // iterate over all clusters
141 if(*cit == 0.) continue; // check if the cluster size in the current bin is not zero
142 bin = cit - m_cluster_begin; // calculate the corresponding bin number
143 AddCluster(bin,*cit); // add response of cluster to total detector response
144 }
145 Integral(); // calculate the Q-integral
146 DoAdcResponse(); // get the ADC response
147
148 return PassedThreshold();
149}
150
151void Amplifier::AddCluster(int startbin, double charge)
152{
153 // set start values for signal and response iterator
154 cluster_vec_it response_it = m_response.begin();
155 cluster_vec_it signal_it = m_signal.begin() + startbin;
156
157 // fill signal vector until stop
158 while(signal_it != m_signal_stop) {
159
160 *signal_it += *response_it*charge; // add response to signal
161 if( *signal_it > m_threshold ) { // check if signal above threshold
162
163 // if new threshold found
164 if( signal_it - m_signal_th < 0 || m_signal_th == m_signal.begin()){
165 m_signal_th = signal_it; // store new threshold
166
167 /* if the bin (threshold + integration window) lies
168 within the signal vector, point the stop iterator to it.
169 nessicary to make sure m_signal_stop never points beyond the m_signal.end() */
170
171 if( m_signal.end()-signal_it > m_integrationWindow ){
174 }
175 }
176 ++signal_it;++response_it; // go to next bin
177 while(signal_it != m_signal_stop) { // loop over the remaining bins
178 *signal_it += *response_it*charge;
179 ++signal_it;++response_it;
180 }
181 break; // exit loop
182 }
183 ++signal_it;++response_it;
184 }
185}
186
188{
190 m_integral = 0.;
191 while(s != m_signal_stop){ // sum charge within integration window
192 m_integral += *s;
193 ++s;
194 }
195 return m_integral;
196}
197
199{
200 if(m_integral > 0){
202 }else{
203 m_adcResponse = -1000;
204 }
205}
206
static const int TAU
Definition AtlasPID.h:79
double charge(const T &p)
Definition AtlasPID.h:997
static Double_t a
static const std::vector< std::string > bins
#define max(a, b)
Definition cfImp.cxx:41
void DoAdcResponse()
static double ResponseFunction(double time)
Definition Amplifier.cxx:32
double m_responseMax
Definition Amplifier.h:60
double m_adcResponse
Definition Amplifier.h:65
double m_integral
Definition Amplifier.h:64
cluster_vec_it m_signal_th
Definition Amplifier.h:68
void InitResponse(unsigned int bins, double binsize)
Definition Amplifier.cxx:97
void InitAmplifierParameters()
Definition Amplifier.cxx:20
double m_binsize
Definition Amplifier.h:53
std::vector< double >::const_iterator cluster_vec_const_it
Definition Amplifier.h:15
double m_adcFraction
Definition Amplifier.h:77
cluster_vec m_signal
Definition Amplifier.h:63
bool PassedThreshold() const
Definition Amplifier.h:104
bool AddClusters(const cluster_vec &clusters)
double m_threshold
Definition Amplifier.h:55
double m_integrationWindowNs
Definition Amplifier.h:57
double m_triggerElectron
Definition Amplifier.h:54
void Reset()
std::vector< double >::iterator cluster_vec_it
Definition Amplifier.h:14
double m_adcOffset
Definition Amplifier.h:75
void AddCluster(int bin, double charge)
cluster_vec_it m_signal_stop
Definition Amplifier.h:69
double Integral()
cluster_vec_const_it m_cluster_begin
Definition Amplifier.h:71
cluster_vec_const_it m_cluster_stop
Definition Amplifier.h:70
double m_adcFactor
Definition Amplifier.h:76
int m_integrationWindow
Definition Amplifier.h:56
cluster_vec m_response
Definition Amplifier.h:62