| 200 |
|
|
| 201 |
tsorted=0; |
tsorted=0; |
| 202 |
timage=0; |
timage=0; |
| 203 |
|
|
| 204 |
|
howtosort = "+CAL+TOF"; |
| 205 |
|
//howtosort = "+TOF"; |
| 206 |
|
sortthr = 100.; |
| 207 |
|
|
| 208 |
}; |
}; |
| 209 |
/** |
/** |
| 304 |
|
|
| 305 |
if(h0_obj) h0_obj->Clear(); |
if(h0_obj) h0_obj->Clear(); |
| 306 |
// if(trk0_obj) trk0_obj->Clear(); |
// if(trk0_obj) trk0_obj->Clear(); |
|
if(calo0_obj) calo0_obj->Clear(); |
|
| 307 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
| 308 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
| 309 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
| 310 |
|
if(calo0_obj) calo0_obj->Clear(); |
| 311 |
if(calo1_obj)calo1_obj->Clear(); |
if(calo1_obj)calo1_obj->Clear(); |
| 312 |
if(calo2_obj)calo2_obj->Clear(); |
if(calo2_obj)calo2_obj->Clear(); |
| 313 |
if(tof_obj) tof_obj->Clear(); |
if(tof_obj) tof_obj->Clear(); |
| 403 |
// |
// |
| 404 |
}; |
}; |
| 405 |
|
|
| 406 |
|
Bool_t PamLevel2::IsGood(){ |
| 407 |
|
Bool_t goodev=true; |
| 408 |
|
// if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; |
| 409 |
|
if(calo2_obj && calo2_obj->good != 1) goodev = false; |
| 410 |
|
if(tof_obj && tof_obj->unpackError != 0) goodev = false; |
| 411 |
|
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
| 412 |
|
if(s4_obj && s4_obj->unpackError != 0) goodev = false; |
| 413 |
|
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
| 414 |
|
if(ac_obj && ac_obj->unpackError != 255) goodev = false; |
| 415 |
|
// if(orb_obj) |
| 416 |
|
return goodev; |
| 417 |
|
}; |
| 418 |
|
|
| 419 |
//-------------------------------------- |
//-------------------------------------- |
| 420 |
// |
// |
| 609 |
} |
} |
| 610 |
//-------------------------------------- |
//-------------------------------------- |
| 611 |
// |
// |
| 612 |
|
|
| 613 |
|
/** |
| 614 |
|
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. Left here as backward compatibility method. |
| 615 |
|
**/ |
| 616 |
|
void PamLevel2::SortTracks(TString how){ |
| 617 |
|
printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data()); |
| 618 |
|
howtosort = how; |
| 619 |
|
SortTracks(); |
| 620 |
|
}; |
| 621 |
|
|
| 622 |
// |
// |
| 623 |
//-------------------------------------- |
//-------------------------------------- |
| 624 |
/** |
/** |
| 632 |
* |
* |
| 633 |
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
| 634 |
*/ |
*/ |
| 635 |
void PamLevel2::SortTracks(TString how){ |
void PamLevel2::SortTracks(){ |
| 636 |
|
TString how = howtosort; |
| 637 |
|
|
| 638 |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
| 639 |
if( !trk2_obj ){ |
if( !trk2_obj ){ |
| 640 |
cout << "void PamLevel2::SortTracks(TString how): TrkLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
| 641 |
return; |
return; |
| 642 |
}; |
}; |
| 643 |
// cout << "call SortTracs() "<<endl; |
// cout << "call SortTracs() "<<endl; |
| 644 |
//Save current Object count |
//Save current Object count |
| 645 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
| 646 |
|
|
| 647 |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
| 648 |
|
|
| 649 |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
| 650 |
// sorted_tracks->Clear(); |
// sorted_tracks->Clear(); |
| 651 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
| 652 |
|
|
| 653 |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
| 654 |
tsorted->Delete(); |
tsorted->Delete(); |
| 655 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
| 656 |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
| 657 |
timage->Delete(); |
timage->Delete(); |
| 658 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
| 659 |
|
|
| 660 |
|
|
| 661 |
// loop over the tracks sorted by the tracker |
|
| 662 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
//-------------------------------------------------- |
| 663 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
// retrieve sorting method |
| 664 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
//-------------------------------------------------- |
| 665 |
|
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
| 666 |
|
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
| 667 |
|
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
| 668 |
|
|
| 669 |
if( !CAL2 && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
| 670 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF && use_TOF) use_TOF = false; |
| 671 |
|
|
| 672 |
if( !TRK2 ){ |
if( !TRK2 ){ |
| 673 |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
| 674 |
return; |
return; |
| 675 |
}; |
}; |
| 676 |
|
|
| 677 |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
| 678 |
|
|
| 679 |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
|
| 680 |
|
//-------------------------------------------------- |
| 681 |
TrkTrack *ts = 0; |
// loop over "physical" tracks sorted by the tracker |
| 682 |
CaloTrkVar *cs = 0; |
//-------------------------------------------------- |
| 683 |
ToFTrkVar *os = 0; |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
| 684 |
|
|
| 685 |
// get tracker tracks |
TrkTrack *ts = 0; |
| 686 |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
CaloTrkVar *cs = 0; |
| 687 |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
ToFTrkVar *os = 0; |
| 688 |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
|
| 689 |
|
// get tracker tracks |
| 690 |
TrkTrack *ti = 0; //tracker (image) |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
| 691 |
CaloTrkVar *ci = 0; |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
| 692 |
ToFTrkVar *oi = 0; |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
| 693 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
|
| 694 |
// if track has an image, check image selection |
TrkTrack *ti = 0; //tracker (image) |
| 695 |
if(tp->HasImage()){ |
CaloTrkVar *ci = 0; |
| 696 |
|
ToFTrkVar *oi = 0; |
| 697 |
|
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
| 698 |
|
// if track has an image, check image selection |
| 699 |
|
if(tp->HasImage()){ |
| 700 |
|
|
| 701 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
| 702 |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
| 703 |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
| 704 |
|
|
| 705 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
| 706 |
|
|
| 707 |
//assign starting scores |
//assign starting scores |
| 708 |
Int_t tp_score = 0; //main track sorted by the tracker |
Int_t tp_score = 0; //main track sorted by the tracker |
| 709 |
Int_t ti_score = 0; //image track |
Int_t ti_score = 0; //image track |
| 710 |
|
|
| 711 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
| 712 |
// calorimeter check |
// calorimeter check |
| 713 |
// ------------------------ |
// ----------------------------------------------------------------------------------------- |
| 714 |
// check the Y spatial residual on the first calorimeter plane |
// check the Y spatial residual on the first calorimeter plane |
| 715 |
// (cut on calorimeter variables from Emiliano) |
// (cut on calorimeter variables from Emiliano) |
| 716 |
if( use_CAL && !calo2_obj ){ |
if( use_CAL && !calo2_obj ){ |
| 717 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but CaloLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
| 718 |
return; |
return; |
| 719 |
}; |
}; |
| 720 |
if( |
if( |
| 721 |
use_CAL && |
use_CAL && |
| 722 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
| 723 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
// calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
| 724 |
cp && ci && |
cp && ci && |
| 725 |
true){ |
true){ |
| 726 |
|
|
| 727 |
|
|
| 728 |
Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
// Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
| 729 |
Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
// Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
| 730 |
|
|
| 731 |
if(resy_p <= resy_i) tp_score++; |
// if(resy_p <= resy_i) tp_score++; |
| 732 |
else ti_score++; |
// else ti_score++; |
| 733 |
|
|
| 734 |
|
|
| 735 |
|
if( cp->npresh > ci->npresh) tp_score++; |
| 736 |
|
if( cp->npresh < ci->npresh) ti_score++; |
| 737 |
|
else ;//niente |
| 738 |
|
|
| 739 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
| 740 |
|
|
| 741 |
|
}; |
| 742 |
|
// ----------------------------------------------------------------------------------------- |
| 743 |
|
// TOF check |
| 744 |
|
// ----------------------------------------------------------------------------------------- |
| 745 |
|
// check the number of hit pmts along the track |
| 746 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
| 747 |
|
if( use_TOF && !tof_obj ){ |
| 748 |
|
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
| 749 |
|
return; |
| 750 |
|
}; |
| 751 |
|
if( use_TOF && op && oi ){ |
| 752 |
|
|
| 753 |
|
// |
| 754 |
|
Float_t sen = 0.; |
| 755 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 756 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 757 |
|
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih); |
| 758 |
|
}; |
| 759 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 760 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 761 |
|
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
| 762 |
|
}; |
| 763 |
|
// |
| 764 |
|
if ( sen >= sortthr ){ |
| 765 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
| 766 |
|
// |
| 767 |
|
// is a nucleus use a different algorithm |
| 768 |
|
// |
| 769 |
|
Int_t nz = 6; Float_t zin[6]; // << define TOF z-coordinates |
| 770 |
|
for(Int_t ip=0; ip<nz; ip++) |
| 771 |
|
zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
| 772 |
|
Trajectory *tr = new Trajectory(nz,zin); |
| 773 |
|
// |
| 774 |
|
Int_t nphit_p =0; |
| 775 |
|
Int_t nphit_i =0; |
| 776 |
|
Float_t enhit_p = 0.; |
| 777 |
|
Float_t enhit_i = 0.; |
| 778 |
|
// |
| 779 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 780 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 781 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
| 782 |
|
nphit_p++; |
| 783 |
|
enhit_p += (op->dedx).At(ih); |
| 784 |
|
}; |
| 785 |
|
}; |
| 786 |
|
// |
| 787 |
|
tp->DoTrack2(tr); |
| 788 |
|
// |
| 789 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
| 790 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 791 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 792 |
|
if(pl == 0){ |
| 793 |
|
nphit_p++; |
| 794 |
|
enhit_p += (op->dedx).At(ih); |
| 795 |
|
}; |
| 796 |
|
}; |
| 797 |
|
}; |
| 798 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
| 799 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 800 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 801 |
|
if(pl == 3){ |
| 802 |
|
nphit_p++; |
| 803 |
|
enhit_p += (op->dedx).At(ih); |
| 804 |
|
}; |
| 805 |
|
}; |
| 806 |
|
}; |
| 807 |
|
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
| 808 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 809 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 810 |
|
if(pl == 4){ |
| 811 |
|
nphit_p++; |
| 812 |
|
enhit_p += (op->dedx).At(ih); |
| 813 |
|
}; |
| 814 |
|
}; |
| 815 |
|
}; |
| 816 |
|
|
| 817 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 818 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 819 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
| 820 |
|
nphit_i++; |
| 821 |
|
enhit_i += (op->dedx).At(ih); |
| 822 |
}; |
}; |
| 823 |
// ------------------------ |
}; |
| 824 |
// TOF check |
// |
| 825 |
// ------------------------ |
ti->DoTrack2(tr); |
| 826 |
// check the number of hit pmts along the track |
// |
| 827 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
| 828 |
if( use_TOF && !tof_obj ){ |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 829 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 830 |
return; |
if(pl == 0){ |
| 831 |
|
nphit_i++; |
| 832 |
|
enhit_i += (op->dedx).At(ih); |
| 833 |
|
}; |
| 834 |
}; |
}; |
| 835 |
if( use_TOF && op && oi ){ |
}; |
| 836 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
| 837 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 838 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 839 |
|
if(pl == 3){ |
| 840 |
|
nphit_i++; |
| 841 |
|
enhit_i += (op->dedx).At(ih); |
| 842 |
|
}; |
| 843 |
|
}; |
| 844 |
|
}; |
| 845 |
|
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
| 846 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 847 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 848 |
|
if(pl == 4){ |
| 849 |
|
nphit_i++; |
| 850 |
|
enhit_i += (op->dedx).At(ih); |
| 851 |
|
}; |
| 852 |
|
}; |
| 853 |
|
}; |
| 854 |
|
|
| 855 |
|
|
| 856 |
|
if( |
| 857 |
|
use_TOF && |
| 858 |
|
(nphit_p+nphit_i) !=0 && |
| 859 |
|
true){ |
| 860 |
|
|
| 861 |
|
// printf(" seqno %i nphit_p %i nphit_i %i enhit_p %f enhit_i %f \n",trk2_obj->TrkLevel2::GetSeqNo(i),nphit_p,nphit_i,enhit_p,enhit_i); |
| 862 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
| 863 |
|
// if( enhit_p > enhit_i ) tp_score++; |
| 864 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
| 865 |
|
if ( nphit_p > nphit_i ) tp_score++; |
| 866 |
|
if ( nphit_p < nphit_i ) ti_score++; |
| 867 |
|
if ( nphit_p == nphit_i ){ |
| 868 |
|
if ( enhit_p > enhit_i ) tp_score++; |
| 869 |
|
else ti_score++; |
| 870 |
|
}; |
| 871 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
| 872 |
|
}; |
| 873 |
|
delete tr; |
| 874 |
|
// |
| 875 |
|
} else { |
| 876 |
|
// |
| 877 |
|
// NOT a NUCLEUS |
| 878 |
|
// |
| 879 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
| 880 |
|
|
| 881 |
|
Int_t nphit_p =0; |
| 882 |
|
Int_t nphit_i =0; |
| 883 |
|
|
|
Int_t nphit_p =0; |
|
|
Int_t nphit_i =0; |
|
| 884 |
|
|
| 885 |
|
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
| 886 |
|
cout << "track: npmttdc "<< op->npmttdc << endl; |
| 887 |
|
cout << "image: npmtadc "<< oi->npmtadc << endl; |
| 888 |
|
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
| 889 |
|
|
| 890 |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
// for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 891 |
cout << "track: npmttdc "<< op->npmttdc << endl; |
// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 892 |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
| 893 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
// }; |
| 894 |
|
|
| 895 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
// for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 896 |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 897 |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
| 898 |
}; |
// }; |
| 899 |
|
// --- modified to count tdc signals (more efficient?) |
| 900 |
|
// --- and to implement check on tdcflag |
| 901 |
|
for (Int_t ih=0; ih < op->npmttdc; ih++){ |
| 902 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); |
| 903 |
|
// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; |
| 904 |
|
if( (op->tdcflag).At(ih)==0 )nphit_p++; |
| 905 |
|
}; |
| 906 |
|
|
| 907 |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
for (Int_t ih=0; ih < oi->npmttdc; ih++){ |
| 908 |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); |
| 909 |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; |
| 910 |
}; |
if( (oi->tdcflag).At(ih)==0 )nphit_i++; |
| 911 |
|
}; |
| 912 |
|
|
| 913 |
if( |
if( |
| 914 |
use_TOF && |
(nphit_p+nphit_i) !=0 && |
| 915 |
(nphit_p+nphit_i) !=0 && |
true){ |
|
true){ |
|
| 916 |
|
|
| 917 |
if( nphit_p >= nphit_i) tp_score++; |
if ( nphit_p > nphit_i) tp_score++; |
| 918 |
else ti_score++; |
else if( nphit_p < nphit_i) ti_score++; |
| 919 |
}; |
else ;//niente |
| 920 |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
}; |
| 921 |
}; |
}; |
| 922 |
if(tp_score == ti_score) use_TRK = true; |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
| 923 |
// ------------------------ |
}; |
| 924 |
// tracker check |
|
| 925 |
// ------------------------ |
|
| 926 |
// chi**2 difference is not always large enough to distinguish among |
// if(tp_score == ti_score) use_TRK = true; |
| 927 |
// the real track and its image. |
|
| 928 |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
|
| 929 |
if(use_TRK){ |
// ----------------------------------------------------------------------------------------- |
| 930 |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
// tracker check |
| 931 |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
// ----------------------------------------------------------------------------------------- |
| 932 |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
// chi**2 difference is not always large enough to distinguish among |
| 933 |
}; |
// the real track and its image. |
| 934 |
|
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
| 935 |
|
// *** MODIFIED ON AUGUST 2007 *** |
| 936 |
|
if(use_TRK){ |
| 937 |
|
// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
| 938 |
|
// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
| 939 |
|
|
| 940 |
|
// CHECK 1 : number of points along X |
| 941 |
|
if ( tp->GetNX() >= ti->GetNX() )tp_score++ ; |
| 942 |
|
if ( tp->GetNX() <= ti->GetNX() )ti_score++ ; |
| 943 |
|
// CHECK 2 : number of points along Y |
| 944 |
|
if ( tp->GetNY() >= ti->GetNY() )tp_score++ ; |
| 945 |
|
if ( tp->GetNY() <= ti->GetNY() )ti_score++ ; |
| 946 |
|
// CHECK 3 : chi**2 along X |
| 947 |
|
// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; |
| 948 |
|
// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; |
| 949 |
|
// CHECK 4 : chi**2 along Y |
| 950 |
|
// if( tp->GetChi2Y() > 0 && (tp->GetChi2Y() < ti->GetChi2Y() || ti->GetChi2Y() <=0) ) tp_score++ ; |
| 951 |
|
// if( ti->GetChi2Y() > 0 && (ti->GetChi2Y() < tp->GetChi2Y() || tp->GetChi2Y() <=0) ) ti_score++ ; |
| 952 |
|
// CHECK 5 : total chi**2 |
| 953 |
|
// if( tp->chi2 > 0 && (tp->chi2 < ti->chi2 || ti->chi2 <=0) ) tp_score++ ; |
| 954 |
|
// if( ti->chi2 > 0 && (ti->chi2 < tp->chi2 || tp->chi2 <=0) ) ti_score++ ; |
| 955 |
|
|
| 956 |
|
// cout << "TRK "<<tp_score<<ti_score<<endl; |
| 957 |
|
}; |
| 958 |
|
|
| 959 |
// ------------------------ |
|
| 960 |
// the winner is.... |
|
| 961 |
// ------------------------ |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
| 962 |
if (tp_score > ti_score) { |
// the winner is.... |
| 963 |
// ts = tp;//the track sorted by the tracker!! |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
| 964 |
// cs = cp; |
if (tp_score > ti_score) { |
| 965 |
// os = op; |
|
| 966 |
}else if (tp_score < ti_score) { |
|
| 967 |
ts = ti;//its image!! |
}else if (tp_score < ti_score) { |
| 968 |
cs = ci; |
|
| 969 |
os = oi; |
|
| 970 |
|
ts = ti;//its image!! |
| 971 |
ti = tp;//its image!! |
cs = ci; |
| 972 |
ci = cp; |
os = oi; |
| 973 |
oi = op; |
|
| 974 |
|
ti = tp;//its image!! |
| 975 |
tp = ts;//its image!! |
ci = cp; |
| 976 |
cp = cs; |
oi = op; |
| 977 |
op = os; |
|
| 978 |
|
tp = ts;//its image!! |
| 979 |
|
cp = cs; |
| 980 |
|
op = os; |
| 981 |
|
|
| 982 |
|
|
| 983 |
}else { |
}else { |
| 984 |
// ts = tp; |
|
| 985 |
// cs = cp; |
// cout << "Warning - track image ambiguity not solved" << endl; |
| 986 |
// os = op; |
|
| 987 |
// cout << "Warning - track image ambiguity not solved" << endl; |
}; |
|
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
|
|
}; |
|
| 988 |
|
|
| 989 |
}else{ |
}else{ |
| 990 |
// ts = tp; |
// ts = tp; |
| 991 |
// cs = cp; |
// cs = cp; |
| 992 |
// os = op; |
// os = op; |
| 993 |
}; |
}; |
| 994 |
|
|
| 995 |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
| 996 |
// sorted_tracks->Add(ts);//save the track in the sorted array |
// sorted_tracks->Add(ts);//save the track in the sorted array |
| 997 |
// sorted_tracks.Add(ts);//save the track in the sorted array |
// sorted_tracks.Add(ts);//save the track in the sorted array |
| 998 |
// sorted_tracks.Add(tp);//save the track in the sorted array |
// sorted_tracks.Add(tp);//save the track in the sorted array |
| 999 |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
| 1000 |
// cout<<"o "<<tp<<endl; |
// cout<<"o "<<tp<<endl; |
| 1001 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
| 1002 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
| 1003 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op); |
| 1004 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi); |
| 1005 |
}; |
}; |
| 1006 |
|
|
| 1007 |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
| 1008 |
cout << "void PamLevel2::SortTracks(TString how): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
| 1009 |
tsorted->Delete(); tsorted=0; |
tsorted->Delete(); tsorted=0; |
| 1010 |
timage->Delete(); timage=0; |
timage->Delete(); timage=0; |
| 1011 |
} |
} |
| 1012 |
|
|
| 1013 |
//Restore Object count |
//Restore Object count |
| 1014 |
//To save space in the table keeping track of all referenced objects |
//To save space in the table keeping track of all referenced objects |
| 1015 |
//We reset the object count to what it was at the beginning of the event. |
//We reset the object count to what it was at the beginning of the event. |
| 1016 |
TProcessID::SetObjectCount(ObjectNumber); |
TProcessID::SetObjectCount(ObjectNumber); |
| 1017 |
|
|
| 1018 |
}; |
}; |
| 1019 |
//-------------------------------------- |
//-------------------------------------- |
| 1037 |
TClonesArray *PamLevel2::GetTracks(){ |
TClonesArray *PamLevel2::GetTracks(){ |
| 1038 |
|
|
| 1039 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1040 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
| 1041 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1042 |
|
|
| 1043 |
return tsorted; |
return tsorted; |
| 1056 |
|
|
| 1057 |
// if(!trk2_obj) return 0; |
// if(!trk2_obj) return 0; |
| 1058 |
|
|
| 1059 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
| 1060 |
// SortTracks("+CAL+TOF"); |
// SortTracks("+CAL+TOF"); |
| 1061 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1062 |
// // if(!sorted_tracks)return 0; |
// // if(!sorted_tracks)return 0; |
| 1075 |
|
|
| 1076 |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
| 1077 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1078 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
| 1079 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1080 |
if(!tsorted)return 0; |
if(!tsorted)return 0; |
| 1081 |
if(!tsorted->GetEntries())return 0; |
if(!tsorted->GetEntries())return 0; |
| 1132 |
|
|
| 1133 |
|
|
| 1134 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1135 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
| 1136 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1137 |
if(!timage)return 0; |
if(!timage)return 0; |
| 1138 |
if(!timage->GetEntries())return 0; |
if(!timage->GetEntries())return 0; |
| 2042 |
// ----------------------------------------------------------------------- |
// ----------------------------------------------------------------------- |
| 2043 |
if ( irun < 0 ){ |
if ( irun < 0 ){ |
| 2044 |
irun = 0LL; |
irun = 0LL; |
| 2045 |
|
irunentry = 0; |
| 2046 |
|
prevshift = 0; |
| 2047 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
| 2048 |
}; |
}; |
| 2049 |
// |
// |
| 2050 |
bool fromfirst = true; // first loop over runs |
bool fromfirst = true; // first loop over runs |
| 2051 |
|
|
| 2052 |
|
// Bool_t hasfrag = false; |
| 2053 |
|
// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; |
| 2054 |
|
// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; |
| 2055 |
|
|
| 2056 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
| 2057 |
// loop over runs to find the one that contains the event |
// loop over runs to find the one that contains the event |
| 2058 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
| 2059 |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
while ( |
| 2060 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
( |
| 2061 |
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
( |
| 2062 |
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) && |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
| 2063 |
irun < run_tree->GetEntries() ){ |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
| 2064 |
|
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
| 2065 |
|
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) |
| 2066 |
|
) |
| 2067 |
|
|| GetRunInfo()->NEVENTS==0 |
| 2068 |
|
|| !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) |
| 2069 |
|
) |
| 2070 |
|
&& irun < run_tree->GetEntries() ){ |
| 2071 |
|
|
| 2072 |
irun++; |
irun++; |
| 2073 |
// ------------------------------------ |
// ------------------------------------ |
| 2074 |
// if the end of run tree is reached... |
// if the end of run tree is reached... |
| 2094 |
// save the index of the first entry of the run, relative to pam_tree, |
// save the index of the first entry of the run, relative to pam_tree, |
| 2095 |
// and read a new run |
// and read a new run |
| 2096 |
// ------------------------------------------------------------------- |
// ------------------------------------------------------------------- |
| 2097 |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS); |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
| 2098 |
|
irunentry = 0; |
| 2099 |
|
prevshift = 0; |
| 2100 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
| 2101 |
if(GetRunInfo()->RUNHEADER_OBT>=GetRunInfo()->RUNTRAILER_OBT ){ |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
| 2102 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
| 2103 |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
| 2104 |
} |
} |
| 2105 |
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
| 2106 |
|
// cout << "... where is the next fragment ??"<<endl; |
| 2107 |
|
// } |
| 2108 |
}; |
}; |
| 2109 |
|
|
| 2110 |
|
|
| 2111 |
// -------------------------------------- |
// -------------------------------------- |
| 2112 |
// if there was no need to update the run |
// if there was no need to update the run |
| 2113 |
// ---> exit with FALSE |
// ---> exit with FALSE |
| 2119 |
// ---> exit with TRUE |
// ---> exit with TRUE |
| 2120 |
// -------------------------------------- |
// -------------------------------------- |
| 2121 |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 2122 |
prevshift = 0; |
// ---------------------------------------------------- |
| 2123 |
|
// then check if the run has a fragment |
| 2124 |
|
// in this case we have to switch to the next fragment |
| 2125 |
|
// when the end of the first fragment is reached |
| 2126 |
|
// ---------------------------------------------------- |
| 2127 |
|
if( |
| 2128 |
|
GetRunInfo()->ID_RUN_FRAG != 0 && |
| 2129 |
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
| 2130 |
|
true ){ |
| 2131 |
|
cout << "* fragment *"<<endl; |
| 2132 |
|
} |
| 2133 |
|
|
| 2134 |
return(true); |
return(true); |
| 2135 |
}; |
}; |
| 2136 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
| 2779 |
*/ |
*/ |
| 2780 |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
| 2781 |
|
|
| 2782 |
|
|
| 2783 |
|
// if the pointer is null, create a default file |
| 2784 |
|
|
| 2785 |
|
if(!ofile){ |
| 2786 |
|
cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<<endl; |
| 2787 |
|
ofile = new TFile("clone-tree.root","recreate"); |
| 2788 |
|
} |
| 2789 |
|
|
| 2790 |
ofile->cd(); |
ofile->cd(); |
| 2791 |
|
|
| 2792 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 2956 |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
| 2957 |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
| 2958 |
|
|
| 2959 |
|
// cout << "-------------------------------------"<<endl; |
| 2960 |
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
| 2961 |
|
|
| 2962 |
if(!pam_tree){ |
if(!pam_tree){ |
| 2963 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
| 2964 |
return 0; |
return 0; |
| 3004 |
|
|
| 3005 |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
| 3006 |
|
|
| 3007 |
// cout << " irunentry "<<irunentry << endl; |
// cout << "irunentry "<<irunentry << endl; |
| 3008 |
|
// cout << "runfirstentry "<<runfirstentry << endl; |
| 3009 |
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
| 3010 |
|
|
| 3011 |
|
// if( TRK0 || CAL0 || TOF0 ){ |
| 3012 |
|
// if( !GetYodaEntry( ) ){ |
| 3013 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
| 3014 |
|
// return 0; |
| 3015 |
|
// } |
| 3016 |
|
// } |
| 3017 |
|
|
| 3018 |
|
|
|
if( TRK0 || CAL0 || TOF0 ){ |
|
|
if( !GetYodaEntry( ) ){ |
|
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
|
|
return 0; |
|
|
} |
|
|
} |
|
| 3019 |
return 1; |
return 1; |
| 3020 |
|
|
| 3021 |
} |
} |
| 3022 |
|
|
| 3023 |
|
TrkLevel0 *PamLevel2::GetTrkLevel0(){ |
| 3024 |
|
if( !TRK0 )return NULL; |
| 3025 |
|
if( !GetYodaEntry( ) ){ |
| 3026 |
|
cout << " Int_t PamLevel2::GetTrkLevel0() -- ERROR -- error reading level0 tree"<<endl; |
| 3027 |
|
return 0; |
| 3028 |
|
} |
| 3029 |
|
return trk0_obj; |
| 3030 |
|
}; |
| 3031 |
|
CaloLevel0 *PamLevel2::GetCaloLevel0(){ |
| 3032 |
|
if( !CAL0 )return NULL; |
| 3033 |
|
if( !GetYodaEntry( ) ){ |
| 3034 |
|
cout << " Int_t PamLevel2::GetCaloLevel0() -- ERROR -- error reading level0 tree"<<endl; |
| 3035 |
|
return 0; |
| 3036 |
|
} |
| 3037 |
|
return calo0_obj; |
| 3038 |
|
}; |
| 3039 |
|
|
| 3040 |
|
|
| 3041 |
/** |
/** |
| 3042 |
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
| 3043 |
* Given the run ID (...), if needed it query the DB and load the proper file. |
* Given the run ID (...), if needed it query the DB and load the proper file. |
| 3057 |
return NULL; |
return NULL; |
| 3058 |
} |
} |
| 3059 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
| 3060 |
// cout << "iroot "<<iroot<<endl; |
// cout << "iroot "<<iroot<<endl; |
| 3061 |
// cout << "irootnew "<<irootnew<<endl; |
// cout << "irootnew "<<irootnew<<endl; |
| 3062 |
|
|
| 3063 |
//=================================== |
//=================================== |
| 3064 |
// load the level0 file |
// load the level0 file |
| 3115 |
}; |
}; |
| 3116 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
| 3117 |
} |
} |
| 3118 |
//--------------------------------------------------- |
//-------------------------------------------------- |
| 3119 |
// CALORIMETER: |
// CALORIMETER: |
| 3120 |
if(CAL0){ |
if(CAL0){ |
| 3121 |
if(!calo0_obj){ |
if(!calo0_obj){ |
| 3204 |
Int_t answer = 0; |
Int_t answer = 0; |
| 3205 |
Int_t shift =0; |
Int_t shift =0; |
| 3206 |
// printf(" siamo qui %i %i \n",shift,prevshift); |
// printf(" siamo qui %i %i \n",shift,prevshift); |
| 3207 |
Int_t maxshift = 100; |
Int_t maxshift = 10; |
| 3208 |
do{ |
do{ |
| 3209 |
if(shift>0){ |
if(shift>0){ |
| 3210 |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
| 3233 |
|
|
| 3234 |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
| 3235 |
|
|
| 3236 |
if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() || shift == maxshift ) { |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
| 3237 |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
| 3238 |
return 0; |
return 0; |
| 3239 |
} |
} |
| 3244 |
return answer; |
return answer; |
| 3245 |
|
|
| 3246 |
} |
} |
| 3247 |
|
/** |
| 3248 |
|
* \Brief Set DB connection |
| 3249 |
|
*/ |
| 3250 |
|
Bool_t PamLevel2::SetDBConnection(){ |
| 3251 |
|
|
| 3252 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
| 3253 |
|
cout<<"Connecting to DB"<<endl; |
| 3254 |
|
cout<<"HOST "<<host<<endl; |
| 3255 |
|
cout<<"USER "<<user<<endl; |
| 3256 |
|
cout<<"PSW "<<psw<<endl; |
| 3257 |
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
| 3258 |
|
if( !dbc )return false; |
| 3259 |
|
if( !dbc->IsConnected() )return false; |
| 3260 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
| 3261 |
|
return true; |
| 3262 |
|
|
| 3263 |
|
} |