12 |
extern "C" { |
extern "C" { |
13 |
void dotrack_(int*, double*, double*, double*, double*, int*); |
void dotrack_(int*, double*, double*, double*, double*, int*); |
14 |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
15 |
void mini2_(int*,int*,int*); |
void dotrack3_(int*, double*, double*, double*, double*,double*, double*, double*,double*,int*); |
16 |
void guess_(); |
void mini2_(int*,int*,int*); |
17 |
|
void guess_(); |
18 |
|
void gufld_(float*, float*); |
19 |
|
float risxeta2_(float *); |
20 |
|
float risxeta3_(float *); |
21 |
|
float risxeta4_(float *); |
22 |
|
float risyeta2_(float *); |
23 |
} |
} |
24 |
|
|
25 |
//-------------------------------------- |
//-------------------------------------- |
53 |
ayv[ip] = 0; |
ayv[ip] = 0; |
54 |
dedx_x[ip] = 0; |
dedx_x[ip] = 0; |
55 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
56 |
|
multmaxx[ip] = 0; |
57 |
|
multmaxy[ip] = 0; |
58 |
|
seedx[ip] = 0; |
59 |
|
seedy[ip] = 0; |
60 |
|
xpu[ip] = 0; |
61 |
|
ypu[ip] = 0; |
62 |
|
|
63 |
}; |
}; |
64 |
// clx = 0; |
|
65 |
// cly = 0; |
// TrkParams::SetTrackingMode(); |
66 |
// clx = new TRefArray(6,0); //forse causa memory leak??? |
// TrkParams::SetPrecisionFactor(); |
67 |
// cly = new TRefArray(6,0); //forse causa memory leak??? |
// TrkParams::SetStepMin(); |
68 |
// clx = TRefArray(6,0); |
TrkParams::SetMiniDefault(); |
|
// cly = TRefArray(6,0); |
|
|
|
|
|
TrkParams::SetTrackingMode(); |
|
|
TrkParams::SetPrecisionFactor(); |
|
|
TrkParams::SetStepMin(); |
|
69 |
TrkParams::SetPFA(); |
TrkParams::SetPFA(); |
70 |
|
|
71 |
|
int ngf = TrkParams::nGF; |
72 |
|
for(int i=0; i<ngf; i++){ |
73 |
|
xGF[i] = 0.; |
74 |
|
yGF[i] = 0.; |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
}; |
}; |
79 |
//-------------------------------------- |
//-------------------------------------- |
80 |
// |
// |
106 |
ayv[ip] = t.ayv[ip]; |
ayv[ip] = t.ayv[ip]; |
107 |
dedx_x[ip] = t.dedx_x[ip]; |
dedx_x[ip] = t.dedx_x[ip]; |
108 |
dedx_y[ip] = t.dedx_y[ip]; |
dedx_y[ip] = t.dedx_y[ip]; |
109 |
|
multmaxx[ip] = t.multmaxx[ip]; |
110 |
|
multmaxy[ip] = t.multmaxy[ip]; |
111 |
|
seedx[ip] = t.seedx[ip]; |
112 |
|
seedy[ip] = t.seedy[ip]; |
113 |
|
xpu[ip] = t.xpu[ip]; |
114 |
|
ypu[ip] = t.ypu[ip]; |
115 |
}; |
}; |
116 |
// clx = 0; |
|
117 |
// cly = 0; |
// TrkParams::SetTrackingMode(); |
118 |
// if(t.clx)clx = new TRefArray(*(t.clx)); |
// TrkParams::SetPrecisionFactor(); |
119 |
// if(t.cly)cly = new TRefArray(*(t.cly)); |
// TrkParams::SetStepMin(); |
120 |
// clx = TRefArray(t.clx); |
TrkParams::SetMiniDefault(); |
|
// cly = TRefArray(t.cly); |
|
|
|
|
|
TrkParams::SetTrackingMode(); |
|
|
TrkParams::SetPrecisionFactor(); |
|
|
TrkParams::SetStepMin(); |
|
121 |
TrkParams::SetPFA(); |
TrkParams::SetPFA(); |
122 |
|
|
123 |
|
int ngf = TrkParams::nGF; |
124 |
|
for(int i=0; i<ngf; i++){ |
125 |
|
xGF[i] = t.xGF[i]; |
126 |
|
yGF[i] = t.yGF[i]; |
127 |
|
} |
128 |
}; |
}; |
129 |
//-------------------------------------- |
//-------------------------------------- |
130 |
// |
// |
157 |
t.ayv[ip] = ayv[ip]; |
t.ayv[ip] = ayv[ip]; |
158 |
t.dedx_x[ip] = dedx_x[ip]; |
t.dedx_x[ip] = dedx_x[ip]; |
159 |
t.dedx_y[ip] = dedx_y[ip]; |
t.dedx_y[ip] = dedx_y[ip]; |
160 |
|
t.multmaxx[ip] = multmaxx[ip]; |
161 |
|
t.multmaxy[ip] = multmaxy[ip]; |
162 |
|
t.seedx[ip] = seedx[ip]; |
163 |
|
t.seedy[ip] = seedy[ip]; |
164 |
|
t.xpu[ip] = xpu[ip]; |
165 |
|
t.ypu[ip] = ypu[ip]; |
166 |
|
|
167 |
}; |
}; |
168 |
|
int ngf = TrkParams::nGF; |
169 |
|
for(int i=0; i<ngf; i++){ |
170 |
|
t.xGF[i] = xGF[i]; |
171 |
|
t.yGF[i] = yGF[i]; |
172 |
|
} |
173 |
|
|
|
// t.clx = TRefArray(clx); |
|
|
// t.cly = TRefArray(cly); |
|
174 |
|
|
175 |
}; |
}; |
176 |
//-------------------------------------- |
//-------------------------------------- |
178 |
// |
// |
179 |
//-------------------------------------- |
//-------------------------------------- |
180 |
/** |
/** |
181 |
* Evaluates the trajectory in the apparatus associated to the track. |
* |
182 |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
* >>> OBSOLETE !!! use TrkTrack::DoTrack(Trajectory* t) instead |
183 |
* @param t pointer to an object of the class Trajectory, |
* |
|
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
|
|
* @return error flag. |
|
184 |
*/ |
*/ |
185 |
int TrkTrack::DoTrack(Trajectory* t){ |
int TrkTrack::DoTrack2(Trajectory* t){ |
|
|
|
|
double *dxout = new double[t->npoint]; |
|
|
double *dyout = new double[t->npoint]; |
|
|
double *dzin = new double[t->npoint]; |
|
|
double dal[5]; |
|
|
|
|
|
int ifail = 0; |
|
|
|
|
|
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
|
|
for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i]; |
|
186 |
|
|
187 |
TrkParams::Load(1); |
cout << endl; |
188 |
if( !TrkParams::IsLoaded(1) ){ |
cout << " int TrkTrack::DoTrack2(Trajectory* t) --->> NB NB !! this method is going to be eliminated !!! "<<endl; |
189 |
cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
cout << " >>>> replace it with TrkTrack::DoTrack(Trajectory* t) <<<<"<<endl; |
190 |
return 0; |
cout << " (Sorry Wolfgang!! Don't be totally confused!! By Elena)"<<endl; |
191 |
} |
cout << endl; |
|
dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail); |
|
|
|
|
|
for (int i=0; i<t->npoint; i++){ |
|
|
t->x[i] = (float)*dxout++; |
|
|
t->y[i] = (float)*dyout++; |
|
|
} |
|
192 |
|
|
193 |
// delete [] dxout; |
return DoTrack(t); |
|
// delete [] dyout; |
|
|
// delete [] dzin; |
|
194 |
|
|
|
return ifail; |
|
195 |
}; |
}; |
196 |
//-------------------------------------- |
//-------------------------------------- |
197 |
// |
// |
198 |
// |
// |
199 |
//-------------------------------------- |
//-------------------------------------- |
200 |
/** |
/** |
201 |
* Evaluates the trajectory in the apparatus associated to the track. |
* Evaluates the trajectory in the apparatus associated to the track state-vector. |
202 |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
* It integrates the equations of motion in the magnetic field. |
203 |
* @param t pointer to an object of the class Trajectory, |
* @param t pointer to an object of the class Trajectory, |
204 |
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
* which z coordinates should be previously assigned. |
205 |
* @return error flag. |
* @return error flag. |
206 |
*/ |
*/ |
207 |
int TrkTrack::DoTrack2(Trajectory* t){ |
int TrkTrack::DoTrack(Trajectory* t){ |
208 |
|
|
209 |
double *dxout = new double[t->npoint]; |
double *dxout = new double[t->npoint]; |
210 |
double *dyout = new double[t->npoint]; |
double *dyout = new double[t->npoint]; |
221 |
|
|
222 |
TrkParams::Load(1); |
TrkParams::Load(1); |
223 |
if( !TrkParams::IsLoaded(1) ){ |
if( !TrkParams::IsLoaded(1) ){ |
224 |
cout << "int TrkTrack::DoTrack2(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
225 |
return 0; |
return 0; |
226 |
} |
} |
227 |
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
228 |
|
|
229 |
for (int i=0; i<t->npoint; i++){ |
for (int i=0; i<t->npoint; i++){ |
230 |
t->x[i] = (float)*dxout++; |
t->x[i] = (float)*(dxout+i); |
231 |
t->y[i] = (float)*dyout++; |
t->y[i] = (float)*(dyout+i); |
232 |
t->thx[i] = (float)*dthxout++; |
t->thx[i] = (float)*(dthxout+i); |
233 |
t->thy[i] = (float)*dthyout++; |
t->thy[i] = (float)*(dthyout+i); |
234 |
t->tl[i] = (float)*dtlout++; |
t->tl[i] = (float)*(dtlout+i); |
235 |
} |
} |
236 |
|
|
237 |
// delete [] dxout; |
delete [] dxout; |
238 |
// delete [] dyout; |
delete [] dyout; |
239 |
// delete [] dzin; |
delete [] dzin; |
240 |
|
delete [] dthxout; |
241 |
|
delete [] dthyout; |
242 |
|
delete [] dtlout; |
243 |
|
|
244 |
return ifail; |
return ifail; |
245 |
}; |
}; |
299 |
return dedx; |
return dedx; |
300 |
}; |
}; |
301 |
/** |
/** |
302 |
* Returns 1 if the cluster on a tracker view includes bad strips. |
* Returns 1 if the cluster on a tracker view includes bad strips |
303 |
|
* (at least one bad strip among the four strip used by p.f.a.) |
304 |
* @param ip plane (0-5) |
* @param ip plane (0-5) |
305 |
* @param iv view (0=x 1=y) |
* @param iv view (0=x 1=y) |
306 |
*/ |
*/ |
373 |
} |
} |
374 |
return (last_plane-first_plane+1); |
return (last_plane-first_plane+1); |
375 |
} |
} |
376 |
|
/** |
377 |
|
* Returns the track "lever-arm" on the x+y view, defined as the distance (in planes) between |
378 |
|
* the upper and lower x,y (couple) measurements (the maximum value of lever-arm is 6). |
379 |
|
*/ |
380 |
|
Int_t TrkTrack::GetLeverArmXY(){ |
381 |
|
int first_plane = -1; |
382 |
|
int last_plane = -1; |
383 |
|
for(Int_t ip=0; ip<6; ip++){ |
384 |
|
if( XGood(ip)*YGood(ip) && first_plane == -1 )first_plane = ip; |
385 |
|
if( XGood(ip)*YGood(ip) && first_plane != -1 )last_plane = ip; |
386 |
|
} |
387 |
|
if( first_plane == -1 || last_plane == -1){ |
388 |
|
cout<< "Int_t TrkTrack::GetLeverArmXY() -- XGood(ip)*YGood(ip) always false ??? "<<endl; |
389 |
|
return 0; |
390 |
|
} |
391 |
|
return (last_plane-first_plane+1); |
392 |
|
} |
393 |
|
/** |
394 |
|
* Returns the reduced chi-square of track x-projection |
395 |
|
*/ |
396 |
|
Float_t TrkTrack::GetChi2X(){ |
397 |
|
float chiq=0; |
398 |
|
for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.); |
399 |
|
if(GetNX()>3)chiq=chiq/(GetNX()-3); |
400 |
|
else chiq=0; |
401 |
|
if(chiq==0)cout << " Float_t TrkTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl; |
402 |
|
return chiq; |
403 |
|
} |
404 |
|
/** |
405 |
|
* Returns the reduced chi-square of track y-projection |
406 |
|
*/ |
407 |
|
Float_t TrkTrack::GetChi2Y(){ |
408 |
|
float chiq=0; |
409 |
|
for(int ip=0; ip<6; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.); |
410 |
|
if(GetNY()>2)chiq=chiq/(GetNY()-2); |
411 |
|
else chiq=0; |
412 |
|
if(chiq==0)cout << " Float_t TrkTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl; |
413 |
|
return chiq; |
414 |
|
} |
415 |
|
/** |
416 |
|
* Returns the logarythm of the likeliwood-function of track x-projection |
417 |
|
*/ |
418 |
|
Float_t TrkTrack::GetLnLX(){ |
419 |
|
float lnl=0; |
420 |
|
for(int ip=0; ip<6; ip++) |
421 |
|
if( XGood(ip) && tailx[ip]!=0 ) |
422 |
|
lnl += (tailx[ip]+1.) * log( (tailx[ip]*pow(resx[ip],2.) + pow(xv[ip]-xm[ip],2.)) / (tailx[ip]*pow(resx[ip],2)) ); |
423 |
|
if(GetNX()>3)lnl=lnl/(GetNX()-3); |
424 |
|
else lnl=0; |
425 |
|
if(lnl==0){ |
426 |
|
cout << " Float_t TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl; |
427 |
|
Dump(); |
428 |
|
} |
429 |
|
return lnl; |
430 |
|
|
431 |
|
} |
432 |
|
/** |
433 |
|
* Returns the logarythm of the likeliwood-function of track y-projection |
434 |
|
*/ |
435 |
|
Float_t TrkTrack::GetLnLY(){ |
436 |
|
float lnl=0; |
437 |
|
for(int ip=0; ip<6; ip++) |
438 |
|
if( YGood(ip) && taily[ip]!=0 ) |
439 |
|
lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) ); |
440 |
|
if(GetNY()>2)lnl=lnl/(GetNY()-2); |
441 |
|
else lnl=0; |
442 |
|
if(lnl==0){ |
443 |
|
cout << " Float_t TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl; |
444 |
|
Dump(); |
445 |
|
} |
446 |
|
return lnl; |
447 |
|
|
448 |
|
} |
449 |
|
/** |
450 |
|
* Returns the effective angle, relative to the sensor, on each plane. |
451 |
|
* @param ip plane (0-5) |
452 |
|
* @param iv view (0=x 1=y) |
453 |
|
*/ |
454 |
|
Float_t TrkTrack::GetEffectiveAngle(int ip, int iv){ |
455 |
|
|
456 |
|
if(ip<0 || ip>5){ |
457 |
|
cout << "Float_t TrkTrack::GetEffectiveAngle(int "<<ip<<", int "<<iv<<") ==> wrong input"<<endl; |
458 |
|
return 0.; |
459 |
|
} |
460 |
|
|
461 |
|
float v[3]={xv[ip],yv[ip],zv[ip]}; |
462 |
|
//----------------------------------------- |
463 |
|
// effective angle (relative to the sensor) |
464 |
|
//----------------------------------------- |
465 |
|
float axv_geo = axv[ip]; |
466 |
|
float muhall_h = 297.61; //cm**2/Vs |
467 |
|
float BY = TrkParams::GetBY(v); |
468 |
|
float axv_eff = 0; |
469 |
|
if(ip==5) axv_geo = -1*axv_geo; |
470 |
|
if(ip==5) BY = -1*BY; |
471 |
|
axv_eff = 180.*atan( tan(axv_geo*acos(-1.)/180.) + muhall_h * BY * 0.0001)/acos(-1.); |
472 |
|
//----------------------------------------- |
473 |
|
// effective angle (relative to the sensor) |
474 |
|
//----------------------------------------- |
475 |
|
float ayv_geo = ayv[ip]; |
476 |
|
float muhall_e = 1258.18; //cm**2/Vs |
477 |
|
float BX = TrkParams::GetBX(v); |
478 |
|
float ayv_eff = 0; |
479 |
|
ayv_eff = 180.*atan( tan(ayv_geo*acos(-1.)/180.) + muhall_e * BX * 0.0001)/acos(-1.); |
480 |
|
|
481 |
|
if (iv==0)return axv_eff; |
482 |
|
else if(iv==1)return ayv_eff; |
483 |
|
else{ |
484 |
|
cout << "Float_t TrkTrack::GetEffectiveAngle(int "<<ip<<", int "<<iv<<") ==> wrong input"<<endl; |
485 |
|
return 0.; |
486 |
|
} |
487 |
|
|
488 |
|
}; |
489 |
|
|
490 |
//-------------------------------------- |
//-------------------------------------- |
491 |
// |
// |
492 |
// |
// |
508 |
cout << endl << "zv : "; for(int i=0; i<6; i++)cout << zv[i] << " "; |
cout << endl << "zv : "; for(int i=0; i<6; i++)cout << zv[i] << " "; |
509 |
cout << endl << "resx : "; for(int i=0; i<6; i++)cout << resx[i] << " "; |
cout << endl << "resx : "; for(int i=0; i<6; i++)cout << resx[i] << " "; |
510 |
cout << endl << "resy : "; for(int i=0; i<6; i++)cout << resy[i] << " "; |
cout << endl << "resy : "; for(int i=0; i<6; i++)cout << resy[i] << " "; |
511 |
|
cout << endl << "tailx : "; for(int i=0; i<6; i++)cout << tailx[i] << " "; |
512 |
|
cout << endl << "taily : "; for(int i=0; i<6; i++)cout << taily[i] << " "; |
513 |
cout << endl << "coval : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" "; |
cout << endl << "coval : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" "; |
514 |
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[1][i]<<" "; |
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[1][i]<<" "; |
515 |
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[2][i]<<" "; |
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[2][i]<<" "; |
517 |
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[4][i]<<" "; |
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[4][i]<<" "; |
518 |
cout << endl << "dedx_x : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " "; |
cout << endl << "dedx_x : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " "; |
519 |
cout << endl << "dedx_y : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " "; |
cout << endl << "dedx_y : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " "; |
520 |
|
cout << endl << "maxs x : "; for(int i=0; i<6; i++)cout << GetClusterX_MaxStrip(i) << " "; |
521 |
|
cout << endl << "maxs y : "; for(int i=0; i<6; i++)cout << GetClusterY_MaxStrip(i) << " "; |
522 |
|
cout << endl << "mult x : "; for(int i=0; i<6; i++)cout << GetClusterX_Multiplicity(i) << " "; |
523 |
|
cout << endl << "mult y : "; for(int i=0; i<6; i++)cout << GetClusterY_Multiplicity(i) << " "; |
524 |
|
cout << endl << "seed x : "; for(int i=0; i<6; i++)cout << GetClusterX_Seed(i) << " "; |
525 |
|
cout << endl << "seed y : "; for(int i=0; i<6; i++)cout << GetClusterY_Seed(i) << " "; |
526 |
|
cout << endl << "xpu : "; for(int i=0; i<6; i++)cout << xpu[i] << " "; |
527 |
|
cout << endl << "ypu : "; for(int i=0; i<6; i++)cout << ypu[i] << " "; |
528 |
|
|
529 |
cout << endl; |
cout << endl; |
530 |
} |
} |
531 |
/** |
/** |
544 |
for(int i=0; i<6; i++) resy[i]=*ry++; |
for(int i=0; i<6; i++) resy[i]=*ry++; |
545 |
} |
} |
546 |
/** |
/** |
547 |
* Set the TrkTrack good measurement. |
* Set the TrkTrack tails position resolution |
548 |
|
*/ |
549 |
|
void TrkTrack::SetTail(double *tx, double *ty, double factor){ |
550 |
|
for(int i=0; i<6; i++) tailx[i]=factor*(*tx++); |
551 |
|
for(int i=0; i<6; i++) taily[i]=factor*(*ty++); |
552 |
|
} |
553 |
|
/** |
554 |
|
* Set the TrkTrack Student parameter (resx,resy,tailx,taily) |
555 |
|
* from previous gausian fit |
556 |
|
*@param flag =0 standard, =1 with noise correction |
557 |
|
*/ |
558 |
|
void TrkTrack::SetStudentParam(int flag){ |
559 |
|
float sx[11]={0.000128242, |
560 |
|
0.000136942, |
561 |
|
0.000162718, |
562 |
|
0.000202644, |
563 |
|
0.00025597, |
564 |
|
0.000317456, |
565 |
|
0.000349048, |
566 |
|
0.000384638, |
567 |
|
0.000457295, |
568 |
|
0.000512319, |
569 |
|
0.000538573}; |
570 |
|
float tx[11]={1.79402, |
571 |
|
2.04876, |
572 |
|
2.88376, |
573 |
|
3.3, |
574 |
|
3.14084, |
575 |
|
4.07686, |
576 |
|
4.44736, |
577 |
|
3.5179, |
578 |
|
3.38697, |
579 |
|
3.45739, |
580 |
|
3.18627}; |
581 |
|
float sy[11]={0.000483075, |
582 |
|
0.000466925, |
583 |
|
0.000431658, |
584 |
|
0.000428317, |
585 |
|
0.000433854, |
586 |
|
0.000444044, |
587 |
|
0.000482098, |
588 |
|
0.000537579, |
589 |
|
0.000636279, |
590 |
|
0.000741998, |
591 |
|
0.000864261}; |
592 |
|
float ty[11]={0.997032, |
593 |
|
1.11147, |
594 |
|
1.18526, |
595 |
|
1.61404, |
596 |
|
2.21908, |
597 |
|
3.08959, |
598 |
|
4.48833, |
599 |
|
4.42687, |
600 |
|
4.65253, |
601 |
|
4.52043, |
602 |
|
4.29926}; |
603 |
|
int index; |
604 |
|
float fact=0.; |
605 |
|
for(int i=0; i<6; i++) { |
606 |
|
index = int((fabs(axv[i])+1.)/2.); |
607 |
|
if(index>10) index=10; |
608 |
|
tailx[i]=tx[index]; |
609 |
|
if(flag==1) { |
610 |
|
if(fabs(axv[i])<=10.) fact = resx[i]/risxeta2_(&(axv[i])); |
611 |
|
if(fabs(axv[i])>10.&&fabs(axv[i])<=15.) fact = resx[i]/risxeta3_(&(axv[i])); |
612 |
|
if(fabs(axv[i])>15.) fact = resx[i]/risxeta4_(&(axv[i])); |
613 |
|
} else fact = 1.; |
614 |
|
resx[i] = sx[index]*fact; |
615 |
|
} |
616 |
|
for(int i=0; i<6; i++) { |
617 |
|
index = int((fabs(ayv[i])+1.)/2.); |
618 |
|
if(index>10) index=10; |
619 |
|
taily[i]=ty[index]; |
620 |
|
if(flag==1) fact = resy[i]/risyeta2_(&(ayv[i])); |
621 |
|
else fact = 1.; |
622 |
|
resy[i] = sy[index]*fact; |
623 |
|
} |
624 |
|
} |
625 |
|
/** |
626 |
|
* Set the TrkTrack good measurement |
627 |
*/ |
*/ |
628 |
void TrkTrack::SetGood(int *xg, int *yg){ |
void TrkTrack::SetGood(int *xg, int *yg){ |
629 |
|
|
641 |
// path_.error = 0; |
// path_.error = 0; |
642 |
// readb_(); |
// readb_(); |
643 |
|
|
644 |
TrkParams::SetTrackingMode(); |
// TrkParams::SetTrackingMode(); |
645 |
TrkParams::SetPrecisionFactor(); |
// TrkParams::SetPrecisionFactor(); |
646 |
TrkParams::SetStepMin(); |
// TrkParams::SetStepMin(); |
647 |
|
TrkParams::SetMiniDefault(); |
648 |
|
|
649 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
650 |
TrkParams::Load(1); |
TrkParams::Load(1); |
651 |
|
if( !TrkParams::IsLoaded(1) ){ |
652 |
|
cout << "void TrkTrack::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl; |
653 |
|
} |
654 |
|
|
655 |
}; |
}; |
656 |
|
|
672 |
track.zm[i]=zm[i]; |
track.zm[i]=zm[i]; |
673 |
|
|
674 |
// --- temporaneo ---------------------------- |
// --- temporaneo ---------------------------- |
675 |
// andrebbe inserita la dimensione del sensore |
// float segment = 100.; |
676 |
float segment = 100.; |
// track.xm_a[i]=xm[i]; |
677 |
track.xm_a[i]=xm[i]; |
// track.xm_b[i]=xm[i]; |
678 |
track.xm_b[i]=xm[i]; |
// track.ym_a[i]=ym[i]; |
679 |
track.ym_a[i]=ym[i]; |
// track.ym_b[i]=ym[i]; |
680 |
track.ym_b[i]=ym[i]; |
// if( XGood(i) && !YGood(i) ){ |
681 |
if( XGood(i) && !YGood(i) ){ |
// track.ym_a[i] = track.ym_a[i]+segment; |
682 |
track.ym_a[i] = track.ym_a[i]+segment; |
// track.ym_b[i] = track.ym_b[i]-segment; |
683 |
track.ym_b[i] = track.ym_b[i]-segment; |
// }else if( !XGood(i) && YGood(i)){ |
684 |
}else if( !XGood(i) && YGood(i)){ |
// track.xm_a[i] = track.xm_a[i]+segment; |
685 |
track.xm_a[i] = track.xm_a[i]+segment; |
// track.xm_b[i] = track.xm_b[i]-segment; |
686 |
track.xm_b[i] = track.xm_b[i]-segment; |
// } |
|
} |
|
687 |
// --- temporaneo ---------------------------- |
// --- temporaneo ---------------------------- |
688 |
|
|
689 |
|
if( XGood(i) || YGood(i) ){ |
690 |
|
double segment = 2.;//cm |
691 |
|
// NB: i parametri di allineamento hanno una notazione particolare!!! |
692 |
|
// sensor = 0 (hybrid side), 1 |
693 |
|
// ladder = 0-2 (increasing x) |
694 |
|
// plane = 0-5 (from bottom to top!!!) |
695 |
|
int is = (int)GetSensor(i); if(i==5)is=1-is; |
696 |
|
int ip = 5-i; |
697 |
|
int il = (int)GetLadder(i); |
698 |
|
|
699 |
|
double omega = 0.; |
700 |
|
double beta = 0.; |
701 |
|
double gamma = 0.; |
702 |
|
if( |
703 |
|
(is < 0 || is > 1 || ip < 0 || ip > 5 || il < 0 || il > 2) && |
704 |
|
true){ |
705 |
|
// se il piano risulta colpito, ladder e sensore devono essere |
706 |
|
// assegnati correttamente |
707 |
|
cout << " void TrkTrack::FillMiniStruct(cMini2track&) --- WARNING --- sensor not defined, cannot read alignment parameters "<<endl; |
708 |
|
cout << " is ip il = "<<is<<" "<<ip<<" "<<il<<endl; |
709 |
|
}else{ |
710 |
|
omega = alignparameters_.omega[is][il][ip]; |
711 |
|
beta = alignparameters_.beta[is][il][ip]; |
712 |
|
gamma = alignparameters_.gamma[is][il][ip]; |
713 |
|
} |
714 |
|
|
715 |
|
if( XGood(i) && !YGood(i) ){ |
716 |
|
track.xm_a[i] = xm[i] - omega * segment; |
717 |
|
track.ym_a[i] = ym[i] + segment; |
718 |
|
// track.zm_a[i] = zm[i] + beta * segment;//not used yet |
719 |
|
track.xm_b[i] = xm[i] + omega * segment; |
720 |
|
track.ym_b[i] = ym[i] - segment; |
721 |
|
// track.zm_b[i] = zm[i] - beta * segment;//not used yet |
722 |
|
}else if( !XGood(i) && YGood(i) ){ |
723 |
|
track.xm_a[i] = xm[i] + segment; |
724 |
|
track.ym_a[i] = ym[i] + omega * segment; |
725 |
|
// track.zm_a[i] = zm[i] - gamma * segment;//not used yet |
726 |
|
track.xm_b[i] = xm[i] - segment; |
727 |
|
track.ym_b[i] = ym[i] - omega * segment; |
728 |
|
// track.zm_b[i] = zm[i] + gamma * segment;//not used yet |
729 |
|
} |
730 |
|
} |
731 |
|
|
732 |
track.resx[i]=resx[i]; |
track.resx[i]=resx[i]; |
733 |
track.resy[i]=resy[i]; |
track.resy[i]=resy[i]; |
734 |
|
track.tailx[i]=tailx[i]; |
735 |
|
track.taily[i]=taily[i]; |
736 |
} |
} |
737 |
|
|
738 |
for(int i=0; i<5; i++) track.al[i]=al[i]; |
for(int i=0; i<5; i++) track.al[i]=al[i]; |
788 |
* |
* |
789 |
* @see TrkParams::SetPFA(int) |
* @see TrkParams::SetPFA(int) |
790 |
*/ |
*/ |
791 |
void TrkTrack::EvaluateClusterPositions(){ |
Bool_t TrkTrack::EvaluateClusterPositions(){ |
792 |
|
|
793 |
// cout << "void TrkTrack::GetClusterPositions() "<<endl; |
// cout << "void TrkTrack::GetClusterositions() "<<endl; |
794 |
|
|
795 |
|
TrkParams::Load(1); |
796 |
|
if( !TrkParams::IsLoaded(1) ){ |
797 |
|
cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- m.field not loaded "<<endl; |
798 |
|
return false; |
799 |
|
} |
800 |
|
TrkParams::Load(4); |
801 |
|
if( !TrkParams::IsLoaded(4) ){ |
802 |
|
cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- p.f.a. par. not loaded "<<endl; |
803 |
|
return false; |
804 |
|
} |
805 |
|
TrkParams::Load(5); |
806 |
|
if( !TrkParams::IsLoaded(5) ){ |
807 |
|
cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- alignment par. not loaded "<<endl; |
808 |
|
return false; |
809 |
|
} |
810 |
|
|
|
TrkParams::Load( ); |
|
|
if( !TrkParams::IsLoaded() )return; |
|
|
|
|
811 |
for(int ip=0; ip<6; ip++){ |
for(int ip=0; ip<6; ip++){ |
812 |
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
813 |
int icx = GetClusterX_ID(ip)+1; |
int icx = GetClusterX_ID(ip)+1; |
825 |
float bfy = 10*TrkParams::GetBY(v);//Tesla |
float bfy = 10*TrkParams::GetBY(v);//Tesla |
826 |
int ipp=ip+1; |
int ipp=ip+1; |
827 |
xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); |
xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); |
828 |
|
if(icx<0 || icy<0)return false; |
829 |
} |
} |
830 |
|
return true; |
831 |
} |
} |
832 |
/** |
/** |
833 |
* \brief Tracking method. It calls F77 mini routine. |
* \brief Tracking method. It calls F77 mini routine. |
851 |
* @see EvaluateClusterPositions() |
* @see EvaluateClusterPositions() |
852 |
* |
* |
853 |
* The fitting procedure can be varied by changing the tracking mode, |
* The fitting procedure can be varied by changing the tracking mode, |
854 |
* the fit-precision factor and the minimum number of step. |
* the fit-precision factor, the minimum number of step, etc. |
855 |
* @see SetTrackingMode(int) |
* @see SetTrackingMode(int) |
856 |
* @see SetPrecisionFactor(double) |
* @see SetPrecisionFactor(double) |
857 |
* @see SetStepMin(int) |
* @see SetStepMin(int) |
858 |
|
* @see SetDeltaB(int,double) |
859 |
*/ |
*/ |
860 |
void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ |
void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ |
861 |
|
|
862 |
float al_ini[] = {0.,0.,0.,0.,0.}; |
TrkParams::Load(1); |
863 |
|
if( !TrkParams::IsLoaded(1) ){ |
864 |
|
cout << "void TrkTrack::Fit(double,int&,int,int) ---ERROR--- m.field not loaded "<<endl; |
865 |
|
return; |
866 |
|
} |
867 |
|
TrkParams::Load(5); |
868 |
|
if( !TrkParams::IsLoaded(5) ){ |
869 |
|
cout << "void TrkTrack::Fit(double,int&,int,int) ---ERROR--- align.param. not loaded "<<endl; |
870 |
|
return; |
871 |
|
} |
872 |
|
|
873 |
TrkParams::Load( ); |
float al_ini[] = {0.,0.,0.,0.,0.}; |
|
if( !TrkParams::IsLoaded() )return; |
|
874 |
|
|
875 |
extern cMini2track track_; |
extern cMini2track track_; |
876 |
fail = 0; |
fail = 0; |
877 |
|
|
878 |
FillMiniStruct(track_); |
FillMiniStruct(track_); |
879 |
|
|
880 |
if(froml1!=0)EvaluateClusterPositions(); |
if(froml1!=0){ |
881 |
|
if( !EvaluateClusterPositions() ){ |
882 |
|
cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl; |
883 |
|
FillMiniStruct(track_) ; |
884 |
|
fail = 1; |
885 |
|
return; |
886 |
|
} |
887 |
|
}else{ |
888 |
|
FillMiniStruct(track_); |
889 |
|
} |
890 |
|
|
891 |
// if fit variables have been reset, evaluate the initial guess |
// if fit variables have been reset, evaluate the initial guess |
892 |
if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_(); |
if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_(); |
906 |
|
|
907 |
// ------------------------------------------ |
// ------------------------------------------ |
908 |
// call mini routine |
// call mini routine |
909 |
// TrkParams::Load(1); |
// ------------------------------------------ |
|
// if( !TrkParams::IsLoaded(1) ){ |
|
|
// cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; |
|
|
// return; |
|
|
// } |
|
910 |
int istep=0; |
int istep=0; |
911 |
int ifail=0; |
int ifail=0; |
912 |
mini2_(&istep,&ifail, &iprint); |
mini2_(&istep,&ifail, &iprint); |
955 |
track_.fact = fact; |
track_.fact = fact; |
956 |
} |
} |
957 |
/** |
/** |
958 |
* Set the factor scale for tracking precision |
* Set the minimum number of steps for tracking precision |
959 |
*/ |
*/ |
960 |
void TrkTrack::SetStepMin(int istepmin){ |
void TrkTrack::SetStepMin(int istepmin){ |
961 |
extern cMini2track track_; |
extern cMini2track track_; |
962 |
track_.istepmin = istepmin; |
track_.istepmin = istepmin; |
963 |
} |
} |
964 |
|
/** |
965 |
|
* Set deltaB parameters (id=0,1). By default they are set to zero. |
966 |
|
*/ |
967 |
|
void TrkTrack::SetDeltaB(int id, double db){ |
968 |
|
if(id!=0 && id!=1)cout << "void TrkTrack::SetDeltaB(int id,double db) -- wrong input parameters: "<<id<<" "<<db<<endl; |
969 |
|
TrkParams::SetDeltaB(id,db); |
970 |
|
} |
971 |
|
|
972 |
|
/** |
973 |
|
* Returns true if the track is inside the magnet cavity. |
974 |
|
* @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume) |
975 |
|
*/ |
976 |
|
Bool_t TrkTrack::IsInsideCavity(float toll){ |
977 |
|
|
978 |
|
// float xmagntop, ymagntop, xmagnbottom, ymagnbottom; |
979 |
|
// xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.); |
980 |
|
// ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.); |
981 |
|
// xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.); |
982 |
|
// ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.); |
983 |
|
// if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH && |
984 |
|
// ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH && |
985 |
|
// xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH && |
986 |
|
// ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true); |
987 |
|
// else return(false); |
988 |
|
|
989 |
|
int ngf = TrkParams::nGF; |
990 |
|
for(int i=0; i<ngf; i++){ |
991 |
|
// |
992 |
|
// cout << endl << TrkParams::GF_element[i]; |
993 |
|
if( |
994 |
|
TrkParams::GF_element[i].CompareTo("CUF") && |
995 |
|
TrkParams::GF_element[i].CompareTo("T2") && |
996 |
|
TrkParams::GF_element[i].CompareTo("T3") && |
997 |
|
TrkParams::GF_element[i].CompareTo("T4") && |
998 |
|
TrkParams::GF_element[i].CompareTo("T5") && |
999 |
|
TrkParams::GF_element[i].CompareTo("CLF") && |
1000 |
|
true)continue; |
1001 |
|
// apply condition only within the cavity |
1002 |
|
// cout << " -- "<<xGF[i]<<" "<<yGF[i]; |
1003 |
|
if( |
1004 |
|
xGF[i] <= TrkParams::xGF_min[i] + toll || |
1005 |
|
xGF[i] >= TrkParams::xGF_max[i] - toll || |
1006 |
|
yGF[i] <= TrkParams::yGF_min[i] + toll || |
1007 |
|
yGF[i] >= TrkParams::yGF_max[i] - toll || |
1008 |
|
false){ |
1009 |
|
|
1010 |
|
return false; |
1011 |
|
} |
1012 |
|
} |
1013 |
|
return true; |
1014 |
|
|
1015 |
|
|
1016 |
|
} |
1017 |
|
/** |
1018 |
|
* Returns true if the track is inside the nominal acceptance, which is defined |
1019 |
|
* by the intersection among magnet cavity, silicon-plane sensitive area and |
1020 |
|
* ToF sensitive area (nominal values from the official document used to |
1021 |
|
* calculate the geometrical factor) |
1022 |
|
*/ |
1023 |
|
Bool_t TrkTrack::IsInsideAcceptance(){ |
1024 |
|
|
1025 |
|
int ngf = TrkParams::nGF; |
1026 |
|
for(int i=0; i<ngf; i++){ |
1027 |
|
if( |
1028 |
|
xGF[i] <= TrkParams::xGF_min[i] || |
1029 |
|
xGF[i] >= TrkParams::xGF_max[i] || |
1030 |
|
yGF[i] <= TrkParams::yGF_min[i] || |
1031 |
|
yGF[i] >= TrkParams::yGF_max[i] || |
1032 |
|
false)return false; |
1033 |
|
} |
1034 |
|
return true; |
1035 |
|
|
1036 |
|
} |
1037 |
/** |
/** |
1038 |
* Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. |
* Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. |
1039 |
* If no cluster is associated, ID=-1. |
* If no cluster is associated, ID=-1. |
1050 |
Int_t TrkTrack::GetClusterY_ID(int ip){ |
Int_t TrkTrack::GetClusterY_ID(int ip){ |
1051 |
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
1052 |
}; |
}; |
1053 |
|
|
1054 |
/** |
/** |
1055 |
* Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane. |
* Method to retrieve the ladder (0-2, increasing x) traversed by the track on this plane. |
1056 |
* If no ladder is traversed (dead area) the metod retuns -1. |
* If no ladder is traversed (dead area) the metod retuns -1. |
1057 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
1058 |
*/ |
*/ |
1075 |
/** |
/** |
1076 |
* \brief Method to include a x-cluster to the track. |
* \brief Method to include a x-cluster to the track. |
1077 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
1078 |
* @param clid Cluster ID (0,1,...) |
* @param clid Cluster ID (0 = no-cluster, 1,2,... otherwise ) |
1079 |
* @param is Sensor (0-1, increasing y) |
* @param il Ladder (0-2, increasing x, -1 if no sensitive area is hit) |
1080 |
|
* @param is Sensor (0-1, increasing y, -1 if no sensitive area is hit) |
1081 |
|
* @param bad True if the cluster contains bad strips |
1082 |
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
1083 |
*/ |
*/ |
1084 |
void TrkTrack::SetXGood(int ip, int clid, int is){ |
void TrkTrack::SetXGood(int ip, int clid, int il, int is, bool bad){ |
1085 |
int il=0; //ladder (temporary) |
// int il=0; //ladder (temporary) |
1086 |
bool bad=false; //ladder (temporary) |
// bool bad=false; //ladder (temporary) |
1087 |
xgood[ip]=il*100000000+is*10000000+clid; |
if(ip<0||ip>5||clid<0||il<-1||il>2||is<-1||is>1) |
1088 |
|
cout << " void TrkTrack::SetXGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<<endl; |
1089 |
|
xgood[ip]=(il+1)*100000000+(is+1)*10000000+clid; |
1090 |
if(bad)xgood[ip]=-xgood[ip]; |
if(bad)xgood[ip]=-xgood[ip]; |
1091 |
}; |
}; |
1092 |
/** |
/** |
1093 |
* \brief Method to include a y-cluster to the track. |
* \brief Method to include a y-cluster to the track. |
1094 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
1095 |
* @param clid Cluster ID (0,1,...) |
* @param clid Cluster ID (0 = no-cluster, 1,2,... otherwise ) |
1096 |
* @param is Sensor (0-1) |
* @param il Ladder (0-2, increasing x, -1 if no sensitive area is hit) |
1097 |
|
* @param is Sensor (0-1, increasing y, -1 if no sensitive area is hit) |
1098 |
|
* @param bad True if the cluster contains bad strips |
1099 |
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
1100 |
*/ |
*/ |
1101 |
void TrkTrack::SetYGood(int ip, int clid, int is){ |
void TrkTrack::SetYGood(int ip, int clid, int il, int is, bool bad){ |
1102 |
int il=0; //ladder (temporary) |
// int il=0; //ladder (temporary) |
1103 |
bool bad=false; //ladder (temporary) |
// bool bad=false; //ladder (temporary) |
1104 |
ygood[ip]=il*100000000+is*10000000+clid; |
if(ip<0||ip>5||clid<0||il<-1||il>2||is<-1||is>1) |
1105 |
|
cout << " void TrkTrack::SetYGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<<endl; |
1106 |
|
ygood[ip]=(il+1)*100000000+(is+1)*10000000+clid; |
1107 |
if(bad)ygood[ip]=-ygood[ip]; |
if(bad)ygood[ip]=-ygood[ip]; |
1108 |
}; |
}; |
1109 |
|
|
1110 |
|
/** |
1111 |
|
* \brief Average X |
1112 |
|
* Average value of <xv>, evaluated from the first to the last hit x view. |
1113 |
|
*/ |
1114 |
|
Float_t TrkTrack::GetXav(){ |
1115 |
|
|
1116 |
|
int first_plane = -1; |
1117 |
|
int last_plane = -1; |
1118 |
|
for(Int_t ip=0; ip<6; ip++){ |
1119 |
|
if( XGood(ip) && first_plane == -1 )first_plane = ip; |
1120 |
|
if( XGood(ip) && first_plane != -1 )last_plane = ip; |
1121 |
|
} |
1122 |
|
if( first_plane == -1 || last_plane == -1){ |
1123 |
|
return -100; |
1124 |
|
} |
1125 |
|
if( last_plane-first_plane+1 ==0 )return -100; |
1126 |
|
|
1127 |
|
Float_t av = 0; |
1128 |
|
for(int ip=first_plane; ip<=last_plane; ip++)av+=xv[ip]; |
1129 |
|
|
1130 |
|
return (av/(last_plane-first_plane+1)); |
1131 |
|
} |
1132 |
|
/** |
1133 |
|
* \brief Average Y |
1134 |
|
* Average value of <yv>, evaluated from the first to the last hit x view. |
1135 |
|
*/ |
1136 |
|
Float_t TrkTrack::GetYav(){ |
1137 |
|
|
1138 |
|
int first_plane = -1; |
1139 |
|
int last_plane = -1; |
1140 |
|
for(Int_t ip=0; ip<6; ip++){ |
1141 |
|
if( XGood(ip) && first_plane == -1 )first_plane = ip; |
1142 |
|
if( XGood(ip) && first_plane != -1 )last_plane = ip; |
1143 |
|
} |
1144 |
|
if( first_plane == -1 || last_plane == -1){ |
1145 |
|
return -100; |
1146 |
|
} |
1147 |
|
if( last_plane-first_plane+1 ==0 )return -100; |
1148 |
|
|
1149 |
|
Float_t av = 0; |
1150 |
|
for(int ip=first_plane; ip<=last_plane; ip++)av+=yv[ip]; |
1151 |
|
|
1152 |
|
return (av/(last_plane-first_plane+1)); |
1153 |
|
} |
1154 |
|
/** |
1155 |
|
* \brief Average Z |
1156 |
|
* Average value of <zv>, evaluated from the first to the last hit x view. |
1157 |
|
*/ |
1158 |
|
Float_t TrkTrack::GetZav(){ |
1159 |
|
|
1160 |
|
int first_plane = -1; |
1161 |
|
int last_plane = -1; |
1162 |
|
for(Int_t ip=0; ip<6; ip++){ |
1163 |
|
if( XGood(ip) && first_plane == -1 )first_plane = ip; |
1164 |
|
if( XGood(ip) && first_plane != -1 )last_plane = ip; |
1165 |
|
} |
1166 |
|
if( first_plane == -1 || last_plane == -1){ |
1167 |
|
return -100; |
1168 |
|
} |
1169 |
|
if( last_plane-first_plane+1 ==0 )return -100; |
1170 |
|
|
1171 |
|
Float_t av = 0; |
1172 |
|
for(int ip=first_plane; ip<=last_plane; ip++)av+=zv[ip]; |
1173 |
|
|
1174 |
|
return (av/(last_plane-first_plane+1)); |
1175 |
|
} |
1176 |
|
|
1177 |
|
/** |
1178 |
|
* \brief Number of column traversed |
1179 |
|
*/ |
1180 |
|
Int_t TrkTrack::GetNColumns(){ |
1181 |
|
int sensors[] = {0,0,0,0,0,0}; |
1182 |
|
for(int ip=0; ip<6; ip++){ |
1183 |
|
int sensorid = GetLadder(ip)+3*GetSensor(ip); |
1184 |
|
if(XGood(ip)||YGood(ip)) |
1185 |
|
if(sensorid>=0 && sensorid<6)sensors[sensorid]=1; |
1186 |
|
} |
1187 |
|
int nsensors=0; |
1188 |
|
for(int is=0; is<6; is++)nsensors += sensors[is]; |
1189 |
|
return nsensors; |
1190 |
|
}; |
1191 |
|
/** |
1192 |
|
* \brief Give the maximum energy release |
1193 |
|
*/ |
1194 |
|
Float_t TrkTrack::GetDEDX_max(int ip, int iv){ |
1195 |
|
Float_t max=0; |
1196 |
|
int pfrom = 0; |
1197 |
|
int pto = 6; |
1198 |
|
int vfrom = 0; |
1199 |
|
int vto = 2; |
1200 |
|
if(ip>=0&&ip<6){ |
1201 |
|
pfrom = ip; |
1202 |
|
pto = ip+1; |
1203 |
|
} |
1204 |
|
if(iv>=0&&iv<2){ |
1205 |
|
vfrom = iv; |
1206 |
|
vto = iv+1; |
1207 |
|
} |
1208 |
|
for(int i=pfrom; i<pto; i++) |
1209 |
|
for(int j=vfrom; j<vto; j++){ |
1210 |
|
if(j==0 && XGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j); |
1211 |
|
if(j==1 && YGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j); |
1212 |
|
} |
1213 |
|
return max; |
1214 |
|
|
1215 |
|
}; |
1216 |
|
|
1217 |
|
/** |
1218 |
|
* \brief Give the minimum energy release |
1219 |
|
*/ |
1220 |
|
Float_t TrkTrack::GetDEDX_min(int ip, int iv){ |
1221 |
|
Float_t min=100000000; |
1222 |
|
int pfrom = 0; |
1223 |
|
int pto = 6; |
1224 |
|
int vfrom = 0; |
1225 |
|
int vto = 2; |
1226 |
|
if(ip>=0&&ip<6){ |
1227 |
|
pfrom = ip; |
1228 |
|
pto = ip+1; |
1229 |
|
} |
1230 |
|
if(iv>=0&&iv<2){ |
1231 |
|
vfrom = iv; |
1232 |
|
vto = iv+1; |
1233 |
|
} |
1234 |
|
for(int i=pfrom; i<pto; i++) |
1235 |
|
for(int j=vfrom; j<vto; j++){ |
1236 |
|
if(j==0 && XGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j); |
1237 |
|
if(j==1 && YGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j); |
1238 |
|
} |
1239 |
|
return min; |
1240 |
|
|
1241 |
|
}; |
1242 |
|
|
1243 |
|
/** |
1244 |
|
* \brief Give the maximum spatial residual |
1245 |
|
*/ |
1246 |
|
Float_t TrkTrack::GetResidual_max(int ip, int iv){ |
1247 |
|
Float_t max=0; |
1248 |
|
int pfrom = 0; |
1249 |
|
int pto = 6; |
1250 |
|
int vfrom = 0; |
1251 |
|
int vto = 2; |
1252 |
|
if(ip>=0&&ip<6){ |
1253 |
|
pfrom = ip; |
1254 |
|
pto = ip+1; |
1255 |
|
} |
1256 |
|
if(iv>=0&&iv<2){ |
1257 |
|
vfrom = iv; |
1258 |
|
vto = iv+1; |
1259 |
|
} |
1260 |
|
for(int i=pfrom; i<pto; i++){ |
1261 |
|
for(int j=vfrom; j<vto; j++){ |
1262 |
|
if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xm[i]-xv[i]; |
1263 |
|
if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=ym[i]-yv[i]; |
1264 |
|
} |
1265 |
|
} |
1266 |
|
return max; |
1267 |
|
|
1268 |
|
}; |
1269 |
|
/** |
1270 |
|
* \brief Give the anerage spatial residual |
1271 |
|
*/ |
1272 |
|
Float_t TrkTrack::GetResidual_av(int ip, int iv){ |
1273 |
|
// |
1274 |
|
//Sum$((xm>-50)*(xm-xv)/resx)/sqrt(TrkTrack.GetNX()*TrkTrack.GetChi2X())<0.3 |
1275 |
|
|
1276 |
|
Float_t av = 0.; |
1277 |
|
int nav = 0; |
1278 |
|
// |
1279 |
|
int pfrom = 0; |
1280 |
|
int pto = 6; |
1281 |
|
int vfrom = 0; |
1282 |
|
int vto = 2; |
1283 |
|
if(ip>=0&&ip<6){ |
1284 |
|
pfrom = ip; |
1285 |
|
pto = ip+1; |
1286 |
|
} |
1287 |
|
if(iv>=0&&iv<2){ |
1288 |
|
vfrom = iv; |
1289 |
|
vto = iv+1; |
1290 |
|
} |
1291 |
|
for(int i=pfrom; i<pto; i++){ |
1292 |
|
for(int j=vfrom; j<vto; j++){ |
1293 |
|
nav++; |
1294 |
|
if(j==0 && XGood(i)) av += (xm[i]-xv[i])/resx[i]; |
1295 |
|
if(j==1 && YGood(i)) av += (ym[i]-yv[i])/resy[i]; |
1296 |
|
} |
1297 |
|
} |
1298 |
|
if(nav==0)return -100.; |
1299 |
|
return av/nav; |
1300 |
|
|
1301 |
|
}; |
1302 |
|
|
1303 |
|
|
1304 |
|
/** |
1305 |
|
* \brief Give the maximum multiplicity on the x view |
1306 |
|
*/ |
1307 |
|
Int_t TrkTrack::GetClusterX_Multiplicity_max(){ |
1308 |
|
int max=0; |
1309 |
|
for(int ip=0; ip<6; ip++) |
1310 |
|
if(GetClusterX_Multiplicity(ip)>max)max=GetClusterX_Multiplicity(ip); |
1311 |
|
return max; |
1312 |
|
}; |
1313 |
|
/** |
1314 |
|
* \brief Give the minimum multiplicity on the x view |
1315 |
|
*/ |
1316 |
|
Int_t TrkTrack::GetClusterX_Multiplicity_min(){ |
1317 |
|
int min=50; |
1318 |
|
for(int ip=0; ip<6; ip++) |
1319 |
|
if(GetClusterX_Multiplicity(ip)<min)min=GetClusterX_Multiplicity(ip); |
1320 |
|
return min; |
1321 |
|
}; |
1322 |
|
/** |
1323 |
|
* \brief Give the maximum multiplicity on the x view |
1324 |
|
*/ |
1325 |
|
Int_t TrkTrack::GetClusterY_Multiplicity_max(){ |
1326 |
|
int max=0; |
1327 |
|
for(int ip=0; ip<6; ip++) |
1328 |
|
if(GetClusterY_Multiplicity(ip)>max)max=GetClusterY_Multiplicity(ip); |
1329 |
|
return max; |
1330 |
|
}; |
1331 |
|
/** |
1332 |
|
* \brief Give the minimum multiplicity on the x view |
1333 |
|
*/ |
1334 |
|
Int_t TrkTrack::GetClusterY_Multiplicity_min(){ |
1335 |
|
int min=50; |
1336 |
|
for(int ip=0; ip<6; ip++) |
1337 |
|
if(GetClusterY_Multiplicity(ip)<min)min=GetClusterY_Multiplicity(ip); |
1338 |
|
return min; |
1339 |
|
}; |
1340 |
|
|
1341 |
|
/** |
1342 |
|
* \brief Give the minimum seed on the x view |
1343 |
|
*/ |
1344 |
|
Float_t TrkTrack::GetClusterX_Seed_min(){ |
1345 |
|
Float_t min=100000; |
1346 |
|
for(int ip=0; ip<6; ip++) |
1347 |
|
if(XGood(ip) && GetClusterX_Seed(ip)<min)min=GetClusterX_Seed(ip); |
1348 |
|
return min; |
1349 |
|
}; |
1350 |
|
/** |
1351 |
|
* \brief Give the minimum seed on the x view |
1352 |
|
*/ |
1353 |
|
Float_t TrkTrack::GetClusterY_Seed_min(){ |
1354 |
|
Float_t min=100000; |
1355 |
|
for(int ip=0; ip<6; ip++) |
1356 |
|
if(YGood(ip) && GetClusterY_Seed(ip)<min)min=GetClusterY_Seed(ip); |
1357 |
|
return min; |
1358 |
|
}; |
1359 |
|
|
1360 |
|
|
1361 |
//-------------------------------------- |
//-------------------------------------- |
1362 |
// |
// |
1363 |
// |
// |
1391 |
dedx_y[ip] = 0; |
dedx_y[ip] = 0; |
1392 |
|
|
1393 |
}; |
}; |
1394 |
|
int ngf = TrkParams::nGF; |
1395 |
|
for(int i=0; i<ngf; i++){ |
1396 |
|
xGF[i] = 0.; |
1397 |
|
yGF[i] = 0.; |
1398 |
|
} |
1399 |
// if(clx)clx->Clear(); |
// if(clx)clx->Clear(); |
1400 |
// if(cly)cly->Clear(); |
// if(cly)cly->Clear(); |
1401 |
// clx.Clear(); |
// clx.Clear(); |
1422 |
//-------------------------------------- |
//-------------------------------------- |
1423 |
TrkSinglet::TrkSinglet(){ |
TrkSinglet::TrkSinglet(){ |
1424 |
// cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl; |
// cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl; |
1425 |
plane = 0; |
// plane = 0; |
1426 |
coord[0] = 0; |
// coord[0] = 0; |
1427 |
coord[1] = 0; |
// coord[1] = 0; |
1428 |
sgnl = 0; |
// sgnl = 0; |
1429 |
|
// multmax = 0; |
1430 |
// cls = 0; |
// cls = 0; |
1431 |
|
Clear(); |
1432 |
}; |
}; |
1433 |
//-------------------------------------- |
//-------------------------------------- |
1434 |
// |
// |
1440 |
coord[0] = s.coord[0]; |
coord[0] = s.coord[0]; |
1441 |
coord[1] = s.coord[1]; |
coord[1] = s.coord[1]; |
1442 |
sgnl = s.sgnl; |
sgnl = s.sgnl; |
1443 |
|
multmax = s.multmax; |
1444 |
// cls = 0;//<<<<pointer |
// cls = 0;//<<<<pointer |
1445 |
// cls = TRef(s.cls); |
// cls = TRef(s.cls); |
1446 |
}; |
}; |
1451 |
void TrkSinglet::Dump(){ |
void TrkSinglet::Dump(){ |
1452 |
int i=0; |
int i=0; |
1453 |
cout << endl << "========== Singlet " ; |
cout << endl << "========== Singlet " ; |
1454 |
cout << endl << "plane : " << plane; |
cout << endl << "plane : " << plane; |
1455 |
cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++; |
cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++; |
1456 |
cout << endl << "sgnl : " << sgnl; |
cout << endl << "sgnl : " << sgnl; |
1457 |
|
cout << endl << "max.strip : "; |
1458 |
|
cout << endl << "multiplicity : "; |
1459 |
} |
} |
1460 |
//-------------------------------------- |
//-------------------------------------- |
1461 |
// |
// |
1468 |
coord[0]=-999; |
coord[0]=-999; |
1469 |
coord[1]=-999; |
coord[1]=-999; |
1470 |
sgnl=0; |
sgnl=0; |
1471 |
|
multmax = 0; |
1472 |
|
|
1473 |
} |
} |
1474 |
//-------------------------------------- |
//-------------------------------------- |
1504 |
|
|
1505 |
// |
// |
1506 |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; |
1507 |
cout << endl << "good : "; for(int i=0; i<12; i++) cout << good[i]<<" "; |
cout << endl << "good : "; for(int i=0; i<12; i++) cout << hex <<" 0x"<< good[i]<<dec; |
1508 |
cout << endl << "ntrk() : " << this->ntrk() ; |
cout << endl << "ntrk() : " << ntrk() ; |
1509 |
cout << endl << "nclsx() : " << this->nclsx(); |
cout << endl << "nclsx() : " << nclsx(); |
1510 |
cout << endl << "nclsy() : " << this->nclsy(); |
cout << endl << "nclsy() : " << nclsy(); |
1511 |
if(Track){ |
if(Track){ |
1512 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
1513 |
for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump(); |
1514 |
} |
} |
1515 |
if(SingletX){ |
// if(SingletX){ |
1516 |
TClonesArray &sx = *SingletX; |
// TClonesArray &sx = *SingletX; |
1517 |
for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
// for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump(); |
1518 |
} |
// } |
1519 |
if(SingletY){ |
// if(SingletY){ |
1520 |
TClonesArray &sy = *SingletY; |
// TClonesArray &sy = *SingletY; |
1521 |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
// for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
1522 |
} |
// } |
1523 |
|
cout << endl; |
1524 |
} |
} |
1525 |
|
/** |
1526 |
|
* \brief Dump processing status |
1527 |
|
*/ |
1528 |
|
void TrkLevel2::StatusDump(int view){ |
1529 |
|
cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl; |
1530 |
|
}; |
1531 |
|
/** |
1532 |
|
* \brief Check event status |
1533 |
|
* |
1534 |
|
* Check the event status, according to a flag-mask given as input. |
1535 |
|
* Return true if the view passes the check. |
1536 |
|
* |
1537 |
|
* @param view View number (0-11) |
1538 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
1539 |
|
* no crc error, no software alarm) |
1540 |
|
* |
1541 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
1542 |
|
* |
1543 |
|
*/ |
1544 |
|
Bool_t TrkLevel2::StatusCheck(int view, int flagmask){ |
1545 |
|
|
1546 |
|
if( view<0 || view >= 12)return false; |
1547 |
|
return !(good[view]&flagmask); |
1548 |
|
|
1549 |
|
}; |
1550 |
|
|
1551 |
|
|
1552 |
//-------------------------------------- |
//-------------------------------------- |
1553 |
// |
// |
1554 |
// |
// |
1579 |
* forced (see TrkLevel2::GetVKMask(int,int)) or |
* forced (see TrkLevel2::GetVKMask(int,int)) or |
1580 |
* for this event only (TrkLevel2::GetVKFlag(int,int)). |
* for this event only (TrkLevel2::GetVKFlag(int,int)). |
1581 |
* @param iv Tracker view (0-11) |
* @param iv Tracker view (0-11) |
1582 |
* @param ivk Viking-chip number (0-23) |
* @param ivk Viking-chip number (0-23) |
1583 |
*/ |
*/ |
1584 |
Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){ |
Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){ |
1585 |
return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) ); |
return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) ); |
1664 |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
1665 |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
1666 |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
1667 |
|
t_track->multmaxx[ip] = l2->multmaxx[i][ip]; |
1668 |
|
t_track->multmaxy[ip] = l2->multmaxy[i][ip]; |
1669 |
|
t_track->seedx[ip] = l2->seedx[i][ip]; |
1670 |
|
t_track->seedy[ip] = l2->seedy[i][ip]; |
1671 |
|
t_track->xpu[ip] = l2->xpu[i][ip]; |
1672 |
|
t_track->ypu[ip] = l2->ypu[i][ip]; |
1673 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1674 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1675 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1676 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1677 |
}; |
}; |
1678 |
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1679 |
|
// evaluated coordinates (to define GF) |
1680 |
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1681 |
|
int ngf = TrkParams::nGF; |
1682 |
|
float *zgf = TrkParams::zGF; |
1683 |
|
Trajectory tgf = Trajectory(ngf,zgf); |
1684 |
|
tgf.DoTrack(t_track->al);//<<<< integrate the trajectory |
1685 |
|
for(int ip=0; ip<ngf; ip++){ |
1686 |
|
t_track->xGF[ip] = tgf.x[ip]; |
1687 |
|
t_track->yGF[ip] = tgf.y[ip]; |
1688 |
|
} |
1689 |
|
|
1690 |
// if(t_track->IsSaturated())t_track->Dump(); |
// if(t_track->IsSaturated())t_track->Dump(); |
1691 |
new(t[i]) TrkTrack(*t_track); |
new(t[i]) TrkTrack(*t_track); |
1692 |
t_track->Clear(); |
t_track->Clear(); |
1693 |
}; |
};//end loop over track |
1694 |
|
|
1695 |
// ---------------- |
// ---------------- |
1696 |
// *** SINGLETS *** |
// *** SINGLETS *** |
1702 |
t_singlet->coord[0] = l2->xs[i][0]; |
t_singlet->coord[0] = l2->xs[i][0]; |
1703 |
t_singlet->coord[1] = l2->xs[i][1]; |
t_singlet->coord[1] = l2->xs[i][1]; |
1704 |
t_singlet->sgnl = l2->signlxs[i]; |
t_singlet->sgnl = l2->signlxs[i]; |
1705 |
|
t_singlet->multmax = l2->multmaxsx[i]; |
1706 |
|
if(l2->sxbad[i]>0) t_singlet->multmax = -1*t_singlet->multmax; |
1707 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1708 |
// if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
// if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
1709 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1717 |
t_singlet->coord[0] = l2->ys[i][0]; |
t_singlet->coord[0] = l2->ys[i][0]; |
1718 |
t_singlet->coord[1] = l2->ys[i][1]; |
t_singlet->coord[1] = l2->ys[i][1]; |
1719 |
t_singlet->sgnl = l2->signlys[i]; |
t_singlet->sgnl = l2->signlys[i]; |
1720 |
|
t_singlet->multmax = l2->multmaxsy[i]; |
1721 |
|
if(l2->sybad[i]>0) t_singlet->multmax = -1*t_singlet->multmax; |
1722 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1723 |
// if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
// if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
1724 |
//----------------------------------------------------- |
//----------------------------------------------------- |
1725 |
new(sy[i]) TrkSinglet(*t_singlet); |
new(sy[i]) TrkSinglet(*t_singlet); |
1726 |
t_singlet->Clear(); |
t_singlet->Clear(); |
1727 |
}; |
}; |
1728 |
|
|
1729 |
|
|
1730 |
|
|
1731 |
delete t_track; |
delete t_track; |
1732 |
delete t_singlet; |
delete t_singlet; |
1839 |
|
|
1840 |
if(!Track)return 0; |
if(!Track)return 0; |
1841 |
|
|
1842 |
TRefArray *sorted = new TRefArray(); |
// TRefArray *sorted = new TRefArray(); |
1843 |
|
TRefArray *sorted = NULL; |
1844 |
|
|
1845 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
1846 |
// TClonesArray &ts = *PhysicalTrack; |
// TClonesArray &ts = *PhysicalTrack; |
1878 |
|
|
1879 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
1880 |
}; |
}; |
1881 |
|
if(!sorted)sorted = new TRefArray( TProcessID::GetProcessWithUID(t[indi])); |
1882 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
1883 |
|
|
1884 |
m[indi] = 0; |
m[indi] = 0; |
1904 |
TrkTrack *TrkLevel2::GetStoredTrack(int is){ |
TrkTrack *TrkLevel2::GetStoredTrack(int is){ |
1905 |
|
|
1906 |
if(is >= this->ntrk()){ |
if(is >= this->ntrk()){ |
1907 |
cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl; |
cout << "TrkTrack *TrkLevel2::GetStoredTrack(int) >> Track "<< is << "doen not exits! " << endl; |
1908 |
cout << " Stored tracks ntrk() = "<< this->ntrk() << endl; |
cout << "Stored tracks ntrk() = "<< this->ntrk() << endl; |
1909 |
return 0; |
return 0; |
1910 |
} |
} |
1911 |
if(!Track){ |
if(!Track){ |
1926 |
TrkSinglet *TrkLevel2::GetSingletX(int is){ |
TrkSinglet *TrkLevel2::GetSingletX(int is){ |
1927 |
|
|
1928 |
if(is >= this->nclsx()){ |
if(is >= this->nclsx()){ |
1929 |
cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl; |
cout << "TrkSinglet *TrkLevel2::GetSingletX(int) >> Singlet "<< is << "doen not exits! " << endl; |
1930 |
cout << " Stored x-singlets nclsx() = "<< this->nclsx() << endl; |
cout << "Stored x-singlets nclsx() = "<< this->nclsx() << endl; |
1931 |
return 0; |
return 0; |
1932 |
} |
} |
1933 |
if(!SingletX)return 0; |
if(!SingletX)return 0; |
1946 |
TrkSinglet *TrkLevel2::GetSingletY(int is){ |
TrkSinglet *TrkLevel2::GetSingletY(int is){ |
1947 |
|
|
1948 |
if(is >= this->nclsy()){ |
if(is >= this->nclsy()){ |
1949 |
cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl; |
cout << "TrkSinglet *TrkLevel2::GetSingletY(int) >> Singlet "<< is << "doen not exits! " << endl; |
1950 |
cout << " Stored y-singlets nclsy() = "<< this->nclsx() << endl; |
cout << "Stored y-singlets nclsx() = "<< this->nclsx() << endl; |
1951 |
return 0; |
return 0; |
1952 |
} |
} |
1953 |
if(!SingletY)return 0; |
if(!SingletY)return 0; |
1967 |
TrkTrack *TrkLevel2::GetTrack(int it){ |
TrkTrack *TrkLevel2::GetTrack(int it){ |
1968 |
|
|
1969 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
1970 |
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
cout << "TrkTrack *TrkLevel2::GetTrack(int) >> Track "<< it << "does not exits! " << endl; |
1971 |
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
1972 |
return 0; |
return 0; |
1973 |
} |
} |
1974 |
|
|
2005 |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
TrkTrack *TrkLevel2::GetTrackImage(int it){ |
2006 |
|
|
2007 |
if(it >= this->GetNTracks()){ |
if(it >= this->GetNTracks()){ |
2008 |
cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl; |
cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not exits! " << endl; |
2009 |
cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl; |
2010 |
return 0; |
return 0; |
2011 |
} |
} |
2012 |
|
|
2015 |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
TrkTrack *track = (TrkTrack*)sorted->At(it); |
2016 |
|
|
2017 |
if(!track->HasImage()){ |
if(!track->HasImage()){ |
2018 |
cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl; |
cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not have image! " << endl; |
2019 |
return 0; |
return 0; |
2020 |
} |
} |
2021 |
if(!Track)return 0; |
if(!Track)return 0; |
2042 |
// path_.error = 0; |
// path_.error = 0; |
2043 |
// readb_(); |
// readb_(); |
2044 |
|
|
2045 |
TrkParams::SetTrackingMode(); |
// TrkParams::SetTrackingMode(); |
2046 |
TrkParams::SetPrecisionFactor(); |
// TrkParams::SetPrecisionFactor(); |
2047 |
TrkParams::SetStepMin(); |
// TrkParams::SetStepMin(); |
2048 |
|
TrkParams::SetMiniDefault(); |
2049 |
|
|
2050 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
2051 |
TrkParams::Load(1); |
TrkParams::Load(1); |
2052 |
|
if( !TrkParams::IsLoaded(1) ){ |
2053 |
|
cout << "void TrkLevel2::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl; |
2054 |
|
} |
2055 |
|
|
2056 |
// |
// |
2057 |
}; |
}; |
2239 |
|
|
2240 |
/** |
/** |
2241 |
* Evaluates the trajectory in the apparatus associated to the track. |
* Evaluates the trajectory in the apparatus associated to the track. |
2242 |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
* It integrates the equations of motion in the magnetic field. |
2243 |
* @param t pointer to an object of the class Trajectory, |
* @param al Track state-vector (X0,Y0,sin(theta),phi,deflection). |
2244 |
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
* @param zini z-coordinate of the reference plane (Z0). |
2245 |
* @return error flag. |
* @return error flag. |
2246 |
*/ |
* |
2247 |
int Trajectory::DoTrack2(float* al){ |
* This method is needed when you want to integrate the particle trajectory |
2248 |
|
* starting from a track state-vector relative to an arbitrary reference plane. |
2249 |
double *dxout = new double[npoint]; |
* The default reference plane, used by the tracker routines, is at zini=23.5. |
2250 |
double *dyout = new double[npoint]; |
* If you give as input the track state-vector from a TrkTrack object, |
2251 |
double *dthxout = new double[npoint]; |
* you can use Trajectory::DoTrack(float* al) instead. |
2252 |
double *dthyout = new double[npoint]; |
*/ |
2253 |
double *dtlout = new double[npoint]; |
int Trajectory::DoTrack(float* al, float zini){ |
2254 |
double *dzin = new double[npoint]; |
|
2255 |
|
// double *dxout = new double[npoint]; |
2256 |
|
// double *dyout = new double[npoint]; |
2257 |
|
// double *dthxout = new double[npoint]; |
2258 |
|
// double *dthyout = new double[npoint]; |
2259 |
|
// double *dtlout = new double[npoint]; |
2260 |
|
// double *dzin = new double[npoint]; |
2261 |
|
|
2262 |
|
double *dxout; |
2263 |
|
double *dyout; |
2264 |
|
double *dthxout; |
2265 |
|
double *dthyout; |
2266 |
|
double *dtlout; |
2267 |
|
double *dzin; |
2268 |
|
|
2269 |
|
dxout = (double*) malloc(npoint*sizeof(double)); |
2270 |
|
dyout = (double*) malloc(npoint*sizeof(double)); |
2271 |
|
dthxout = (double*) malloc(npoint*sizeof(double)); |
2272 |
|
dthyout = (double*) malloc(npoint*sizeof(double)); |
2273 |
|
dtlout = (double*) malloc(npoint*sizeof(double)); |
2274 |
|
dzin = (double*) malloc(npoint*sizeof(double)); |
2275 |
|
|
2276 |
double dal[5]; |
double dal[5]; |
2277 |
|
|
2278 |
int ifail = 0; |
double dzini = (double)zini; |
2279 |
|
|
2280 |
|
int ifail = 0; |
2281 |
|
|
2282 |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
2283 |
for (int i=0; i<npoint; i++) dzin[i] = (double)z[i]; |
for (int i=0; i<npoint; i++) dzin[i] = (double)z[i]; |
2284 |
|
|
2285 |
TrkParams::Load(1); |
TrkParams::Load(1); |
2286 |
if( !TrkParams::IsLoaded(1) ){ |
if( !TrkParams::IsLoaded(1) ){ |
2287 |
cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- m.field not loaded"<<endl; |
cout << "int Trajectory::DoTrack(float* al) --- ERROR --- m.field not loaded"<<endl; |
2288 |
return 0; |
return 0; |
2289 |
} |
} |
2290 |
dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
// dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
2291 |
|
dotrack3_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&dzini,&ifail); |
2292 |
|
|
2293 |
for (int i=0; i<npoint; i++){ |
for (int i=0; i<npoint; i++){ |
2294 |
x[i] = (float)*dxout++; |
x[i] = (float)*(dxout+i); |
2295 |
y[i] = (float)*dyout++; |
y[i] = (float)*(dyout+i); |
2296 |
thx[i] = (float)*dthxout++; |
thx[i] = (float)*(dthxout+i); |
2297 |
thy[i] = (float)*dthyout++; |
thy[i] = (float)*(dthyout+i); |
2298 |
tl[i] = (float)*dtlout++; |
tl[i] = (float)*(dtlout+i); |
2299 |
} |
} |
2300 |
|
|
2301 |
|
if(dxout) free( dxout ); |
2302 |
|
if(dyout) free( dyout ); |
2303 |
|
if(dthxout)free( dthxout ); |
2304 |
|
if(dthyout)free( dthyout ); |
2305 |
|
if(dtlout) free( dtlout ); |
2306 |
|
if(dzin) free( dzin ); |
2307 |
|
|
2308 |
|
// delete [] dxout; |
2309 |
|
// delete [] dyout; |
2310 |
|
// delete [] dthxout; |
2311 |
|
// delete [] dthyout; |
2312 |
|
// delete [] dtlout; |
2313 |
|
// delete [] dzin; |
2314 |
|
|
2315 |
|
|
2316 |
return ifail; |
return ifail; |
2317 |
}; |
}; |
2318 |
|
|
2319 |
|
/** |
2320 |
|
* |
2321 |
|
* >>> OBSOLETE !!! use Trajectory::DoTrack(float* al, float zini) instead |
2322 |
|
* |
2323 |
|
*/ |
2324 |
|
int Trajectory::DoTrack2(float* al, float zini){ |
2325 |
|
|
2326 |
|
cout << endl; |
2327 |
|
cout << " int Trajectory::DoTrack2(float* al, float zini) --->> NB NB !! this method is going to be eliminated !!! "<<endl; |
2328 |
|
cout << " >>>> replace it with TrkTrack::DoTrack(Trajectory* t) <<<<"<<endl; |
2329 |
|
cout << " (Sorry Wolfgang!! Don't be totally confused!! By Elena)"<<endl; |
2330 |
|
cout << endl; |
2331 |
|
|
2332 |
|
return DoTrack(al,zini); |
2333 |
|
|
2334 |
|
}; |
2335 |
|
|
2336 |
|
|
2337 |
|
|
2338 |
ClassImp(TrkLevel2); |
ClassImp(TrkLevel2); |
2339 |
ClassImp(TrkSinglet); |
ClassImp(TrkSinglet); |
2340 |
ClassImp(TrkTrack); |
ClassImp(TrkTrack); |