--- DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2007/04/27 10:39:57 1.32 +++ DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2007/11/27 11:43:50 1.41 @@ -12,9 +12,13 @@ extern "C" { void dotrack_(int*, double*, double*, double*, double*, int*); void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); - void mini2_(int*,int*,int*); - void guess_(); - void gufld_(float*, float*); + void mini2_(int*,int*,int*); + void guess_(); + void gufld_(float*, float*); + float risxeta2_(float *); + float risxeta3_(float *); + float risxeta4_(float *); + float risyeta2_(float *); } //-------------------------------------- @@ -48,13 +52,20 @@ ayv[ip] = 0; dedx_x[ip] = 0; dedx_y[ip] = 0; + multmaxx[ip] = 0; + multmaxy[ip] = 0; + seedx[ip] = 0; + seedy[ip] = 0; + xpu[ip] = 0; + ypu[ip] = 0; + }; -// clx = 0; -// cly = 0; -// clx = new TRefArray(6,0); //forse causa memory leak??? -// cly = new TRefArray(6,0); //forse causa memory leak??? -// clx = TRefArray(6,0); -// cly = TRefArray(6,0); + +// TrkParams::SetTrackingMode(); +// TrkParams::SetPrecisionFactor(); +// TrkParams::SetStepMin(); + TrkParams::SetMiniDefault(); + TrkParams::SetPFA(); }; //-------------------------------------- @@ -87,13 +98,19 @@ ayv[ip] = t.ayv[ip]; dedx_x[ip] = t.dedx_x[ip]; dedx_y[ip] = t.dedx_y[ip]; + multmaxx[ip] = t.multmaxx[ip]; + multmaxy[ip] = t.multmaxy[ip]; + seedx[ip] = t.seedx[ip]; + seedy[ip] = t.seedy[ip]; + xpu[ip] = t.xpu[ip]; + ypu[ip] = t.ypu[ip]; }; -// clx = 0; -// cly = 0; -// if(t.clx)clx = new TRefArray(*(t.clx)); -// if(t.cly)cly = new TRefArray(*(t.cly)); -// clx = TRefArray(t.clx); -// cly = TRefArray(t.cly); + +// TrkParams::SetTrackingMode(); +// TrkParams::SetPrecisionFactor(); +// TrkParams::SetStepMin(); + TrkParams::SetMiniDefault(); + TrkParams::SetPFA(); }; //-------------------------------------- @@ -127,11 +144,15 @@ t.ayv[ip] = ayv[ip]; t.dedx_x[ip] = dedx_x[ip]; t.dedx_y[ip] = dedx_y[ip]; + t.multmaxx[ip] = multmaxx[ip]; + t.multmaxy[ip] = multmaxy[ip]; + t.seedx[ip] = seedx[ip]; + t.seedy[ip] = seedy[ip]; + t.xpu[ip] = xpu[ip]; + t.ypu[ip] = ypu[ip]; }; -// t.clx = TRefArray(clx); -// t.cly = TRefArray(cly); }; //-------------------------------------- @@ -351,6 +372,103 @@ } return (last_plane-first_plane+1); } +/** + * Returns the reduced chi-square of track x-projection + */ +Float_t TrkTrack::GetChi2X(){ + float chiq=0; + for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.); + if(GetNX()>3)chiq=chiq/(GetNX()-3); + else chiq=0; + if(chiq==0)cout << " Float_t TrkTrack::GetChi2X() -- WARNING -- value not defined "<2)chiq=chiq/(GetNY()-2); + else chiq=0; + if(chiq==0)cout << " Float_t TrkTrack::GetChi2Y() -- WARNING -- value not defined "<3)lnl=lnl/(GetNX()-3); + else lnl=0; + if(lnl==0){ + cout << " Float_t TrkTrack::GetLnLX() -- WARNING -- value not defined "<2)lnl=lnl/(GetNY()-2); + else lnl=0; + if(lnl==0){ + cout << " Float_t TrkTrack::GetLnLY() -- WARNING -- value not defined "<5){ + cout << "Float_t TrkTrack::GetEffectiveAngle(int "< wrong input"< wrong input"<10) index=10; + tailx[i]=tx[index]; + if(flag==1) { + if(fabs(axv[i])<=10.) fact = resx[i]/risxeta2_(&(axv[i])); + if(fabs(axv[i])>10.&&fabs(axv[i])<=15.) fact = resx[i]/risxeta3_(&(axv[i])); + if(fabs(axv[i])>15.) fact = resx[i]/risxeta4_(&(axv[i])); + } else fact = 1.; + resx[i] = sx[index]*fact; + } + for(int i=0; i<6; i++) { + index = int((fabs(ayv[i])+1.)/2.); + if(index>10) index=10; + taily[i]=ty[index]; + if(flag==1) fact = resy[i]/risyeta2_(&(ayv[i])); + else fact = 1.; + resy[i] = sy[index]*fact; + } +} +/** * Set the TrkTrack good measurement */ void TrkTrack::SetGood(int *xg, int *yg){ - // NB! si perdera` l'informazione sul numero del cluster + for(int i=0; i<6; i++) xgood[i]=*xg++; for(int i=0; i<6; i++) ygood[i]=*yg++; } @@ -415,6 +623,11 @@ // path_.error = 0; // readb_(); +// TrkParams::SetTrackingMode(); +// TrkParams::SetPrecisionFactor(); +// TrkParams::SetStepMin(); + TrkParams::SetMiniDefault(); + TrkParams::Set(path,1); TrkParams::Load(1); @@ -428,8 +641,8 @@ for(int i=0; i<6; i++){ -// track.xgood[i]=xgood[i]; -// track.ygood[i]=ygood[i]; +// cout << i<<" - "<GetTrkLevel0() )return false; + * event->GetTrkLevel0()->ProcessEvent(); // re-processing level0->level1 + * int fail=0; + * event->GetTrkLevel2()->GetTrack(0)->Fit(0.,fail,0,1); + * + * @see EvaluateClusterPositions() + * + * The fitting procedure can be varied by changing the tracking mode, + * the fit-precision factor, the minimum number of step, etc. + * @see SetTrackingMode(int) + * @see SetPrecisionFactor(double) + * @see SetStepMin(int) + * @see SetDeltaB(int,double) */ -void TrkTrack::Fit(double pfixed, int& fail, int iprint){ +void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ float al_ini[] = {0.,0.,0.,0.,0.}; + TrkParams::Load( ); + if( !TrkParams::IsLoaded() )return; + extern cMini2track track_; fail = 0; - FillMiniStruct(track_); + FillMiniStruct(track_); + + if(froml1!=0){ + if( !EvaluateClusterPositions() ){ + cout << "void TrkTrack::Fit("< " << 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]; -// } if(fail){ - if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<>>> fit failed "<XMAGNLOW && xmagntopYMAGNLOW && ymagntopXMAGNLOW && xmagnbottomYMAGNLOW && ymagnbottomntrk() ; - cout << endl << "nclsx() : " << this->nclsx(); - cout << endl << "nclsy() : " << this->nclsy(); + cout << endl << "good : "; for(int i=0; i<12; i++) cout << hex <<" 0x"<< good[i]<Dump(); } - if(SingletX){ - TClonesArray &sx = *SingletX; - for(int i=0; iDump(); - } - if(SingletY){ - TClonesArray &sy = *SingletY; - for(int i=0; iDump(); - } +// if(SingletX){ +// TClonesArray &sx = *SingletX; +// for(int i=0; iDump(); +// } +// if(SingletY){ +// TClonesArray &sy = *SingletY; +// for(int i=0; iDump(); +// } + cout << endl; } +/** + * \brief Dump processing status + */ +void TrkLevel2::StatusDump(int view){ + cout << "DSP n. "<= 12)return false; + return !(good[view]&flagmask); + +}; + + //-------------------------------------- // // @@ -893,6 +1265,12 @@ t_track->ayv[ip] = l2->ayv_nt[i][ip]; t_track->dedx_x[ip] = l2->dedx_x[i][ip]; t_track->dedx_y[ip] = l2->dedx_y[i][ip]; + t_track->multmaxx[ip] = l2->multmaxx[i][ip]; + t_track->multmaxy[ip] = l2->multmaxy[i][ip]; + t_track->seedx[ip] = l2->seedx[i][ip]; + t_track->seedy[ip] = l2->seedy[i][ip]; + t_track->xpu[ip] = l2->xpu[i][ip]; + t_track->ypu[ip] = l2->ypu[i][ip]; //----------------------------------------------------- //----------------------------------------------------- //----------------------------------------------------- @@ -1245,38 +1623,43 @@ // path_.error = 0; // readb_(); +// TrkParams::SetTrackingMode(); +// TrkParams::SetPrecisionFactor(); +// TrkParams::SetStepMin(); + TrkParams::SetMiniDefault(); + TrkParams::Set(path,1); TrkParams::Load(1); // }; -/** - * Get BY (kGauss) - * @param v (x,y,z) coordinates in cm - */ -float TrkLevel2::GetBX(float* v){ - float b[3]; - gufld_(v,b); - return b[0]/10.; -} -/** - * Get BY (kGauss) - * @param v (x,y,z) coordinates in cm - */ -float TrkLevel2::GetBY(float* v){ - float b[3]; - gufld_(v,b); - return b[1]/10.; -} -/** - * Get BY (kGauss) - * @param v (x,y,z) coordinates in cm - */ -float TrkLevel2::GetBZ(float* v){ - float b[3]; - gufld_(v,b); - return b[2]/10.; -} +// /** +// * Get BY (kGauss) +// * @param v (x,y,z) coordinates in cm +// */ +// float TrkLevel2::GetBX(float* v){ +// float b[3]; +// gufld_(v,b); +// return b[0]/10.; +// } +// /** +// * Get BY (kGauss) +// * @param v (x,y,z) coordinates in cm +// */ +// float TrkLevel2::GetBY(float* v){ +// float b[3]; +// gufld_(v,b); +// return b[1]/10.; +// } +// /** +// * Get BY (kGauss) +// * @param v (x,y,z) coordinates in cm +// */ +// float TrkLevel2::GetBZ(float* v){ +// float b[3]; +// gufld_(v,b); +// return b[2]/10.; +// } //-------------------------------------- // //