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 mini2_(int*,int*,int*); |
16 |
void guess_(); |
void guess_(); |
17 |
void gufld_(float*, float*); |
void gufld_(float*, float*); |
18 |
|
float risxeta2_(float *); |
19 |
|
float risxeta3_(float *); |
20 |
|
float risxeta4_(float *); |
21 |
|
float risyeta2_(float *); |
22 |
} |
} |
23 |
|
|
24 |
//-------------------------------------- |
//-------------------------------------- |
60 |
// clx = TRefArray(6,0); |
// clx = TRefArray(6,0); |
61 |
// cly = TRefArray(6,0); |
// cly = TRefArray(6,0); |
62 |
|
|
63 |
|
TrkParams::SetTrackingMode(); |
64 |
|
TrkParams::SetPrecisionFactor(); |
65 |
|
TrkParams::SetStepMin(); |
66 |
|
TrkParams::SetPFA(); |
67 |
|
|
68 |
}; |
}; |
69 |
//-------------------------------------- |
//-------------------------------------- |
70 |
// |
// |
104 |
// clx = TRefArray(t.clx); |
// clx = TRefArray(t.clx); |
105 |
// cly = TRefArray(t.cly); |
// cly = TRefArray(t.cly); |
106 |
|
|
107 |
|
TrkParams::SetTrackingMode(); |
108 |
|
TrkParams::SetPrecisionFactor(); |
109 |
|
TrkParams::SetStepMin(); |
110 |
|
TrkParams::SetPFA(); |
111 |
|
|
112 |
}; |
}; |
113 |
//-------------------------------------- |
//-------------------------------------- |
114 |
// |
// |
365 |
} |
} |
366 |
return (last_plane-first_plane+1); |
return (last_plane-first_plane+1); |
367 |
} |
} |
368 |
|
/** |
369 |
|
* Returns the reduced chi-square of track x-projection |
370 |
|
*/ |
371 |
|
Float_t TrkTrack::GetChi2X(){ |
372 |
|
float chiq=0; |
373 |
|
for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.); |
374 |
|
if(GetNX()>3)chiq=chiq/(GetNX()-3); |
375 |
|
else chiq=0; |
376 |
|
if(chiq==0)cout << " Float_t TrkTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl; |
377 |
|
return chiq; |
378 |
|
} |
379 |
|
/** |
380 |
|
* Returns the reduced chi-square of track y-projection |
381 |
|
*/ |
382 |
|
Float_t TrkTrack::GetChi2Y(){ |
383 |
|
float chiq=0; |
384 |
|
for(int ip=0; ip<6; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.); |
385 |
|
if(GetNY()>2)chiq=chiq/(GetNY()-2); |
386 |
|
else chiq=0; |
387 |
|
if(chiq==0)cout << " Float_t TrkTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl; |
388 |
|
return chiq; |
389 |
|
} |
390 |
|
/** |
391 |
|
* Returns the logarythm of the likeliwood-function of track x-projection |
392 |
|
*/ |
393 |
|
Float_t TrkTrack::GetLnLX(){ |
394 |
|
float lnl=0; |
395 |
|
for(int ip=0; ip<6; ip++) |
396 |
|
if( XGood(ip) && tailx[ip]!=0 ) |
397 |
|
lnl += (tailx[ip]+1.) * log( (tailx[ip]*pow(resx[ip],2.) + pow(xv[ip]-xm[ip],2.)) / (tailx[ip]*pow(resx[ip],2)) ); |
398 |
|
if(GetNX()>3)lnl=lnl/(GetNX()-3); |
399 |
|
else lnl=0; |
400 |
|
if(lnl==0){ |
401 |
|
cout << " Float_t TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl; |
402 |
|
Dump(); |
403 |
|
} |
404 |
|
return lnl; |
405 |
|
|
406 |
|
} |
407 |
|
/** |
408 |
|
* Returns the logarythm of the likeliwood-function of track y-projection |
409 |
|
*/ |
410 |
|
Float_t TrkTrack::GetLnLY(){ |
411 |
|
float lnl=0; |
412 |
|
for(int ip=0; ip<6; ip++) |
413 |
|
if( YGood(ip) && taily[ip]!=0 ) |
414 |
|
lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) ); |
415 |
|
if(GetNY()>2)lnl=lnl/(GetNY()-2); |
416 |
|
else lnl=0; |
417 |
|
if(lnl==0){ |
418 |
|
cout << " Float_t TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl; |
419 |
|
Dump(); |
420 |
|
} |
421 |
|
return lnl; |
422 |
|
|
423 |
|
} |
424 |
|
/** |
425 |
|
* Returns the effective angle, relative to the sensor, on each plane. |
426 |
|
* @param ip plane (0-5) |
427 |
|
* @param iv view (0=x 1=y) |
428 |
|
*/ |
429 |
|
Float_t TrkTrack::GetEffectiveAngle(int ip, int iv){ |
430 |
|
|
431 |
|
if(ip<0 || ip>5){ |
432 |
|
cout << "Float_t TrkTrack::GetEffectiveAngle(int "<<ip<<", int "<<iv<<") ==> wrong input"<<endl; |
433 |
|
return 0.; |
434 |
|
} |
435 |
|
|
436 |
|
float v[3]={xv[ip],yv[ip],zv[ip]}; |
437 |
|
//----------------------------------------- |
438 |
|
// effective angle (relative to the sensor) |
439 |
|
//----------------------------------------- |
440 |
|
float axv_geo = axv[ip]; |
441 |
|
float muhall_h = 297.61; //cm**2/Vs |
442 |
|
float BY = TrkParams::GetBY(v); |
443 |
|
float axv_eff = 0; |
444 |
|
if(ip==5) axv_geo = -1*axv_geo; |
445 |
|
if(ip==5) BY = -1*BY; |
446 |
|
axv_eff = 180.*atan( tan(axv_geo*acos(-1.)/180.) + muhall_h * BY * 0.0001)/acos(-1.); |
447 |
|
//----------------------------------------- |
448 |
|
// effective angle (relative to the sensor) |
449 |
|
//----------------------------------------- |
450 |
|
float ayv_geo = ayv[ip]; |
451 |
|
float muhall_e = 1258.18; //cm**2/Vs |
452 |
|
float BX = TrkParams::GetBX(v); |
453 |
|
float ayv_eff = 0; |
454 |
|
ayv_eff = 180.*atan( tan(ayv_geo*acos(-1.)/180.) + muhall_e * BX * 0.0001)/acos(-1.); |
455 |
|
|
456 |
|
if (iv==0)return axv_eff; |
457 |
|
else if(iv==1)return ayv_eff; |
458 |
|
else{ |
459 |
|
cout << "Float_t TrkTrack::GetEffectiveAngle(int "<<ip<<", int "<<iv<<") ==> wrong input"<<endl; |
460 |
|
return 0.; |
461 |
|
} |
462 |
|
|
463 |
|
}; |
464 |
|
|
465 |
//-------------------------------------- |
//-------------------------------------- |
466 |
// |
// |
467 |
// |
// |
483 |
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] << " "; |
484 |
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] << " "; |
485 |
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] << " "; |
486 |
|
cout << endl << "tailx : "; for(int i=0; i<6; i++)cout << tailx[i] << " "; |
487 |
|
cout << endl << "taily : "; for(int i=0; i<6; i++)cout << taily[i] << " "; |
488 |
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]<<" "; |
489 |
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]<<" "; |
490 |
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]<<" "; |
510 |
for(int i=0; i<6; i++) resy[i]=*ry++; |
for(int i=0; i<6; i++) resy[i]=*ry++; |
511 |
} |
} |
512 |
/** |
/** |
513 |
|
* Set the TrkTrack tails position resolution |
514 |
|
*/ |
515 |
|
void TrkTrack::SetTail(double *tx, double *ty, double factor){ |
516 |
|
for(int i=0; i<6; i++) tailx[i]=factor*(*tx++); |
517 |
|
for(int i=0; i<6; i++) taily[i]=factor*(*ty++); |
518 |
|
} |
519 |
|
/** |
520 |
|
* Set the TrkTrack Student parameter (resx,resy,tailx,taily) |
521 |
|
* from previous gausian fit |
522 |
|
*@param flag =0 standard, =1 with noise correction |
523 |
|
*/ |
524 |
|
void TrkTrack::SetStudentParam(int flag){ |
525 |
|
float sx[11]={0.000128242, |
526 |
|
0.000136942, |
527 |
|
0.000162718, |
528 |
|
0.000202644, |
529 |
|
0.00025597, |
530 |
|
0.000317456, |
531 |
|
0.000349048, |
532 |
|
0.000384638, |
533 |
|
0.000457295, |
534 |
|
0.000512319, |
535 |
|
0.000538573}; |
536 |
|
float tx[11]={1.79402, |
537 |
|
2.04876, |
538 |
|
2.88376, |
539 |
|
3.3, |
540 |
|
3.14084, |
541 |
|
4.07686, |
542 |
|
4.44736, |
543 |
|
3.5179, |
544 |
|
3.38697, |
545 |
|
3.45739, |
546 |
|
3.18627}; |
547 |
|
float sy[11]={0.000483075, |
548 |
|
0.000466925, |
549 |
|
0.000431658, |
550 |
|
0.000428317, |
551 |
|
0.000433854, |
552 |
|
0.000444044, |
553 |
|
0.000482098, |
554 |
|
0.000537579, |
555 |
|
0.000636279, |
556 |
|
0.000741998, |
557 |
|
0.000864261}; |
558 |
|
float ty[11]={0.997032, |
559 |
|
1.11147, |
560 |
|
1.18526, |
561 |
|
1.61404, |
562 |
|
2.21908, |
563 |
|
3.08959, |
564 |
|
4.48833, |
565 |
|
4.42687, |
566 |
|
4.65253, |
567 |
|
4.52043, |
568 |
|
4.29926}; |
569 |
|
int index; |
570 |
|
float fact; |
571 |
|
for(int i=0; i<6; i++) { |
572 |
|
index = int((fabs(axv[i])+1.)/2.); |
573 |
|
if(index>10) index=10; |
574 |
|
tailx[i]=tx[index]; |
575 |
|
if(flag==1) { |
576 |
|
if(fabs(axv[i])<=10.) fact = resx[i]/risxeta2_(&(axv[i])); |
577 |
|
if(fabs(axv[i])>10.&&fabs(axv[i])<=15.) fact = resx[i]/risxeta3_(&(axv[i])); |
578 |
|
if(fabs(axv[i])>15.) fact = resx[i]/risxeta4_(&(axv[i])); |
579 |
|
} else fact = 1.; |
580 |
|
resx[i] = sx[index]*fact; |
581 |
|
} |
582 |
|
for(int i=0; i<6; i++) { |
583 |
|
index = int((fabs(ayv[i])+1.)/2.); |
584 |
|
if(index>10) index=10; |
585 |
|
taily[i]=ty[index]; |
586 |
|
if(flag==1) fact = resy[i]/risyeta2_(&(ayv[i])); |
587 |
|
else fact = 1.; |
588 |
|
resy[i] = sy[index]*fact; |
589 |
|
} |
590 |
|
} |
591 |
|
/** |
592 |
* Set the TrkTrack good measurement |
* Set the TrkTrack good measurement |
593 |
*/ |
*/ |
594 |
void TrkTrack::SetGood(int *xg, int *yg){ |
void TrkTrack::SetGood(int *xg, int *yg){ |
595 |
// NB! si perdera` l'informazione sul numero del cluster |
|
596 |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
597 |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
598 |
} |
} |
607 |
// path_.error = 0; |
// path_.error = 0; |
608 |
// readb_(); |
// readb_(); |
609 |
|
|
610 |
|
TrkParams::SetTrackingMode(); |
611 |
|
TrkParams::SetPrecisionFactor(); |
612 |
|
TrkParams::SetStepMin(); |
613 |
|
|
614 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
615 |
TrkParams::Load(1); |
TrkParams::Load(1); |
616 |
|
|
624 |
|
|
625 |
for(int i=0; i<6; i++){ |
for(int i=0; i<6; i++){ |
626 |
|
|
627 |
// track.xgood[i]=xgood[i]; |
// cout << i<<" - "<<xgood[i]<<" "<<XGood(i)<<endl; |
628 |
// track.ygood[i]=ygood[i]; |
// cout << i<<" - "<<ygood[i]<<" "<<YGood(i)<<endl; |
629 |
track.xgood[i]=XGood(i); |
track.xgood[i]=XGood(i); |
630 |
track.ygood[i]=YGood(i); |
track.ygood[i]=YGood(i); |
631 |
|
|
651 |
|
|
652 |
track.resx[i]=resx[i]; |
track.resx[i]=resx[i]; |
653 |
track.resy[i]=resy[i]; |
track.resy[i]=resy[i]; |
654 |
|
track.tailx[i]=tailx[i]; |
655 |
|
track.taily[i]=taily[i]; |
656 |
} |
} |
657 |
|
|
658 |
for(int i=0; i<5; i++) track.al[i]=al[i]; |
for(int i=0; i<5; i++) track.al[i]=al[i]; |
684 |
|
|
685 |
} |
} |
686 |
/** |
/** |
687 |
* Tracking method. It calls F77 mini routine. |
* \brief Method to re-evaluate coordinates of clusters associated with a track. |
688 |
|
* |
689 |
|
* The method can be applied only after recovering level1 information |
690 |
|
* (either by reprocessing single events from level0 or from |
691 |
|
* the TrkLevel1 branch, if present); it calls F77 subroutines that |
692 |
|
* read the level1 common and fill the minimization-routine common. |
693 |
|
* Some clusters can be excluded or added by means of the methods: |
694 |
|
* |
695 |
|
* TrkTrack::ResetXGood(int ip) |
696 |
|
* TrkTrack::ResetYGood(int ip) |
697 |
|
* TrkTrack::SetXGood(int ip, int cid, int is) |
698 |
|
* TrkTrack::SetYGood(int ip, int cid, int is) |
699 |
|
* |
700 |
|
* NB! The method TrkTrack::SetGood(int *xg, int *yg) set the plane-mask (0-1) |
701 |
|
* for the minimization-routine common. It deletes the cluster information |
702 |
|
* (at least for the moment...) thus cannot be applied before |
703 |
|
* TrkTrack::EvaluateClusterPositions(). |
704 |
|
* |
705 |
|
* Different p.f.a. can be applied by calling (once) the method: |
706 |
|
* |
707 |
|
* TrkParams::SetPFA(0); //Set ETA p.f.a. |
708 |
|
* |
709 |
|
* @see TrkParams::SetPFA(int) |
710 |
|
*/ |
711 |
|
Bool_t TrkTrack::EvaluateClusterPositions(){ |
712 |
|
|
713 |
|
// cout << "void TrkTrack::GetClusterPositions() "<<endl; |
714 |
|
|
715 |
|
TrkParams::Load( ); |
716 |
|
if( !TrkParams::IsLoaded() )return false; |
717 |
|
|
718 |
|
for(int ip=0; ip<6; ip++){ |
719 |
|
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
720 |
|
int icx = GetClusterX_ID(ip)+1; |
721 |
|
int icy = GetClusterY_ID(ip)+1; |
722 |
|
int sensor = GetSensor(ip)+1;//<< convenzione "Paolo" |
723 |
|
if(ip==5 && sensor!=0)sensor=3-sensor;//<< convenzione "Elena" |
724 |
|
int ladder = GetLadder(ip)+1; |
725 |
|
float ax = axv[ip]; |
726 |
|
float ay = ayv[ip]; |
727 |
|
float v[3]; |
728 |
|
v[0]=xv[ip]; |
729 |
|
v[1]=yv[ip]; |
730 |
|
v[2]=zv[ip]; |
731 |
|
float bfx = 10*TrkParams::GetBX(v);//Tesla |
732 |
|
float bfy = 10*TrkParams::GetBY(v);//Tesla |
733 |
|
int ipp=ip+1; |
734 |
|
xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); |
735 |
|
if(icx<0 || icy<0)return false; |
736 |
|
} |
737 |
|
return true; |
738 |
|
} |
739 |
|
/** |
740 |
|
* \brief Tracking method. It calls F77 mini routine. |
741 |
|
* |
742 |
|
* @param pfixed Particle momentum. If pfixed=0 the momentum |
743 |
|
* is left as a free parameter, otherwise it is fixed to the input value. |
744 |
|
* @param fail Output flag (!=0 if the fit failed). |
745 |
|
* @param iprint Flag to set debug mode ( 0 = no output; 1 = verbose; 2 = debug). |
746 |
|
* @param froml1 Flag to re-evaluate positions (see TrkTrack::GetClusterPositions()). |
747 |
|
* |
748 |
|
* The option to re-evaluate positions can be used only after recovering |
749 |
|
* level1 information, eg. by reprocessing the single event. |
750 |
|
* |
751 |
|
* Example: |
752 |
|
* |
753 |
|
* if( !event->GetTrkLevel0() )return false; |
754 |
|
* event->GetTrkLevel0()->ProcessEvent(); // re-processing level0->level1 |
755 |
|
* int fail=0; |
756 |
|
* event->GetTrkLevel2()->GetTrack(0)->Fit(0.,fail,0,1); |
757 |
|
* |
758 |
|
* @see EvaluateClusterPositions() |
759 |
|
* |
760 |
|
* The fitting procedure can be varied by changing the tracking mode, |
761 |
|
* the fit-precision factor and the minimum number of step. |
762 |
|
* @see SetTrackingMode(int) |
763 |
|
* @see SetPrecisionFactor(double) |
764 |
|
* @see SetStepMin(int) |
765 |
*/ |
*/ |
766 |
void TrkTrack::Fit(double pfixed, int& fail, int iprint){ |
void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ |
767 |
|
|
768 |
float al_ini[] = {0.,0.,0.,0.,0.}; |
float al_ini[] = {0.,0.,0.,0.,0.}; |
769 |
|
|
770 |
|
TrkParams::Load( ); |
771 |
|
if( !TrkParams::IsLoaded() )return; |
772 |
|
|
773 |
extern cMini2track track_; |
extern cMini2track track_; |
774 |
fail = 0; |
fail = 0; |
|
FillMiniStruct(track_); |
|
775 |
|
|
776 |
|
FillMiniStruct(track_); |
777 |
|
|
778 |
|
if(froml1!=0){ |
779 |
|
if( !EvaluateClusterPositions() ){ |
780 |
|
cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl; |
781 |
|
FillMiniStruct(track_) ; |
782 |
|
fail = 1; |
783 |
|
return; |
784 |
|
} |
785 |
|
}else{ |
786 |
|
FillMiniStruct(track_); |
787 |
|
} |
788 |
|
|
789 |
// if fit variables have been reset, evaluate the initial guess |
// if fit variables have been reset, evaluate the initial guess |
790 |
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_(); |
791 |
|
|
804 |
|
|
805 |
// ------------------------------------------ |
// ------------------------------------------ |
806 |
// call mini routine |
// call mini routine |
807 |
TrkParams::Load(1); |
// TrkParams::Load(1); |
808 |
if( !TrkParams::IsLoaded(1) ){ |
// if( !TrkParams::IsLoaded(1) ){ |
809 |
cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; |
// cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; |
810 |
return; |
// return; |
811 |
} |
// } |
812 |
int istep=0; |
int istep=0; |
813 |
int ifail=0; |
int ifail=0; |
814 |
mini2_(&istep,&ifail, &iprint); |
mini2_(&istep,&ifail, &iprint); |
819 |
// ------------------------------------------ |
// ------------------------------------------ |
820 |
|
|
821 |
SetFromMiniStruct(&track_); |
SetFromMiniStruct(&track_); |
|
// cout << endl << "eta ===> " << track_.al[4] << endl; |
|
|
|
|
|
// for(int i=0; i<5; i++) al[i]=track_.al[i]; |
|
|
// chi2=track_.chi2; |
|
|
// nstep=track_.nstep; |
|
|
// for(int i=0; i<6; i++) xv[i]=track_.xv[i]; |
|
|
// for(int i=0; i<6; i++) yv[i]=track_.yv[i]; |
|
|
// for(int i=0; i<6; i++) zv[i]=track_.zv[i]; |
|
|
// for(int i=0; i<6; i++) axv[i]=track_.axv[i]; |
|
|
// for(int i=0; i<6; i++) ayv[i]=track_.ayv[i]; |
|
|
// for(int i=0; i<5; i++) { |
|
|
// for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j]; |
|
|
// } |
|
822 |
|
|
823 |
if(fail){ |
if(fail){ |
824 |
if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<<endl; |
if(iprint)cout << " >>>> fit failed "<<endl; |
825 |
for(int i=0; i<5; i++) al[i]=al_ini[i]; |
for(int i=0; i<5; i++) al[i]=al_ini[i]; |
826 |
} |
} |
827 |
|
|
828 |
}; |
}; |
829 |
/* |
/** |
830 |
* Reset the fit parameters |
* Reset the fit parameters |
831 |
*/ |
*/ |
832 |
void TrkTrack::FitReset(){ |
void TrkTrack::FitReset(){ |
833 |
for(int i=0; i<5; i++) al[i]=-9999.; |
for(int i=0; i<5; i++) al[i]=-9999.; |
834 |
chi2=0.; |
chi2=0.; |
835 |
nstep=0; |
nstep=0; |
836 |
for(int i=0; i<6; i++) xv[i]=0.; |
// for(int i=0; i<6; i++) xv[i]=0.; |
837 |
for(int i=0; i<6; i++) yv[i]=0.; |
// for(int i=0; i<6; i++) yv[i]=0.; |
838 |
for(int i=0; i<6; i++) zv[i]=0.; |
// for(int i=0; i<6; i++) zv[i]=0.; |
839 |
for(int i=0; i<6; i++) axv[i]=0.; |
// for(int i=0; i<6; i++) axv[i]=0.; |
840 |
for(int i=0; i<6; i++) ayv[i]=0.; |
// for(int i=0; i<6; i++) ayv[i]=0.; |
841 |
for(int i=0; i<5; i++) { |
for(int i=0; i<5; i++) { |
842 |
for(int j=0; j<5; j++) coval[i][j]=0.; |
for(int j=0; j<5; j++) coval[i][j]=0.; |
843 |
} |
} |
844 |
} |
} |
845 |
/* |
/** |
846 |
* Set the tracking mode |
* Set the tracking mode |
847 |
*/ |
*/ |
848 |
void TrkTrack::SetTrackingMode(int trackmode){ |
void TrkTrack::SetTrackingMode(int trackmode){ |
849 |
extern cMini2track track_; |
extern cMini2track track_; |
850 |
track_.trackmode = trackmode; |
track_.trackmode = trackmode; |
851 |
} |
} |
852 |
/* |
/** |
853 |
* Set the factor scale for tracking precision |
* Set the factor scale for tracking precision |
854 |
*/ |
*/ |
855 |
void TrkTrack::SetPrecisionFactor(double fact){ |
void TrkTrack::SetPrecisionFactor(double fact){ |
856 |
extern cMini2track track_; |
extern cMini2track track_; |
857 |
track_.fact = fact; |
track_.fact = fact; |
858 |
} |
} |
859 |
/* |
/** |
860 |
* Set the factor scale for tracking precision |
* Set the minimum number of steps for tracking precision |
861 |
*/ |
*/ |
862 |
void TrkTrack::SetStepMin(int istepmin){ |
void TrkTrack::SetStepMin(int istepmin){ |
863 |
extern cMini2track track_; |
extern cMini2track track_; |
864 |
track_.istepmin = istepmin; |
track_.istepmin = istepmin; |
865 |
} |
} |
866 |
|
/** |
867 |
|
* Returns 1 if the track is inside the magnet cavity |
868 |
/* |
* Set the minimum number of steps for tracking precision |
869 |
|
*/ |
870 |
|
Bool_t TrkTrack::IsInsideCavity(){ |
871 |
|
float xmagntop, ymagntop, xmagnbottom, ymagnbottom; |
872 |
|
xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.); |
873 |
|
ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.); |
874 |
|
xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.); |
875 |
|
ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.); |
876 |
|
if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH && |
877 |
|
ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH && |
878 |
|
xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH && |
879 |
|
ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true); |
880 |
|
else return(false); |
881 |
|
} |
882 |
|
/** |
883 |
* 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. |
884 |
* If no cluster is associated, ID=-1. |
* If no cluster is associated, ID=-1. |
885 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
887 |
Int_t TrkTrack::GetClusterX_ID(int ip){ |
Int_t TrkTrack::GetClusterX_ID(int ip){ |
888 |
return ((Int_t)fabs(xgood[ip]))%10000000-1; |
return ((Int_t)fabs(xgood[ip]))%10000000-1; |
889 |
}; |
}; |
890 |
/* |
/** |
891 |
* Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. |
* Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. |
892 |
* If no cluster is associated, ID=-1. |
* If no cluster is associated, ID=-1. |
893 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
895 |
Int_t TrkTrack::GetClusterY_ID(int ip){ |
Int_t TrkTrack::GetClusterY_ID(int ip){ |
896 |
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
897 |
}; |
}; |
898 |
/* |
/** |
899 |
* Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane. |
* Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane. |
900 |
* If no ladder is traversed (dead area) the metod retuns -1. |
* If no ladder is traversed (dead area) the metod retuns -1. |
901 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
905 |
if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; |
if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; |
906 |
return -1; |
return -1; |
907 |
}; |
}; |
908 |
/* |
/** |
909 |
* Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane. |
* Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane. |
910 |
* If no sensor is traversed (dead area) the metod retuns -1. |
* If no sensor is traversed (dead area) the metod retuns -1. |
911 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
916 |
return -1; |
return -1; |
917 |
}; |
}; |
918 |
|
|
919 |
|
/** |
920 |
|
* \brief Method to include a x-cluster to the track. |
921 |
|
* @param ip Tracker plane (0-5) |
922 |
|
* @param clid Cluster ID (0,1,...) |
923 |
|
* @param is Sensor (0-1, increasing y) |
924 |
|
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
925 |
|
*/ |
926 |
|
void TrkTrack::SetXGood(int ip, int clid, int is){ |
927 |
|
int il=0; //ladder (temporary) |
928 |
|
bool bad=false; //ladder (temporary) |
929 |
|
xgood[ip]=il*100000000+is*10000000+clid; |
930 |
|
if(bad)xgood[ip]=-xgood[ip]; |
931 |
|
}; |
932 |
|
/** |
933 |
|
* \brief Method to include a y-cluster to the track. |
934 |
|
* @param ip Tracker plane (0-5) |
935 |
|
* @param clid Cluster ID (0,1,...) |
936 |
|
* @param is Sensor (0-1) |
937 |
|
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
938 |
|
*/ |
939 |
|
void TrkTrack::SetYGood(int ip, int clid, int is){ |
940 |
|
int il=0; //ladder (temporary) |
941 |
|
bool bad=false; //ladder (temporary) |
942 |
|
ygood[ip]=il*100000000+is*10000000+clid; |
943 |
|
if(bad)ygood[ip]=-ygood[ip]; |
944 |
|
}; |
945 |
|
|
946 |
//-------------------------------------- |
//-------------------------------------- |
947 |
// |
// |
1095 |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
1096 |
} |
} |
1097 |
} |
} |
1098 |
|
/** |
1099 |
|
* \brief Dump processing status |
1100 |
|
*/ |
1101 |
|
void TrkLevel2::StatusDump(int view){ |
1102 |
|
cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl; |
1103 |
|
}; |
1104 |
|
/** |
1105 |
|
* \brief Check event status |
1106 |
|
* |
1107 |
|
* Check the event status, according to a flag-mask given as input. |
1108 |
|
* Return true if the view passes the check. |
1109 |
|
* |
1110 |
|
* @param view View number (0-11) |
1111 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
1112 |
|
* no crc error, no software alarm) |
1113 |
|
* |
1114 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
1115 |
|
* |
1116 |
|
*/ |
1117 |
|
Bool_t TrkLevel2::StatusCheck(int view, int flagmask){ |
1118 |
|
|
1119 |
|
if( view<0 || view >= 12)return false; |
1120 |
|
return !(good[view]&flagmask); |
1121 |
|
|
1122 |
|
}; |
1123 |
|
|
1124 |
|
|
1125 |
//-------------------------------------- |
//-------------------------------------- |
1126 |
// |
// |
1127 |
// |
// |
1589 |
// path_.error = 0; |
// path_.error = 0; |
1590 |
// readb_(); |
// readb_(); |
1591 |
|
|
1592 |
|
TrkParams::SetTrackingMode(); |
1593 |
|
TrkParams::SetPrecisionFactor(); |
1594 |
|
TrkParams::SetStepMin(); |
1595 |
|
|
1596 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
1597 |
TrkParams::Load(1); |
TrkParams::Load(1); |
1598 |
|
|
1599 |
// |
// |
1600 |
}; |
}; |
1601 |
/** |
// /** |
1602 |
* Get BY (kGauss) |
// * Get BY (kGauss) |
1603 |
* @param v (x,y,z) coordinates in cm |
// * @param v (x,y,z) coordinates in cm |
1604 |
*/ |
// */ |
1605 |
float TrkLevel2::GetBX(float* v){ |
// float TrkLevel2::GetBX(float* v){ |
1606 |
float b[3]; |
// float b[3]; |
1607 |
gufld_(v,b); |
// gufld_(v,b); |
1608 |
return b[0]/10.; |
// return b[0]/10.; |
1609 |
} |
// } |
1610 |
/** |
// /** |
1611 |
* Get BY (kGauss) |
// * Get BY (kGauss) |
1612 |
* @param v (x,y,z) coordinates in cm |
// * @param v (x,y,z) coordinates in cm |
1613 |
*/ |
// */ |
1614 |
float TrkLevel2::GetBY(float* v){ |
// float TrkLevel2::GetBY(float* v){ |
1615 |
float b[3]; |
// float b[3]; |
1616 |
gufld_(v,b); |
// gufld_(v,b); |
1617 |
return b[1]/10.; |
// return b[1]/10.; |
1618 |
} |
// } |
1619 |
/** |
// /** |
1620 |
* Get BY (kGauss) |
// * Get BY (kGauss) |
1621 |
* @param v (x,y,z) coordinates in cm |
// * @param v (x,y,z) coordinates in cm |
1622 |
*/ |
// */ |
1623 |
float TrkLevel2::GetBZ(float* v){ |
// float TrkLevel2::GetBZ(float* v){ |
1624 |
float b[3]; |
// float b[3]; |
1625 |
gufld_(v,b); |
// gufld_(v,b); |
1626 |
return b[2]/10.; |
// return b[2]/10.; |
1627 |
} |
// } |
1628 |
//-------------------------------------- |
//-------------------------------------- |
1629 |
// |
// |
1630 |
// |
// |