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 |
// |
// |
456 |
track_.trackmode = trackmode; |
track_.trackmode = trackmode; |
457 |
} |
} |
458 |
|
|
459 |
|
|
460 |
|
/* |
461 |
|
* Method to retrieve the X-view clusters associated to the track. |
462 |
|
* @param ip Tracker plane (0-5) |
463 |
|
*/ |
464 |
|
TrkCluster *TrkTrack::GetClusterX(int ip){ |
465 |
|
cout << " TrkCluster *TrkTrack::GetClusterX(int ip) -- momentaneamente fuori servizio --"<< endl; |
466 |
|
if(!clx)return NULL; |
467 |
|
TrkCluster *pt = (TrkCluster*)(clx->At(ip)); |
468 |
|
return pt; |
469 |
|
}; |
470 |
|
/* |
471 |
|
* Method to retrieve the Y-view clusters associated to the track. |
472 |
|
* @param ip Tracker plane (0-5) |
473 |
|
*/ |
474 |
|
TrkCluster *TrkTrack::GetClusterY(int ip){ |
475 |
|
cout << " TrkCluster *TrkTrack::GetClusterY(int ip) -- momentaneamente fuori servizio --"<< endl; |
476 |
|
if(!cly)return NULL; |
477 |
|
TrkCluster *pt = (TrkCluster*)(cly->At(ip)); |
478 |
|
return pt; |
479 |
|
}; |
480 |
|
|
481 |
|
|
482 |
//-------------------------------------- |
//-------------------------------------- |
483 |
// |
// |
484 |
// |
// |
722 |
//-------------------------------------- |
//-------------------------------------- |
723 |
/** |
/** |
724 |
* 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). |
725 |
* Ref to Level1 data (clusters) is also set. |
* Ref to Level1 data (clusters) is also set. If l1==NULL no references are set. |
726 |
|
* (NB It make sense to set references only if events are stored in a tree that contains also the Level1 branch) |
727 |
*/ |
*/ |
728 |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){ |
729 |
|
|
730 |
|
// cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl; |
731 |
|
Clear(); |
732 |
// temporary objects: |
// temporary objects: |
733 |
TrkSinglet* t_singlet = new TrkSinglet(); |
TrkSinglet* t_singlet = new TrkSinglet(); |
734 |
TrkTrack* t_track = new TrkTrack(); |
TrkTrack* t_track = new TrkTrack(); |
735 |
// general variables |
|
736 |
// good2 = l2->good2; |
// ----------------- |
737 |
for(Int_t i=0; i<12 ; i++){ |
// general variables |
738 |
// crc[i] = l2->crc[i]; |
// ----------------- |
739 |
good[i] = l2->good[i]; |
for(Int_t i=0; i<12 ; i++){ |
740 |
|
good[i] = l2->good[i]; |
741 |
|
}; |
742 |
|
// -------------- |
743 |
|
// *** TRACKS *** |
744 |
|
// -------------- |
745 |
|
if(!Track) Track = new TClonesArray("TrkTrack"); |
746 |
|
TClonesArray &t = *Track; |
747 |
|
//----------------------------------------------------- |
748 |
|
if( l1 && !t_track->clx )t_track->clx = new TRefArray(6,0); |
749 |
|
if( l1 && !t_track->cly )t_track->cly = new TRefArray(6,0); |
750 |
|
//----------------------------------------------------- |
751 |
|
for(int i=0; i<l2->ntrk; i++){ |
752 |
|
// cout <<" TRACK "<<i<<" ------------------ "<<endl; |
753 |
|
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
754 |
|
t_track->image = l2->image[i]-1; |
755 |
|
t_track->chi2 = l2->chi2_nt[i]; |
756 |
|
t_track->nstep = l2->nstep_nt[i]; |
757 |
|
for(int it1=0;it1<5;it1++){ |
758 |
|
t_track->al[it1] = l2->al_nt[i][it1]; |
759 |
|
for(int it2=0;it2<5;it2++) |
760 |
|
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
761 |
}; |
}; |
762 |
// *** TRACKS *** |
for(int ip=0;ip<6;ip++){ |
763 |
if(!Track) Track = new TClonesArray("TrkTrack"); |
t_track->xgood[ip] = l2->cltrx[i][ip];//l2->xgood_nt[i][ip]; |
764 |
TClonesArray &t = *Track; |
t_track->ygood[ip] = l2->cltry[i][ip];//l2->ygood_nt[i][ip]; |
765 |
|
t_track->xm[ip] = l2->xm_nt[i][ip]; |
766 |
|
t_track->ym[ip] = l2->ym_nt[i][ip]; |
767 |
|
t_track->zm[ip] = l2->zm_nt[i][ip]; |
768 |
|
t_track->resx[ip] = l2->resx_nt[i][ip]; |
769 |
|
t_track->resy[ip] = l2->resy_nt[i][ip]; |
770 |
|
t_track->xv[ip] = l2->xv_nt[i][ip]; |
771 |
|
t_track->yv[ip] = l2->yv_nt[i][ip]; |
772 |
|
t_track->zv[ip] = l2->zv_nt[i][ip]; |
773 |
|
t_track->axv[ip] = l2->axv_nt[i][ip]; |
774 |
|
t_track->ayv[ip] = l2->ayv_nt[i][ip]; |
775 |
|
t_track->dedx_x[ip] = l2->dedx_x[i][ip]; |
776 |
|
t_track->dedx_y[ip] = l2->dedx_y[i][ip]; |
777 |
|
// cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl; |
778 |
|
// cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl; |
779 |
|
//----------------------------------------------------- |
780 |
|
//----------------------------------------------------- |
781 |
|
// if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
782 |
|
// if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
783 |
|
if(l2->xgood_nt[i][ip]){ |
784 |
|
// cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl; |
785 |
|
// cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<" "; |
786 |
|
// if( l1->GetCluster(l2->cltrx[i][ip]-1)->TestBit(l1->GetCluster(l2->cltrx[i][ip]-1)->kIsReferenced) )cout << ">> is referenced "; |
787 |
|
if(l1)t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip); |
788 |
|
// cout << " --- "<<l1->GetCluster(l2->cltrx[i][ip]-1)->GetUniqueID()<<endl; |
789 |
|
// t_track->xgood[ip] = l2->cltrx[i][ip]; // WORK-AROUND ***** |
790 |
|
}else{ |
791 |
|
if(l1)t_track->clx->RemoveAt(ip); |
792 |
|
} |
793 |
|
if(l2->ygood_nt[i][ip]){ |
794 |
|
// cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl; |
795 |
|
// cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<" "; |
796 |
|
// if( l1->GetCluster(l2->cltry[i][ip]-1)->TestBit(l1->GetCluster(l2->cltry[i][ip]-1)->kIsReferenced) )cout << ">> is referenced "; |
797 |
|
if(l1)t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip); |
798 |
|
// cout << " --- "<<l1->GetCluster(l2->cltry[i][ip]-1)->GetUniqueID()<<endl; |
799 |
|
// t_track->ygood[ip] = l2->cltry[i][ip]; // WORK-AROUND ***** |
800 |
|
}else{ |
801 |
|
if(l1)t_track->cly->RemoveAt(ip); |
802 |
|
} |
803 |
|
//----------------------------------------------------- |
804 |
|
//----------------------------------------------------- |
805 |
|
}; |
806 |
|
new(t[i]) TrkTrack(*t_track); |
807 |
|
t_track->Clear(); |
808 |
|
}; |
809 |
|
// ---------------- |
810 |
|
// *** SINGLETS *** |
811 |
|
// ---------------- |
812 |
|
if(!SingletX)SingletX = new TClonesArray("TrkSinglet"); |
813 |
|
TClonesArray &sx = *SingletX; |
814 |
|
for(int i=0; i<l2->nclsx; i++){ |
815 |
|
t_singlet->plane = l2->planex[i]; |
816 |
|
t_singlet->coord[0] = l2->xs[i][0]; |
817 |
|
t_singlet->coord[1] = l2->xs[i][1]; |
818 |
|
t_singlet->sgnl = l2->signlxs[i]; |
819 |
//----------------------------------------------------- |
//----------------------------------------------------- |
820 |
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); |
|
821 |
//----------------------------------------------------- |
//----------------------------------------------------- |
822 |
for(int i=0; i<l2->ntrk; i++){ |
new(sx[i]) TrkSinglet(*t_singlet); |
823 |
t_track->seqno = i;// NBNBNBNB deve sempre essere = i |
t_singlet->Clear(); |
824 |
t_track->image = l2->image[i]-1; |
} |
825 |
// cout << "track "<<i<<t_track->seqno << t_track->image<<endl; |
if(!SingletY)SingletY = new TClonesArray("TrkSinglet"); |
826 |
t_track->chi2 = l2->chi2_nt[i]; |
TClonesArray &sy = *SingletY; |
827 |
t_track->nstep = l2->nstep_nt[i]; |
for(int i=0; i<l2->nclsy; i++){ |
828 |
for(int it1=0;it1<5;it1++){ |
t_singlet->plane = l2->planey[i]; |
829 |
t_track->al[it1] = l2->al_nt[i][it1]; |
t_singlet->coord[0] = l2->ys[i][0]; |
830 |
for(int it2=0;it2<5;it2++) |
t_singlet->coord[1] = l2->ys[i][1]; |
831 |
t_track->coval[it1][it2] = l2->coval[i][it2][it1]; |
t_singlet->sgnl = l2->signlys[i]; |
832 |
}; |
//----------------------------------------------------- |
833 |
for(int ip=0;ip<6;ip++){ |
if(l1) t_singlet->cls = l1->GetCluster(l2->clsy[i]-1); |
834 |
t_track->xgood[ip] = l2->xgood_nt[i][ip]; |
//----------------------------------------------------- |
835 |
t_track->ygood[ip] = l2->ygood_nt[i][ip]; |
new(sy[i]) TrkSinglet(*t_singlet); |
836 |
t_track->xm[ip] = l2->xm_nt[i][ip]; |
t_singlet->Clear(); |
837 |
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(); |
|
|
}; |
|
838 |
|
|
839 |
delete t_track; |
delete t_track; |
840 |
delete t_singlet; |
delete t_singlet; |
841 |
} |
} |
842 |
/** |
/** |
843 |
* 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). |