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 |
// |
// |
426 |
// |
// |
667 |
* |
* |
668 |
* @see TrkParams::SetPFA(int) |
* @see TrkParams::SetPFA(int) |
669 |
*/ |
*/ |
670 |
void TrkTrack::EvaluateClusterPositions(){ |
Bool_t TrkTrack::EvaluateClusterPositions(){ |
671 |
|
|
672 |
// cout << "void TrkTrack::GetClusterPositions() "<<endl; |
// cout << "void TrkTrack::GetClusterPositions() "<<endl; |
673 |
|
|
674 |
TrkParams::Load( ); |
TrkParams::Load( ); |
675 |
if( !TrkParams::IsLoaded() )return; |
if( !TrkParams::IsLoaded() )return false; |
676 |
|
|
677 |
for(int ip=0; ip<6; ip++){ |
for(int ip=0; ip<6; ip++){ |
678 |
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
691 |
float bfy = 10*TrkParams::GetBY(v);//Tesla |
float bfy = 10*TrkParams::GetBY(v);//Tesla |
692 |
int ipp=ip+1; |
int ipp=ip+1; |
693 |
xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); |
xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); |
694 |
|
if(icx<0 || icy<0)return false; |
695 |
} |
} |
696 |
|
return true; |
697 |
} |
} |
698 |
/** |
/** |
699 |
* \brief Tracking method. It calls F77 mini routine. |
* \brief Tracking method. It calls F77 mini routine. |
731 |
|
|
732 |
extern cMini2track track_; |
extern cMini2track track_; |
733 |
fail = 0; |
fail = 0; |
734 |
|
|
735 |
FillMiniStruct(track_); |
FillMiniStruct(track_); |
736 |
|
|
737 |
if(froml1!=0)EvaluateClusterPositions(); |
if(froml1!=0){ |
738 |
|
if( !EvaluateClusterPositions() ){ |
739 |
|
cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl; |
740 |
|
FillMiniStruct(track_) ; |
741 |
|
fail = 1; |
742 |
|
return; |
743 |
|
} |
744 |
|
}else{ |
745 |
|
FillMiniStruct(track_); |
746 |
|
} |
747 |
|
|
748 |
// if fit variables have been reset, evaluate the initial guess |
// if fit variables have been reset, evaluate the initial guess |
749 |
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_(); |
1054 |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); |
1055 |
} |
} |
1056 |
} |
} |
1057 |
|
/** |
1058 |
|
* \brief Dump processing status |
1059 |
|
*/ |
1060 |
|
void TrkLevel2::StatusDump(int view){ |
1061 |
|
cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl; |
1062 |
|
}; |
1063 |
|
/** |
1064 |
|
* \brief Check event status |
1065 |
|
* |
1066 |
|
* Check the event status, according to a flag-mask given as input. |
1067 |
|
* Return true if the view passes the check. |
1068 |
|
* |
1069 |
|
* @param view View number (0-11) |
1070 |
|
* @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, |
1071 |
|
* no crc error, no software alarm) |
1072 |
|
* |
1073 |
|
* @see TrkLevel2 class definition to know how the status flag is defined |
1074 |
|
* |
1075 |
|
*/ |
1076 |
|
Bool_t TrkLevel2::StatusCheck(int view, int flagmask){ |
1077 |
|
|
1078 |
|
if( view<0 || view >= 12)return false; |
1079 |
|
return !(good[view]&flagmask); |
1080 |
|
|
1081 |
|
}; |
1082 |
|
|
1083 |
|
|
1084 |
//-------------------------------------- |
//-------------------------------------- |
1085 |
// |
// |
1086 |
// |
// |