11 |
extern "C" { |
extern "C" { |
12 |
|
|
13 |
// int readetaparam_(); |
// int readetaparam_(); |
14 |
float cog_(int*,int*); |
float cog_(int*,int*); |
15 |
float pfaeta_(int*,float*); |
float pfaeta_(int*,float*); |
16 |
float pfaeta2_(int*,float*); |
float pfaeta2_(int*,float*); |
17 |
float pfaeta3_(int*,float*); |
float pfaeta3_(int*,float*); |
18 |
float pfaeta4_(int*,float*); |
float pfaeta4_(int*,float*); |
19 |
|
float pfaetal_(int*,float*); |
20 |
|
float digsat_(int*); |
21 |
|
int npfastrips_(int*,float*); |
22 |
|
|
23 |
|
float fbad_cog_(int*,int*); |
24 |
|
float risx_cog_(float*); |
25 |
|
float risy_cog_(float*); |
26 |
} |
} |
27 |
//-------------------------------------- |
//-------------------------------------- |
28 |
// |
// |
100 |
* strips, around maxs, having a significant signal. |
* strips, around maxs, having a significant signal. |
101 |
* @param nstrip Maximum number of strips. |
* @param nstrip Maximum number of strips. |
102 |
* @param cut Inclusion cut ( s > cut*sigma ). |
* @param cut Inclusion cut ( s > cut*sigma ). |
103 |
|
* @param force Falg to force the PFA strip-inclusion pattern (nstrip>0) |
104 |
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
* If nstrip<=0 only the inclusion cut is used to determine the cluster size. |
105 |
*/ |
*/ |
106 |
Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut){ |
Float_t TrkCluster::GetSignal(Int_t nstrip, Float_t cut, Bool_t force){ |
107 |
|
|
108 |
if(CLlength<=0)return 0; |
if(CLlength<=0)return 0; |
109 |
|
|
110 |
Float_t s = 0; |
Float_t s = 0; |
111 |
|
|
112 |
|
//----------------------------------- |
113 |
|
// inlcude strips with s > cut*sigma |
114 |
|
//----------------------------------- |
115 |
|
|
116 |
if( nstrip<=0 ){ |
if( nstrip<=0 ){ |
117 |
// for(Int_t is = 0; is < CLlength; is++){ |
// for(Int_t is = 0; is < CLlength; is++){ |
118 |
// Float_t scut = cut*clsigma[is]; |
// Float_t scut = cut*clsigma[is]; |
131 |
return s; |
return s; |
132 |
}; |
}; |
133 |
|
|
134 |
|
//--------------------------------------------------- |
135 |
|
// inlcude strips with s > cut*sigma, up to nstrip. |
136 |
|
// strips are included in order of decreasing signal |
137 |
|
//--------------------------------------------------- |
138 |
|
if( !force ){ |
139 |
|
|
140 |
|
Int_t il = indmax; |
141 |
|
Int_t ir = indmax; |
142 |
|
Int_t inc = 0; |
143 |
|
|
144 |
|
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
145 |
|
|
146 |
|
while ( inc < nstrip ){ |
147 |
|
Float_t sl = -100000; |
148 |
|
Float_t sr = -100000; |
149 |
|
if( il >= 0 ) sl = clsignal[il]; |
150 |
|
if( ir < CLlength ) sr = clsignal[ir]; |
151 |
|
if( sl == sr && inc == 0 ){ |
152 |
|
s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
153 |
|
il--; |
154 |
|
ir++; |
155 |
|
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
156 |
|
s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
157 |
|
il--; |
158 |
|
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
159 |
|
s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl; |
160 |
|
ir++; |
161 |
|
}else break; |
162 |
|
|
163 |
|
inc++; |
164 |
|
} |
165 |
|
return s; |
166 |
|
|
167 |
|
}else{ |
168 |
|
//--------------------------------------------------- |
169 |
|
// evaluate signal using a fixed number of strips, |
170 |
|
// following the PFA inclusion patters |
171 |
|
//--------------------------------------------------- |
172 |
|
// --> signal of the central strip |
173 |
|
Float_t sc = clsignal[indmax]; |
174 |
|
// signal of adjacent strips |
175 |
|
Float_t sl1 = -9999.; |
176 |
|
Float_t sl2 = -9999.; |
177 |
|
Float_t sr1 = -9999.; |
178 |
|
Float_t sr2 = -9999.; |
179 |
|
if(indmax-1>=0) sl1 = clsignal[indmax-1]; |
180 |
|
if(indmax-2>=0) sl2 = clsignal[indmax-2]; |
181 |
|
if(indmax+1<CLlength) sr1 = clsignal[indmax+1]; |
182 |
|
if(indmax+2<CLlength) sr2 = clsignal[indmax+2]; |
183 |
|
|
184 |
|
if(nstrip==1){ |
185 |
|
s = sc; |
186 |
|
}else if(nstrip==2){ |
187 |
|
if( sl1>sr1 && sl1+sc!=0 )s = (sl1+sc); |
188 |
|
if( sl1<sr1 && sr1+sc!=0 )s = (sc+sr1); |
189 |
|
if( sl1==sr1 && sl1 != -9999.){ |
190 |
|
if( clsigma[indmax-1] < clsigma[indmax+1] && sl1+sc!=0 )s = (sl1+sc); |
191 |
|
if( clsigma[indmax-1] > clsigma[indmax+1] && sc+sr1!=0 )s = (sc+sr1); |
192 |
|
} |
193 |
|
}else if(nstrip==3){ |
194 |
|
s = (sl1+sc+sr1); |
195 |
|
}else if(nstrip==4){ |
196 |
|
if( sl2>sr2 && sl2+sl1+sc+sr1!=0 )s = (sl2+sl1+sc+sr1); |
197 |
|
if( sl2<sr2 && sl1+sc+sr1+sr2!=0 )s = (sl1+sc+sr1+sr2); |
198 |
|
if( sl2==sr2 && sl2 != -9999.){ |
199 |
|
if( clsigma[indmax-2] < clsigma[indmax+2] && sl2+sl1+sc+sr1!=0 )s = (sl2+sl1+sc+sr1); |
200 |
|
if( clsigma[indmax-2] > clsigma[indmax+2] && sl1+sc+sr1+sr2!=0 )s = (sl1+sc+sr1+sr2); |
201 |
|
} |
202 |
|
}else if(nstrip==5){ |
203 |
|
s = (sl1+sc+sr1); |
204 |
|
if(sl2 != -9999.)s += sl2; |
205 |
|
if(sr2 != -9999.)s += sr2; |
206 |
|
}else{ |
207 |
|
cout << "Float_t TrkCluster::GetSignal("<<nstrip<<","<<cut<<","<<force<<")- not implemented"<<endl; |
208 |
|
} |
209 |
|
|
210 |
Int_t il = indmax; |
} |
|
Int_t ir = indmax; |
|
|
Int_t inc = 0; |
|
211 |
|
|
212 |
if( clsignal[indmax] < cut*clsigma[indmax] ) return 0; |
return 0.; |
213 |
|
|
|
while ( inc < nstrip ){ |
|
|
Float_t sl = -100000; |
|
|
Float_t sr = -100000; |
|
|
if( il >= 0 ) sl = clsignal[il]; |
|
|
if( ir < CLlength ) sr = clsignal[ir]; |
|
|
if( sl == sr && inc == 0 ){ |
|
|
s += clsignal[il]; //cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
|
|
il--; |
|
|
ir++; |
|
|
}else if ( sl >= sr && sl > cut*clsigma[il] && inc !=0 ){ |
|
|
s += sl;//cout << inc<<" - "<< clsignal[il]<<" "<<s<<endl; |
|
|
il--; |
|
|
}else if ( sl < sr && sr > cut*clsigma[ir] ){ |
|
|
s += sr;//cout << inc<<" - " << clsignal[ir]<<" "<<s<<endl; |
|
|
ir++; |
|
|
}else break; |
|
|
|
|
|
inc++; |
|
|
} |
|
|
return s; |
|
214 |
}; |
}; |
215 |
|
|
216 |
|
|
303 |
il = indmax; |
il = indmax; |
304 |
ir = indmax; |
ir = indmax; |
305 |
for(Int_t i=1; i<nbad; i++){ |
for(Int_t i=1; i<nbad; i++){ |
306 |
if (ir == CLlength && il == 0)break; |
if (ir == CLlength-1 && il == 0)break; |
307 |
else if (ir == CLlength && il != 0)il--; |
else if (ir == CLlength-1 && il != 0)il--; |
308 |
else if (ir != CLlength && il == 0)ir++; |
else if (ir != CLlength-1 && il == 0)ir++; |
309 |
else{ |
else{ |
310 |
if(clsignal[il-1] > clsignal[ir+1])il--; |
if(clsignal[il-1] > clsignal[ir+1])il--; |
311 |
else ir++; |
else ir++; |
328 |
il = indmax; |
il = indmax; |
329 |
ir = indmax; |
ir = indmax; |
330 |
for(Int_t i=1; i<nbad; i++){ |
for(Int_t i=1; i<nbad; i++){ |
331 |
if (ir == CLlength && il == 0)break; |
if (ir == CLlength-1 && il == 0)break; |
332 |
else if (ir == CLlength && il != 0)il--; |
else if (ir == CLlength-1 && il != 0)il--; |
333 |
else if (ir != CLlength && il == 0)ir++; |
else if (ir != CLlength-1 && il == 0)ir++; |
334 |
else{ |
else{ |
335 |
if(clsignal[il-1] > clsignal[ir+1])il--; |
if(clsignal[il-1] > clsignal[ir+1])il--; |
336 |
else ir++; |
else ir++; |
355 |
cout << "Position of maximun "<< maxs <<endl; |
cout << "Position of maximun "<< maxs <<endl; |
356 |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
357 |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
358 |
cout << "Signal/Noise "<< GetSignalToNoise(); |
cout << "Signal/Noise "<< GetSignalToNoise()<<endl; |
359 |
cout <<endl<< "Strip signals "; |
cout << "COG "<< GetCOG(0)<<endl;; |
360 |
|
cout << "Strip signals "; |
361 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
362 |
cout <<endl<< "Strip sigmas "; |
cout <<endl<< "Strip sigmas "; |
363 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsigma[i]; |
411 |
* @param ncog Number of strips to evaluate COG. |
* @param ncog Number of strips to evaluate COG. |
412 |
* If ncog=0, the COG of the cluster is evaluated according to the cluster multiplicity (defined by the inclusion cut). |
* If ncog=0, the COG of the cluster is evaluated according to the cluster multiplicity (defined by the inclusion cut). |
413 |
* If ncog>0, the COG is evaluated using ncog strips, even if they have a negative signal (according to G.Landi) |
* If ncog>0, the COG is evaluated using ncog strips, even if they have a negative signal (according to G.Landi) |
414 |
|
* |
415 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
416 |
*/ |
*/ |
417 |
Float_t TrkCluster::GetCOG(Int_t ncog){ |
Float_t TrkCluster::GetCOG(Int_t ncog){ |
418 |
|
|
419 |
int ic = 1; |
int ic = 1; |
420 |
GetLevel1Struct(); |
// GetLevel1Struct(); //Elena: dangerous... |
421 |
return cog_(&ncog,&ic); |
return cog_(&ncog,&ic); |
422 |
|
|
423 |
}; |
}; |
454 |
// |
// |
455 |
//-------------------------------------- |
//-------------------------------------- |
456 |
/** |
/** |
457 |
* Evaluates the cluster position, in strips, relative to the strip with the maximum signal (TrkCluster::maxs), by applying the non-linear ETA-algorythm. |
* Evaluates the cluster position, in pitch units, relative to the strip |
458 |
|
* with the maximum signal (TrkCluster::maxs), by applying the non-linear |
459 |
|
* ETA-algorythm. |
460 |
* @param neta Number of strips to evaluate ETA. |
* @param neta Number of strips to evaluate ETA. |
461 |
* @param angle Projected angle between particle track and detector plane. |
* @param angle Projected (effective) angle between particle track and detector plane. |
462 |
|
* @landi flag to apply Landi correction |
463 |
* Implemented values of neta are 2,3,4. If neta=0, ETA2, ETA3 and ETA4 are applied according to the angle. |
* Implemented values of neta are 2,3,4. If neta=0, ETA2, ETA3 and ETA4 are applied according to the angle. |
464 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
465 |
*/ |
*/ |
466 |
Float_t TrkCluster::GetETA(Int_t neta, float angle){ |
Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi){ |
467 |
|
|
468 |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
469 |
// LoadPfaParam(); |
// LoadPfaParam(); |
470 |
|
|
471 |
TrkParams::Load(4); |
TrkParams::Load(4); |
472 |
if( !TrkParams::IsLoaded(4) ){ |
if( !TrkParams::IsLoaded(4) ){ |
473 |
cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
cout << "Float_t TrkCluster::GetETA(Int_t neta, float angle, bool landi) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
474 |
return 0; |
return 0; |
475 |
} |
} |
476 |
|
|
477 |
float ax = angle; |
float ax = angle; |
478 |
int ic = 1; |
int ic = 1; |
479 |
GetLevel1Struct(); |
//GetLevel1Struct(); //Elena: dangerous... |
480 |
if(neta == 0) return pfaeta_(&ic,&ax); |
if( neta == 0 && !landi) return pfaeta_(&ic,&ax); |
481 |
else if(neta == 2) return pfaeta2_(&ic,&ax); |
else if(neta == 0 && landi ) return pfaetal_(&ic,&ax); |
482 |
else if(neta == 3) return pfaeta3_(&ic,&ax); |
else if(neta == 2 ) return pfaeta2_(&ic,&ax); |
483 |
else if(neta == 4) return pfaeta4_(&ic,&ax); |
else if(neta == 3 ) return pfaeta3_(&ic,&ax); |
484 |
else cout << "ETA"<<neta<<" not implemented\n"; |
else if(neta == 4 ) return pfaeta4_(&ic,&ax); |
485 |
|
else cout << "TrkCluster::GetETA("<<neta<<","<<angle<<","<<landi<<") not implemented\n"; |
486 |
return 0; |
return 0; |
487 |
|
|
488 |
}; |
}; |
489 |
|
|
490 |
|
/** |
491 |
|
* Evaluates the cluster position, in pitch units, relative to the strip |
492 |
|
* with the maximum signal (TrkCluster::maxs), by applying the digital |
493 |
|
* algorithm for saturated clusters. |
494 |
|
* |
495 |
|
* @return The cluster position (0 also if if no saturated strip is found). |
496 |
|
* |
497 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
498 |
|
*/ |
499 |
|
Float_t TrkCluster::GetDigSat() { |
500 |
|
|
501 |
|
// GetLevel1Struct(); //Elena: dangerous... |
502 |
|
int ic = 1; |
503 |
|
return digsat_(&ic); |
504 |
|
|
505 |
|
} |
506 |
|
|
507 |
|
/** |
508 |
|
* Evaluates the cluster position, in pitch unit, relative to the strip with |
509 |
|
* the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams). |
510 |
|
* @param angle Projected (effective) angle between particle track and detector plane. |
511 |
|
*/ |
512 |
|
Float_t TrkCluster::GetPositionPU(float angle){ |
513 |
|
|
514 |
|
if ( TrkParams::GetPFA() == 0 )return GetETA(0,angle,false); |
515 |
|
else if( TrkParams::GetPFA() == 2 )return GetETA(2,angle,false); |
516 |
|
else if( TrkParams::GetPFA() == 3 )return GetETA(3,angle,false); |
517 |
|
else if( TrkParams::GetPFA() == 4 )return GetETA(4,angle,false); |
518 |
|
else if( TrkParams::GetPFA() == 5 )return GetETA(0,angle,true); |
519 |
|
else if( TrkParams::GetPFA() == 10 )return GetCOG(0); |
520 |
|
else if( TrkParams::GetPFA() == 11 )return GetCOG(1); |
521 |
|
else if( TrkParams::GetPFA() == 12 )return GetCOG(2); |
522 |
|
else if( TrkParams::GetPFA() == 13 )return GetCOG(3); |
523 |
|
else if( TrkParams::GetPFA() == 14 )return GetCOG(4); |
524 |
|
else cout << " TrkCluster::GetPositionPU(float "<<angle<<") -- WARNING -- PFA="<<TrkParams::GetPFA()<<" not implemented"<<endl; |
525 |
|
|
526 |
|
return 0.; |
527 |
|
|
528 |
|
} |
529 |
|
|
530 |
|
/** |
531 |
|
* Give the number of strip used to evaluate the cluster coordinate |
532 |
|
* according to the p.f.a. |
533 |
|
* It returns 0 when the COG is used (in this case the number of strip used |
534 |
|
* equals the multiplicity). |
535 |
|
* (NB TrkCluster::GetLevel1Struct() showld be called first, in order to fill the F77 level1 common with this single cluster) |
536 |
|
*/ |
537 |
|
Int_t TrkCluster::GetPFAstrips(float angle){ |
538 |
|
|
539 |
|
float ax = angle; |
540 |
|
int ic = 1; |
541 |
|
// GetLevel1Struct(); //Elena: dangerous... |
542 |
|
return npfastrips_(&ic,&ax); |
543 |
|
|
544 |
|
} |
545 |
|
|
546 |
//-------------------------------------- |
//-------------------------------------- |
547 |
// |
// |
548 |
// |
// |
559 |
cnn[j][i]=0; |
cnn[j][i]=0; |
560 |
}; |
}; |
561 |
}; |
}; |
562 |
|
// TrkParams::SetTrackingMode(); |
563 |
|
// TrkParams::SetPrecisionFactor(); |
564 |
|
// TrkParams::SetStepMin(); |
565 |
|
TrkParams::SetMiniDefault(); |
566 |
|
TrkParams::SetPFA(); |
567 |
} |
} |
568 |
//-------------------------------------- |
//-------------------------------------- |
569 |
// |
// |
596 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
597 |
|
|
598 |
} |
} |
599 |
|
/** |
600 |
|
* \brief Dump processing status |
601 |
|
*/ |
602 |
|
void TrkLevel1::StatusDump(int view){ |
603 |
|
cout << "DSP n. "<<view+1<<" (level1-)status: "<<hex<<showbase<<good[view]<<dec<<endl; |
604 |
|
}; |
605 |
|
/** |
606 |
|
* \brief Check event status |
607 |
|
* |
608 |
|
* Check the event status, according to a flag-mask given as input. |
609 |
|
* Return true if the view passes the check. |
610 |
|
* |
611 |
|
* @param view View number (0-11) |
612 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
613 |
|
* no crc error, no software alarm) |
614 |
|
* |
615 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
616 |
|
* |
617 |
|
*/ |
618 |
|
Bool_t TrkLevel1::StatusCheck(int view, int flagmask){ |
619 |
|
|
620 |
|
if( view<0 || view >= 12)return false; |
621 |
|
return !(good[view]&flagmask); |
622 |
|
|
623 |
|
}; |
624 |
|
|
625 |
|
|
626 |
//-------------------------------------- |
//-------------------------------------- |
627 |
// |
// |
628 |
// |
// |
660 |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
t_cl->clsigma = new Float_t[t_cl->CLlength]; |
661 |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
t_cl->cladc = new Int_t[t_cl->CLlength]; |
662 |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
t_cl->clbad = new Bool_t[t_cl->CLlength]; |
663 |
|
|
664 |
Int_t index = 0; |
Int_t index = 0; |
665 |
for(Int_t is = from; is < to; is++ ){ |
for(Int_t is = from; is < to; is++ ){ |
666 |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
t_cl->clsignal[index] = (Float_t) l1->clsignal[is]; |
787 |
TrkCluster *cluster = (TrkCluster*)t[is]; |
TrkCluster *cluster = (TrkCluster*)t[is]; |
788 |
return cluster; |
return cluster; |
789 |
} |
} |
|
//-------------------------------------- |
|
|
// |
|
|
// |
|
|
//-------------------------------------- |
|
|
// /** |
|
|
// * Load Position-Finding-Algorythm parameters (call the F77 routine). |
|
|
// * |
|
|
// */ |
|
|
// int TrkLevel1::LoadPfaParam(TString path){ |
|
|
|
|
|
// if( path.IsNull() ){ |
|
|
// path = gSystem->Getenv("PAM_CALIB"); |
|
|
// if(path.IsNull()){ |
|
|
// cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// path.Append("/trk-param/eta_param-0/"); |
|
|
// } |
|
790 |
|
|
|
// strcpy(path_.path,path.Data()); |
|
|
// path_.pathlen = path.Length(); |
|
|
// path_.error = 0; |
|
|
// cout <<"Loading p.f.a. parameters: "<<path<<endl; |
|
|
// return readetaparam_(); |
|
|
// } |
|
791 |
|
|
792 |
// /** |
// int TrkLevel1::GetPfaNbinsAngle(){ |
793 |
// * Load magnetic field parameters (call the F77 routine). |
// TrkParams::Load(4); |
794 |
// * |
// if( !TrkParams::IsLoaded(4) ){ |
795 |
// */ |
// cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
796 |
// int TrkLevel1::LoadFieldParam(TString path){ |
// return 0; |
|
|
|
|
// // if( strcmp(path_.path,path.Data()) ){ |
|
|
// if( path.IsNull() ){ |
|
|
// path = gSystem->Getenv("PAM_CALIB"); |
|
|
// if(path.IsNull()){ |
|
|
// cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// path.Append("/trk-param/field_param-0/"); |
|
|
// } |
|
|
// cout <<"Loading magnetic field "<<path<<endl; |
|
|
// strcpy(path_.path,path.Data()); |
|
|
// path_.pathlen = path.Length(); |
|
|
// path_.error = 0; |
|
|
// return readb_(); |
|
|
// // } |
|
|
// // return 0; |
|
|
// } |
|
|
// /** |
|
|
// * Load magnetic field parameters (call the F77 routine). |
|
|
// * |
|
|
// */ |
|
|
// int TrkLevel1::LoadChargeParam(TString path){ |
|
|
|
|
|
// // if( strcmp(path_.path,path.Data()) ){ |
|
|
// if( path.IsNull() ){ |
|
|
// path = gSystem->Getenv("PAM_CALIB"); |
|
|
// if(path.IsNull()){ |
|
|
// cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// path.Append("/trk-param/charge_param-1/"); |
|
|
// } |
|
|
// cout <<"Loading charge-correlation parameters: "<<path<<endl; |
|
|
// strcpy(path_.path,path.Data()); |
|
|
// path_.pathlen = path.Length(); |
|
|
// path_.error = 0; |
|
|
// return readchargeparam_(); |
|
|
// // } |
|
|
// // return 0; |
|
|
// } |
|
|
// /** |
|
|
// * Load magnetic field parameters (call the F77 routine). |
|
|
// * |
|
|
// */ |
|
|
// int TrkLevel1::LoadAlignmentParam(TString path){ |
|
|
|
|
|
// // if( strcmp(path_.path,path.Data()) ){ |
|
|
// if( path.IsNull() ){ |
|
|
// path = gSystem->Getenv("PAM_CALIB"); |
|
|
// if(path.IsNull()){ |
|
|
// cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// path.Append("/trk-param/align_param-0/"); |
|
|
// } |
|
|
// cout <<"Loading alignment parameters: "<<path<<endl; |
|
|
// strcpy(path_.path,path.Data()); |
|
|
// path_.pathlen = path.Length(); |
|
|
// path_.error = 0; |
|
|
// return readalignparam_(); |
|
|
// // } |
|
|
// // return 0; |
|
|
// } |
|
|
// /** |
|
|
// * Load magnetic field parameters (call the F77 routine). |
|
|
// * |
|
|
// */ |
|
|
// int TrkLevel1::LoadMipParam(TString path){ |
|
|
|
|
|
// // if( strcmp(path_.path,path.Data()) ){ |
|
|
// if( path.IsNull() ){ |
|
|
// path = gSystem->Getenv("PAM_CALIB"); |
|
|
// if(path.IsNull()){ |
|
|
// cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// path.Append("/trk-param/mip_param-0/"); |
|
797 |
// } |
// } |
798 |
// cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl; |
// return pfa_.nangbin; |
799 |
// strcpy(path_.path,path.Data()); |
// }; |
800 |
// path_.pathlen = path.Length(); |
|
801 |
// path_.error = 0; |
// int TrkLevel1::GetPfaNbinsETA(){ |
802 |
// return readmipparam_(); |
// TrkParams::Load(4); |
803 |
// // } |
// if( !TrkParams::IsLoaded(4) ){ |
804 |
// // return 0; |
// cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
805 |
// } |
// return 0; |
|
// /** |
|
|
// * Load magnetic field parameters (call the F77 routine). |
|
|
// * |
|
|
// */ |
|
|
// int TrkLevel1::LoadVKMaskParam(TString path){ |
|
|
|
|
|
// // if( strcmp(path_.path,path.Data()) ){ |
|
|
// if( path.IsNull() ){ |
|
|
// path = gSystem->Getenv("PAM_CALIB"); |
|
|
// if(path.IsNull()){ |
|
|
// cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl; |
|
|
// return 0; |
|
|
// } |
|
|
// path.Append("/trk-param/mask_param-1/"); |
|
806 |
// } |
// } |
807 |
// cout <<"Loading VK-mask parameters: "<<path<<endl; |
// return pfa_.netaval; |
808 |
// strcpy(path_.path,path.Data()); |
// }; |
|
// path_.pathlen = path.Length(); |
|
|
// path_.error = 0; |
|
|
// return readvkmask_(); |
|
|
// // } |
|
|
// // return 0; |
|
|
// } |
|
809 |
|
|
810 |
// /** |
// /** |
811 |
// * Load all (default) parameters. Environment variable must be defined. |
// * |
812 |
// * |
// * |
813 |
// */ |
// */ |
814 |
// int TrkLevel1::LoadParams(){ |
// float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
|
|
|
|
// int result=0; |
|
|
|
|
|
// result = result * LoadFieldParam(); |
|
|
// result = result * LoadPfaParam(); |
|
|
// result = result * LoadChargeParam(); |
|
|
// result = result * LoadAlignmentParam(); |
|
|
// result = result * LoadMipParam(); |
|
|
// result = result * LoadVKMaskParam(); |
|
|
|
|
|
// return result; |
|
|
// } |
|
|
|
|
|
|
|
815 |
|
|
816 |
int TrkLevel1::GetPfaNbinsAngle(){ |
// TrkParams::Load(4); |
817 |
TrkParams::Load(4); |
// if( !TrkParams::IsLoaded(4) ){ |
818 |
if( !TrkParams::IsLoaded(4) ){ |
// cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
819 |
cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
// return 0; |
820 |
return 0; |
// } |
|
} |
|
|
return pfa_.nangbin; |
|
|
}; |
|
|
|
|
|
int TrkLevel1::GetPfaNbinsETA(){ |
|
|
TrkParams::Load(4); |
|
|
if( !TrkParams::IsLoaded(4) ){ |
|
|
cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
|
|
return 0; |
|
|
} |
|
|
return pfa_.netaval; |
|
|
}; |
|
|
|
|
|
/** |
|
|
* |
|
|
* |
|
|
*/ |
|
|
float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
|
|
|
|
|
TrkParams::Load(4); |
|
|
if( !TrkParams::IsLoaded(4) ){ |
|
|
cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
|
|
return 0; |
|
|
} |
|
821 |
|
|
822 |
int nbins = GetPfaNbinsETA(); |
// int nbins = GetPfaNbinsETA(); |
823 |
if(!nbins)return 0; |
// if(!nbins)return 0; |
824 |
|
|
825 |
float *fcorr = new float [nbins]; |
// float *fcorr = new float [nbins]; |
826 |
|
|
827 |
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
// if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
828 |
for(int ib=0; ib<nbins; ib++){ |
// for(int ib=0; ib<nbins; ib++){ |
829 |
fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
// fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
830 |
cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
// cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
831 |
} |
// } |
832 |
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
// }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
833 |
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
834 |
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
// }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
835 |
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
836 |
}else{ |
// }else{ |
837 |
cout << pfa<<" pfa parameters not implemented "<<endl; |
// cout << pfa<<" pfa parameters not implemented "<<endl; |
838 |
return 0; |
// return 0; |
839 |
} |
// } |
840 |
|
|
841 |
return fcorr; |
// return fcorr; |
842 |
|
|
843 |
}; |
// }; |
844 |
|
|
845 |
float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
// float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
846 |
|
|
847 |
TrkParams::Load(4); |
// TrkParams::Load(4); |
848 |
if( !TrkParams::IsLoaded(4) ){ |
// if( !TrkParams::IsLoaded(4) ){ |
849 |
cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
// cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
850 |
return 0; |
// return 0; |
851 |
} |
// } |
852 |
|
|
853 |
int nbins = GetPfaNbinsETA(); |
// int nbins = GetPfaNbinsETA(); |
854 |
if(!nbins)return 0; |
// if(!nbins)return 0; |
855 |
|
|
856 |
float *fcorr = new float [nbins]; |
// float *fcorr = new float [nbins]; |
857 |
|
|
858 |
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
// if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
859 |
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
860 |
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
// }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
861 |
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
862 |
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
// }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
863 |
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
// for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
864 |
}else{ |
// }else{ |
865 |
cout << pfa<<" pfa parameters not implemented "<<endl; |
// cout << pfa<<" pfa parameters not implemented "<<endl; |
866 |
return 0; |
// return 0; |
867 |
} |
// } |
868 |
|
|
869 |
return fcorr; |
// return fcorr; |
870 |
|
|
871 |
}; |
// }; |
872 |
|
|
873 |
/** |
/** |
874 |
* Method to call the F77 routine that performs level1->level2 processing. |
* Method to call the F77 routine that performs level1->level2 processing. |
875 |
* The level2 output is stored in a common block, which can be retrieved |
* The level2 output is stored in a common block, which can be retrieved |
876 |
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
|
* @param pfa Position finding algorythm used to reconstruct the track |
|
|
* Implemented algorythms: |
|
|
* 0 ETA (default) |
|
|
* 1 --- |
|
|
* 2 ETA2 |
|
|
* 3 ETA3 |
|
|
* 4 ETA4 |
|
|
* 10 COG |
|
|
* 11 COG1 |
|
|
* 12 COG2 |
|
|
* 13 COG3 |
|
|
* 14 COG4 |
|
877 |
* NB If the TrkLevel1 object is readout from a tree, and the |
* NB If the TrkLevel1 object is readout from a tree, and the |
878 |
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
879 |
* should be payed to the fact that single clusters (clusters not associated |
* should be payed to the fact that single clusters (clusters not associated |
880 |
* with any track) might not be stored. Full reprocessing should be done from |
* with any track) might not be stored. Full reprocessing should be done starting |
881 |
* level0 data. |
* from level0 data. |
882 |
*/ |
*/ |
883 |
int TrkLevel1::ProcessEvent(int pfa){ |
//int TrkLevel1::ProcessEvent(int pfa){ |
884 |
|
int TrkLevel1::ProcessEvent(){ |
885 |
|
|
886 |
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
887 |
TrkParams::Load( ); |
TrkParams::Load( ); |
889 |
|
|
890 |
GetLevel1Struct(); |
GetLevel1Struct(); |
891 |
|
|
892 |
analysisflight_(&pfa); |
// analysisflight_(&pfa); |
893 |
|
// TrkParams::SetPFA(pfa); |
894 |
// cout << "...done"<<endl; |
analysisflight_(); |
895 |
|
|
896 |
return 1; |
return 1; |
897 |
|
|
898 |
} |
} |
899 |
|
|
900 |
|
//-------------------------------------- |
901 |
|
// |
902 |
|
// |
903 |
|
//-------------------------------------- |
904 |
|
/** |
905 |
|
* Method to fill a TrkLevel1 object from an existing one, by cleaning low-signal clusters. |
906 |
|
* |
907 |
|
*/ |
908 |
|
void TrkLevel1::Set(TrkLevel1 *trkl1, float mipCut, float fCut){ |
909 |
|
|
910 |
|
|
911 |
|
|
912 |
|
|
913 |
|
if(!trkl1)return; |
914 |
|
|
915 |
|
// ------------------------- |
916 |
|
// ****general variables**** |
917 |
|
// ------------------------- |
918 |
|
for(Int_t i=0; i<12 ; i++){ |
919 |
|
good[i] = trkl1->good[i]; |
920 |
|
for(Int_t j=0; j<24 ; j++){ |
921 |
|
cn[j][i] = trkl1->cn[j][i]; |
922 |
|
cnn[j][i] = trkl1->cnn[j][i]; |
923 |
|
}; |
924 |
|
}; |
925 |
|
// ------------------------- |
926 |
|
// ****cluster array**** |
927 |
|
// ------------------------- |
928 |
|
|
929 |
|
if(Cluster)Cluster->Clear("C"); |
930 |
|
Cluster = new TClonesArray("TrkCluster"); |
931 |
|
TClonesArray &t = *Cluster; |
932 |
|
|
933 |
|
int isel=0; |
934 |
|
for(int icl=0 ; icl< trkl1->GetClusters()->GetEntries(); icl++){ |
935 |
|
TrkCluster *cl = trkl1->GetCluster(icl); |
936 |
|
|
937 |
|
float mip = TrkParams::GetMIP(cl->GetLadder()-1,cl->view-1); |
938 |
|
float smip = cl->GetSignal()/(mip>0.?mip:1.); |
939 |
|
float smax = cl->clsignal[cl->indmax]/(mip>0.?mip:1.); |
940 |
|
if(smax/smip<fCut)continue; |
941 |
|
if(smip<mipCut)continue; |
942 |
|
if(smax<0.5*mipCut)continue; |
943 |
|
|
944 |
|
|
945 |
|
|
946 |
|
new(t[isel]) TrkCluster(*cl); // <<< store cluster |
947 |
|
isel++; |
948 |
|
} |
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
} |
953 |
|
|
954 |
ClassImp(TrkLevel1); |
ClassImp(TrkLevel1); |
955 |
ClassImp(TrkCluster); |
ClassImp(TrkCluster); |