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 |
|
int npfastrips_(int*,float*); |
21 |
|
|
22 |
} |
} |
23 |
//-------------------------------------- |
//-------------------------------------- |
26 |
//-------------------------------------- |
//-------------------------------------- |
27 |
TrkCluster::TrkCluster(){ |
TrkCluster::TrkCluster(){ |
28 |
|
|
29 |
view = 0; |
// cout << "TrkCluster::TrkCluster()"<<endl; |
30 |
maxs = 0; |
view = -1; |
31 |
indmax = 0; |
maxs = -1; |
32 |
|
indmax = -1; |
33 |
CLlength = 0; |
|
34 |
clsignal = 0; |
CLlength = 0; |
35 |
clsigma = 0; |
clsignal = 0; |
36 |
cladc = 0; |
clsigma = 0; |
37 |
clbad = 0; |
cladc = 0; |
38 |
|
clbad = 0; |
39 |
|
|
40 |
}; |
}; |
41 |
//-------------------------------------- |
//-------------------------------------- |
42 |
// |
// |
43 |
// |
// |
44 |
//-------------------------------------- |
//-------------------------------------- |
|
TrkCluster::~TrkCluster(){ |
|
|
|
|
|
delete [] clsignal; |
|
|
delete [] clsigma; |
|
|
delete [] cladc; |
|
|
delete [] clbad; |
|
|
}; |
|
|
//-------------------------------------- |
|
|
// |
|
|
// |
|
|
//-------------------------------------- |
|
45 |
TrkCluster::TrkCluster(const TrkCluster& t){ |
TrkCluster::TrkCluster(const TrkCluster& t){ |
46 |
|
|
47 |
view = t.view; |
view = t.view; |
48 |
maxs = t.maxs; |
maxs = t.maxs; |
49 |
indmax = t.indmax; |
indmax = t.indmax; |
50 |
|
|
51 |
CLlength = t.CLlength; |
CLlength = t.CLlength; |
52 |
|
if(CLlength){ |
53 |
clsignal = new Float_t[CLlength]; |
clsignal = new Float_t[CLlength]; |
54 |
clsigma = new Float_t[CLlength]; |
clsigma = new Float_t[CLlength]; |
55 |
cladc = new Int_t[CLlength]; |
cladc = new Int_t[CLlength]; |
56 |
clbad = new Bool_t[CLlength]; |
clbad = new Bool_t[CLlength]; |
57 |
for(Int_t i=0; i<CLlength;i++){ |
for(Int_t i=0; i<CLlength;i++){ |
58 |
clsignal[i] = t.clsignal[i]; |
clsignal[i] = t.clsignal[i]; |
59 |
clsigma[i] = t.clsigma[i]; |
clsigma[i] = t.clsigma[i]; |
60 |
cladc[i] = t.cladc[i]; |
cladc[i] = t.cladc[i]; |
61 |
clbad[i] = t.clbad[i]; |
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; |
74 |
|
delete [] clsigma; |
75 |
|
delete [] cladc; |
76 |
|
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 |
//-------------------------------------- |
//-------------------------------------- |
96 |
* strips, around maxs, having a significant signal. |
* strips, around maxs, having a significant signal. |
97 |
* @param nstrip Maximum number of strips. |
* @param nstrip Maximum number of strips. |
98 |
* @param cut Inclusion cut ( s > cut*sigma ). |
* @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. |
* 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){ |
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; |
Float_t s = 0; |
107 |
|
|
108 |
|
//----------------------------------- |
109 |
|
// inlcude strips with s > cut*sigma |
110 |
|
//----------------------------------- |
111 |
|
|
112 |
if( nstrip<=0 ){ |
if( nstrip<=0 ){ |
113 |
// for(Int_t is = 0; is < CLlength; is++){ |
// for(Int_t is = 0; is < CLlength; is++){ |
114 |
// Float_t scut = cut*clsigma[is]; |
// Float_t scut = cut*clsigma[is]; |
127 |
return s; |
return s; |
128 |
}; |
}; |
129 |
|
|
130 |
|
//--------------------------------------------------- |
131 |
Int_t il = indmax; |
// inlcude strips with s > cut*sigma, up to nstrip. |
132 |
Int_t ir = indmax; |
// strips are included in order of decreasing signal |
133 |
Int_t inc = 0; |
//--------------------------------------------------- |
134 |
|
if( !force ){ |
135 |
|
|
136 |
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
Int_t il = indmax; |
137 |
|
Int_t ir = indmax; |
138 |
|
Int_t inc = 0; |
139 |
|
|
140 |
|
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
141 |
|
|
142 |
|
while ( inc < nstrip ){ |
143 |
|
Float_t sl = -100000; |
144 |
|
Float_t sr = -100000; |
145 |
|
if( il >= 0 ) sl = clsignal[il]; |
146 |
|
if( ir < CLlength ) sr = clsignal[ir]; |
147 |
|
if( sl == sr && inc == 0 ){ |
148 |
|
s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
149 |
|
il--; |
150 |
|
ir++; |
151 |
|
}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 |
while ( inc < nstrip ){ |
}else{ |
164 |
Float_t sl = -100000; |
//--------------------------------------------------- |
165 |
Float_t sr = -100000; |
// evaluate signal using a fixed number of strips, |
166 |
if( il >= 0 ) sl = clsignal[il]; |
// following the PFA inclusion patters |
167 |
if( ir < CLlength ) sr = clsignal[ir]; |
//--------------------------------------------------- |
168 |
if( sl == sr && inc == 0 ){ |
// --> signal of the central strip |
169 |
s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
Float_t sc = clsignal[indmax]; |
170 |
il--; |
// signal of adjacent strips |
171 |
ir++; |
Float_t sl1 = -9999.; |
172 |
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
Float_t sl2 = -9999.; |
173 |
s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
Float_t sr1 = -9999.; |
174 |
il--; |
Float_t sr2 = -9999.; |
175 |
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
if(indmax-1>=0) sl1 = clsignal[indmax-1]; |
176 |
s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl; |
if(indmax-2>=0) sl2 = clsignal[indmax-2]; |
177 |
ir++; |
if(indmax+1<CLlength) sr1 = clsignal[indmax+1]; |
178 |
}else break; |
if(indmax+2<CLlength) sr2 = clsignal[indmax+2]; |
179 |
|
|
180 |
inc++; |
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 |
return s; |
|
208 |
|
return 0.; |
209 |
|
|
210 |
}; |
}; |
211 |
|
|
212 |
|
|
213 |
/** |
/** |
214 |
including a ( maximum ) fixed number of adjacent strips (with s>0) around the maxs. |
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including a |
215 |
* @param nstrip Number of strips. |
* maximum number of adjacent strips, around maxs, having a significant signal. |
|
*/ |
|
|
/** |
|
|
* Evaluate the cluster signal-to-noise, as defined by Turchetta, including a maximum number of adjacent strips, around maxs, having a significant signal. |
|
216 |
* @param nstrip Maximum number of strips. |
* @param nstrip Maximum number of strips. |
217 |
* @param cut Inclusion cut ( s > cut*sigma ). |
* @param cut Inclusion cut ( s > cut*sigma ). |
218 |
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
* 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){ |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip, Float_t cut){ |
221 |
|
|
222 |
|
if(CLlength<=0)return 0; |
223 |
|
|
224 |
Float_t sn = 0; |
Float_t sn = 0; |
225 |
|
|
226 |
if( nstrip<=0 ){ |
if( nstrip<=0 ){ |
270 |
* @param cut Inclusion cut. |
* @param cut Inclusion cut. |
271 |
*/ |
*/ |
272 |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
273 |
Int_t m = 0; |
|
274 |
for(Int_t is = 0; is < CLlength; is++){ |
if(CLlength<=0)return 0; |
275 |
Float_t scut = cut*clsigma[is]; |
|
276 |
if(clsignal[is] > scut) m++; |
Int_t m = 0; |
277 |
}; |
|
278 |
return m; |
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. |
* True if the cluster contains bad strips. |
292 |
* @param nbad Number of strips around the maximum. |
* @param nbad Number of strips around the maximum. |
293 |
*/ |
*/ |
294 |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
295 |
|
|
296 |
/* Float_t max = 0; |
if(CLlength<=0)return 0; |
297 |
Int_t imax = 0; |
|
298 |
for(Int_t is = 0; is < CLlength; is++){ |
Int_t il,ir; |
299 |
if(clsignal[is] > max){ |
il = indmax; |
300 |
max = clsignal[is]; |
ir = indmax; |
301 |
imax = is; |
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 |
Int_t il,ir; |
else{ |
306 |
il = imax; |
if(clsignal[il-1] > clsignal[ir+1])il--; |
307 |
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++; |
|
|
} |
|
308 |
} |
} |
309 |
Int_t isbad = 0; |
} |
310 |
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
Int_t isbad = 0; |
311 |
|
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
312 |
return ( isbad != nbad ); |
|
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 "<<GetLadder()<<endl; |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
351 |
cout << "Position of maximun "<< maxs <<endl; |
cout << "Position of maximun "<< maxs <<endl; |
352 |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
353 |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
354 |
cout << "Signal/Noise "<< GetSignalToNoise(); |
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 <<endl<< "Strip BAD "; |
363 |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
for(Int_t i =0; i<CLlength; i++){ |
364 |
else cout << " " <<clbad[i]; |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
365 |
} |
else cout << " " <<clbad[i]; |
366 |
cout << endl; |
} |
367 |
|
cout << endl; |
368 |
|
|
369 |
} |
} |
370 |
//-------------------------------------- |
//-------------------------------------- |
374 |
/** |
/** |
375 |
* 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). |
376 |
*/ |
*/ |
377 |
cTrkLevel1* TrkCluster::GetLevel1Struct(){ |
void TrkCluster::GetLevel1Struct(cTrkLevel1* l1){ |
378 |
|
|
379 |
// cTrkLevel1* l1 = new cTrkLevel1; |
// cTrkLevel1* l1 = new cTrkLevel1; |
380 |
|
|
381 |
cTrkLevel1* l1 = &level1event_ ; |
// cTrkLevel1* l1 = &level1event_ ; |
382 |
|
|
383 |
l1->nclstr1 = 1; |
l1->nclstr1 = 1; |
384 |
l1->view[0] = view; |
l1->view[0] = view; |
396 |
l1->clbad[i] = clbad[i]; |
l1->clbad[i] = clbad[i]; |
397 |
}; |
}; |
398 |
|
|
399 |
return l1; |
// return l1; |
400 |
}; |
}; |
401 |
//-------------------------------------- |
//-------------------------------------- |
402 |
// |
// |
448 |
// |
// |
449 |
//-------------------------------------- |
//-------------------------------------- |
450 |
/** |
/** |
451 |
* 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 |
452 |
|
* with the maximum signal (TrkCluster::maxs), by applying the non-linear |
453 |
|
* ETA-algorythm. |
454 |
* @param neta Number of strips to evaluate ETA. |
* @param neta Number of strips to evaluate ETA. |
455 |
* @param angle Projected angle between particle track and detector plane. |
* @param angle Projected (effective) angle between particle track and detector plane. |
456 |
|
* @landi flag to apply Landi correction |
457 |
* 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. |
458 |
*/ |
*/ |
459 |
Float_t TrkCluster::GetETA(Int_t neta, float angle){ |
Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi){ |
460 |
|
|
461 |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
462 |
// LoadPfaParam(); |
// LoadPfaParam(); |
463 |
|
|
464 |
|
TrkParams::Load(4); |
465 |
|
if( !TrkParams::IsLoaded(4) ){ |
466 |
|
cout << "Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
467 |
|
return 0; |
468 |
|
} |
469 |
|
|
470 |
float ax = angle; |
float ax = angle; |
471 |
int ic = 1; |
int ic = 1; |
472 |
GetLevel1Struct(); |
GetLevel1Struct(); |
473 |
if(neta == 0) return pfaeta_(&ic,&ax); |
if( neta == 0 && !landi) return pfaeta_(&ic,&ax); |
474 |
else if(neta == 2) return pfaeta2_(&ic,&ax); |
else if(neta == 0 && landi ) return pfaetal_(&ic,&ax); |
475 |
else if(neta == 3) return pfaeta3_(&ic,&ax); |
else if(neta == 2 ) return pfaeta2_(&ic,&ax); |
476 |
else if(neta == 4) return pfaeta4_(&ic,&ax); |
else if(neta == 3 ) return pfaeta3_(&ic,&ax); |
477 |
else cout << "ETA"<<neta<<" not implemented\n"; |
else if(neta == 4 ) return pfaeta4_(&ic,&ax); |
478 |
|
else cout << "TrkCluster::GetETA("<<neta<<","<<angle<<","<<landi<<") not implemented\n"; |
479 |
return 0; |
return 0; |
480 |
|
|
481 |
}; |
}; |
482 |
|
|
483 |
|
/** |
484 |
|
* Evaluates the cluster position, in pitch unit, relative to the strip with |
485 |
|
* the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams). |
486 |
|
* @param angle Projected (effective) angle between particle track and detector plane. |
487 |
|
*/ |
488 |
|
Float_t TrkCluster::GetPositionPU(float angle){ |
489 |
|
|
490 |
|
if ( TrkParams::GetPFA() == 0 )return GetETA(0,angle,false); |
491 |
|
else if( TrkParams::GetPFA() == 2 )return GetETA(2,angle,false); |
492 |
|
else if( TrkParams::GetPFA() == 3 )return GetETA(3,angle,false); |
493 |
|
else if( TrkParams::GetPFA() == 4 )return GetETA(4,angle,false); |
494 |
|
else if( TrkParams::GetPFA() == 5 )return GetETA(0,angle,true); |
495 |
|
else if( TrkParams::GetPFA() == 10 )return GetCOG(0); |
496 |
|
else if( TrkParams::GetPFA() == 11 )return GetCOG(1); |
497 |
|
else if( TrkParams::GetPFA() == 12 )return GetCOG(2); |
498 |
|
else if( TrkParams::GetPFA() == 13 )return GetCOG(3); |
499 |
|
else if( TrkParams::GetPFA() == 14 )return GetCOG(4); |
500 |
|
else cout << " TrkCluster::GetPositionPU(float "<<angle<<") -- WARNING -- PFA="<<TrkParams::GetPFA()<<" not implemented"<<endl; |
501 |
|
|
502 |
|
return 0.; |
503 |
|
|
504 |
|
} |
505 |
|
|
506 |
|
/** |
507 |
|
* Give the number of strip used to evaluate the cluster coordinate |
508 |
|
* according to the p.f.a. |
509 |
|
* It returns 0 when the COG is used (in this case the number of strip used |
510 |
|
* equals the multiplicity). |
511 |
|
*/ |
512 |
|
Int_t TrkCluster::GetPFAstrips(float angle){ |
513 |
|
|
514 |
|
float ax = angle; |
515 |
|
int ic = 1; |
516 |
|
GetLevel1Struct(); |
517 |
|
return npfastrips_(&ic,&ax); |
518 |
|
|
519 |
|
} |
520 |
|
|
521 |
//-------------------------------------- |
//-------------------------------------- |
522 |
// |
// |
523 |
// |
// |
524 |
//-------------------------------------- |
//-------------------------------------- |
525 |
TrkLevel1::TrkLevel1(){ |
TrkLevel1::TrkLevel1(){ |
526 |
|
|
527 |
Cluster = new TClonesArray("TrkCluster"); |
// cout << "TrkLevel1::TrkLevel1()"<<endl; |
528 |
|
// Cluster = new TClonesArray("TrkCluster"); |
529 |
|
Cluster = 0; |
530 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
531 |
good[i] = -1; |
good[i] = -1; |
532 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
533 |
cn[j][i]=0; |
cn[j][i]=0; |
|
// cnrms[j][i]=0; |
|
534 |
cnn[j][i]=0; |
cnn[j][i]=0; |
535 |
}; |
}; |
536 |
}; |
}; |
537 |
|
// TrkParams::SetTrackingMode(); |
538 |
|
// TrkParams::SetPrecisionFactor(); |
539 |
|
// TrkParams::SetStepMin(); |
540 |
|
TrkParams::SetMiniDefault(); |
541 |
|
TrkParams::SetPFA(); |
542 |
|
} |
543 |
|
//-------------------------------------- |
544 |
|
// |
545 |
|
// |
546 |
|
//-------------------------------------- |
547 |
|
void TrkLevel1::Set(){ |
548 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
549 |
} |
} |
550 |
//-------------------------------------- |
//-------------------------------------- |
551 |
// |
// |
566 |
cout <<endl; |
cout <<endl; |
567 |
} |
} |
568 |
|
|
569 |
|
if(!Cluster)return; |
570 |
TClonesArray &t = *Cluster; |
TClonesArray &t = *Cluster; |
571 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
572 |
|
|
573 |
} |
} |
574 |
|
/** |
575 |
|
* \brief Dump processing status |
576 |
|
*/ |
577 |
|
void TrkLevel1::StatusDump(int view){ |
578 |
|
cout << "DSP n. "<<view+1<<" (level1-)status: "<<hex<<showbase<<good[view]<<dec<<endl; |
579 |
|
}; |
580 |
|
/** |
581 |
|
* \brief Check event status |
582 |
|
* |
583 |
|
* Check the event status, according to a flag-mask given as input. |
584 |
|
* Return true if the view passes the check. |
585 |
|
* |
586 |
|
* @param view View number (0-11) |
587 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
588 |
|
* no crc error, no software alarm) |
589 |
|
* |
590 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
591 |
|
* |
592 |
|
*/ |
593 |
|
Bool_t TrkLevel1::StatusCheck(int view, int flagmask){ |
594 |
|
|
595 |
|
if( view<0 || view >= 12)return false; |
596 |
|
return !(good[view]&flagmask); |
597 |
|
|
598 |
|
}; |
599 |
|
|
600 |
|
|
601 |
//-------------------------------------- |
//-------------------------------------- |
602 |
// |
// |
603 |
// |
// |
605 |
/** |
/** |
606 |
* 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). |
607 |
*/ |
*/ |
608 |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1){ |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){ |
609 |
|
|
610 |
|
// cout << "void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full)"<<endl; |
611 |
|
|
612 |
|
Clear(); |
613 |
|
// --------------- |
614 |
// *** CLUSTER *** |
// *** CLUSTER *** |
615 |
|
// --------------- |
616 |
TrkCluster* t_cl = new TrkCluster(); |
TrkCluster* t_cl = new TrkCluster(); |
617 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
618 |
TClonesArray &t = *Cluster; |
TClonesArray &t = *Cluster; |
619 |
for(int i=0; i<l1->nclstr1; i++){ |
for(int i=0; i<l1->nclstr1; i++){ |
620 |
|
|
621 |
|
t_cl->Clear(); |
622 |
|
// if( full || (!full && l1->whichtrack[i]) ){ |
623 |
|
|
624 |
t_cl->view = l1->view[i]; |
t_cl->view = l1->view[i]; |
625 |
t_cl->maxs = l1->maxs[i]; |
t_cl->maxs = l1->maxs[i]; |
626 |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
|
627 |
|
if( full || (!full && l1->whichtrack[i]) ){ |
628 |
Int_t from = l1->indstart[i] -1; |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
629 |
Int_t to = l1->totCLlength ; |
Int_t from = l1->indstart[i] -1; |
630 |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
Int_t to = l1->totCLlength ; |
631 |
t_cl->CLlength = to - from ; |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
632 |
|
t_cl->CLlength = to - from ; |
633 |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
|
634 |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
635 |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
636 |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
637 |
Int_t index = 0; |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
638 |
for(Int_t is = from; is < to; is++ ){ |
|
639 |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
Int_t index = 0; |
640 |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
for(Int_t is = from; is < to; is++ ){ |
641 |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
642 |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
643 |
index++; |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
644 |
}; |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
645 |
|
index++; |
646 |
new(t[i]) TrkCluster(*t_cl); |
}; |
647 |
|
} |
648 |
|
new(t[i]) TrkCluster(*t_cl); // <<< store cluster |
649 |
}; |
}; |
650 |
|
|
651 |
delete t_cl; |
delete t_cl; |
652 |
|
|
653 |
|
// ------------------------- |
654 |
// ****general variables**** |
// ****general variables**** |
655 |
|
// ------------------------- |
656 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
657 |
good[i] = l1->good[i]; |
good[i] = l1->good[i]; |
658 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
667 |
* 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). |
668 |
*/ |
*/ |
669 |
|
|
670 |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
void TrkLevel1::GetLevel1Struct(cTrkLevel1* l1) { |
671 |
|
|
672 |
cTrkLevel1 *l1=0; |
// cTrkLevel1* l1 = &level1event_ ; |
673 |
// |
|
674 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
675 |
l1->good[i] = good[i]; |
l1->good[i] = good[i]; |
676 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
677 |
l1->cnev[j][i] = cn[j][i]; |
l1->cnev[j][i] = cn[j][i] ; |
678 |
// l1->cnrmsev[j][i] = cnrms[j][i]; |
l1->cnnev[j][i] = cnn[j][i] ; |
679 |
l1->cnnev[j][i] = cnn[j][i]; |
l1->cnrmsev[j][i] = 0. ; |
680 |
}; |
}; |
681 |
|
l1->fshower[i] = 0; |
682 |
}; |
}; |
683 |
|
|
684 |
// *** CLUSTERS *** |
l1->nclstr1=0; |
685 |
l1->nclstr1 = Cluster->GetEntries(); |
l1->totCLlength=0; |
686 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
Int_t index=0; |
687 |
|
if(Cluster){ |
688 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
Int_t i=0; |
689 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
for(Int_t ii=0;ii<Cluster->GetEntries();ii++){ |
690 |
// COMPLETARE // |
TrkCluster *clu = GetCluster(ii); |
691 |
// COMPLETARE // |
// ---------------------------------------- |
692 |
// COMPLETARE // |
// attenzione!! |
693 |
// COMPLETARE // |
// se il cluster non e` salvato (view = 0) |
694 |
// COMPLETARE // |
// DEVE essere escluso dal common F77 |
695 |
// COMPLETARE // |
// ---------------------------------------- |
696 |
|
if(clu->view != 0 ){ |
697 |
} |
l1->view[i] = clu->view; |
698 |
// COMPLETARE // |
l1->ladder[i] = clu->GetLadder(); |
699 |
// COMPLETARE // |
l1->maxs[i] = clu->maxs; |
700 |
// COMPLETARE // |
l1->mult[i] = clu->GetMultiplicity(); |
701 |
// COMPLETARE // |
l1->dedx[i] = clu->GetSignal(); |
702 |
// COMPLETARE // |
l1->indstart[i] = index+1; |
703 |
// COMPLETARE // |
l1->indmax[i] = l1->indstart[i] + clu->indmax; |
704 |
return l1; |
l1->totCLlength += clu->CLlength; |
705 |
|
for(Int_t iw=0; iw < clu->CLlength; iw++){ |
706 |
|
l1->clsignal[index] = clu->clsignal[iw]; |
707 |
|
l1->clsigma[index] = clu->clsigma[iw]; |
708 |
|
l1->cladc[index] = clu->cladc[iw]; |
709 |
|
l1->clbad[index] = clu->clbad[iw]; |
710 |
|
index++; |
711 |
|
} |
712 |
|
i++; |
713 |
|
} |
714 |
|
} |
715 |
|
l1->nclstr1 = i; |
716 |
|
} |
717 |
|
|
718 |
|
// return l1; |
719 |
} |
} |
720 |
//-------------------------------------- |
//-------------------------------------- |
721 |
// |
// |
727 |
good[i] = -1; |
good[i] = -1; |
728 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
729 |
cn[j][i] = 0; |
cn[j][i] = 0; |
|
// cnrms[j][i] = 0; |
|
730 |
cnn[j][i] = 0; |
cnn[j][i] = 0; |
731 |
}; |
}; |
732 |
}; |
}; |
733 |
// |
// if(Cluster)Cluster->Clear("C"); |
734 |
Cluster->Clear(); |
if(Cluster)Cluster->Delete(); |
735 |
|
|
736 |
} |
} |
737 |
//-------------------------------------- |
//-------------------------------------- |
739 |
// |
// |
740 |
//-------------------------------------- |
//-------------------------------------- |
741 |
void TrkLevel1::Delete(){ |
void TrkLevel1::Delete(){ |
742 |
|
|
743 |
for(Int_t i=0; i<12 ; i++){ |
// Clear(); |
744 |
good[i] = -1; |
if(Cluster)Cluster->Delete(); |
745 |
for(Int_t j=0; j<24 ; j++){ |
if(Cluster)delete Cluster; |
|
cn[j][i] = 0; |
|
|
// cnrms[j][i] = 0; |
|
|
cnn[j][i] = 0; |
|
|
}; |
|
|
}; |
|
|
// |
|
|
Cluster->Delete(); |
|
746 |
|
|
747 |
} |
} |
|
|
|
748 |
//-------------------------------------- |
//-------------------------------------- |
749 |
// |
// |
750 |
// |
// |
751 |
//-------------------------------------- |
//-------------------------------------- |
752 |
TrkCluster *TrkLevel1::GetCluster(int is){ |
TrkCluster *TrkLevel1::GetCluster(int is){ |
753 |
|
|
754 |
if(is >= this->nclstr()){ |
if(!Cluster)return 0; |
755 |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
if(is >= nclstr()){ |
756 |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
757 |
return 0; |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
758 |
} |
return 0; |
759 |
TClonesArray &t = *(Cluster); |
} |
760 |
TrkCluster *cluster = (TrkCluster*)t[is]; |
|
761 |
return cluster; |
TClonesArray &t = *(Cluster); |
762 |
|
TrkCluster *cluster = (TrkCluster*)t[is]; |
763 |
|
return cluster; |
764 |
} |
} |
765 |
//-------------------------------------- |
//-------------------------------------- |
766 |
// |
// |
767 |
// |
// |
768 |
//-------------------------------------- |
//-------------------------------------- |
769 |
|
// /** |
770 |
|
// * Load Position-Finding-Algorythm parameters (call the F77 routine). |
771 |
|
// * |
772 |
|
// */ |
773 |
|
// int TrkLevel1::LoadPfaParam(TString path){ |
774 |
|
|
775 |
|
// if( path.IsNull() ){ |
776 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
777 |
|
// if(path.IsNull()){ |
778 |
|
// cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl; |
779 |
|
// return 0; |
780 |
|
// } |
781 |
|
// path.Append("/trk-param/eta_param-0/"); |
782 |
|
// } |
783 |
|
|
784 |
|
// strcpy(path_.path,path.Data()); |
785 |
|
// path_.pathlen = path.Length(); |
786 |
|
// path_.error = 0; |
787 |
|
// cout <<"Loading p.f.a. parameters: "<<path<<endl; |
788 |
|
// return readetaparam_(); |
789 |
|
// } |
790 |
|
|
791 |
|
// /** |
792 |
|
// * Load magnetic field parameters (call the F77 routine). |
793 |
|
// * |
794 |
|
// */ |
795 |
|
// int TrkLevel1::LoadFieldParam(TString path){ |
796 |
|
|
797 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
798 |
|
// if( path.IsNull() ){ |
799 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
800 |
|
// if(path.IsNull()){ |
801 |
|
// cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl; |
802 |
|
// return 0; |
803 |
|
// } |
804 |
|
// path.Append("/trk-param/field_param-0/"); |
805 |
|
// } |
806 |
|
// cout <<"Loading magnetic field "<<path<<endl; |
807 |
|
// strcpy(path_.path,path.Data()); |
808 |
|
// path_.pathlen = path.Length(); |
809 |
|
// path_.error = 0; |
810 |
|
// return readb_(); |
811 |
|
// // } |
812 |
|
// // return 0; |
813 |
|
// } |
814 |
|
// /** |
815 |
|
// * Load magnetic field parameters (call the F77 routine). |
816 |
|
// * |
817 |
|
// */ |
818 |
|
// int TrkLevel1::LoadChargeParam(TString path){ |
819 |
|
|
820 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
821 |
|
// if( path.IsNull() ){ |
822 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
823 |
|
// if(path.IsNull()){ |
824 |
|
// cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl; |
825 |
|
// return 0; |
826 |
|
// } |
827 |
|
// path.Append("/trk-param/charge_param-1/"); |
828 |
|
// } |
829 |
|
// cout <<"Loading charge-correlation parameters: "<<path<<endl; |
830 |
|
// strcpy(path_.path,path.Data()); |
831 |
|
// path_.pathlen = path.Length(); |
832 |
|
// path_.error = 0; |
833 |
|
// return readchargeparam_(); |
834 |
|
// // } |
835 |
|
// // return 0; |
836 |
|
// } |
837 |
|
// /** |
838 |
|
// * Load magnetic field parameters (call the F77 routine). |
839 |
|
// * |
840 |
|
// */ |
841 |
|
// int TrkLevel1::LoadAlignmentParam(TString path){ |
842 |
|
|
843 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
844 |
|
// if( path.IsNull() ){ |
845 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
846 |
|
// if(path.IsNull()){ |
847 |
|
// cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl; |
848 |
|
// return 0; |
849 |
|
// } |
850 |
|
// path.Append("/trk-param/align_param-0/"); |
851 |
|
// } |
852 |
|
// cout <<"Loading alignment parameters: "<<path<<endl; |
853 |
|
// strcpy(path_.path,path.Data()); |
854 |
|
// path_.pathlen = path.Length(); |
855 |
|
// path_.error = 0; |
856 |
|
// return readalignparam_(); |
857 |
|
// // } |
858 |
|
// // return 0; |
859 |
|
// } |
860 |
|
// /** |
861 |
|
// * Load magnetic field parameters (call the F77 routine). |
862 |
|
// * |
863 |
|
// */ |
864 |
|
// int TrkLevel1::LoadMipParam(TString path){ |
865 |
|
|
866 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
867 |
|
// if( path.IsNull() ){ |
868 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
869 |
|
// if(path.IsNull()){ |
870 |
|
// cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl; |
871 |
|
// return 0; |
872 |
|
// } |
873 |
|
// path.Append("/trk-param/mip_param-0/"); |
874 |
|
// } |
875 |
|
// cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl; |
876 |
|
// strcpy(path_.path,path.Data()); |
877 |
|
// path_.pathlen = path.Length(); |
878 |
|
// path_.error = 0; |
879 |
|
// return readmipparam_(); |
880 |
|
// // } |
881 |
|
// // return 0; |
882 |
|
// } |
883 |
|
// /** |
884 |
|
// * Load magnetic field parameters (call the F77 routine). |
885 |
|
// * |
886 |
|
// */ |
887 |
|
// int TrkLevel1::LoadVKMaskParam(TString path){ |
888 |
|
|
889 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
890 |
|
// if( path.IsNull() ){ |
891 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
892 |
|
// if(path.IsNull()){ |
893 |
|
// cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl; |
894 |
|
// return 0; |
895 |
|
// } |
896 |
|
// path.Append("/trk-param/mask_param-1/"); |
897 |
|
// } |
898 |
|
// cout <<"Loading VK-mask parameters: "<<path<<endl; |
899 |
|
// strcpy(path_.path,path.Data()); |
900 |
|
// path_.pathlen = path.Length(); |
901 |
|
// path_.error = 0; |
902 |
|
// return readvkmask_(); |
903 |
|
// // } |
904 |
|
// // return 0; |
905 |
|
// } |
906 |
|
|
907 |
|
// /** |
908 |
|
// * Load all (default) parameters. Environment variable must be defined. |
909 |
|
// * |
910 |
|
// */ |
911 |
|
// int TrkLevel1::LoadParams(){ |
912 |
|
|
913 |
|
// int result=0; |
914 |
|
|
915 |
|
// result = result * LoadFieldParam(); |
916 |
|
// result = result * LoadPfaParam(); |
917 |
|
// result = result * LoadChargeParam(); |
918 |
|
// result = result * LoadAlignmentParam(); |
919 |
|
// result = result * LoadMipParam(); |
920 |
|
// result = result * LoadVKMaskParam(); |
921 |
|
|
922 |
|
// return result; |
923 |
|
// } |
924 |
|
|
925 |
|
|
926 |
|
|
927 |
|
int TrkLevel1::GetPfaNbinsAngle(){ |
928 |
|
TrkParams::Load(4); |
929 |
|
if( !TrkParams::IsLoaded(4) ){ |
930 |
|
cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
931 |
|
return 0; |
932 |
|
} |
933 |
|
return pfa_.nangbin; |
934 |
|
}; |
935 |
|
|
936 |
|
int TrkLevel1::GetPfaNbinsETA(){ |
937 |
|
TrkParams::Load(4); |
938 |
|
if( !TrkParams::IsLoaded(4) ){ |
939 |
|
cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
940 |
|
return 0; |
941 |
|
} |
942 |
|
return pfa_.netaval; |
943 |
|
}; |
944 |
|
|
945 |
/** |
/** |
946 |
* Load Position-Finding-Algorythm parameters (call the F77 routine). |
* |
947 |
* |
* |
948 |
*/ |
*/ |
949 |
int TrkLevel1::LoadPfaParam(TString path){ |
float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
950 |
|
|
951 |
if( strcmp(path_.path,path.Data()) ){ |
TrkParams::Load(4); |
952 |
cout <<"Loading p.f.a. parameters\n"; |
if( !TrkParams::IsLoaded(4) ){ |
953 |
strcpy(path_.path,path.Data()); |
cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
|
path_.pathlen = path.Length(); |
|
|
path_.error = 0; |
|
|
return readetaparam_(); |
|
|
} |
|
954 |
return 0; |
return 0; |
955 |
|
} |
956 |
|
|
957 |
|
int nbins = GetPfaNbinsETA(); |
958 |
|
if(!nbins)return 0; |
959 |
|
|
960 |
|
float *fcorr = new float [nbins]; |
961 |
|
|
962 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
963 |
|
for(int ib=0; ib<nbins; ib++){ |
964 |
|
fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
965 |
|
cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
966 |
|
} |
967 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
968 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
969 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
970 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
971 |
|
}else{ |
972 |
|
cout << pfa<<" pfa parameters not implemented "<<endl; |
973 |
|
return 0; |
974 |
|
} |
975 |
|
|
976 |
|
return fcorr; |
977 |
|
|
978 |
|
}; |
979 |
|
|
980 |
|
float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
981 |
|
|
982 |
|
TrkParams::Load(4); |
983 |
|
if( !TrkParams::IsLoaded(4) ){ |
984 |
|
cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
985 |
|
return 0; |
986 |
|
} |
987 |
|
|
988 |
|
int nbins = GetPfaNbinsETA(); |
989 |
|
if(!nbins)return 0; |
990 |
|
|
991 |
|
float *fcorr = new float [nbins]; |
992 |
|
|
993 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
994 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
995 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
996 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
997 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
998 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
999 |
|
}else{ |
1000 |
|
cout << pfa<<" pfa parameters not implemented "<<endl; |
1001 |
|
return 0; |
1002 |
|
} |
1003 |
|
|
1004 |
|
return fcorr; |
1005 |
|
|
1006 |
|
}; |
1007 |
|
|
1008 |
|
/** |
1009 |
|
* Method to call the F77 routine that performs level1->level2 processing. |
1010 |
|
* The level2 output is stored in a common block, which can be retrieved |
1011 |
|
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
1012 |
|
* NB If the TrkLevel1 object is readout from a tree, and the |
1013 |
|
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
1014 |
|
* should be payed to the fact that single clusters (clusters not associated |
1015 |
|
* with any track) might not be stored. Full reprocessing should be done starting |
1016 |
|
* from level0 data. |
1017 |
|
*/ |
1018 |
|
//int TrkLevel1::ProcessEvent(int pfa){ |
1019 |
|
int TrkLevel1::ProcessEvent(){ |
1020 |
|
|
1021 |
|
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
1022 |
|
TrkParams::Load( ); |
1023 |
|
if( !TrkParams::IsLoaded() )return 0; |
1024 |
|
|
1025 |
|
GetLevel1Struct(); |
1026 |
|
|
1027 |
|
// analysisflight_(&pfa); |
1028 |
|
// TrkParams::SetPFA(pfa); |
1029 |
|
analysisflight_(); |
1030 |
|
|
1031 |
|
return 1; |
1032 |
|
|
1033 |
} |
} |
1034 |
|
|
1035 |
|
|