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