51 |
}; |
}; |
52 |
clx = 0; |
clx = 0; |
53 |
cly = 0; |
cly = 0; |
54 |
// clx = new TRefArray(6,0); |
// clx = new TRefArray(6,0); //forse causa memory leak??? |
55 |
// cly = new TRefArray(6,0); |
// cly = new TRefArray(6,0); //forse causa memory leak??? |
56 |
}; |
}; |
57 |
//-------------------------------------- |
//-------------------------------------- |
58 |
// |
// |
235 |
// |
// |
236 |
Float_t TrkTrack::GetDEDX(){ |
Float_t TrkTrack::GetDEDX(){ |
237 |
Float_t dedx=0; |
Float_t dedx=0; |
238 |
for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i]; |
// for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i]; |
239 |
|
for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*XGood(i)+dedx_y[i]*YGood(i); |
240 |
dedx = dedx/(this->GetNX()+this->GetNY()); |
dedx = dedx/(this->GetNX()+this->GetNY()); |
241 |
return dedx; |
return dedx; |
242 |
}; |
}; |
252 |
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
253 |
cout << endl << "chi^2 : "<< chi2; |
cout << endl << "chi^2 : "<< chi2; |
254 |
cout << endl << "n.step : "<< nstep; |
cout << endl << "n.step : "<< nstep; |
255 |
cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << xgood[i] ; |
cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << XGood(i) ; |
256 |
cout << endl << "ygood : "; for(int i=0; i<6; i++)cout << ygood[i] ; |
cout << endl << "ygood : "; for(int i=0; i<6; i++)cout << YGood(i) ; |
257 |
cout << endl << "xm : "; for(int i=0; i<6; i++)cout << xm[i] << " "; |
cout << endl << "xm : "; for(int i=0; i<6; i++)cout << xm[i] << " "; |
258 |
cout << endl << "ym : "; for(int i=0; i<6; i++)cout << ym[i] << " "; |
cout << endl << "ym : "; for(int i=0; i<6; i++)cout << ym[i] << " "; |
259 |
cout << endl << "zm : "; for(int i=0; i<6; i++)cout << zm[i] << " "; |
cout << endl << "zm : "; for(int i=0; i<6; i++)cout << zm[i] << " "; |
290 |
* Set the TrkTrack good measurement |
* Set the TrkTrack good measurement |
291 |
*/ |
*/ |
292 |
void TrkTrack::SetGood(int *xg, int *yg){ |
void TrkTrack::SetGood(int *xg, int *yg){ |
293 |
|
// NB! si perdera` l'informazione sul numero del cluster |
294 |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
for(int i=0; i<6; i++) xgood[i]=*xg++; |
295 |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
for(int i=0; i<6; i++) ygood[i]=*yg++; |
296 |
} |
} |
318 |
|
|
319 |
for(int i=0; i<6; i++){ |
for(int i=0; i<6; i++){ |
320 |
|
|
321 |
track.xgood[i]=xgood[i]; |
// track.xgood[i]=xgood[i]; |
322 |
track.ygood[i]=ygood[i]; |
// track.ygood[i]=ygood[i]; |
323 |
|
track.xgood[i]=XGood(i); |
324 |
|
track.ygood[i]=YGood(i); |
325 |
|
|
326 |
track.xm[i]=xm[i]; |
track.xm[i]=xm[i]; |
327 |
track.ym[i]=ym[i]; |
track.ym[i]=ym[i]; |
334 |
track.xm_b[i]=xm[i]; |
track.xm_b[i]=xm[i]; |
335 |
track.ym_a[i]=ym[i]; |
track.ym_a[i]=ym[i]; |
336 |
track.ym_b[i]=ym[i]; |
track.ym_b[i]=ym[i]; |
337 |
if( xgood[i] && !ygood[i] ){ |
if( XGood(i) && !YGood(i) ){ |
338 |
track.ym_a[i] = track.ym_a[i]+segment; |
track.ym_a[i] = track.ym_a[i]+segment; |
339 |
track.ym_b[i] = track.ym_b[i]-segment; |
track.ym_b[i] = track.ym_b[i]-segment; |
340 |
}else if( !xgood[i] && ygood[i]){ |
}else if( !XGood(i) && YGood(i)){ |
341 |
track.xm_a[i] = track.xm_a[i]+segment; |
track.xm_a[i] = track.xm_a[i]+segment; |
342 |
track.xm_b[i] = track.xm_b[i]-segment; |
track.xm_b[i] = track.xm_b[i]-segment; |
343 |
} |
} |
455 |
for(int j=0; j<5; j++) coval[i][j]=0.; |
for(int j=0; j<5; j++) coval[i][j]=0.; |
456 |
} |
} |
457 |
} |
} |
458 |
|
/* |
459 |
|
* Set the tracking mode |
460 |
|
*/ |
461 |
void TrkTrack::SetTrackingMode(int trackmode){ |
void TrkTrack::SetTrackingMode(int trackmode){ |
462 |
extern cMini2track track_; |
extern cMini2track track_; |
463 |
track_.trackmode = trackmode; |
track_.trackmode = trackmode; |
464 |
} |
} |
465 |
|
/* |
466 |
|
* Set the factor scale for tracking precision |
467 |
|
*/ |
468 |
|
void TrkTrack::SetPrecisionFactor(double fact){ |
469 |
|
extern cMini2track track_; |
470 |
|
track_.fact = fact; |
471 |
|
} |
472 |
|
/* |
473 |
|
* Set the factor scale for tracking precision |
474 |
|
*/ |
475 |
|
void TrkTrack::SetStepMin(int istepmin){ |
476 |
|
extern cMini2track track_; |
477 |
|
track_.istepmin = istepmin; |
478 |
|
} |
479 |
|
|
480 |
|
|
481 |
|
/* |
482 |
|
* Method to retrieve the X-view clusters associated to the track. |
483 |
|
* @param ip Tracker plane (0-5) |
484 |
|
*/ |
485 |
|
TrkCluster *TrkTrack::GetClusterX(int ip){ |
486 |
|
cout << " TrkCluster *TrkTrack::GetClusterX(int ip) -- momentaneamente fuori servizio --"<< endl; |
487 |
|
if(!clx)return NULL; |
488 |
|
TrkCluster *pt = (TrkCluster*)(clx->At(ip)); |
489 |
|
return pt; |
490 |
|
}; |
491 |
|
/* |
492 |
|
* Method to retrieve the Y-view clusters associated to the track. |
493 |
|
* @param ip Tracker plane (0-5) |
494 |
|
*/ |
495 |
|
TrkCluster *TrkTrack::GetClusterY(int ip){ |
496 |
|
cout << " TrkCluster *TrkTrack::GetClusterY(int ip) -- momentaneamente fuori servizio --"<< endl; |
497 |
|
if(!cly)return NULL; |
498 |
|
TrkCluster *pt = (TrkCluster*)(cly->At(ip)); |
499 |
|
return pt; |
500 |
|
}; |
501 |
|
|
502 |
|
|
503 |
//-------------------------------------- |
//-------------------------------------- |
504 |
// |
// |
743 |
//-------------------------------------- |
//-------------------------------------- |
744 |
/** |
/** |
745 |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
* Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common). |
746 |
* Ref to Level1 data (clusters) is also set. |
* Ref to Level1 data (clusters) is also set. If l1==NULL no references are set. |
747 |
|
* (NB It make sense to set references only if events are stored in a tree that contains also the Level1 branch) |
748 |
*/ |
*/ |
749 |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
750 |
|
|
751 |
|
// cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl; |
752 |
|
Clear(); |
753 |
// temporary objects: |
// temporary objects: |
754 |
TrkSinglet* t_singlet = new TrkSinglet(); |
TrkSinglet* t_singlet = new TrkSinglet(); |
755 |
TrkTrack* t_track = new TrkTrack(); |
TrkTrack* t_track = new TrkTrack(); |
756 |
// general variables |
|
757 |
// good2 = l2->good2; |
// ----------------- |
758 |
for(Int_t i=0; i<12 ; i++){ |
// general variables |
759 |
// crc[i] = l2->crc[i]; |
// ----------------- |
760 |
good[i] = l2->good[i]; |
for(Int_t i=0; i<12 ; i++){ |
761 |
|
good[i] = l2->good[i]; |
762 |
|
}; |
763 |
|
// -------------- |
764 |
|
// *** TRACKS *** |
765 |
|
// -------------- |
766 |
|
if(!Track) Track = new TClonesArray("TrkTrack"); |
767 |
|
TClonesArray &t = *Track; |
768 |
|
//----------------------------------------------------- |
769 |
|
if( l1 && !t_track->clx )t_track->clx = new TRefArray(6,0); |
770 |
|
if( l1 && !t_track->cly )t_track->cly = new TRefArray(6,0); |
771 |
|
//----------------------------------------------------- |
772 |
|
for(int i=0; i<l2->ntrk; i++){ |
773 |
|
// cout <<" TRACK "<<i<<" ------------------ "<<endl; |
774 |
|
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
775 |
|
t_track->image = l2->image[i]-1; |
776 |
|
t_track->chi2 = l2->chi2_nt[i]; |
777 |
|
t_track->nstep = l2->nstep_nt[i]; |
778 |
|
for(int it1=0;it1<5;it1++){ |
779 |
|
t_track->al[it1] = l2->al_nt[i][it1]; |
780 |
|
for(int it2=0;it2<5;it2++) |
781 |
|
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
782 |
}; |
}; |
783 |
// *** TRACKS *** |
for(int ip=0;ip<6;ip++){ |
784 |
if(!Track) Track = new TClonesArray("TrkTrack"); |
t_track->xgood[ip] = l2->cltrx[i][ip];//l2->xgood_nt[i][ip]; |
785 |
TClonesArray &t = *Track; |
t_track->ygood[ip] = l2->cltry[i][ip];//l2->ygood_nt[i][ip]; |
786 |
|
t_track->xm[ip] = l2->xm_nt[i][ip]; |
787 |
|
t_track->ym[ip] = l2->ym_nt[i][ip]; |
788 |
|
t_track->zm[ip] = l2->zm_nt[i][ip]; |
789 |
|
t_track->resx[ip] = l2->resx_nt[i][ip]; |
790 |
|
t_track->resy[ip] = l2->resy_nt[i][ip]; |
791 |
|
t_track->xv[ip] = l2->xv_nt[i][ip]; |
792 |
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
793 |
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
794 |
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
795 |
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
796 |
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
797 |
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
798 |
|
// cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl; |
799 |
|
// cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl; |
800 |
|
//----------------------------------------------------- |
801 |
|
//----------------------------------------------------- |
802 |
|
// if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
803 |
|
// if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
804 |
|
if(l2->xgood_nt[i][ip]){ |
805 |
|
// cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl; |
806 |
|
// cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<" "; |
807 |
|
// if( l1->GetCluster(l2->cltrx[i][ip]-1)->TestBit(l1->GetCluster(l2->cltrx[i][ip]-1)->kIsReferenced) )cout << ">> is referenced "; |
808 |
|
if(l1)t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
809 |
|
// cout << " --- "<<l1->GetCluster(l2->cltrx[i][ip]-1)->GetUniqueID()<<endl; |
810 |
|
// t_track->xgood[ip] = l2->cltrx[i][ip]; // WORK-AROUND ***** |
811 |
|
}else{ |
812 |
|
if(l1)t_track->clx->RemoveAt(ip); |
813 |
|
} |
814 |
|
if(l2->ygood_nt[i][ip]){ |
815 |
|
// cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl; |
816 |
|
// cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<" "; |
817 |
|
// if( l1->GetCluster(l2->cltry[i][ip]-1)->TestBit(l1->GetCluster(l2->cltry[i][ip]-1)->kIsReferenced) )cout << ">> is referenced "; |
818 |
|
if(l1)t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
819 |
|
// cout << " --- "<<l1->GetCluster(l2->cltry[i][ip]-1)->GetUniqueID()<<endl; |
820 |
|
// t_track->ygood[ip] = l2->cltry[i][ip]; // WORK-AROUND ***** |
821 |
|
}else{ |
822 |
|
if(l1)t_track->cly->RemoveAt(ip); |
823 |
|
} |
824 |
|
//----------------------------------------------------- |
825 |
|
//----------------------------------------------------- |
826 |
|
}; |
827 |
|
new(t[i]) TrkTrack(*t_track); |
828 |
|
t_track->Clear(); |
829 |
|
}; |
830 |
|
// ---------------- |
831 |
|
// *** SINGLETS *** |
832 |
|
// ---------------- |
833 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
834 |
|
TClonesArray &sx = *SingletX; |
835 |
|
for(int i=0; i<l2->nclsx; i++){ |
836 |
|
t_singlet->plane = l2->planex[i]; |
837 |
|
t_singlet->coord[0] = l2->xs[i][0]; |
838 |
|
t_singlet->coord[1] = l2->xs[i][1]; |
839 |
|
t_singlet->sgnl = l2->signlxs[i]; |
840 |
//----------------------------------------------------- |
//----------------------------------------------------- |
841 |
if(l1 && !t_track->clx)t_track->clx = new TRefArray(6,0); |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
|
if(l1 && !t_track->cly)t_track->cly = new TRefArray(6,0); |
|
842 |
//----------------------------------------------------- |
//----------------------------------------------------- |
843 |
for(int i=0; i<l2->ntrk; i++){ |
new(sx[i]) TrkSinglet(*t_singlet); |
844 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_singlet->Clear(); |
845 |
t_track->image = l2->image[i]-1; |
} |
846 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
847 |
t_track->chi2 = l2->chi2_nt[i]; |
TClonesArray &sy = *SingletY; |
848 |
t_track->nstep = l2->nstep_nt[i]; |
for(int i=0; i<l2->nclsy; i++){ |
849 |
for(int it1=0;it1<5;it1++){ |
t_singlet->plane = l2->planey[i]; |
850 |
t_track->al[it1] = l2->al_nt[i][it1]; |
t_singlet->coord[0] = l2->ys[i][0]; |
851 |
for(int it2=0;it2<5;it2++) |
t_singlet->coord[1] = l2->ys[i][1]; |
852 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
t_singlet->sgnl = l2->signlys[i]; |
853 |
}; |
//----------------------------------------------------- |
854 |
for(int ip=0;ip<6;ip++){ |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
855 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
//----------------------------------------------------- |
856 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
new(sy[i]) TrkSinglet(*t_singlet); |
857 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_singlet->Clear(); |
858 |
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]; |
|
|
//----------------------------------------------------- |
|
|
//----------------------------------------------------- |
|
|
if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
|
|
if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
|
|
//----------------------------------------------------- |
|
|
//----------------------------------------------------- |
|
|
}; |
|
|
new(t[i]) TrkTrack(*t_track); |
|
|
t_track->Clear(); |
|
|
}; |
|
|
// *** SINGLETS *** |
|
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
|
|
TClonesArray &sx = *SingletX; |
|
|
for(int i=0; i<l2->nclsx; 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]; |
|
|
//----------------------------------------------------- |
|
|
if(l1) t_singlet->cls = l1->GetCluster(l2->clsx[i]-1); |
|
|
//----------------------------------------------------- |
|
|
new(sx[i]) TrkSinglet(*t_singlet); |
|
|
t_singlet->Clear(); |
|
|
} |
|
|
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
|
|
TClonesArray &sy = *SingletY; |
|
|
for(int i=0; i<l2->nclsy; 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]; |
|
|
//----------------------------------------------------- |
|
|
if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
|
|
//----------------------------------------------------- |
|
|
new(sy[i]) TrkSinglet(*t_singlet); |
|
|
t_singlet->Clear(); |
|
|
}; |
|
859 |
|
|
860 |
delete t_track; |
delete t_track; |
861 |
delete t_singlet; |
delete t_singlet; |
862 |
} |
} |
863 |
/** |
/** |
864 |
* Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common). |
* Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common). |
886 |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2]; |
887 |
}; |
}; |
888 |
for(int ip=0;ip<6;ip++){ |
for(int ip=0;ip<6;ip++){ |
889 |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip]; |
l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->XGood(ip); |
890 |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip]; |
l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->YGood(ip); |
891 |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip]; |
892 |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip]; |
893 |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |
l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip]; |