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)cout << " Float_t TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl; |
401 |
|
return lnl; |
402 |
|
|
403 |
|
} |
404 |
|
/** |
405 |
|
* Returns the logarythm of the likeliwood-function of track y-projection |
406 |
|
*/ |
407 |
|
Float_t TrkTrack::GetLnLY(){ |
408 |
|
float lnl=0; |
409 |
|
for(int ip=0; ip<6; ip++) |
410 |
|
if( YGood(ip) && taily[ip]!=0 ) |
411 |
|
lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) ); |
412 |
|
if(GetNY()>2)lnl=lnl/(GetNY()-2); |
413 |
|
else lnl=0; |
414 |
|
if(lnl==0)cout << " Float_t TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl; |
415 |
|
return lnl; |
416 |
|
|
417 |
|
} |
418 |
//-------------------------------------- |
//-------------------------------------- |
419 |
// |
// |
420 |
// |
// |
436 |
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] << " "; |
437 |
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] << " "; |
438 |
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] << " "; |
439 |
|
cout << endl << "tailx : "; for(int i=0; i<6; i++)cout << tailx[i] << " "; |
440 |
|
cout << endl << "taily : "; for(int i=0; i<6; i++)cout << taily[i] << " "; |
441 |
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]<<" "; |
442 |
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]<<" "; |
443 |
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]<<" "; |
463 |
for(int i=0; i<6; i++) resy[i]=*ry++; |
for(int i=0; i<6; i++) resy[i]=*ry++; |
464 |
} |
} |
465 |
/** |
/** |
466 |
|
* Set the TrkTrack tails position resolution |
467 |
|
*/ |
468 |
|
void TrkTrack::SetTail(double *tx, double *ty, double factor){ |
469 |
|
for(int i=0; i<6; i++) tailx[i]=factor*(*tx++); |
470 |
|
for(int i=0; i<6; i++) taily[i]=factor*(*ty++); |
471 |
|
} |
472 |
|
/** |
473 |
|
* Set the TrkTrack Student parameter (resx,resy,tailx,taily) |
474 |
|
* from previous gausian fit |
475 |
|
*@param flag =0 standard, =1 with noise correction |
476 |
|
*/ |
477 |
|
void TrkTrack::SetStudentParam(int flag){ |
478 |
|
float sx[11]={0.000128242, |
479 |
|
0.000136942, |
480 |
|
0.000162718, |
481 |
|
0.000202644, |
482 |
|
0.00025597, |
483 |
|
0.000317456, |
484 |
|
0.000349048, |
485 |
|
0.000384638, |
486 |
|
0.000457295, |
487 |
|
0.000512319, |
488 |
|
0.000538573}; |
489 |
|
float tx[11]={1.79402, |
490 |
|
2.04876, |
491 |
|
2.88376, |
492 |
|
3.3, |
493 |
|
3.14084, |
494 |
|
4.07686, |
495 |
|
4.44736, |
496 |
|
3.5179, |
497 |
|
3.38697, |
498 |
|
3.45739, |
499 |
|
3.18627}; |
500 |
|
float sy[11]={0.000483075, |
501 |
|
0.000466925, |
502 |
|
0.000431658, |
503 |
|
0.000428317, |
504 |
|
0.000433854, |
505 |
|
0.000444044, |
506 |
|
0.000482098, |
507 |
|
0.000537579, |
508 |
|
0.000636279, |
509 |
|
0.000741998, |
510 |
|
0.000864261}; |
511 |
|
float ty[11]={0.997032, |
512 |
|
1.11147, |
513 |
|
1.18526, |
514 |
|
1.61404, |
515 |
|
2.21908, |
516 |
|
3.08959, |
517 |
|
4.48833, |
518 |
|
4.42687, |
519 |
|
4.65253, |
520 |
|
4.52043, |
521 |
|
4.29926}; |
522 |
|
int index; |
523 |
|
float fact; |
524 |
|
for(int i=0; i<6; i++) { |
525 |
|
index = int((fabs(axv[i])+1.)/2.); |
526 |
|
if(index>10) index=10; |
527 |
|
tailx[i]=tx[index]; |
528 |
|
if(flag==1) { |
529 |
|
if(fabs(axv[i])<=10.) fact = resx[i]/risxeta2_(&(axv[i])); |
530 |
|
if(fabs(axv[i])>10.&&fabs(axv[i])<=15.) fact = resx[i]/risxeta3_(&(axv[i])); |
531 |
|
if(fabs(axv[i])>15.) fact = resx[i]/risxeta4_(&(axv[i])); |
532 |
|
} else fact = 1.; |
533 |
|
resx[i] = sx[index]*fact; |
534 |
|
} |
535 |
|
for(int i=0; i<6; i++) { |
536 |
|
index = int((fabs(ayv[i])+1.)/2.); |
537 |
|
if(index>10) index=10; |
538 |
|
taily[i]=ty[index]; |
539 |
|
if(flag==1) fact = resy[i]/risyeta2_(&(ayv[i])); |
540 |
|
else fact = 1.; |
541 |
|
resy[i] = sy[index]*fact; |
542 |
|
} |
543 |
|
} |
544 |
|
/** |
545 |
* Set the TrkTrack good measurement |
* Set the TrkTrack good measurement |
546 |
*/ |
*/ |
547 |
void TrkTrack::SetGood(int *xg, int *yg){ |
void TrkTrack::SetGood(int *xg, int *yg){ |
548 |
// NB! si perdera` l'informazione sul numero del cluster |
|
549 |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
550 |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
551 |
} |
} |
560 |
// path_.error = 0; |
// path_.error = 0; |
561 |
// readb_(); |
// readb_(); |
562 |
|
|
563 |
|
TrkParams::SetTrackingMode(); |
564 |
|
TrkParams::SetPrecisionFactor(); |
565 |
|
TrkParams::SetStepMin(); |
566 |
|
|
567 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
568 |
TrkParams::Load(1); |
TrkParams::Load(1); |
569 |
|
|
577 |
|
|
578 |
for(int i=0; i<6; i++){ |
for(int i=0; i<6; i++){ |
579 |
|
|
580 |
// track.xgood[i]=xgood[i]; |
// cout << i<<" - "<<xgood[i]<<" "<<XGood(i)<<endl; |
581 |
// track.ygood[i]=ygood[i]; |
// cout << i<<" - "<<ygood[i]<<" "<<YGood(i)<<endl; |
582 |
track.xgood[i]=XGood(i); |
track.xgood[i]=XGood(i); |
583 |
track.ygood[i]=YGood(i); |
track.ygood[i]=YGood(i); |
584 |
|
|
604 |
|
|
605 |
track.resx[i]=resx[i]; |
track.resx[i]=resx[i]; |
606 |
track.resy[i]=resy[i]; |
track.resy[i]=resy[i]; |
607 |
|
track.tailx[i]=tailx[i]; |
608 |
|
track.taily[i]=taily[i]; |
609 |
} |
} |
610 |
|
|
611 |
for(int i=0; i<5; i++) track.al[i]=al[i]; |
for(int i=0; i<5; i++) track.al[i]=al[i]; |
637 |
|
|
638 |
} |
} |
639 |
/** |
/** |
640 |
* Tracking method. It calls F77 mini routine. |
* \brief Method to re-evaluate coordinates of clusters associated with a track. |
641 |
|
* |
642 |
|
* The method can be applied only after recovering level1 information |
643 |
|
* (either by reprocessing single events from level0 or from |
644 |
|
* the TrkLevel1 branch, if present); it calls F77 subroutines that |
645 |
|
* read the level1 common and fill the minimization-routine common. |
646 |
|
* Some clusters can be excluded or added by means of the methods: |
647 |
|
* |
648 |
|
* TrkTrack::ResetXGood(int ip) |
649 |
|
* TrkTrack::ResetYGood(int ip) |
650 |
|
* TrkTrack::SetXGood(int ip, int cid, int is) |
651 |
|
* TrkTrack::SetYGood(int ip, int cid, int is) |
652 |
|
* |
653 |
|
* NB! The method TrkTrack::SetGood(int *xg, int *yg) set the plane-mask (0-1) |
654 |
|
* for the minimization-routine common. It deletes the cluster information |
655 |
|
* (at least for the moment...) thus cannot be applied before |
656 |
|
* TrkTrack::EvaluateClusterPositions(). |
657 |
|
* |
658 |
|
* Different p.f.a. can be applied by calling (once) the method: |
659 |
|
* |
660 |
|
* TrkParams::SetPFA(0); //Set ETA p.f.a. |
661 |
|
* |
662 |
|
* @see TrkParams::SetPFA(int) |
663 |
|
*/ |
664 |
|
Bool_t TrkTrack::EvaluateClusterPositions(){ |
665 |
|
|
666 |
|
// cout << "void TrkTrack::GetClusterPositions() "<<endl; |
667 |
|
|
668 |
|
TrkParams::Load( ); |
669 |
|
if( !TrkParams::IsLoaded() )return false; |
670 |
|
|
671 |
|
for(int ip=0; ip<6; ip++){ |
672 |
|
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
673 |
|
int icx = GetClusterX_ID(ip)+1; |
674 |
|
int icy = GetClusterY_ID(ip)+1; |
675 |
|
int sensor = GetSensor(ip)+1;//<< convenzione "Paolo" |
676 |
|
if(ip==5 && sensor!=0)sensor=3-sensor;//<< convenzione "Elena" |
677 |
|
int ladder = GetLadder(ip)+1; |
678 |
|
float ax = axv[ip]; |
679 |
|
float ay = ayv[ip]; |
680 |
|
float v[3]; |
681 |
|
v[0]=xv[ip]; |
682 |
|
v[1]=yv[ip]; |
683 |
|
v[2]=zv[ip]; |
684 |
|
float bfx = 10*TrkParams::GetBX(v);//Tesla |
685 |
|
float bfy = 10*TrkParams::GetBY(v);//Tesla |
686 |
|
int ipp=ip+1; |
687 |
|
xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); |
688 |
|
if(icx<0 || icy<0)return false; |
689 |
|
} |
690 |
|
return true; |
691 |
|
} |
692 |
|
/** |
693 |
|
* \brief Tracking method. It calls F77 mini routine. |
694 |
|
* |
695 |
|
* @param pfixed Particle momentum. If pfixed=0 the momentum |
696 |
|
* is left as a free parameter, otherwise it is fixed to the input value. |
697 |
|
* @param fail Output flag (!=0 if the fit failed). |
698 |
|
* @param iprint Flag to set debug mode ( 0 = no output; 1 = verbose; 2 = debug). |
699 |
|
* @param froml1 Flag to re-evaluate positions (see TrkTrack::GetClusterPositions()). |
700 |
|
* |
701 |
|
* The option to re-evaluate positions can be used only after recovering |
702 |
|
* level1 information, eg. by reprocessing the single event. |
703 |
|
* |
704 |
|
* Example: |
705 |
|
* |
706 |
|
* if( !event->GetTrkLevel0() )return false; |
707 |
|
* event->GetTrkLevel0()->ProcessEvent(); // re-processing level0->level1 |
708 |
|
* int fail=0; |
709 |
|
* event->GetTrkLevel2()->GetTrack(0)->Fit(0.,fail,0,1); |
710 |
|
* |
711 |
|
* @see EvaluateClusterPositions() |
712 |
|
* |
713 |
|
* The fitting procedure can be varied by changing the tracking mode, |
714 |
|
* the fit-precision factor and the minimum number of step. |
715 |
|
* @see SetTrackingMode(int) |
716 |
|
* @see SetPrecisionFactor(double) |
717 |
|
* @see SetStepMin(int) |
718 |
*/ |
*/ |
719 |
void TrkTrack::Fit(double pfixed, int& fail, int iprint){ |
void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ |
720 |
|
|
721 |
float al_ini[] = {0.,0.,0.,0.,0.}; |
float al_ini[] = {0.,0.,0.,0.,0.}; |
722 |
|
|
723 |
|
TrkParams::Load( ); |
724 |
|
if( !TrkParams::IsLoaded() )return; |
725 |
|
|
726 |
extern cMini2track track_; |
extern cMini2track track_; |
727 |
fail = 0; |
fail = 0; |
|
FillMiniStruct(track_); |
|
728 |
|
|
729 |
|
FillMiniStruct(track_); |
730 |
|
|
731 |
|
if(froml1!=0){ |
732 |
|
if( !EvaluateClusterPositions() ){ |
733 |
|
cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl; |
734 |
|
FillMiniStruct(track_) ; |
735 |
|
fail = 1; |
736 |
|
return; |
737 |
|
} |
738 |
|
}else{ |
739 |
|
FillMiniStruct(track_); |
740 |
|
} |
741 |
|
|
742 |
// if fit variables have been reset, evaluate the initial guess |
// if fit variables have been reset, evaluate the initial guess |
743 |
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_(); |
744 |
|
|
757 |
|
|
758 |
// ------------------------------------------ |
// ------------------------------------------ |
759 |
// call mini routine |
// call mini routine |
760 |
TrkParams::Load(1); |
// TrkParams::Load(1); |
761 |
if( !TrkParams::IsLoaded(1) ){ |
// if( !TrkParams::IsLoaded(1) ){ |
762 |
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; |
763 |
return; |
// return; |
764 |
} |
// } |
765 |
int istep=0; |
int istep=0; |
766 |
int ifail=0; |
int ifail=0; |
767 |
mini2_(&istep,&ifail, &iprint); |
mini2_(&istep,&ifail, &iprint); |
772 |
// ------------------------------------------ |
// ------------------------------------------ |
773 |
|
|
774 |
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]; |
|
|
// } |
|
775 |
|
|
776 |
if(fail){ |
if(fail){ |
777 |
if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<<endl; |
if(iprint)cout << " >>>> fit failed "<<endl; |
778 |
for(int i=0; i<5; i++) al[i]=al_ini[i]; |
for(int i=0; i<5; i++) al[i]=al_ini[i]; |
779 |
} |
} |
780 |
|
|
781 |
}; |
}; |
782 |
/* |
/** |
783 |
* Reset the fit parameters |
* Reset the fit parameters |
784 |
*/ |
*/ |
785 |
void TrkTrack::FitReset(){ |
void TrkTrack::FitReset(){ |
786 |
for(int i=0; i<5; i++) al[i]=-9999.; |
for(int i=0; i<5; i++) al[i]=-9999.; |
787 |
chi2=0.; |
chi2=0.; |
788 |
nstep=0; |
nstep=0; |
789 |
for(int i=0; i<6; i++) xv[i]=0.; |
// for(int i=0; i<6; i++) xv[i]=0.; |
790 |
for(int i=0; i<6; i++) yv[i]=0.; |
// for(int i=0; i<6; i++) yv[i]=0.; |
791 |
for(int i=0; i<6; i++) zv[i]=0.; |
// for(int i=0; i<6; i++) zv[i]=0.; |
792 |
for(int i=0; i<6; i++) axv[i]=0.; |
// for(int i=0; i<6; i++) axv[i]=0.; |
793 |
for(int i=0; i<6; i++) ayv[i]=0.; |
// for(int i=0; i<6; i++) ayv[i]=0.; |
794 |
for(int i=0; i<5; i++) { |
for(int i=0; i<5; i++) { |
795 |
for(int j=0; j<5; j++) coval[i][j]=0.; |
for(int j=0; j<5; j++) coval[i][j]=0.; |
796 |
} |
} |
797 |
} |
} |
798 |
/* |
/** |
799 |
* Set the tracking mode |
* Set the tracking mode |
800 |
*/ |
*/ |
801 |
void TrkTrack::SetTrackingMode(int trackmode){ |
void TrkTrack::SetTrackingMode(int trackmode){ |
802 |
extern cMini2track track_; |
extern cMini2track track_; |
803 |
track_.trackmode = trackmode; |
track_.trackmode = trackmode; |
804 |
} |
} |
805 |
/* |
/** |
806 |
* Set the factor scale for tracking precision |
* Set the factor scale for tracking precision |
807 |
*/ |
*/ |
808 |
void TrkTrack::SetPrecisionFactor(double fact){ |
void TrkTrack::SetPrecisionFactor(double fact){ |
809 |
extern cMini2track track_; |
extern cMini2track track_; |
810 |
track_.fact = fact; |
track_.fact = fact; |
811 |
} |
} |
812 |
/* |
/** |
813 |
* Set the factor scale for tracking precision |
* Set the minimum number of steps for tracking precision |
814 |
*/ |
*/ |
815 |
void TrkTrack::SetStepMin(int istepmin){ |
void TrkTrack::SetStepMin(int istepmin){ |
816 |
extern cMini2track track_; |
extern cMini2track track_; |
817 |
track_.istepmin = istepmin; |
track_.istepmin = istepmin; |
818 |
} |
} |
819 |
|
/** |
820 |
|
* Returns 1 if the track is inside the magnet cavity |
821 |
/* |
* Set the minimum number of steps for tracking precision |
822 |
|
*/ |
823 |
|
Bool_t TrkTrack::IsInsideCavity(){ |
824 |
|
float xmagntop, ymagntop, xmagnbottom, ymagnbottom; |
825 |
|
xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.); |
826 |
|
ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.); |
827 |
|
xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.); |
828 |
|
ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.); |
829 |
|
if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH && |
830 |
|
ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH && |
831 |
|
xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH && |
832 |
|
ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true); |
833 |
|
else return(false); |
834 |
|
} |
835 |
|
/** |
836 |
* 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. |
837 |
* If no cluster is associated, ID=-1. |
* If no cluster is associated, ID=-1. |
838 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
840 |
Int_t TrkTrack::GetClusterX_ID(int ip){ |
Int_t TrkTrack::GetClusterX_ID(int ip){ |
841 |
return ((Int_t)fabs(xgood[ip]))%10000000-1; |
return ((Int_t)fabs(xgood[ip]))%10000000-1; |
842 |
}; |
}; |
843 |
/* |
/** |
844 |
* 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. |
845 |
* If no cluster is associated, ID=-1. |
* If no cluster is associated, ID=-1. |
846 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
848 |
Int_t TrkTrack::GetClusterY_ID(int ip){ |
Int_t TrkTrack::GetClusterY_ID(int ip){ |
849 |
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
return ((Int_t)fabs(ygood[ip]))%10000000-1; |
850 |
}; |
}; |
851 |
/* |
/** |
852 |
* 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. |
853 |
* If no ladder is traversed (dead area) the metod retuns -1. |
* If no ladder is traversed (dead area) the metod retuns -1. |
854 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
858 |
if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; |
if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; |
859 |
return -1; |
return -1; |
860 |
}; |
}; |
861 |
/* |
/** |
862 |
* 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. |
863 |
* If no sensor is traversed (dead area) the metod retuns -1. |
* If no sensor is traversed (dead area) the metod retuns -1. |
864 |
* @param ip Tracker plane (0-5) |
* @param ip Tracker plane (0-5) |
869 |
return -1; |
return -1; |
870 |
}; |
}; |
871 |
|
|
872 |
|
/** |
873 |
|
* \brief Method to include a x-cluster to the track. |
874 |
|
* @param ip Tracker plane (0-5) |
875 |
|
* @param clid Cluster ID (0,1,...) |
876 |
|
* @param is Sensor (0-1, increasing y) |
877 |
|
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
878 |
|
*/ |
879 |
|
void TrkTrack::SetXGood(int ip, int clid, int is){ |
880 |
|
int il=0; //ladder (temporary) |
881 |
|
bool bad=false; //ladder (temporary) |
882 |
|
xgood[ip]=il*100000000+is*10000000+clid; |
883 |
|
if(bad)xgood[ip]=-xgood[ip]; |
884 |
|
}; |
885 |
|
/** |
886 |
|
* \brief Method to include a y-cluster to the track. |
887 |
|
* @param ip Tracker plane (0-5) |
888 |
|
* @param clid Cluster ID (0,1,...) |
889 |
|
* @param is Sensor (0-1) |
890 |
|
* @see Fit(double pfixed, int& fail, int iprint, int froml1) |
891 |
|
*/ |
892 |
|
void TrkTrack::SetYGood(int ip, int clid, int is){ |
893 |
|
int il=0; //ladder (temporary) |
894 |
|
bool bad=false; //ladder (temporary) |
895 |
|
ygood[ip]=il*100000000+is*10000000+clid; |
896 |
|
if(bad)ygood[ip]=-ygood[ip]; |
897 |
|
}; |
898 |
|
|
899 |
//-------------------------------------- |
//-------------------------------------- |
900 |
// |
// |
1048 |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
1049 |
} |
} |
1050 |
} |
} |
1051 |
|
/** |
1052 |
|
* \brief Dump processing status |
1053 |
|
*/ |
1054 |
|
void TrkLevel2::StatusDump(int view){ |
1055 |
|
cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl; |
1056 |
|
}; |
1057 |
|
/** |
1058 |
|
* \brief Check event status |
1059 |
|
* |
1060 |
|
* Check the event status, according to a flag-mask given as input. |
1061 |
|
* Return true if the view passes the check. |
1062 |
|
* |
1063 |
|
* @param view View number (0-11) |
1064 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
1065 |
|
* no crc error, no software alarm) |
1066 |
|
* |
1067 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
1068 |
|
* |
1069 |
|
*/ |
1070 |
|
Bool_t TrkLevel2::StatusCheck(int view, int flagmask){ |
1071 |
|
|
1072 |
|
if( view<0 || view >= 12)return false; |
1073 |
|
return !(good[view]&flagmask); |
1074 |
|
|
1075 |
|
}; |
1076 |
|
|
1077 |
|
|
1078 |
//-------------------------------------- |
//-------------------------------------- |
1079 |
// |
// |
1080 |
// |
// |
1542 |
// path_.error = 0; |
// path_.error = 0; |
1543 |
// readb_(); |
// readb_(); |
1544 |
|
|
1545 |
|
TrkParams::SetTrackingMode(); |
1546 |
|
TrkParams::SetPrecisionFactor(); |
1547 |
|
TrkParams::SetStepMin(); |
1548 |
|
|
1549 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
1550 |
TrkParams::Load(1); |
TrkParams::Load(1); |
1551 |
|
|
1552 |
// |
// |
1553 |
}; |
}; |
1554 |
/** |
// /** |
1555 |
* Get BY (kGauss) |
// * Get BY (kGauss) |
1556 |
* @param v (x,y,z) coordinates in cm |
// * @param v (x,y,z) coordinates in cm |
1557 |
*/ |
// */ |
1558 |
float TrkLevel2::GetBX(float* v){ |
// float TrkLevel2::GetBX(float* v){ |
1559 |
float b[3]; |
// float b[3]; |
1560 |
gufld_(v,b); |
// gufld_(v,b); |
1561 |
return b[0]/10.; |
// return b[0]/10.; |
1562 |
} |
// } |
1563 |
/** |
// /** |
1564 |
* Get BY (kGauss) |
// * Get BY (kGauss) |
1565 |
* @param v (x,y,z) coordinates in cm |
// * @param v (x,y,z) coordinates in cm |
1566 |
*/ |
// */ |
1567 |
float TrkLevel2::GetBY(float* v){ |
// float TrkLevel2::GetBY(float* v){ |
1568 |
float b[3]; |
// float b[3]; |
1569 |
gufld_(v,b); |
// gufld_(v,b); |
1570 |
return b[1]/10.; |
// return b[1]/10.; |
1571 |
} |
// } |
1572 |
/** |
// /** |
1573 |
* Get BY (kGauss) |
// * Get BY (kGauss) |
1574 |
* @param v (x,y,z) coordinates in cm |
// * @param v (x,y,z) coordinates in cm |
1575 |
*/ |
// */ |
1576 |
float TrkLevel2::GetBZ(float* v){ |
// float TrkLevel2::GetBZ(float* v){ |
1577 |
float b[3]; |
// float b[3]; |
1578 |
gufld_(v,b); |
// gufld_(v,b); |
1579 |
return b[2]/10.; |
// return b[2]/10.; |
1580 |
} |
// } |
1581 |
//-------------------------------------- |
//-------------------------------------- |
1582 |
// |
// |
1583 |
// |
// |