11 |
extern "C" { |
extern "C" { |
12 |
|
|
13 |
// int readetaparam_(); |
// int readetaparam_(); |
14 |
float cog_(int*,int*); |
float cog_(int*,int*); |
15 |
float pfaeta_(int*,float*); |
float pfaeta_(int*,float*); |
16 |
float pfaeta2_(int*,float*); |
float pfaeta2_(int*,float*); |
17 |
float pfaeta3_(int*,float*); |
float pfaeta3_(int*,float*); |
18 |
float pfaeta4_(int*,float*); |
float pfaeta4_(int*,float*); |
19 |
|
float pfaetal_(int*,float*); |
20 |
|
float digsat_(int*); |
21 |
|
int npfastrips_(int*,float*); |
22 |
|
|
23 |
|
float fbad_cog_(int*,int*); |
24 |
|
float risx_cog_(float*); |
25 |
|
float risy_cog_(float*); |
26 |
} |
} |
27 |
//-------------------------------------- |
//-------------------------------------- |
28 |
// |
// |
30 |
//-------------------------------------- |
//-------------------------------------- |
31 |
TrkCluster::TrkCluster(){ |
TrkCluster::TrkCluster(){ |
32 |
|
|
33 |
view = 0; |
// cout << "TrkCluster::TrkCluster()"<<endl; |
34 |
maxs = 0; |
view = -1; |
35 |
indmax = 0; |
maxs = -1; |
36 |
|
indmax = -1; |
37 |
CLlength = 0; |
|
38 |
clsignal = 0; |
CLlength = 0; |
39 |
clsigma = 0; |
clsignal = 0; |
40 |
cladc = 0; |
clsigma = 0; |
41 |
clbad = 0; |
cladc = 0; |
42 |
|
clbad = 0; |
43 |
|
|
44 |
}; |
}; |
45 |
//-------------------------------------- |
//-------------------------------------- |
46 |
// |
// |
47 |
// |
// |
48 |
//-------------------------------------- |
//-------------------------------------- |
|
TrkCluster::~TrkCluster(){ |
|
|
|
|
|
delete [] clsignal; |
|
|
delete [] clsigma; |
|
|
delete [] cladc; |
|
|
delete [] clbad; |
|
|
}; |
|
|
//-------------------------------------- |
|
|
// |
|
|
// |
|
|
//-------------------------------------- |
|
49 |
TrkCluster::TrkCluster(const TrkCluster& t){ |
TrkCluster::TrkCluster(const TrkCluster& t){ |
50 |
|
|
51 |
view = t.view; |
view = t.view; |
52 |
maxs = t.maxs; |
maxs = t.maxs; |
53 |
indmax = t.indmax; |
indmax = t.indmax; |
54 |
|
|
55 |
CLlength = t.CLlength; |
CLlength = t.CLlength; |
56 |
|
if(CLlength){ |
57 |
clsignal = new Float_t[CLlength]; |
clsignal = new Float_t[CLlength]; |
58 |
clsigma = new Float_t[CLlength]; |
clsigma = new Float_t[CLlength]; |
59 |
cladc = new Int_t[CLlength]; |
cladc = new Int_t[CLlength]; |
60 |
clbad = new Bool_t[CLlength]; |
clbad = new Bool_t[CLlength]; |
61 |
for(Int_t i=0; i<CLlength;i++){ |
for(Int_t i=0; i<CLlength;i++){ |
62 |
clsignal[i] = t.clsignal[i]; |
clsignal[i] = t.clsignal[i]; |
63 |
clsigma[i] = t.clsigma[i]; |
clsigma[i] = t.clsigma[i]; |
64 |
cladc[i] = t.cladc[i]; |
cladc[i] = t.cladc[i]; |
65 |
clbad[i] = t.clbad[i]; |
clbad[i] = t.clbad[i]; |
66 |
}; |
}; |
67 |
|
}; |
68 |
|
}; |
69 |
|
//-------------------------------------- |
70 |
|
// |
71 |
|
// |
72 |
|
//-------------------------------------- |
73 |
|
void TrkCluster::Clear(){ |
74 |
|
|
75 |
|
// cout << "void TrkCluster::Clear()"<<endl; |
76 |
|
if(CLlength){ |
77 |
|
delete [] clsignal; |
78 |
|
delete [] clsigma; |
79 |
|
delete [] cladc; |
80 |
|
delete [] clbad; |
81 |
|
} |
82 |
|
|
83 |
|
view = 0; |
84 |
|
maxs = 0; |
85 |
|
indmax = 0; |
86 |
|
|
87 |
|
CLlength = 0; |
88 |
|
clsignal = 0; |
89 |
|
clsigma = 0; |
90 |
|
cladc = 0; |
91 |
|
clbad = 0; |
92 |
|
|
93 |
}; |
}; |
94 |
//-------------------------------------- |
//-------------------------------------- |
96 |
// |
// |
97 |
//-------------------------------------- |
//-------------------------------------- |
98 |
/** |
/** |
99 |
* Evaluate the cluster signal including all adjacent strip with a significant signal ( s > cut*sigma ). |
* Evaluate the cluster signal including a maximum number of adjacent |
100 |
* @param cut Inclusion cut. |
* strips, around maxs, having a significant signal. |
101 |
|
* @param nstrip Maximum number of strips. |
102 |
|
* @param cut Inclusion cut ( s > cut*sigma ). |
103 |
|
* @param force Falg to force the PFA strip-inclusion pattern (nstrip>0) |
104 |
|
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
105 |
*/ |
*/ |
106 |
Float_t TrkCluster::GetSignal(Float_t cut){ |
Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut, Bool_t force){ |
107 |
Float_t s = 0; |
|
108 |
for(Int_t is = 0; is < CLlength; is++){ |
if(CLlength<=0)return 0; |
109 |
Float_t scut = cut*clsigma[is]; |
|
110 |
if(clsignal[is] > scut) s += clsignal[is]; |
Float_t s = 0; |
111 |
|
|
112 |
|
//----------------------------------- |
113 |
|
// inlcude strips with s > cut*sigma |
114 |
|
//----------------------------------- |
115 |
|
|
116 |
|
if( nstrip<=0 ){ |
117 |
|
// for(Int_t is = 0; is < CLlength; is++){ |
118 |
|
// Float_t scut = cut*clsigma[is]; |
119 |
|
// if(clsignal[is] > scut) s += clsignal[is]; |
120 |
|
// }; |
121 |
|
for(Int_t is = indmax+1; is < CLlength; is++){ |
122 |
|
Float_t scut = cut*clsigma[is]; |
123 |
|
if(clsignal[is] > scut) s += clsignal[is]; |
124 |
|
else break; |
125 |
|
}; |
126 |
|
for(Int_t is = indmax; is >=0; is--){ |
127 |
|
Float_t scut = cut*clsigma[is]; |
128 |
|
if(clsignal[is] > scut) s += clsignal[is]; |
129 |
|
else break; |
130 |
}; |
}; |
131 |
return s; |
return s; |
132 |
}; |
}; |
133 |
/** |
|
134 |
* Evaluate the cluster signal including a ( maximum ) fixed number of adjacent strips (with s>0) around the maxs. |
//--------------------------------------------------- |
135 |
* @param nstrip Number of strips. |
// inlcude strips with s > cut*sigma, up to nstrip. |
136 |
*/ |
// strips are included in order of decreasing signal |
137 |
Float_t TrkCluster::GetSignal(Int_t nstrip){ |
//--------------------------------------------------- |
138 |
|
if( !force ){ |
139 |
Float_t s = 0; |
|
140 |
Int_t il = indmax; |
Int_t il = indmax; |
141 |
Int_t ir = indmax; |
Int_t ir = indmax; |
142 |
Int_t inc = 0; |
Int_t inc = 0; |
143 |
|
|
144 |
while ( inc<nstrip ){ |
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
145 |
Float_t sl = 0; |
|
146 |
Float_t sr = 0; |
while ( inc < nstrip ){ |
147 |
if( il >= 0 ) sl = clsignal[il]; |
Float_t sl = -100000; |
148 |
if( ir < CLlength ) sr = clsignal[ir]; |
Float_t sr = -100000; |
149 |
if( sl == sr && inc == 0 ){ |
if( il >= 0 ) sl = clsignal[il]; |
150 |
s += clsignal[il]; |
if( ir < CLlength ) sr = clsignal[ir]; |
151 |
il--; |
if( sl == sr && inc == 0 ){ |
152 |
ir++; |
s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
153 |
}else if ( sl >= sr && sl>0 && inc !=0){ |
il--; |
154 |
s += sl; |
ir++; |
155 |
il--; |
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
156 |
}else if ( sl < sr && sr>0 ){ |
s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
157 |
s += sr; |
il--; |
158 |
ir++; |
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
159 |
}else break; |
s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl; |
160 |
|
ir++; |
161 |
inc++; |
}else break; |
162 |
|
|
163 |
|
inc++; |
164 |
} |
} |
165 |
return s; |
return s; |
166 |
|
|
167 |
|
}else{ |
168 |
|
//--------------------------------------------------- |
169 |
|
// evaluate signal using a fixed number of strips, |
170 |
|
// following the PFA inclusion patters |
171 |
|
//--------------------------------------------------- |
172 |
|
// --> signal of the central strip |
173 |
|
Float_t sc = clsignal[indmax]; |
174 |
|
// signal of adjacent strips |
175 |
|
Float_t sl1 = -9999.; |
176 |
|
Float_t sl2 = -9999.; |
177 |
|
Float_t sr1 = -9999.; |
178 |
|
Float_t sr2 = -9999.; |
179 |
|
if(indmax-1>=0) sl1 = clsignal[indmax-1]; |
180 |
|
if(indmax-2>=0) sl2 = clsignal[indmax-2]; |
181 |
|
if(indmax+1<CLlength) sr1 = clsignal[indmax+1]; |
182 |
|
if(indmax+2<CLlength) sr2 = clsignal[indmax+2]; |
183 |
|
|
184 |
|
if(nstrip==1){ |
185 |
|
s = sc; |
186 |
|
}else if(nstrip==2){ |
187 |
|
if( sl1>sr1 && sl1+sc!=0 )s = (sl1+sc); |
188 |
|
if( sl1<sr1 && sr1+sc!=0 )s = (sc+sr1); |
189 |
|
if( sl1==sr1 && sl1 != -9999.){ |
190 |
|
if( clsigma[indmax-1] < clsigma[indmax+1] && sl1+sc!=0 )s = (sl1+sc); |
191 |
|
if( clsigma[indmax-1] > clsigma[indmax+1] && sc+sr1!=0 )s = (sc+sr1); |
192 |
|
} |
193 |
|
}else if(nstrip==3){ |
194 |
|
s = (sl1+sc+sr1); |
195 |
|
}else if(nstrip==4){ |
196 |
|
if( sl2>sr2 && sl2+sl1+sc+sr1!=0 )s = (sl2+sl1+sc+sr1); |
197 |
|
if( sl2<sr2 && sl1+sc+sr1+sr2!=0 )s = (sl1+sc+sr1+sr2); |
198 |
|
if( sl2==sr2 && sl2 != -9999.){ |
199 |
|
if( clsigma[indmax-2] < clsigma[indmax+2] && sl2+sl1+sc+sr1!=0 )s = (sl2+sl1+sc+sr1); |
200 |
|
if( clsigma[indmax-2] > clsigma[indmax+2] && sl1+sc+sr1+sr2!=0 )s = (sl1+sc+sr1+sr2); |
201 |
|
} |
202 |
|
}else if(nstrip==5){ |
203 |
|
s = (sl1+sc+sr1); |
204 |
|
if(sl2 != -9999.)s += sl2; |
205 |
|
if(sr2 != -9999.)s += sr2; |
206 |
|
}else{ |
207 |
|
cout << "Float_t TrkCluster::GetSignal("<<nstrip<<","<<cut<<","<<force<<")- not implemented"<<endl; |
208 |
|
} |
209 |
|
|
210 |
|
} |
211 |
|
|
212 |
|
return 0.; |
213 |
|
|
214 |
}; |
}; |
215 |
|
|
216 |
|
|
217 |
/** |
/** |
218 |
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including all adjacent strip with a significant signal ( s > cut*sigma ). |
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including a |
219 |
* @param cut Inclusion cut. |
* maximum number of adjacent strips, around maxs, having a significant signal. |
220 |
*/ |
* @param nstrip Maximum number of strips. |
221 |
Float_t TrkCluster::GetSignalToNoise(Float_t cut){ |
* @param cut Inclusion cut ( s > cut*sigma ). |
222 |
Float_t sn = 0; |
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
|
for(Int_t is = 0; is < CLlength; is++){ |
|
|
Float_t scut = cut*clsigma[is]; |
|
|
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
|
|
}; |
|
|
return sn; |
|
|
}; |
|
|
/** |
|
|
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including a ( maximum ) fixed number of adjacent strips (with s>0) around the maxs. |
|
|
* @param nstrip Number of strips. |
|
223 |
*/ |
*/ |
224 |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip){ |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip, Float_t cut){ |
|
|
|
|
Float_t sn = 0; |
|
|
Int_t il = indmax; |
|
|
Int_t ir = indmax; |
|
|
Int_t inc = 0; |
|
225 |
|
|
226 |
while ( inc<nstrip ){ |
if(CLlength<=0)return 0; |
227 |
Float_t sl = 0; |
|
228 |
Float_t sr = 0; |
Float_t sn = 0; |
229 |
if( il >= 0 ) sl = clsignal[il]; |
|
230 |
if( ir < CLlength ) sr = clsignal[ir]; |
if( nstrip<=0 ){ |
231 |
if( sl == sr && inc == 0 ){ |
for(Int_t is = indmax+1; is < CLlength; is++){ |
232 |
sn += clsignal[il]/clsigma[il]; |
Float_t scut = cut*clsigma[is]; |
233 |
il--; |
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
234 |
ir++; |
else break; |
235 |
}else if ( sl >= sr && sl>0 && inc !=0){ |
}; |
236 |
sn += sl/clsigma[il]; |
for(Int_t is = indmax; is >=0; is--){ |
237 |
il--; |
Float_t scut = cut*clsigma[is]; |
238 |
}else if ( sl < sr && sr>0 ){ |
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
239 |
sn += sr/clsigma[ir]; |
else break; |
240 |
ir++; |
}; |
|
}else break; |
|
|
|
|
|
inc++; |
|
|
} |
|
241 |
return sn; |
return sn; |
242 |
|
}; |
243 |
|
|
244 |
|
|
245 |
|
Int_t il = indmax; |
246 |
|
Int_t ir = indmax; |
247 |
|
Int_t inc = 0; |
248 |
|
|
249 |
|
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
250 |
|
|
251 |
|
while ( inc < nstrip ){ |
252 |
|
Float_t sl = -100000; |
253 |
|
Float_t sr = -100000; |
254 |
|
if( il >= 0 ) sl = clsignal[il]; |
255 |
|
if( ir < CLlength ) sr = clsignal[ir]; |
256 |
|
if( sl == sr && inc == 0 ){ |
257 |
|
sn += clsignal[il]/clsigma[il]; |
258 |
|
il--; |
259 |
|
ir++; |
260 |
|
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
261 |
|
sn += sl/clsigma[il]; |
262 |
|
il--; |
263 |
|
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
264 |
|
sn += sr/clsigma[ir]; |
265 |
|
ir++; |
266 |
|
}else break; |
267 |
|
|
268 |
|
inc++; |
269 |
|
} |
270 |
|
return sn; |
271 |
}; |
}; |
272 |
/** |
/** |
273 |
* Evaluate the cluster multiplicity. |
* Evaluate the cluster multiplicity. |
274 |
* @param cut Inclusion cut. |
* @param cut Inclusion cut. |
275 |
*/ |
*/ |
276 |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
277 |
Int_t m = 0; |
|
278 |
for(Int_t is = 0; is < CLlength; is++){ |
if(CLlength<=0)return 0; |
279 |
Float_t scut = cut*clsigma[is]; |
|
280 |
if(clsignal[is] > scut) m++; |
Int_t m = 0; |
281 |
}; |
|
282 |
return m; |
for(Int_t is = indmax+1; is < CLlength; is++){ |
283 |
|
Float_t scut = cut*clsigma[is]; |
284 |
|
if(clsignal[is] > scut) m++; |
285 |
|
else break; |
286 |
|
}; |
287 |
|
for(Int_t is = indmax; is >=0; is--){ |
288 |
|
Float_t scut = cut*clsigma[is]; |
289 |
|
if(clsignal[is] > scut) m++; |
290 |
|
else break; |
291 |
|
}; |
292 |
|
return m; |
293 |
}; |
}; |
294 |
/** |
/** |
295 |
* True if the cluster contains bad strips. |
* True if the cluster contains bad strips. |
296 |
* @param nbad Number of strips around the maximum. |
* @param nbad Number of strips around the maximum. |
297 |
*/ |
*/ |
298 |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
299 |
|
|
300 |
/* Float_t max = 0; |
if(CLlength<=0)return 0; |
301 |
Int_t imax = 0; |
|
302 |
for(Int_t is = 0; is < CLlength; is++){ |
Int_t il,ir; |
303 |
if(clsignal[is] > max){ |
il = indmax; |
304 |
max = clsignal[is]; |
ir = indmax; |
305 |
imax = is; |
for(Int_t i=1; i<nbad; i++){ |
306 |
}; |
if (ir == CLlength-1 && il == 0)break; |
307 |
}; |
else if (ir == CLlength-1 && il != 0)il--; |
308 |
|
else if (ir != CLlength-1 && il == 0)ir++; |
309 |
Int_t il,ir; |
else{ |
310 |
il = imax; |
if(clsignal[il-1] > clsignal[ir+1])il--; |
311 |
ir = imax;*/ |
else ir++; |
|
|
|
|
Int_t il,ir; |
|
|
il = indmax; |
|
|
ir = indmax; |
|
|
for(Int_t i=1; i<nbad; i++){ |
|
|
if (ir == CLlength && il == 0)break; |
|
|
else if (ir == CLlength && il != 0)il--; |
|
|
else if (ir != CLlength && il == 0)ir++; |
|
|
else{ |
|
|
if(clsignal[il-1] > clsignal[ir+1])il--; |
|
|
else ir++; |
|
|
} |
|
312 |
} |
} |
313 |
Int_t isbad = 0; |
} |
314 |
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
Int_t isbad = 0; |
315 |
|
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
316 |
return ( isbad != nbad ); |
|
317 |
|
return ( isbad != nbad ); |
318 |
}; |
}; |
319 |
|
/** |
320 |
|
* True if the cluster contains saturated strips. |
321 |
|
* @param nbad Number of strips around the maximum. |
322 |
|
*/ |
323 |
|
Bool_t TrkCluster::IsSaturated(Int_t nbad){ |
324 |
|
|
325 |
|
if(CLlength<=0)return 0; |
326 |
|
|
327 |
|
Int_t il,ir; |
328 |
|
il = indmax; |
329 |
|
ir = indmax; |
330 |
|
for(Int_t i=1; i<nbad; i++){ |
331 |
|
if (ir == CLlength-1 && il == 0)break; |
332 |
|
else if (ir == CLlength-1 && il != 0)il--; |
333 |
|
else if (ir != CLlength-1 && il == 0)ir++; |
334 |
|
else{ |
335 |
|
if(clsignal[il-1] > clsignal[ir+1])il--; |
336 |
|
else ir++; |
337 |
|
} |
338 |
|
} |
339 |
|
Int_t isbad = 0; |
340 |
|
for(Int_t i=il; i<=ir; i++){ |
341 |
|
if( IsX() && cladc[i] > 2980 )isbad++; |
342 |
|
if( IsY() && cladc[i] < 80 )isbad++; |
343 |
|
} |
344 |
|
return ( isbad != 0 ); |
345 |
|
|
346 |
|
} |
347 |
//-------------------------------------- |
//-------------------------------------- |
348 |
// |
// |
349 |
// |
// |
350 |
//-------------------------------------- |
//-------------------------------------- |
351 |
void TrkCluster::Dump(){ |
void TrkCluster::Dump(){ |
352 |
|
|
353 |
cout << "----- Cluster" << endl; |
cout << "----- Cluster" << endl; |
354 |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
355 |
cout << "Position of maximun "<< maxs <<endl; |
cout << "Position of maximun "<< maxs <<endl; |
356 |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
357 |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
358 |
cout << "Signal/Noise "<< GetSignalToNoise(); |
cout << "Signal/Noise "<< GetSignalToNoise()<<endl; |
359 |
cout <<endl<< "Strip signals "; |
cout << "COG "<< GetCOG(0)<<endl;; |
360 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
cout << "Strip signals "; |
361 |
cout <<endl<< "Strip sigmas "; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
362 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
cout <<endl<< "Strip sigmas "; |
363 |
cout <<endl<< "Strip ADC "; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
364 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
cout <<endl<< "Strip ADC "; |
365 |
cout <<endl<< "Strip BAD "; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
366 |
for(Int_t i =0; i<CLlength; i++){ |
cout <<endl<< "Strip BAD "; |
367 |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
for(Int_t i =0; i<CLlength; i++){ |
368 |
else cout << " " <<clbad[i]; |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
369 |
} |
else cout << " " <<clbad[i]; |
370 |
cout << endl; |
} |
371 |
|
cout << endl; |
372 |
|
|
373 |
} |
} |
374 |
//-------------------------------------- |
//-------------------------------------- |
378 |
/** |
/** |
379 |
* Method to fill a level1 struct with only one cluster (done to use F77 p.f.a. routines on a cluster basis). |
* Method to fill a level1 struct with only one cluster (done to use F77 p.f.a. routines on a cluster basis). |
380 |
*/ |
*/ |
381 |
cTrkLevel1* TrkCluster::GetLevel1Struct(){ |
void TrkCluster::GetLevel1Struct(cTrkLevel1* l1){ |
382 |
|
|
383 |
cTrkLevel1* l1 = new cTrkLevel1; |
// cTrkLevel1* l1 = new cTrkLevel1; |
384 |
|
|
385 |
l1->nclstr1 = 1; |
// cTrkLevel1* l1 = &level1event_ ; |
|
l1->view[0] = view; |
|
|
l1->ladder[0] = GetLadder(); |
|
|
l1->maxs[0] = maxs; |
|
|
l1->mult[0] = GetMultiplicity(); |
|
|
l1->dedx[0] = GetSignal(); |
|
|
l1->indstart[0] = 1; |
|
|
l1->indmax[0] = indmax+1; |
|
|
l1->totCLlength = CLlength; |
|
|
for(Int_t i=0; i<CLlength; i++){ |
|
|
l1->clsignal[i] = clsignal[i]; |
|
|
l1->clsigma[i] = clsigma[i]; |
|
|
l1->cladc[i] = cladc[i]; |
|
|
l1->clbad[i] = clbad[i]; |
|
|
}; |
|
386 |
|
|
387 |
return l1; |
l1->nclstr1 = 1; |
388 |
|
l1->view[0] = view; |
389 |
|
l1->ladder[0] = GetLadder(); |
390 |
|
l1->maxs[0] = maxs; |
391 |
|
l1->mult[0] = GetMultiplicity(); |
392 |
|
l1->dedx[0] = GetSignal(); |
393 |
|
l1->indstart[0] = 1; |
394 |
|
l1->indmax[0] = indmax+1; |
395 |
|
l1->totCLlength = CLlength; |
396 |
|
for(Int_t i=0; i<CLlength; i++){ |
397 |
|
l1->clsignal[i] = clsignal[i]; |
398 |
|
l1->clsigma[i] = clsigma[i]; |
399 |
|
l1->cladc[i] = cladc[i]; |
400 |
|
l1->clbad[i] = clbad[i]; |
401 |
|
}; |
402 |
|
|
403 |
|
// return l1; |
404 |
}; |
}; |
405 |
//-------------------------------------- |
//-------------------------------------- |
406 |
// |
// |
411 |
* @param ncog Number of strips to evaluate COG. |
* @param ncog Number of strips to evaluate COG. |
412 |
* If ncog=0, the COG of the cluster is evaluated according to the cluster multiplicity (defined by the inclusion cut). |
* If ncog=0, the COG of the cluster is evaluated according to the cluster multiplicity (defined by the inclusion cut). |
413 |
* If ncog>0, the COG is evaluated using ncog strips, even if they have a negative signal (according to G.Landi) |
* If ncog>0, the COG is evaluated using ncog strips, even if they have a negative signal (according to G.Landi) |
414 |
|
* |
415 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
416 |
*/ |
*/ |
417 |
Float_t TrkCluster::GetCOG(Int_t ncog){ |
Float_t TrkCluster::GetCOG(Int_t ncog){ |
418 |
|
|
419 |
int ic = 1; |
int ic = 1; |
420 |
level1event_ = *GetLevel1Struct(); |
// GetLevel1Struct(); //Elena: dangerous... |
421 |
return cog_(&ncog,&ic); |
return cog_(&ncog,&ic); |
422 |
|
|
423 |
|
}; |
424 |
|
/** |
425 |
|
* Evaluates the Center-Of-Gravity (COG) of the cluster, in strips, relative to the strip with the maximum signal (TrkCluster::maxs), |
426 |
|
* choosing the number of strips according to the angle, as implemented for the eta-algorythm . |
427 |
|
* @param angle Projected angle in degree. |
428 |
|
*/ |
429 |
|
Float_t TrkCluster::GetCOG(Float_t angle){ |
430 |
|
|
431 |
|
Int_t neta = 0; |
432 |
|
|
433 |
|
// Float_t eta = GetETA(0,angle); |
434 |
|
// for(neta=2; neta<10; neta++) if( eta == GetETA(neta,angle) ) break; |
435 |
|
// if(eta != GetETA(neta,angle) )cout << "Attenzione!! pasticcio "<<endl; |
436 |
|
|
437 |
|
if( view%2 ){ //Y |
438 |
|
neta=2; |
439 |
|
}else{ //X |
440 |
|
if( fabs(angle) <= 10. ){ |
441 |
|
neta = 2; |
442 |
|
}else if( fabs(angle) > 10. && fabs(angle) <= 15. ){ |
443 |
|
neta = 3; |
444 |
|
}else{ |
445 |
|
neta = 4; |
446 |
|
}; |
447 |
|
}; |
448 |
|
|
449 |
|
return GetCOG(neta); |
450 |
|
|
451 |
}; |
}; |
452 |
//-------------------------------------- |
//-------------------------------------- |
454 |
// |
// |
455 |
//-------------------------------------- |
//-------------------------------------- |
456 |
/** |
/** |
457 |
* Evaluates the cluster position, in strips, relative to the strip with the maximum signal (TrkCluster::maxs), by applying the non-linear ETA-algorythm. |
* Evaluates the cluster position, in pitch units, relative to the strip |
458 |
|
* with the maximum signal (TrkCluster::maxs), by applying the non-linear |
459 |
|
* ETA-algorythm. |
460 |
* @param neta Number of strips to evaluate ETA. |
* @param neta Number of strips to evaluate ETA. |
461 |
* @param angle Projected angle between particle track and detector plane. |
* @param angle Projected (effective) angle between particle track and detector plane. |
462 |
|
* @landi flag to apply Landi correction |
463 |
* Implemented values of neta are 2,3,4. If neta=0, ETA2, ETA3 and ETA4 are applied according to the angle. |
* Implemented values of neta are 2,3,4. If neta=0, ETA2, ETA3 and ETA4 are applied according to the angle. |
464 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
465 |
*/ |
*/ |
466 |
Float_t TrkCluster::GetETA(Int_t neta, float angle){ |
Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi){ |
467 |
|
|
468 |
|
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
469 |
// LoadPfaParam(); |
// LoadPfaParam(); |
470 |
int ic = 1; |
|
471 |
level1event_ = *GetLevel1Struct(); |
TrkParams::Load(4); |
472 |
if(neta == 0) return pfaeta_(&ic,&angle); |
if( !TrkParams::IsLoaded(4) ){ |
473 |
else if(neta == 2) return pfaeta2_(&ic,&angle); |
cout << "Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
|
else if(neta == 3) return pfaeta3_(&ic,&angle); |
|
|
else if(neta == 4) return pfaeta4_(&ic,&angle); |
|
|
else cout << "ETA"<<neta<<" not implemented\n"; |
|
474 |
return 0; |
return 0; |
475 |
|
} |
476 |
|
|
477 |
|
float ax = angle; |
478 |
|
int ic = 1; |
479 |
|
//GetLevel1Struct(); //Elena: dangerous... |
480 |
|
if( neta == 0 && !landi) return pfaeta_(&ic,&ax); |
481 |
|
else if(neta == 0 && landi ) return pfaetal_(&ic,&ax); |
482 |
|
else if(neta == 2 ) return pfaeta2_(&ic,&ax); |
483 |
|
else if(neta == 3 ) return pfaeta3_(&ic,&ax); |
484 |
|
else if(neta == 4 ) return pfaeta4_(&ic,&ax); |
485 |
|
else cout << "TrkCluster::GetETA("<<neta<<","<<angle<<","<<landi<<") not implemented\n"; |
486 |
|
return 0; |
487 |
|
|
488 |
}; |
}; |
489 |
|
|
490 |
|
/** |
491 |
|
* Evaluates the cluster position, in pitch units, relative to the strip |
492 |
|
* with the maximum signal (TrkCluster::maxs), by applying the digital |
493 |
|
* algorithm for saturated clusters. |
494 |
|
* |
495 |
|
* @return The cluster position (0 also if if no saturated strip is found). |
496 |
|
* |
497 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
498 |
|
*/ |
499 |
|
Float_t TrkCluster::GetDigSat() { |
500 |
|
|
501 |
|
// GetLevel1Struct(); //Elena: dangerous... |
502 |
|
int ic = 1; |
503 |
|
return digsat_(&ic); |
504 |
|
|
505 |
|
} |
506 |
|
|
507 |
|
/** |
508 |
|
* Evaluates the cluster position, in pitch unit, relative to the strip with |
509 |
|
* the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams). |
510 |
|
* @param angle Projected (effective) angle between particle track and detector plane. |
511 |
|
*/ |
512 |
|
Float_t TrkCluster::GetPositionPU(float angle){ |
513 |
|
|
514 |
|
if ( TrkParams::GetPFA() == 0 )return GetETA(0,angle,false); |
515 |
|
else if( TrkParams::GetPFA() == 2 )return GetETA(2,angle,false); |
516 |
|
else if( TrkParams::GetPFA() == 3 )return GetETA(3,angle,false); |
517 |
|
else if( TrkParams::GetPFA() == 4 )return GetETA(4,angle,false); |
518 |
|
else if( TrkParams::GetPFA() == 5 )return GetETA(0,angle,true); |
519 |
|
else if( TrkParams::GetPFA() == 10 )return GetCOG(0); |
520 |
|
else if( TrkParams::GetPFA() == 11 )return GetCOG(1); |
521 |
|
else if( TrkParams::GetPFA() == 12 )return GetCOG(2); |
522 |
|
else if( TrkParams::GetPFA() == 13 )return GetCOG(3); |
523 |
|
else if( TrkParams::GetPFA() == 14 )return GetCOG(4); |
524 |
|
else cout << " TrkCluster::GetPositionPU(float "<<angle<<") -- WARNING -- PFA="<<TrkParams::GetPFA()<<" not implemented"<<endl; |
525 |
|
|
526 |
|
return 0.; |
527 |
|
|
528 |
|
} |
529 |
|
|
530 |
|
/** |
531 |
|
* Give the number of strip used to evaluate the cluster coordinate |
532 |
|
* according to the p.f.a. |
533 |
|
* It returns 0 when the COG is used (in this case the number of strip used |
534 |
|
* equals the multiplicity). |
535 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
536 |
|
*/ |
537 |
|
Int_t TrkCluster::GetPFAstrips(float angle){ |
538 |
|
|
539 |
|
float ax = angle; |
540 |
|
int ic = 1; |
541 |
|
// GetLevel1Struct(); //Elena: dangerous... |
542 |
|
return npfastrips_(&ic,&ax); |
543 |
|
|
544 |
|
} |
545 |
|
|
546 |
//-------------------------------------- |
//-------------------------------------- |
547 |
// |
// |
548 |
// |
// |
549 |
//-------------------------------------- |
//-------------------------------------- |
550 |
TrkLevel1::TrkLevel1(){ |
TrkLevel1::TrkLevel1(){ |
551 |
|
|
552 |
// good1 = -1; |
// cout << "TrkLevel1::TrkLevel1()"<<endl; |
553 |
|
// Cluster = new TClonesArray("TrkCluster"); |
554 |
Cluster = new TClonesArray("TrkCluster"); |
Cluster = 0; |
555 |
|
for(Int_t i=0; i<12 ; i++){ |
556 |
for(Int_t i=0; i<12 ; i++){ |
good[i] = -1; |
557 |
// crc[i] = -1; |
for(Int_t j=0; j<24 ; j++){ |
558 |
good[i] = -1; |
cn[j][i]=0; |
559 |
for(Int_t j=0; j<24 ; j++){ |
cnn[j][i]=0; |
560 |
cnev[j][i]=0; |
}; |
561 |
cnnev[j][i]=0; |
}; |
562 |
}; |
// TrkParams::SetTrackingMode(); |
563 |
// fshower[i]=0; |
// TrkParams::SetPrecisionFactor(); |
564 |
}; |
// TrkParams::SetStepMin(); |
565 |
|
TrkParams::SetMiniDefault(); |
566 |
|
TrkParams::SetPFA(); |
567 |
|
} |
568 |
|
//-------------------------------------- |
569 |
|
// |
570 |
|
// |
571 |
|
//-------------------------------------- |
572 |
|
void TrkLevel1::Set(){ |
573 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
574 |
} |
} |
575 |
//-------------------------------------- |
//-------------------------------------- |
576 |
// |
// |
578 |
//-------------------------------------- |
//-------------------------------------- |
579 |
void TrkLevel1::Dump(){ |
void TrkLevel1::Dump(){ |
580 |
|
|
581 |
cout<<"DSP status: "; |
cout<<"DSP status: "; |
582 |
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
583 |
cout<<endl; |
cout<<endl; |
584 |
|
cout<<"VA1 mask : "<<endl; |
585 |
TClonesArray &t = *Cluster; |
for(Int_t i=0; i<12 ; i++){ |
586 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
for(Int_t ii=0; ii<24 ; ii++){ |
587 |
|
Int_t mask = cnn[ii][i]; |
588 |
|
if(mask>0)mask=1; |
589 |
|
cout<<mask<<" "; |
590 |
|
} |
591 |
|
cout <<endl; |
592 |
|
} |
593 |
|
|
594 |
|
if(!Cluster)return; |
595 |
|
TClonesArray &t = *Cluster; |
596 |
|
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
597 |
|
|
598 |
} |
} |
599 |
|
/** |
600 |
|
* \brief Dump processing status |
601 |
|
*/ |
602 |
|
void TrkLevel1::StatusDump(int view){ |
603 |
|
cout << "DSP n. "<<view+1<<" (level1-)status: "<<hex<<showbase<<good[view]<<dec<<endl; |
604 |
|
}; |
605 |
|
/** |
606 |
|
* \brief Check event status |
607 |
|
* |
608 |
|
* Check the event status, according to a flag-mask given as input. |
609 |
|
* Return true if the view passes the check. |
610 |
|
* |
611 |
|
* @param view View number (0-11) |
612 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
613 |
|
* no crc error, no software alarm) |
614 |
|
* |
615 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
616 |
|
* |
617 |
|
*/ |
618 |
|
Bool_t TrkLevel1::StatusCheck(int view, int flagmask){ |
619 |
|
|
620 |
|
if( view<0 || view >= 12)return false; |
621 |
|
return !(good[view]&flagmask); |
622 |
|
|
623 |
|
}; |
624 |
|
|
625 |
|
|
626 |
//-------------------------------------- |
//-------------------------------------- |
627 |
// |
// |
628 |
// |
// |
630 |
/** |
/** |
631 |
* Fills a TrkLevel1 object with values from a struct cTrkLevel1 (to get data from F77 common). |
* Fills a TrkLevel1 object with values from a struct cTrkLevel1 (to get data from F77 common). |
632 |
*/ |
*/ |
633 |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1){ |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){ |
634 |
|
|
635 |
// *** CLUSTER *** |
// cout << "void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full)"<<endl; |
636 |
TrkCluster* t_cl = new TrkCluster(); |
|
637 |
TClonesArray &t = *Cluster; |
Clear(); |
638 |
for(int i=0; i<l1->nclstr1; i++){ |
// --------------- |
639 |
|
// *** CLUSTER *** |
640 |
t_cl->view = l1->view[i]; |
// --------------- |
641 |
t_cl->maxs = l1->maxs[i]; |
TrkCluster* t_cl = new TrkCluster(); |
642 |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
643 |
|
TClonesArray &t = *Cluster; |
644 |
Int_t from = l1->indstart[i] -1; |
for(int i=0; i<l1->nclstr1; i++){ |
645 |
Int_t to = l1->totCLlength ; |
|
646 |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
t_cl->Clear(); |
647 |
t_cl->CLlength = to - from ; |
// if( full || (!full && l1->whichtrack[i]) ){ |
648 |
|
|
649 |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
t_cl->view = l1->view[i]; |
650 |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
t_cl->maxs = l1->maxs[i]; |
651 |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
|
652 |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
if( full || (!full && l1->whichtrack[i]) ){ |
653 |
Int_t index = 0; |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
654 |
for(Int_t is = from; is < to; is++ ){ |
Int_t from = l1->indstart[i] -1; |
655 |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
Int_t to = l1->totCLlength ; |
656 |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
657 |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
t_cl->CLlength = to - from ; |
658 |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
|
659 |
index++; |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
660 |
}; |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
661 |
|
t_cl->cladc = new Int_t[t_cl->CLlength]; |
662 |
new(t[i]) TrkCluster(*t_cl); |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
663 |
}; |
|
664 |
|
Int_t index = 0; |
665 |
delete t_cl; |
for(Int_t is = from; is < to; is++ ){ |
666 |
|
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
667 |
// ****general variables**** |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
668 |
|
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
669 |
for(Int_t i=0; i<12 ; i++){ |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
670 |
good[i] = -1; |
index++; |
671 |
for(Int_t j=0; j<24 ; j++){ |
}; |
672 |
cnev[j][i] = l1->cnev[j][i]; |
} |
673 |
cnnev[j][i] = l1->cnnev[j][i]; |
new(t[i]) TrkCluster(*t_cl); // <<< store cluster |
674 |
}; |
}; |
675 |
|
|
676 |
|
delete t_cl; |
677 |
|
|
678 |
|
// ------------------------- |
679 |
|
// ****general variables**** |
680 |
|
// ------------------------- |
681 |
|
for(Int_t i=0; i<12 ; i++){ |
682 |
|
good[i] = l1->good[i]; |
683 |
|
for(Int_t j=0; j<24 ; j++){ |
684 |
|
cn[j][i] = l1->cnev[j][i]; |
685 |
|
// cnrms[j][i] = l1->cnrmsev[j][i]; |
686 |
|
cnn[j][i] = l1->cnnev[j][i]; |
687 |
}; |
}; |
688 |
|
}; |
689 |
|
|
690 |
} |
} |
691 |
/** |
/** |
692 |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
693 |
*/ |
*/ |
694 |
|
|
695 |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
void TrkLevel1::GetLevel1Struct(cTrkLevel1* l1) { |
696 |
|
|
697 |
cTrkLevel1 *l1=0; |
// cTrkLevel1* l1 = &level1event_ ; |
698 |
// |
|
699 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
700 |
l1->good[i] = good[i]; |
l1->good[i] = good[i]; |
701 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
702 |
l1->cnev[j][i] = cnev[j][i]; |
l1->cnev[j][i] = cn[j][i] ; |
703 |
l1->cnnev[j][i] = cnnev[j][i]; |
l1->cnnev[j][i] = cnn[j][i] ; |
704 |
}; |
l1->cnrmsev[j][i] = 0. ; |
705 |
}; |
}; |
706 |
|
l1->fshower[i] = 0; |
707 |
// *** CLUSTERS *** |
}; |
708 |
l1->nclstr1 = Cluster->GetEntries(); |
|
709 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
l1->nclstr1=0; |
710 |
|
l1->totCLlength=0; |
711 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
Int_t index=0; |
712 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
if(Cluster){ |
713 |
// COMPLETARE // |
Int_t i=0; |
714 |
// COMPLETARE // |
for(Int_t ii=0;ii<Cluster->GetEntries();ii++){ |
715 |
// COMPLETARE // |
TrkCluster *clu = GetCluster(ii); |
716 |
// COMPLETARE // |
// ---------------------------------------- |
717 |
// COMPLETARE // |
// attenzione!! |
718 |
// COMPLETARE // |
// se il cluster non e` salvato (view = 0) |
719 |
|
// DEVE essere escluso dal common F77 |
720 |
|
// ---------------------------------------- |
721 |
|
if(clu->view != 0 ){ |
722 |
|
l1->view[i] = clu->view; |
723 |
|
l1->ladder[i] = clu->GetLadder(); |
724 |
|
l1->maxs[i] = clu->maxs; |
725 |
|
l1->mult[i] = clu->GetMultiplicity(); |
726 |
|
l1->dedx[i] = clu->GetSignal(); |
727 |
|
l1->indstart[i] = index+1; |
728 |
|
l1->indmax[i] = l1->indstart[i] + clu->indmax; |
729 |
|
l1->totCLlength += clu->CLlength; |
730 |
|
for(Int_t iw=0; iw < clu->CLlength; iw++){ |
731 |
|
l1->clsignal[index] = clu->clsignal[iw]; |
732 |
|
l1->clsigma[index] = clu->clsigma[iw]; |
733 |
|
l1->cladc[index] = clu->cladc[iw]; |
734 |
|
l1->clbad[index] = clu->clbad[iw]; |
735 |
|
index++; |
736 |
|
} |
737 |
|
i++; |
738 |
|
} |
739 |
} |
} |
740 |
// COMPLETARE // |
l1->nclstr1 = i; |
741 |
// COMPLETARE // |
} |
742 |
// COMPLETARE // |
|
743 |
// COMPLETARE // |
// return l1; |
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
return l1; |
|
744 |
} |
} |
745 |
//-------------------------------------- |
//-------------------------------------- |
746 |
// |
// |
747 |
// |
// |
748 |
//-------------------------------------- |
//-------------------------------------- |
749 |
void TrkLevel1::Clear(){ |
void TrkLevel1::Clear(){ |
750 |
|
|
751 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
752 |
good[i] = -1; |
good[i] = -1; |
753 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
754 |
cnev[j][i] = 0; |
cn[j][i] = 0; |
755 |
cnnev[j][i] = 0; |
cnn[j][i] = 0; |
756 |
}; |
}; |
757 |
}; |
}; |
758 |
// |
// if(Cluster)Cluster->Clear("C"); |
759 |
Cluster->Clear(); |
if(Cluster)Cluster->Delete(); |
760 |
|
|
761 |
} |
} |
762 |
//-------------------------------------- |
//-------------------------------------- |
763 |
// |
// |
764 |
// |
// |
765 |
//-------------------------------------- |
//-------------------------------------- |
766 |
void TrkLevel1::Delete(){ |
void TrkLevel1::Delete(){ |
767 |
|
|
768 |
for(Int_t i=0; i<12 ; i++){ |
// Clear(); |
769 |
good[i] = -1; |
if(Cluster)Cluster->Delete(); |
770 |
for(Int_t j=0; j<24 ; j++){ |
if(Cluster)delete Cluster; |
771 |
cnev[j][i] = 0; |
|
|
cnnev[j][i] = 0; |
|
|
}; |
|
|
}; |
|
|
// |
|
|
Cluster->Delete(); |
|
|
|
|
772 |
} |
} |
|
|
|
773 |
//-------------------------------------- |
//-------------------------------------- |
774 |
// |
// |
775 |
// |
// |
776 |
//-------------------------------------- |
//-------------------------------------- |
777 |
TrkCluster *TrkLevel1::GetCluster(int is){ |
TrkCluster *TrkLevel1::GetCluster(int is){ |
778 |
|
|
779 |
if(is >= this->nclstr()){ |
if(!Cluster)return 0; |
780 |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
if(is >= nclstr()){ |
781 |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
782 |
return 0; |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
783 |
} |
return 0; |
784 |
TClonesArray &t = *(Cluster); |
} |
785 |
TrkCluster *cluster = (TrkCluster*)t[is]; |
|
786 |
return cluster; |
TClonesArray &t = *(Cluster); |
787 |
|
TrkCluster *cluster = (TrkCluster*)t[is]; |
788 |
|
return cluster; |
789 |
} |
} |
790 |
|
|
791 |
|
|
792 |
|
// int TrkLevel1::GetPfaNbinsAngle(){ |
793 |
|
// TrkParams::Load(4); |
794 |
|
// if( !TrkParams::IsLoaded(4) ){ |
795 |
|
// cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
796 |
|
// return 0; |
797 |
|
// } |
798 |
|
// return pfa_.nangbin; |
799 |
|
// }; |
800 |
|
|
801 |
|
// int TrkLevel1::GetPfaNbinsETA(){ |
802 |
|
// TrkParams::Load(4); |
803 |
|
// if( !TrkParams::IsLoaded(4) ){ |
804 |
|
// cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
805 |
|
// return 0; |
806 |
|
// } |
807 |
|
// return pfa_.netaval; |
808 |
|
// }; |
809 |
|
|
810 |
|
// /** |
811 |
|
// * |
812 |
|
// * |
813 |
|
// */ |
814 |
|
// float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
815 |
|
|
816 |
|
// TrkParams::Load(4); |
817 |
|
// if( !TrkParams::IsLoaded(4) ){ |
818 |
|
// cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
819 |
|
// return 0; |
820 |
|
// } |
821 |
|
|
822 |
|
// int nbins = GetPfaNbinsETA(); |
823 |
|
// if(!nbins)return 0; |
824 |
|
|
825 |
|
// float *fcorr = new float [nbins]; |
826 |
|
|
827 |
|
// if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
828 |
|
// for(int ib=0; ib<nbins; ib++){ |
829 |
|
// fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
830 |
|
// cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
831 |
|
// } |
832 |
|
// }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
833 |
|
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
834 |
|
// }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
835 |
|
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
836 |
|
// }else{ |
837 |
|
// cout << pfa<<" pfa parameters not implemented "<<endl; |
838 |
|
// return 0; |
839 |
|
// } |
840 |
|
|
841 |
|
// return fcorr; |
842 |
|
|
843 |
|
// }; |
844 |
|
|
845 |
|
// float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
846 |
|
|
847 |
|
// TrkParams::Load(4); |
848 |
|
// if( !TrkParams::IsLoaded(4) ){ |
849 |
|
// cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
850 |
|
// return 0; |
851 |
|
// } |
852 |
|
|
853 |
|
// int nbins = GetPfaNbinsETA(); |
854 |
|
// if(!nbins)return 0; |
855 |
|
|
856 |
|
// float *fcorr = new float [nbins]; |
857 |
|
|
858 |
|
// if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
859 |
|
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
860 |
|
// }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
861 |
|
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
862 |
|
// }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
863 |
|
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
864 |
|
// }else{ |
865 |
|
// cout << pfa<<" pfa parameters not implemented "<<endl; |
866 |
|
// return 0; |
867 |
|
// } |
868 |
|
|
869 |
|
// return fcorr; |
870 |
|
|
871 |
|
// }; |
872 |
|
|
873 |
|
/** |
874 |
|
* Method to call the F77 routine that performs level1->level2 processing. |
875 |
|
* The level2 output is stored in a common block, which can be retrieved |
876 |
|
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
877 |
|
* NB If the TrkLevel1 object is readout from a tree, and the |
878 |
|
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
879 |
|
* should be payed to the fact that single clusters (clusters not associated |
880 |
|
* with any track) might not be stored. Full reprocessing should be done starting |
881 |
|
* from level0 data. |
882 |
|
*/ |
883 |
|
//int TrkLevel1::ProcessEvent(int pfa){ |
884 |
|
int TrkLevel1::ProcessEvent(){ |
885 |
|
|
886 |
|
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
887 |
|
TrkParams::Load( ); |
888 |
|
if( !TrkParams::IsLoaded() )return 0; |
889 |
|
|
890 |
|
GetLevel1Struct(); |
891 |
|
|
892 |
|
// analysisflight_(&pfa); |
893 |
|
// TrkParams::SetPFA(pfa); |
894 |
|
analysisflight_(); |
895 |
|
|
896 |
|
return 1; |
897 |
|
|
898 |
|
} |
899 |
|
|
900 |
//-------------------------------------- |
//-------------------------------------- |
901 |
// |
// |
902 |
// |
// |
903 |
//-------------------------------------- |
//-------------------------------------- |
904 |
/** |
/** |
905 |
* Load Position-Finding-Algorythm parameters (call the F77 routine). |
* Method to fill a TrkLevel1 object from an existing one, by cleaning low-signal clusters. |
906 |
* |
* |
907 |
*/ |
*/ |
908 |
int TrkLevel1::LoadPfaParam(TString path){ |
void TrkLevel1::Set(TrkLevel1 *trkl1, float mipCut, float fCut){ |
909 |
|
|
910 |
|
|
911 |
|
|
912 |
|
|
913 |
|
if(!trkl1)return; |
914 |
|
|
915 |
|
// ------------------------- |
916 |
|
// ****general variables**** |
917 |
|
// ------------------------- |
918 |
|
for(Int_t i=0; i<12 ; i++){ |
919 |
|
good[i] = trkl1->good[i]; |
920 |
|
for(Int_t j=0; j<24 ; j++){ |
921 |
|
cn[j][i] = trkl1->cn[j][i]; |
922 |
|
cnn[j][i] = trkl1->cnn[j][i]; |
923 |
|
}; |
924 |
|
}; |
925 |
|
// ------------------------- |
926 |
|
// ****cluster array**** |
927 |
|
// ------------------------- |
928 |
|
|
929 |
|
if(Cluster)Cluster->Clear("C"); |
930 |
|
Cluster = new TClonesArray("TrkCluster"); |
931 |
|
TClonesArray &t = *Cluster; |
932 |
|
|
933 |
|
int isel=0; |
934 |
|
for(int icl=0 ; icl< trkl1->GetClusters()->GetEntries(); icl++){ |
935 |
|
TrkCluster *cl = trkl1->GetCluster(icl); |
936 |
|
|
937 |
|
float mip = TrkParams::GetMIP(cl->GetLadder()-1,cl->view-1); |
938 |
|
float smip = cl->GetSignal()/(mip>0.?mip:1.); |
939 |
|
float smax = cl->clsignal[cl->indmax]/(mip>0.?mip:1.); |
940 |
|
if(smax/smip<fCut)continue; |
941 |
|
if(smip<mipCut)continue; |
942 |
|
if(smax<0.5*mipCut)continue; |
943 |
|
|
|
if( strcmp(path_.path,path.Data()) ){ |
|
|
cout <<"Loading p.f.a. parameters\n"; |
|
|
strcpy(path_.path,path.Data()); |
|
|
path_.pathlen = path.Length(); |
|
|
path_.error = 0; |
|
|
return readetaparam_(); |
|
|
} |
|
|
return 0; |
|
|
} |
|
944 |
|
|
945 |
|
|
946 |
|
new(t[isel]) TrkCluster(*cl); // <<< store cluster |
947 |
|
isel++; |
948 |
|
} |
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
} |
953 |
|
|
954 |
ClassImp(TrkLevel1); |
ClassImp(TrkLevel1); |
955 |
ClassImp(TrkCluster); |
ClassImp(TrkCluster); |