--- DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2007/01/31 16:15:55 1.24 +++ DarthVader/TrackerLevel2/src/TrkLevel2.cpp 2007/08/17 13:25:14 1.38 @@ -12,11 +12,15 @@ extern "C" { void dotrack_(int*, double*, double*, double*, double*, int*); void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); -// int readb_(const char*); - int readb_(); void mini2_(int*,int*,int*); void guess_(); + void gufld_(float*, float*); + float risxeta2_(float *); + float risxeta3_(float *); + float risxeta4_(float *); + float risyeta2_(float *); } + //-------------------------------------- // // @@ -39,6 +43,8 @@ zm[ip] = 0; resx[ip] = 0; resy[ip] = 0; + tailx[ip] = 0; + taily[ip] = 0; xv[ip] = 0; yv[ip] = 0; zv[ip] = 0; @@ -47,10 +53,18 @@ dedx_x[ip] = 0; dedx_y[ip] = 0; }; - clx = 0; - cly = 0; -// clx = new TRefArray(6,0); -// cly = new TRefArray(6,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::SetPFA(); + }; //-------------------------------------- // @@ -73,6 +87,8 @@ zm[ip] = t.zm[ip]; resx[ip] = t.resx[ip]; resy[ip] = t.resy[ip]; + tailx[ip] = t.tailx[ip]; + taily[ip] = t.taily[ip]; xv[ip] = t.xv[ip]; yv[ip] = t.yv[ip]; zv[ip] = t.zv[ip]; @@ -81,11 +97,18 @@ dedx_x[ip] = t.dedx_x[ip]; dedx_y[ip] = t.dedx_y[ip]; }; - clx = 0; - cly = 0; - if(t.clx)clx = new TRefArray(*(t.clx)); - if(t.cly)cly = new TRefArray(*(t.cly)); - +// 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::SetPFA(); + }; //-------------------------------------- // @@ -109,6 +132,8 @@ t.zm[ip] = zm[ip]; t.resx[ip] = resx[ip]; t.resy[ip] = resy[ip]; + t.tailx[ip] = tailx[ip]; + t.taily[ip] = taily[ip]; t.xv[ip] = xv[ip]; t.yv[ip] = yv[ip]; t.zv[ip] = zv[ip]; @@ -118,6 +143,9 @@ t.dedx_y[ip] = dedx_y[ip]; }; + +// t.clx = TRefArray(clx); +// t.cly = TRefArray(cly); }; //-------------------------------------- @@ -143,6 +171,11 @@ for (int i=0; i<5; i++) dal[i] = (double)al[i]; for (int i=0; inpoint; i++) dzin[i] = (double)t->z[i]; + TrkParams::Load(1); + if( !TrkParams::IsLoaded(1) ){ + cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<npoint),dzin,dxout,dyout,dal,&ifail); for (int i=0; inpoint; i++){ @@ -182,6 +215,11 @@ for (int i=0; i<5; i++) dal[i] = (double)al[i]; for (int i=0; inpoint; i++) dzin[i] = (double)t->z[i]; + TrkParams::Load(1); + if( !TrkParams::IsLoaded(1) ){ + cout << "int TrkTrack::DoTrack2(Trajectory* t) --- ERROR --- m.field not loaded"<npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); for (int i=0; inpoint; i++){ @@ -221,13 +259,168 @@ return def; }; // -Float_t TrkTrack::GetDEDX(){ - Float_t dedx=0; - for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i]; - dedx = dedx/(this->GetNX()+this->GetNY()); - return dedx; +/** + * Method to retrieve the dE/dx measured on a tracker view. + * @param ip plane (0-5) + * @param iv view (0=x 1=y) + */ +Float_t TrkTrack::GetDEDX(int ip, int iv){ + if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]); + else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]); + else { + cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<=0 && ip<6)return (xgood[ip]<0) ; + else if(iv==1 && ip>=0 && ip<6)return (ygood[ip]<0) ; + else { + cout << "TrkTrack::IsBad(int ip, int iv) -- wrong input parameters "<=0 && ip<6)return (dedx_x[ip]<0) ; + else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ; + else { + cout << "TrkTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<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 "<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){ + for(int i=0; i<6; i++) xgood[i]=*xg++; for(int i=0; i<6; i++) ygood[i]=*yg++; } @@ -286,13 +561,21 @@ */ void TrkTrack::LoadField(TString path){ - strcpy(path_.path,path.Data()); - path_.pathlen = path.Length(); - path_.error = 0; - readb_(); +// strcpy(path_.path,path.Data()); +// path_.pathlen = path.Length(); +// path_.error = 0; +// readb_(); + + TrkParams::SetTrackingMode(); + TrkParams::SetPrecisionFactor(); + TrkParams::SetStepMin(); + + TrkParams::Set(path,1); + TrkParams::Load(1); }; + /** * Method to fill minimization-routine common */ @@ -300,8 +583,10 @@ for(int i=0; i<6; i++){ - track.xgood[i]=xgood[i]; - track.ygood[i]=ygood[i]; +// cout << i<<" - "<axv[i]; ayv[i] = track->ayv[i]; } - } /** - * Tracking method. It calls F77 mini routine. + * \brief Method to re-evaluate coordinates of clusters associated with a track. + * + * The method can be applied only after recovering level1 information + * (either by reprocessing single events from level0 or from + * the TrkLevel1 branch, if present); it calls F77 subroutines that + * read the level1 common and fill the minimization-routine common. + * Some clusters can be excluded or added by means of the methods: + * + * TrkTrack::ResetXGood(int ip) + * TrkTrack::ResetYGood(int ip) + * TrkTrack::SetXGood(int ip, int cid, int is) + * TrkTrack::SetYGood(int ip, int cid, int is) + * + * NB! The method TrkTrack::SetGood(int *xg, int *yg) set the plane-mask (0-1) + * for the minimization-routine common. It deletes the cluster information + * (at least for the moment...) thus cannot be applied before + * TrkTrack::EvaluateClusterPositions(). + * + * Different p.f.a. can be applied by calling (once) the method: + * + * TrkParams::SetPFA(0); //Set ETA p.f.a. + * + * @see TrkParams::SetPFA(int) + */ +Bool_t TrkTrack::EvaluateClusterPositions(){ + +// cout << "void TrkTrack::GetClusterPositions() "<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 and the minimum number of step. + * @see SetTrackingMode(int) + * @see SetPrecisionFactor(double) + * @see SetStepMin(int) */ -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 && ymagnbottomClear(); - if(cly)cly->Clear(); +// if(clx)clx->Clear(); +// if(cly)cly->Clear(); +// clx.Clear(); +// cly.Clear(); }; //-------------------------------------- // @@ -472,9 +946,9 @@ //-------------------------------------- void TrkTrack::Delete(){ // cout << "TrkTrack::Delete()"<ntrk() ; cout << endl << "nclsx() : " << this->nclsx(); cout << endl << "nclsy() : " << this->nclsy(); -// TClonesArray &t = *Track; -// TClonesArray &sx = *SingletX; -// TClonesArray &sy = *SingletY; -// for(int i=0; iDump(); -// for(int i=0; iDump(); -// for(int i=0; iDump(); if(Track){ TClonesArray &t = *Track; for(int i=0; iDump(); @@ -588,32 +1054,109 @@ for(int i=0; iDump(); } } +/** + * \brief Dump processing status + */ +void TrkLevel2::StatusDump(int view){ + cout << "DSP n. "<= 12)return false; + return !(good[view]&flagmask); + +}; + + //-------------------------------------- // // //-------------------------------------- /** - * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). + * The method returns false if the viking-chip was masked + * either apriori ,on the basis of the mask read from the DB, + * or run-by-run, on the basis of the calibration parameters) + * @param iv Tracker view (0-11) + * @param ivk Viking-chip number (0-23) + */ +Bool_t TrkLevel2::GetVKMask(int iv, int ivk){ + Int_t whichbit = (Int_t)pow(2,ivk); + return (whichbit&VKmask[iv])!=0; +} +/** + * The method returns false if the viking-chip was masked + * for this event due to common-noise computation failure. + * @param iv Tracker view (0-11) + * @param ivk Viking-chip number (0-23) + */ +Bool_t TrkLevel2::GetVKFlag(int iv, int ivk){ + Int_t whichbit = (Int_t)pow(2,ivk); + return (whichbit&VKflag[iv])!=0; +} +/** + * The method returns true if the viking-chip was masked, either + * forced (see TrkLevel2::GetVKMask(int,int)) or + * for this event only (TrkLevel2::GetVKFlag(int,int)). + * @param iv Tracker view (0-11) + * @param ivk Viking-chip number (0-23) */ -void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){ +Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){ + return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) ); +}; - // temporary objects: +//-------------------------------------- +// +// +//-------------------------------------- +/** + * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). + * Ref to Level1 data (clusters) is also set. If l1==NULL no references are set. + * (NB It make sense to set references only if events are stored in a tree that contains also the Level1 branch) + */ +void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ + +// cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<good2; +// ----------------- +// general variables +// ----------------- for(Int_t i=0; i<12 ; i++){ -// crc[i] = l2->crc[i]; - good[i] = l2->good[i]; + good[i] = l2->good[i]; + VKmask[i]=0; + VKflag[i]=0; + for(Int_t ii=0; ii<24 ; ii++){ + Int_t setbit = (Int_t)pow(2,ii); + if( l2->vkflag[ii][i]!=-1 )VKmask[i]=VKmask[i]|setbit; + if( l2->vkflag[ii][i]!=0 )VKflag[i]=VKflag[i]|setbit; }; - // *** TRACKS *** + }; +// -------------- +// *** TRACKS *** +// -------------- if(!Track) Track = new TClonesArray("TrkTrack"); TClonesArray &t = *Track; + for(int i=0; intrk; i++){ t_track->seqno = i;// NBNBNBNB deve sempre essere = i t_track->image = l2->image[i]-1; - // cout << "track "<seqno << t_track->image<chi2 = l2->chi2_nt[i]; t_track->nstep = l2->nstep_nt[i]; for(int it1=0;it1<5;it1++){ @@ -622,13 +1165,30 @@ t_track->coval[it1][it2] = l2->coval[i][it2][it1]; }; for(int ip=0;ip<6;ip++){ - t_track->xgood[ip] = l2->xgood_nt[i][ip]; - t_track->ygood[ip] = l2->ygood_nt[i][ip]; + // --------------------------------- + // new implementation of xgood/ygood + // --------------------------------- + t_track->xgood[ip] = l2->cltrx[i][ip]; //cluster ID + t_track->ygood[ip] = l2->cltry[i][ip]; //cluster ID + t_track->xgood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor + t_track->ygood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor + if(l2->xbad[i][ip]>0)t_track->xgood[ip]=-t_track->xgood[ip]; + if(l2->ybad[i][ip]>0)t_track->ygood[ip]=-t_track->ygood[ip]; +// if(l2->xbad[i][ip]>0 || l2->ybad[i][ip]>0){ +// if(l2->dedx_x[i][ip]<0 || l2->dedx_y[i][ip]<0){ +// cout << ip << " - "<< l2->cltrx[i][ip] << " "<cltry[i][ip]<<" "<ls[i][ip]<xgood[ip]<<" "<ygood[ip]<GetClusterX_ID(ip)<<" "<GetClusterY_ID(ip)<<" "<GetLadder(ip)<<" "<GetSensor(ip)<BadClusterX(ip)<<" "<BadClusterY(ip)<SaturatedClusterX(ip)<<" "<SaturatedClusterY(ip)<xm[ip] = l2->xm_nt[i][ip]; t_track->ym[ip] = l2->ym_nt[i][ip]; t_track->zm[ip] = l2->zm_nt[i][ip]; t_track->resx[ip] = l2->resx_nt[i][ip]; t_track->resy[ip] = l2->resy_nt[i][ip]; + t_track->tailx[ip] = l2->tailx[i][ip]; + t_track->taily[ip] = l2->taily[i][ip]; t_track->xv[ip] = l2->xv_nt[i][ip]; t_track->yv[ip] = l2->yv_nt[i][ip]; t_track->zv[ip] = l2->zv_nt[i][ip]; @@ -636,13 +1196,19 @@ 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->clx[ip] = 0; -// t_track->cly[ip] = 0; + //----------------------------------------------------- + //----------------------------------------------------- + //----------------------------------------------------- + //----------------------------------------------------- }; +// if(t_track->IsSaturated())t_track->Dump(); new(t[i]) TrkTrack(*t_track); t_track->Clear(); }; + +// ---------------- // *** SINGLETS *** +// ---------------- if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); TClonesArray &sx = *SingletX; for(int i=0; inclsx; i++){ @@ -650,7 +1216,9 @@ t_singlet->coord[0] = l2->xs[i][0]; t_singlet->coord[1] = l2->xs[i][1]; t_singlet->sgnl = l2->signlxs[i]; -// t_singlet->cls = 0; + //----------------------------------------------------- +// if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); + //----------------------------------------------------- new(sx[i]) TrkSinglet(*t_singlet); t_singlet->Clear(); } @@ -661,7 +1229,9 @@ t_singlet->coord[0] = l2->ys[i][0]; t_singlet->coord[1] = l2->ys[i][1]; t_singlet->sgnl = l2->signlys[i]; -// t_singlet->cls = 0; + //----------------------------------------------------- +// if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); + //----------------------------------------------------- new(sy[i]) TrkSinglet(*t_singlet); t_singlet->Clear(); }; @@ -669,104 +1239,6 @@ delete t_track; delete t_singlet; } -//-------------------------------------- -// -// -//-------------------------------------- -/** - * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). - * Ref to Level1 data (clusters) is also set. - */ -void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ - -// temporary objects: - TrkSinglet* t_singlet = new TrkSinglet(); - TrkTrack* t_track = new TrkTrack(); -// general variables -// good2 = l2->good2; - for(Int_t i=0; i<12 ; i++){ -// crc[i] = l2->crc[i]; - good[i] = l2->good[i]; - }; -// *** TRACKS *** - if(!Track) Track = new TClonesArray("TrkTrack"); - TClonesArray &t = *Track; - if(!t_track->clx)t_track->clx = new TRefArray(6,0); - if(!t_track->cly)t_track->cly = new TRefArray(6,0); - for(int i=0; intrk; i++){ - t_track->seqno = i;// NBNBNBNB deve sempre essere = i - t_track->image = l2->image[i]-1; -// cout << "track "<seqno << t_track->image<chi2 = l2->chi2_nt[i]; - t_track->nstep = l2->nstep_nt[i]; - for(int it1=0;it1<5;it1++){ - t_track->al[it1] = l2->al_nt[i][it1]; - for(int it2=0;it2<5;it2++) - t_track->coval[it1][it2] = l2->coval[i][it2][it1]; - }; - for(int ip=0;ip<6;ip++){ - t_track->xgood[ip] = l2->xgood_nt[i][ip]; - t_track->ygood[ip] = l2->ygood_nt[i][ip]; - t_track->xm[ip] = l2->xm_nt[i][ip]; - t_track->ym[ip] = l2->ym_nt[i][ip]; - t_track->zm[ip] = l2->zm_nt[i][ip]; - t_track->resx[ip] = l2->resx_nt[i][ip]; - t_track->resy[ip] = l2->resy_nt[i][ip]; - t_track->xv[ip] = l2->xv_nt[i][ip]; - t_track->yv[ip] = l2->yv_nt[i][ip]; - t_track->zv[ip] = l2->zv_nt[i][ip]; - t_track->axv[ip] = l2->axv_nt[i][ip]; - 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]; -// cout << "traccia "<cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); - if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); -// if(t_track->ygood[ip])cout<<" i "<cltry[i][ip] "<cltry[i][ip]<< " l1->GetCluster(l2->cltry[i][ip]-1) "<GetCluster(l2->cltry[i][ip]-1)<xgood[ip])cout<<" i "<cltrx[i][ip] "<cltrx[i][ip]<< " l1->GetCluster(l2->cltrx[i][ip]-1) "<GetCluster(l2->cltrx[i][ip]-1)<Clear(); - }; -// *** SINGLETS *** - if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); - TClonesArray &sx = *SingletX; - for(int i=0; inclsx; i++){ - t_singlet->plane = l2->planex[i]; - t_singlet->coord[0] = l2->xs[i][0]; - t_singlet->coord[1] = l2->xs[i][1]; - t_singlet->sgnl = l2->signlxs[i]; - //----------------------------------------------------- -// cout << "singolo x "<clsx[i] <cls = l1->GetCluster(l2->clsx[i]-1); -// cout<<" i "<clsx[i] "<clsx[i]<< " l1->GetCluster(l2->clsx[i]-1) "<GetCluster(l2->clsx[i]-1)<Clear(); - } - if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); - TClonesArray &sy = *SingletY; - for(int i=0; inclsy; i++){ - t_singlet->plane = l2->planey[i]; - t_singlet->coord[0] = l2->ys[i][0]; - t_singlet->coord[1] = l2->ys[i][1]; - t_singlet->sgnl = l2->signlys[i]; - //----------------------------------------------------- -// cout << "singolo y "<clsy[i] <cls = l1->GetCluster(l2->clsy[i]-1); -// cout<<" i "<clsy[i] "<clsy[i]<< " l1->GetCluster(l2->clsy[i]-1) "<GetCluster(l2->clsy[i]-1)<Clear(); - }; - - delete t_track; - delete t_singlet; -} /** * Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common). */ @@ -793,13 +1265,15 @@ l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; }; for(int ip=0;ip<6;ip++){ - l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; - l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; + l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->XGood(ip); + l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->YGood(ip); l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip]; l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip]; + l2->tailx[i][ip] = ((TrkTrack *)Track->At(i))->tailx[ip]; + l2->taily[i][ip] = ((TrkTrack *)Track->At(i))->taily[ip]; l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip]; l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip]; l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip]; @@ -838,6 +1312,8 @@ void TrkLevel2::Clear(){ for(Int_t i=0; i<12 ; i++){ good[i] = -1; + VKflag[i] = 0; + VKmask[i] = 0; }; // if(Track)Track->Clear("C"); // if(SingletX)SingletX->Clear("C"); @@ -881,7 +1357,8 @@ int indo=0; int indi=0; - while(N != 0){ + while(N > 0){ +// while(N != 0){ int nfit =0; float chi2ref = numeric_limits::max(); @@ -892,9 +1369,9 @@ } } //second loop to search minimum chi2 among selected - for(int i=0; intrk(); i++){ + for(int i=0; ichi2; - if(chi2 < 0) chi2 = chi2*1000; + if(chi2 < 0) chi2 = -chi2*1000; if( chi2 < chi2ref && ((TrkTrack *)t[i])->GetNtot() == nfit && m[i]==1){ @@ -906,17 +1383,17 @@ m[((TrkTrack *)t[indi])->image] = 0; N--; - // cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<image << " " << nfiti <<" "<Add( (TrkTrack*)t[indi] ); m[indi] = 0; -// cout << "SORTED "<< indo << " "<< indi << " "<< N << endl; +// cout << "SORTED "<< indo << " "<< indi << " "<< N << " "<<((TrkTrack *)t[indi])->image<<" "<