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 |
|
|
20 |
} |
} |
21 |
//-------------------------------------- |
//-------------------------------------- |
24 |
//-------------------------------------- |
//-------------------------------------- |
25 |
TrkCluster::TrkCluster(){ |
TrkCluster::TrkCluster(){ |
26 |
|
|
27 |
view = 0; |
// cout << "TrkCluster::TrkCluster()"<<endl; |
28 |
maxs = 0; |
view = -1; |
29 |
indmax = 0; |
maxs = -1; |
30 |
|
indmax = -1; |
31 |
CLlength = 0; |
|
32 |
clsignal = 0; |
CLlength = 0; |
33 |
clsigma = 0; |
clsignal = 0; |
34 |
cladc = 0; |
clsigma = 0; |
35 |
clbad = 0; |
cladc = 0; |
36 |
|
clbad = 0; |
37 |
|
|
38 |
}; |
}; |
39 |
//-------------------------------------- |
//-------------------------------------- |
40 |
// |
// |
41 |
// |
// |
42 |
//-------------------------------------- |
//-------------------------------------- |
|
TrkCluster::~TrkCluster(){ |
|
|
|
|
|
delete [] clsignal; |
|
|
delete [] clsigma; |
|
|
delete [] cladc; |
|
|
delete [] clbad; |
|
|
}; |
|
|
//-------------------------------------- |
|
|
// |
|
|
// |
|
|
//-------------------------------------- |
|
43 |
TrkCluster::TrkCluster(const TrkCluster& t){ |
TrkCluster::TrkCluster(const TrkCluster& t){ |
44 |
|
|
45 |
view = t.view; |
view = t.view; |
46 |
maxs = t.maxs; |
maxs = t.maxs; |
47 |
indmax = t.indmax; |
indmax = t.indmax; |
48 |
|
|
49 |
CLlength = t.CLlength; |
CLlength = t.CLlength; |
50 |
|
if(CLlength){ |
51 |
clsignal = new Float_t[CLlength]; |
clsignal = new Float_t[CLlength]; |
52 |
clsigma = new Float_t[CLlength]; |
clsigma = new Float_t[CLlength]; |
53 |
cladc = new Int_t[CLlength]; |
cladc = new Int_t[CLlength]; |
54 |
clbad = new Bool_t[CLlength]; |
clbad = new Bool_t[CLlength]; |
55 |
for(Int_t i=0; i<CLlength;i++){ |
for(Int_t i=0; i<CLlength;i++){ |
56 |
clsignal[i] = t.clsignal[i]; |
clsignal[i] = t.clsignal[i]; |
57 |
clsigma[i] = t.clsigma[i]; |
clsigma[i] = t.clsigma[i]; |
58 |
cladc[i] = t.cladc[i]; |
cladc[i] = t.cladc[i]; |
59 |
clbad[i] = t.clbad[i]; |
clbad[i] = t.clbad[i]; |
60 |
}; |
}; |
61 |
|
}; |
62 |
|
}; |
63 |
|
//-------------------------------------- |
64 |
|
// |
65 |
|
// |
66 |
|
//-------------------------------------- |
67 |
|
void TrkCluster::Clear(){ |
68 |
|
|
69 |
|
// cout << "void TrkCluster::Clear()"<<endl; |
70 |
|
if(CLlength){ |
71 |
|
delete [] clsignal; |
72 |
|
delete [] clsigma; |
73 |
|
delete [] cladc; |
74 |
|
delete [] clbad; |
75 |
|
} |
76 |
|
|
77 |
|
view = 0; |
78 |
|
maxs = 0; |
79 |
|
indmax = 0; |
80 |
|
|
81 |
|
CLlength = 0; |
82 |
|
clsignal = 0; |
83 |
|
clsigma = 0; |
84 |
|
cladc = 0; |
85 |
|
clbad = 0; |
86 |
|
|
87 |
}; |
}; |
88 |
//-------------------------------------- |
//-------------------------------------- |
97 |
* 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. |
98 |
*/ |
*/ |
99 |
Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut){ |
Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut){ |
100 |
|
|
101 |
|
if(CLlength<=0)return 0; |
102 |
|
|
103 |
Float_t s = 0; |
Float_t s = 0; |
104 |
|
|
105 |
if( nstrip<=0 ){ |
if( nstrip<=0 ){ |
149 |
return s; |
return s; |
150 |
}; |
}; |
151 |
|
|
152 |
|
|
153 |
/** |
/** |
154 |
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 |
155 |
* @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. |
|
156 |
* @param nstrip Maximum number of strips. |
* @param nstrip Maximum number of strips. |
157 |
* @param cut Inclusion cut ( s > cut*sigma ). |
* @param cut Inclusion cut ( s > cut*sigma ). |
158 |
* 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. |
159 |
*/ |
*/ |
160 |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip, Float_t cut){ |
Float_t TrkCluster::GetSignalToNoise(Int_t nstrip, Float_t cut){ |
161 |
|
|
162 |
|
if(CLlength<=0)return 0; |
163 |
|
|
164 |
Float_t sn = 0; |
Float_t sn = 0; |
165 |
|
|
166 |
if( nstrip<=0 ){ |
if( nstrip<=0 ){ |
210 |
* @param cut Inclusion cut. |
* @param cut Inclusion cut. |
211 |
*/ |
*/ |
212 |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
213 |
Int_t m = 0; |
|
214 |
for(Int_t is = 0; is < CLlength; is++){ |
if(CLlength<=0)return 0; |
215 |
Float_t scut = cut*clsigma[is]; |
|
216 |
if(clsignal[is] > scut) m++; |
Int_t m = 0; |
217 |
}; |
|
218 |
return m; |
for(Int_t is = indmax+1; is < CLlength; is++){ |
219 |
|
Float_t scut = cut*clsigma[is]; |
220 |
|
if(clsignal[is] > scut) m++; |
221 |
|
else break; |
222 |
|
}; |
223 |
|
for(Int_t is = indmax; is >=0; is--){ |
224 |
|
Float_t scut = cut*clsigma[is]; |
225 |
|
if(clsignal[is] > scut) m++; |
226 |
|
else break; |
227 |
|
}; |
228 |
|
return m; |
229 |
}; |
}; |
230 |
/** |
/** |
231 |
* True if the cluster contains bad strips. |
* True if the cluster contains bad strips. |
232 |
* @param nbad Number of strips around the maximum. |
* @param nbad Number of strips around the maximum. |
233 |
*/ |
*/ |
234 |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
Bool_t TrkCluster::IsBad(Int_t nbad){ |
235 |
|
|
236 |
/* Float_t max = 0; |
if(CLlength<=0)return 0; |
237 |
Int_t imax = 0; |
|
238 |
for(Int_t is = 0; is < CLlength; is++){ |
Int_t il,ir; |
239 |
if(clsignal[is] > max){ |
il = indmax; |
240 |
max = clsignal[is]; |
ir = indmax; |
241 |
imax = is; |
for(Int_t i=1; i<nbad; i++){ |
242 |
}; |
if (ir == CLlength && il == 0)break; |
243 |
}; |
else if (ir == CLlength && il != 0)il--; |
244 |
|
else if (ir != CLlength && il == 0)ir++; |
245 |
Int_t il,ir; |
else{ |
246 |
il = imax; |
if(clsignal[il-1] > clsignal[ir+1])il--; |
247 |
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++; |
|
|
} |
|
248 |
} |
} |
249 |
Int_t isbad = 0; |
} |
250 |
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
Int_t isbad = 0; |
251 |
|
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
252 |
return ( isbad != nbad ); |
|
253 |
|
return ( isbad != nbad ); |
254 |
}; |
}; |
255 |
|
/** |
256 |
|
* True if the cluster contains saturated strips. |
257 |
|
* @param nbad Number of strips around the maximum. |
258 |
|
*/ |
259 |
|
Bool_t TrkCluster::IsSaturated(Int_t nbad){ |
260 |
|
|
261 |
|
if(CLlength<=0)return 0; |
262 |
|
|
263 |
|
Int_t il,ir; |
264 |
|
il = indmax; |
265 |
|
ir = indmax; |
266 |
|
for(Int_t i=1; i<nbad; i++){ |
267 |
|
if (ir == CLlength && il == 0)break; |
268 |
|
else if (ir == CLlength && il != 0)il--; |
269 |
|
else if (ir != CLlength && il == 0)ir++; |
270 |
|
else{ |
271 |
|
if(clsignal[il-1] > clsignal[ir+1])il--; |
272 |
|
else ir++; |
273 |
|
} |
274 |
|
} |
275 |
|
Int_t isbad = 0; |
276 |
|
for(Int_t i=il; i<=ir; i++){ |
277 |
|
if( IsX() && cladc[i] > 2980 )isbad++; |
278 |
|
if( IsY() && cladc[i] < 80 )isbad++; |
279 |
|
} |
280 |
|
return ( isbad != 0 ); |
281 |
|
|
282 |
|
} |
283 |
//-------------------------------------- |
//-------------------------------------- |
284 |
// |
// |
285 |
// |
// |
286 |
//-------------------------------------- |
//-------------------------------------- |
287 |
void TrkCluster::Dump(){ |
void TrkCluster::Dump(){ |
288 |
|
|
289 |
cout << "----- Cluster" << endl; |
cout << "----- Cluster" << endl; |
290 |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
291 |
cout << "Position of maximun "<< maxs <<endl; |
cout << "Position of maximun "<< maxs <<endl; |
292 |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
293 |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
294 |
cout << "Signal/Noise "<< GetSignalToNoise(); |
cout << "Signal/Noise "<< GetSignalToNoise(); |
295 |
cout <<endl<< "Strip signals "; |
cout <<endl<< "Strip signals "; |
296 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
297 |
cout <<endl<< "Strip sigmas "; |
cout <<endl<< "Strip sigmas "; |
298 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
299 |
cout <<endl<< "Strip ADC "; |
cout <<endl<< "Strip ADC "; |
300 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
301 |
cout <<endl<< "Strip BAD "; |
cout <<endl<< "Strip BAD "; |
302 |
for(Int_t i =0; i<CLlength; i++){ |
for(Int_t i =0; i<CLlength; i++){ |
303 |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
304 |
else cout << " " <<clbad[i]; |
else cout << " " <<clbad[i]; |
305 |
} |
} |
306 |
cout << endl; |
cout << endl; |
307 |
|
|
308 |
} |
} |
309 |
//-------------------------------------- |
//-------------------------------------- |
313 |
/** |
/** |
314 |
* 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). |
315 |
*/ |
*/ |
316 |
cTrkLevel1* TrkCluster::GetLevel1Struct(){ |
void TrkCluster::GetLevel1Struct(cTrkLevel1* l1){ |
317 |
|
|
318 |
// cTrkLevel1* l1 = new cTrkLevel1; |
// cTrkLevel1* l1 = new cTrkLevel1; |
319 |
|
|
320 |
cTrkLevel1* l1 = &level1event_ ; |
// cTrkLevel1* l1 = &level1event_ ; |
321 |
|
|
322 |
l1->nclstr1 = 1; |
l1->nclstr1 = 1; |
323 |
l1->view[0] = view; |
l1->view[0] = view; |
335 |
l1->clbad[i] = clbad[i]; |
l1->clbad[i] = clbad[i]; |
336 |
}; |
}; |
337 |
|
|
338 |
return l1; |
// return l1; |
339 |
}; |
}; |
340 |
//-------------------------------------- |
//-------------------------------------- |
341 |
// |
// |
397 |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
398 |
// LoadPfaParam(); |
// LoadPfaParam(); |
399 |
|
|
400 |
|
TrkParams::Load(4); |
401 |
|
if( !TrkParams::IsLoaded(4) ){ |
402 |
|
cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
403 |
|
return 0; |
404 |
|
} |
405 |
|
|
406 |
float ax = angle; |
float ax = angle; |
407 |
int ic = 1; |
int ic = 1; |
408 |
GetLevel1Struct(); |
GetLevel1Struct(); |
421 |
//-------------------------------------- |
//-------------------------------------- |
422 |
TrkLevel1::TrkLevel1(){ |
TrkLevel1::TrkLevel1(){ |
423 |
|
|
424 |
Cluster = new TClonesArray("TrkCluster"); |
// cout << "TrkLevel1::TrkLevel1()"<<endl; |
425 |
|
// Cluster = new TClonesArray("TrkCluster"); |
426 |
|
Cluster = 0; |
427 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
428 |
good[i] = -1; |
good[i] = -1; |
429 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
430 |
cn[j][i]=0; |
cn[j][i]=0; |
|
// cnrms[j][i]=0; |
|
431 |
cnn[j][i]=0; |
cnn[j][i]=0; |
432 |
}; |
}; |
433 |
}; |
}; |
434 |
|
TrkParams::SetTrackingMode(); |
435 |
|
TrkParams::SetPrecisionFactor(); |
436 |
|
TrkParams::SetStepMin(); |
437 |
|
TrkParams::SetPFA(); |
438 |
|
} |
439 |
|
//-------------------------------------- |
440 |
|
// |
441 |
|
// |
442 |
|
//-------------------------------------- |
443 |
|
void TrkLevel1::Set(){ |
444 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
445 |
} |
} |
446 |
//-------------------------------------- |
//-------------------------------------- |
447 |
// |
// |
452 |
cout<<"DSP status: "; |
cout<<"DSP status: "; |
453 |
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
454 |
cout<<endl; |
cout<<endl; |
455 |
|
cout<<"VA1 mask : "<<endl; |
456 |
|
for(Int_t i=0; i<12 ; i++){ |
457 |
|
for(Int_t ii=0; ii<24 ; ii++){ |
458 |
|
Int_t mask = cnn[ii][i]; |
459 |
|
if(mask>0)mask=1; |
460 |
|
cout<<mask<<" "; |
461 |
|
} |
462 |
|
cout <<endl; |
463 |
|
} |
464 |
|
|
465 |
|
if(!Cluster)return; |
466 |
TClonesArray &t = *Cluster; |
TClonesArray &t = *Cluster; |
467 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
468 |
|
|
474 |
/** |
/** |
475 |
* 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). |
476 |
*/ |
*/ |
477 |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1){ |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){ |
478 |
|
|
479 |
|
// cout << "void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full)"<<endl; |
480 |
|
|
481 |
|
Clear(); |
482 |
|
// --------------- |
483 |
// *** CLUSTER *** |
// *** CLUSTER *** |
484 |
|
// --------------- |
485 |
TrkCluster* t_cl = new TrkCluster(); |
TrkCluster* t_cl = new TrkCluster(); |
486 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
487 |
TClonesArray &t = *Cluster; |
TClonesArray &t = *Cluster; |
488 |
for(int i=0; i<l1->nclstr1; i++){ |
for(int i=0; i<l1->nclstr1; i++){ |
489 |
|
|
490 |
|
t_cl->Clear(); |
491 |
|
// if( full || (!full && l1->whichtrack[i]) ){ |
492 |
|
|
493 |
t_cl->view = l1->view[i]; |
t_cl->view = l1->view[i]; |
494 |
t_cl->maxs = l1->maxs[i]; |
t_cl->maxs = l1->maxs[i]; |
495 |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
|
496 |
|
if( full || (!full && l1->whichtrack[i]) ){ |
497 |
Int_t from = l1->indstart[i] -1; |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
498 |
Int_t to = l1->totCLlength ; |
Int_t from = l1->indstart[i] -1; |
499 |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
Int_t to = l1->totCLlength ; |
500 |
t_cl->CLlength = to - from ; |
if(i != l1->nclstr1-1)to = l1->indstart[i+1] -1 ; |
501 |
|
t_cl->CLlength = to - from ; |
502 |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
|
503 |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
t_cl->clsignal = new Float_t[t_cl->CLlength]; |
504 |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
505 |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
506 |
Int_t index = 0; |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
507 |
for(Int_t is = from; is < to; is++ ){ |
Int_t index = 0; |
508 |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
for(Int_t is = from; is < to; is++ ){ |
509 |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
510 |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
t_cl->clsigma[index] = (Float_t) l1->clsigma[is]; |
511 |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
t_cl->cladc[index] = (Int_t) l1->cladc[is]; |
512 |
index++; |
t_cl->clbad[index] = (Bool_t) l1->clbad[is]; |
513 |
}; |
index++; |
514 |
|
}; |
515 |
new(t[i]) TrkCluster(*t_cl); |
} |
516 |
|
new(t[i]) TrkCluster(*t_cl); // <<< store cluster |
517 |
}; |
}; |
518 |
|
|
519 |
delete t_cl; |
delete t_cl; |
520 |
|
|
521 |
|
// ------------------------- |
522 |
// ****general variables**** |
// ****general variables**** |
523 |
|
// ------------------------- |
524 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
525 |
good[i] = l1->good[i]; |
good[i] = l1->good[i]; |
526 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
535 |
* 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). |
536 |
*/ |
*/ |
537 |
|
|
538 |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
void TrkLevel1::GetLevel1Struct(cTrkLevel1* l1) { |
539 |
|
|
540 |
cTrkLevel1 *l1=0; |
// cTrkLevel1* l1 = &level1event_ ; |
541 |
// |
|
542 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
543 |
l1->good[i] = good[i]; |
l1->good[i] = good[i]; |
544 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
545 |
l1->cnev[j][i] = cn[j][i]; |
l1->cnev[j][i] = cn[j][i] ; |
546 |
// l1->cnrmsev[j][i] = cnrms[j][i]; |
l1->cnnev[j][i] = cnn[j][i] ; |
547 |
l1->cnnev[j][i] = cnn[j][i]; |
l1->cnrmsev[j][i] = 0. ; |
548 |
}; |
}; |
549 |
|
l1->fshower[i] = 0; |
550 |
}; |
}; |
551 |
|
|
552 |
// *** CLUSTERS *** |
l1->nclstr1=0; |
553 |
l1->nclstr1 = Cluster->GetEntries(); |
l1->totCLlength=0; |
554 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
Int_t index=0; |
555 |
|
if(Cluster){ |
556 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
Int_t i=0; |
557 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
for(Int_t ii=0;ii<Cluster->GetEntries();ii++){ |
558 |
// COMPLETARE // |
TrkCluster *clu = GetCluster(ii); |
559 |
// COMPLETARE // |
// ---------------------------------------- |
560 |
// COMPLETARE // |
// attenzione!! |
561 |
// COMPLETARE // |
// se il cluster non e` salvato (view = 0) |
562 |
// COMPLETARE // |
// DEVE essere escluso dal common F77 |
563 |
// COMPLETARE // |
// ---------------------------------------- |
564 |
|
if(clu->view != 0 ){ |
565 |
} |
l1->view[i] = clu->view; |
566 |
// COMPLETARE // |
l1->ladder[i] = clu->GetLadder(); |
567 |
// COMPLETARE // |
l1->maxs[i] = clu->maxs; |
568 |
// COMPLETARE // |
l1->mult[i] = clu->GetMultiplicity(); |
569 |
// COMPLETARE // |
l1->dedx[i] = clu->GetSignal(); |
570 |
// COMPLETARE // |
l1->indstart[i] = index+1; |
571 |
// COMPLETARE // |
l1->indmax[i] = l1->indstart[i] + clu->indmax; |
572 |
return l1; |
l1->totCLlength += clu->CLlength; |
573 |
|
for(Int_t iw=0; iw < clu->CLlength; iw++){ |
574 |
|
l1->clsignal[index] = clu->clsignal[iw]; |
575 |
|
l1->clsigma[index] = clu->clsigma[iw]; |
576 |
|
l1->cladc[index] = clu->cladc[iw]; |
577 |
|
l1->clbad[index] = clu->clbad[iw]; |
578 |
|
index++; |
579 |
|
} |
580 |
|
i++; |
581 |
|
} |
582 |
|
} |
583 |
|
l1->nclstr1 = i; |
584 |
|
} |
585 |
|
|
586 |
|
// return l1; |
587 |
} |
} |
588 |
//-------------------------------------- |
//-------------------------------------- |
589 |
// |
// |
595 |
good[i] = -1; |
good[i] = -1; |
596 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
597 |
cn[j][i] = 0; |
cn[j][i] = 0; |
|
// cnrms[j][i] = 0; |
|
598 |
cnn[j][i] = 0; |
cnn[j][i] = 0; |
599 |
}; |
}; |
600 |
}; |
}; |
601 |
// |
// if(Cluster)Cluster->Clear("C"); |
602 |
Cluster->Clear(); |
if(Cluster)Cluster->Delete(); |
603 |
|
|
604 |
} |
} |
605 |
//-------------------------------------- |
//-------------------------------------- |
607 |
// |
// |
608 |
//-------------------------------------- |
//-------------------------------------- |
609 |
void TrkLevel1::Delete(){ |
void TrkLevel1::Delete(){ |
610 |
|
|
611 |
for(Int_t i=0; i<12 ; i++){ |
// Clear(); |
612 |
good[i] = -1; |
if(Cluster)Cluster->Delete(); |
613 |
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(); |
|
614 |
|
|
615 |
} |
} |
|
|
|
616 |
//-------------------------------------- |
//-------------------------------------- |
617 |
// |
// |
618 |
// |
// |
619 |
//-------------------------------------- |
//-------------------------------------- |
620 |
TrkCluster *TrkLevel1::GetCluster(int is){ |
TrkCluster *TrkLevel1::GetCluster(int is){ |
621 |
|
|
622 |
if(is >= this->nclstr()){ |
if(!Cluster)return 0; |
623 |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
if(is >= nclstr()){ |
624 |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
cout << "** TrkLevel1::GetCluster(int) ** Cluster "<< is << " does not exits! " << endl; |
625 |
return 0; |
cout << "( Stored clusters nclstr() = "<< this->nclstr()<<" )" << endl; |
626 |
} |
return 0; |
627 |
TClonesArray &t = *(Cluster); |
} |
628 |
TrkCluster *cluster = (TrkCluster*)t[is]; |
|
629 |
return cluster; |
TClonesArray &t = *(Cluster); |
630 |
|
TrkCluster *cluster = (TrkCluster*)t[is]; |
631 |
|
return cluster; |
632 |
} |
} |
633 |
//-------------------------------------- |
//-------------------------------------- |
634 |
// |
// |
635 |
// |
// |
636 |
//-------------------------------------- |
//-------------------------------------- |
637 |
|
// /** |
638 |
|
// * Load Position-Finding-Algorythm parameters (call the F77 routine). |
639 |
|
// * |
640 |
|
// */ |
641 |
|
// int TrkLevel1::LoadPfaParam(TString path){ |
642 |
|
|
643 |
|
// if( path.IsNull() ){ |
644 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
645 |
|
// if(path.IsNull()){ |
646 |
|
// cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl; |
647 |
|
// return 0; |
648 |
|
// } |
649 |
|
// path.Append("/trk-param/eta_param-0/"); |
650 |
|
// } |
651 |
|
|
652 |
|
// strcpy(path_.path,path.Data()); |
653 |
|
// path_.pathlen = path.Length(); |
654 |
|
// path_.error = 0; |
655 |
|
// cout <<"Loading p.f.a. parameters: "<<path<<endl; |
656 |
|
// return readetaparam_(); |
657 |
|
// } |
658 |
|
|
659 |
|
// /** |
660 |
|
// * Load magnetic field parameters (call the F77 routine). |
661 |
|
// * |
662 |
|
// */ |
663 |
|
// int TrkLevel1::LoadFieldParam(TString path){ |
664 |
|
|
665 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
666 |
|
// if( path.IsNull() ){ |
667 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
668 |
|
// if(path.IsNull()){ |
669 |
|
// cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl; |
670 |
|
// return 0; |
671 |
|
// } |
672 |
|
// path.Append("/trk-param/field_param-0/"); |
673 |
|
// } |
674 |
|
// cout <<"Loading magnetic field "<<path<<endl; |
675 |
|
// strcpy(path_.path,path.Data()); |
676 |
|
// path_.pathlen = path.Length(); |
677 |
|
// path_.error = 0; |
678 |
|
// return readb_(); |
679 |
|
// // } |
680 |
|
// // return 0; |
681 |
|
// } |
682 |
|
// /** |
683 |
|
// * Load magnetic field parameters (call the F77 routine). |
684 |
|
// * |
685 |
|
// */ |
686 |
|
// int TrkLevel1::LoadChargeParam(TString path){ |
687 |
|
|
688 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
689 |
|
// if( path.IsNull() ){ |
690 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
691 |
|
// if(path.IsNull()){ |
692 |
|
// cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl; |
693 |
|
// return 0; |
694 |
|
// } |
695 |
|
// path.Append("/trk-param/charge_param-1/"); |
696 |
|
// } |
697 |
|
// cout <<"Loading charge-correlation parameters: "<<path<<endl; |
698 |
|
// strcpy(path_.path,path.Data()); |
699 |
|
// path_.pathlen = path.Length(); |
700 |
|
// path_.error = 0; |
701 |
|
// return readchargeparam_(); |
702 |
|
// // } |
703 |
|
// // return 0; |
704 |
|
// } |
705 |
|
// /** |
706 |
|
// * Load magnetic field parameters (call the F77 routine). |
707 |
|
// * |
708 |
|
// */ |
709 |
|
// int TrkLevel1::LoadAlignmentParam(TString path){ |
710 |
|
|
711 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
712 |
|
// if( path.IsNull() ){ |
713 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
714 |
|
// if(path.IsNull()){ |
715 |
|
// cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl; |
716 |
|
// return 0; |
717 |
|
// } |
718 |
|
// path.Append("/trk-param/align_param-0/"); |
719 |
|
// } |
720 |
|
// cout <<"Loading alignment parameters: "<<path<<endl; |
721 |
|
// strcpy(path_.path,path.Data()); |
722 |
|
// path_.pathlen = path.Length(); |
723 |
|
// path_.error = 0; |
724 |
|
// return readalignparam_(); |
725 |
|
// // } |
726 |
|
// // return 0; |
727 |
|
// } |
728 |
|
// /** |
729 |
|
// * Load magnetic field parameters (call the F77 routine). |
730 |
|
// * |
731 |
|
// */ |
732 |
|
// int TrkLevel1::LoadMipParam(TString path){ |
733 |
|
|
734 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
735 |
|
// if( path.IsNull() ){ |
736 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
737 |
|
// if(path.IsNull()){ |
738 |
|
// cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl; |
739 |
|
// return 0; |
740 |
|
// } |
741 |
|
// path.Append("/trk-param/mip_param-0/"); |
742 |
|
// } |
743 |
|
// cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl; |
744 |
|
// strcpy(path_.path,path.Data()); |
745 |
|
// path_.pathlen = path.Length(); |
746 |
|
// path_.error = 0; |
747 |
|
// return readmipparam_(); |
748 |
|
// // } |
749 |
|
// // return 0; |
750 |
|
// } |
751 |
|
// /** |
752 |
|
// * Load magnetic field parameters (call the F77 routine). |
753 |
|
// * |
754 |
|
// */ |
755 |
|
// int TrkLevel1::LoadVKMaskParam(TString path){ |
756 |
|
|
757 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
758 |
|
// if( path.IsNull() ){ |
759 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
760 |
|
// if(path.IsNull()){ |
761 |
|
// cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl; |
762 |
|
// return 0; |
763 |
|
// } |
764 |
|
// path.Append("/trk-param/mask_param-1/"); |
765 |
|
// } |
766 |
|
// cout <<"Loading VK-mask parameters: "<<path<<endl; |
767 |
|
// strcpy(path_.path,path.Data()); |
768 |
|
// path_.pathlen = path.Length(); |
769 |
|
// path_.error = 0; |
770 |
|
// return readvkmask_(); |
771 |
|
// // } |
772 |
|
// // return 0; |
773 |
|
// } |
774 |
|
|
775 |
|
// /** |
776 |
|
// * Load all (default) parameters. Environment variable must be defined. |
777 |
|
// * |
778 |
|
// */ |
779 |
|
// int TrkLevel1::LoadParams(){ |
780 |
|
|
781 |
|
// int result=0; |
782 |
|
|
783 |
|
// result = result * LoadFieldParam(); |
784 |
|
// result = result * LoadPfaParam(); |
785 |
|
// result = result * LoadChargeParam(); |
786 |
|
// result = result * LoadAlignmentParam(); |
787 |
|
// result = result * LoadMipParam(); |
788 |
|
// result = result * LoadVKMaskParam(); |
789 |
|
|
790 |
|
// return result; |
791 |
|
// } |
792 |
|
|
793 |
|
|
794 |
|
|
795 |
|
int TrkLevel1::GetPfaNbinsAngle(){ |
796 |
|
TrkParams::Load(4); |
797 |
|
if( !TrkParams::IsLoaded(4) ){ |
798 |
|
cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
799 |
|
return 0; |
800 |
|
} |
801 |
|
return pfa_.nangbin; |
802 |
|
}; |
803 |
|
|
804 |
|
int TrkLevel1::GetPfaNbinsETA(){ |
805 |
|
TrkParams::Load(4); |
806 |
|
if( !TrkParams::IsLoaded(4) ){ |
807 |
|
cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
808 |
|
return 0; |
809 |
|
} |
810 |
|
return pfa_.netaval; |
811 |
|
}; |
812 |
|
|
813 |
/** |
/** |
814 |
* Load Position-Finding-Algorythm parameters (call the F77 routine). |
* |
815 |
* |
* |
816 |
*/ |
*/ |
817 |
int TrkLevel1::LoadPfaParam(TString path){ |
float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
818 |
|
|
819 |
if( strcmp(path_.path,path.Data()) ){ |
TrkParams::Load(4); |
820 |
cout <<"Loading p.f.a. parameters\n"; |
if( !TrkParams::IsLoaded(4) ){ |
821 |
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; |
822 |
path_.pathlen = path.Length(); |
return 0; |
823 |
path_.error = 0; |
} |
824 |
return readetaparam_(); |
|
825 |
} |
int nbins = GetPfaNbinsETA(); |
826 |
|
if(!nbins)return 0; |
827 |
|
|
828 |
|
float *fcorr = new float [nbins]; |
829 |
|
|
830 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
831 |
|
for(int ib=0; ib<nbins; ib++){ |
832 |
|
fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
833 |
|
cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
834 |
|
} |
835 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
836 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
837 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
838 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
839 |
|
}else{ |
840 |
|
cout << pfa<<" pfa parameters not implemented "<<endl; |
841 |
|
return 0; |
842 |
|
} |
843 |
|
|
844 |
|
return fcorr; |
845 |
|
|
846 |
|
}; |
847 |
|
|
848 |
|
float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
849 |
|
|
850 |
|
TrkParams::Load(4); |
851 |
|
if( !TrkParams::IsLoaded(4) ){ |
852 |
|
cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
853 |
return 0; |
return 0; |
854 |
|
} |
855 |
|
|
856 |
|
int nbins = GetPfaNbinsETA(); |
857 |
|
if(!nbins)return 0; |
858 |
|
|
859 |
|
float *fcorr = new float [nbins]; |
860 |
|
|
861 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
862 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
863 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
864 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
865 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
866 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
867 |
|
}else{ |
868 |
|
cout << pfa<<" pfa parameters not implemented "<<endl; |
869 |
|
return 0; |
870 |
|
} |
871 |
|
|
872 |
|
return fcorr; |
873 |
|
|
874 |
|
}; |
875 |
|
|
876 |
|
/** |
877 |
|
* Method to call the F77 routine that performs level1->level2 processing. |
878 |
|
* The level2 output is stored in a common block, which can be retrieved |
879 |
|
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
880 |
|
* NB If the TrkLevel1 object is readout from a tree, and the |
881 |
|
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
882 |
|
* should be payed to the fact that single clusters (clusters not associated |
883 |
|
* with any track) might not be stored. Full reprocessing should be done from |
884 |
|
* level0 data. |
885 |
|
*/ |
886 |
|
int TrkLevel1::ProcessEvent(int pfa){ |
887 |
|
|
888 |
|
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
889 |
|
TrkParams::Load( ); |
890 |
|
if( !TrkParams::IsLoaded() )return 0; |
891 |
|
|
892 |
|
GetLevel1Struct(); |
893 |
|
|
894 |
|
// analysisflight_(&pfa); |
895 |
|
TrkParams::SetPFA(pfa); |
896 |
|
analysisflight_(); |
897 |
|
|
898 |
|
return 1; |
899 |
|
|
900 |
} |
} |
901 |
|
|
902 |
|
|