--- PamelaLevel2/src/PamLevel2.cpp 2007/05/14 11:57:36 1.39 +++ PamelaLevel2/src/PamLevel2.cpp 2007/11/05 13:10:13 1.52 @@ -1,4 +1,278 @@ #include + + + +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// + +void GPamela::Clear(){ + Irun = 0; + Ievnt = 0; + Ipa = 0; + X0 = 0.; + Y0 = 0.; + Z0 = 0.; + Theta = 0.; + Phi = 0.; + P0 = 0.; + Nthtof = 0; + Nthcat = 0; + Nthcas = 0; + Nthspe = 0; + Nstrpx = 0; + Nstrpy = 0; + Nthcali = 0; + Nthcal = 0; + Nthnd = 0; + Nthcard = 0; +} + +void GPamela::Delete(){ + + Clear(); + + delete [] Ipltof; + delete [] Ipaddle; + delete [] Ipartof; + delete [] Xintof; + delete [] Yintof; + delete [] Zintof; + delete [] Xouttof; + delete [] Youttof; + delete [] Zouttof; + delete [] Ereltof; + delete [] Timetof; + delete [] Pathtof; + delete [] P0tof; + delete [] Iparcat; + delete [] Icat; + delete [] Xincat; + delete [] Yincat; + delete [] Zincat; + delete [] Xoutcat; + delete [] Youtcat; + delete [] Zoutcat; + delete [] Erelcat; + delete [] Timecat; + delete [] Pathcat; + delete [] P0cat; + delete [] Iparcas; + delete [] Icas; + delete [] Xincas; + delete [] Yincas; + delete [] Zincas; + delete [] Xoutcas; + delete [] Youtcas; + delete [] Zoutcas; + delete [] Erelcas; + delete [] Timecas; + delete [] Pathcas; + delete [] P0cas; + delete [] Iparspe; + delete [] Itrpb; + delete [] Itrsl; + delete [] Itspa; + delete [] Xinspe; + delete [] Yinspe; + delete [] Zinspe; + delete [] Xoutspe; + delete [] Youtspe; + delete [] Zoutspe; + delete [] Xavspe; + delete [] Yavspe; + delete [] Zavspe; + delete [] Erelspe; + delete [] Pathspe; + delete [] P0spe; + delete [] Nxmult; + delete [] Nymult; + delete [] Npstripx; + delete [] Ntstripx; + delete [] Istripx; + delete [] Qstripx; + delete [] Xstripx; + delete [] Npstripy; + delete [] Ntstripy; + delete [] Istripy; + delete [] Qstripy; + delete [] Ystripy; + delete [] Icaplane; + delete [] Icastrip; + delete [] Icamod; + delete [] Enestrip; + delete [] Icapl; + delete [] Icasi; + delete [] Icast; + delete [] Xincal; + delete [] Yincal; + delete [] Zincal; + delete [] Erelcal; + delete [] Itubend; + delete [] Iparnd; + delete [] Xinnd; + delete [] Yinnd; + delete [] Zinnd; + delete [] Xoutnd; + delete [] Youtnd; + delete [] Zoutnd; + delete [] Erelnd; + delete [] Timend; + delete [] Pathnd; + delete [] P0nd; + delete [] Iparcard; + delete [] Icard; + delete [] Xincard; + delete [] Yincard; + delete [] Zincard; + delete [] Xoutcard; + delete [] Youtcard; + delete [] Zoutcard; + delete [] Erelcard; + delete [] Timecard; + delete [] Pathcard; + delete [] P0card; + + +}; + + + +void GPamela::SetBranchAddress( TChain* fhBookTree ){ + +// cout << "fhBookTree "<SetBranchAddress("Irun",&Irun); + fhBookTree->SetBranchAddress("Ievnt",&Ievnt); + fhBookTree->SetBranchAddress("Ipa",&Ipa); + fhBookTree->SetBranchAddress("X0",&X0); + fhBookTree->SetBranchAddress("Y0",&Y0); + fhBookTree->SetBranchAddress("Z0",&Z0); + fhBookTree->SetBranchAddress("Theta",&Theta); + fhBookTree->SetBranchAddress("Phi",&Phi); + fhBookTree->SetBranchAddress("P0",&P0); + fhBookTree->SetBranchAddress("Nthtof",&Nthtof); + fhBookTree->SetBranchAddress("Ipltof",Ipltof); + fhBookTree->SetBranchAddress("Ipaddle",Ipaddle); + fhBookTree->SetBranchAddress("Ipartof",Ipartof); + fhBookTree->SetBranchAddress("Xintof",Xintof); + fhBookTree->SetBranchAddress("Yintof",Yintof); + fhBookTree->SetBranchAddress("Zintof",Zintof); + fhBookTree->SetBranchAddress("Xouttof",Xouttof); + fhBookTree->SetBranchAddress("Youttof",Youttof); + fhBookTree->SetBranchAddress("Zouttof",Zouttof); + fhBookTree->SetBranchAddress("Ereltof",Ereltof); + fhBookTree->SetBranchAddress("Timetof",Timetof); + fhBookTree->SetBranchAddress("Pathtof",Pathtof); + fhBookTree->SetBranchAddress("P0tof",P0tof); + fhBookTree->SetBranchAddress("Nthcat",&Nthcat); + fhBookTree->SetBranchAddress("Iparcat",Iparcat); + fhBookTree->SetBranchAddress("Icat",Icat); + fhBookTree->SetBranchAddress("Xincat",Xincat); + fhBookTree->SetBranchAddress("Yincat",Yincat); + fhBookTree->SetBranchAddress("Zincat",Zincat); + fhBookTree->SetBranchAddress("Xoutcat",Xoutcat); + fhBookTree->SetBranchAddress("Youtcat",Youtcat); + fhBookTree->SetBranchAddress("Zoutcat",Zoutcat); + fhBookTree->SetBranchAddress("Erelcat",Erelcat); + fhBookTree->SetBranchAddress("Timecat",Timecat); + fhBookTree->SetBranchAddress("Pathcat",Pathcat); + fhBookTree->SetBranchAddress("P0cat",P0cat); + fhBookTree->SetBranchAddress("Nthcas",&Nthcas); + fhBookTree->SetBranchAddress("Iparcas",Iparcas); + fhBookTree->SetBranchAddress("Icas",Icas); + fhBookTree->SetBranchAddress("Xincas",Xincas); + fhBookTree->SetBranchAddress("Yincas",Yincas); + fhBookTree->SetBranchAddress("Zincas",Zincas); + fhBookTree->SetBranchAddress("Xoutcas",Xoutcas); + fhBookTree->SetBranchAddress("Youtcas",Youtcas); + fhBookTree->SetBranchAddress("Zoutcas",Zoutcas); + fhBookTree->SetBranchAddress("Erelcas",Erelcas); + fhBookTree->SetBranchAddress("Timecas",Timecas); + fhBookTree->SetBranchAddress("Pathcas",Pathcas); + fhBookTree->SetBranchAddress("P0cas",P0cas); + fhBookTree->SetBranchAddress("Nthspe",&Nthspe); + fhBookTree->SetBranchAddress("Iparspe",Iparspe); + fhBookTree->SetBranchAddress("Itrpb",Itrpb); + fhBookTree->SetBranchAddress("Itrsl",Itrsl); + fhBookTree->SetBranchAddress("Itspa",Itspa); + fhBookTree->SetBranchAddress("Xinspe",Xinspe); + fhBookTree->SetBranchAddress("Yinspe",Yinspe); + fhBookTree->SetBranchAddress("Zinspe",Zinspe); + fhBookTree->SetBranchAddress("Xoutspe",Xoutspe); + fhBookTree->SetBranchAddress("Youtspe",Youtspe); + fhBookTree->SetBranchAddress("Zoutspe",Zoutspe); + fhBookTree->SetBranchAddress("Xavspe",Xavspe); + fhBookTree->SetBranchAddress("Yavspe",Yavspe); + fhBookTree->SetBranchAddress("Zavspe",Zavspe); + fhBookTree->SetBranchAddress("Erelspe",Erelspe); + fhBookTree->SetBranchAddress("Pathspe",Pathspe); + fhBookTree->SetBranchAddress("P0spe",P0spe); + fhBookTree->SetBranchAddress("Nxmult",Nxmult); + fhBookTree->SetBranchAddress("Nymult",Nymult); + fhBookTree->SetBranchAddress("Nstrpx",&Nstrpx); + fhBookTree->SetBranchAddress("Npstripx",Npstripx); + fhBookTree->SetBranchAddress("Ntstripx",Ntstripx); + fhBookTree->SetBranchAddress("Istripx",Istripx); + fhBookTree->SetBranchAddress("Qstripx",Qstripx); + fhBookTree->SetBranchAddress("Xstripx",Xstripx); + fhBookTree->SetBranchAddress("Nstrpy",&Nstrpy); + fhBookTree->SetBranchAddress("Npstripy",Npstripy); + fhBookTree->SetBranchAddress("Ntstripy",Ntstripy); + fhBookTree->SetBranchAddress("Istripy",Istripy); + fhBookTree->SetBranchAddress("Qstripy",Qstripy); + fhBookTree->SetBranchAddress("Ystripy",Ystripy); + fhBookTree->SetBranchAddress("Nthcali",&Nthcali); + fhBookTree->SetBranchAddress("Icaplane",Icaplane); + fhBookTree->SetBranchAddress("Icastrip",Icastrip); + fhBookTree->SetBranchAddress("Icamod",Icamod); + fhBookTree->SetBranchAddress("Enestrip",Enestrip); + fhBookTree->SetBranchAddress("Nthcal",&Nthcal); + fhBookTree->SetBranchAddress("Icapl",Icapl); + fhBookTree->SetBranchAddress("Icasi",Icasi); + fhBookTree->SetBranchAddress("Icast",Icast); + fhBookTree->SetBranchAddress("Xincal",Xincal); + fhBookTree->SetBranchAddress("Yincal",Yincal); + fhBookTree->SetBranchAddress("Zincal",Zincal); + fhBookTree->SetBranchAddress("Erelcal",Erelcal); + fhBookTree->SetBranchAddress("Nthnd",&Nthnd); + fhBookTree->SetBranchAddress("Itubend",Itubend); + fhBookTree->SetBranchAddress("Iparnd",Iparnd); + fhBookTree->SetBranchAddress("Xinnd",Xinnd); + fhBookTree->SetBranchAddress("Yinnd",Yinnd); + fhBookTree->SetBranchAddress("Zinnd",Zinnd); + fhBookTree->SetBranchAddress("Xoutnd",Xoutnd); + fhBookTree->SetBranchAddress("Youtnd",Youtnd); + fhBookTree->SetBranchAddress("Zoutnd",Zoutnd); + fhBookTree->SetBranchAddress("Erelnd",Erelnd); + fhBookTree->SetBranchAddress("Timend",Timend); + fhBookTree->SetBranchAddress("Pathnd",Pathnd); + fhBookTree->SetBranchAddress("P0nd",P0nd); + fhBookTree->SetBranchAddress("Nthcard",&Nthcard); + fhBookTree->SetBranchAddress("Iparcard",Iparcard); + fhBookTree->SetBranchAddress("Icard",Icard); + fhBookTree->SetBranchAddress("Xincard",Xincard); + fhBookTree->SetBranchAddress("Yincard",Yincard); + fhBookTree->SetBranchAddress("Zincard",Zincard); + fhBookTree->SetBranchAddress("Xoutcard",Xoutcard); + fhBookTree->SetBranchAddress("Youtcard",Youtcard); + fhBookTree->SetBranchAddress("Zoutcard",Zoutcard); + fhBookTree->SetBranchAddress("Erelcard",Erelcard); + fhBookTree->SetBranchAddress("Timecard",Timecard); + fhBookTree->SetBranchAddress("Pathcard",Pathcard); + fhBookTree->SetBranchAddress("P0card",P0card); + +// fhBookTree->SetBranchStatus("*",0); + +} + +ClassImp(GPamela); + +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// //-------------------------------------- // // @@ -11,6 +285,8 @@ calo_track = 0; tof_track = 0; candeleteobj = 0; + pscore = 0; + iscore = 0; }; //-------------------------------------- // @@ -60,6 +336,9 @@ calo_track = 0; tof_track = 0; } + pscore = 0; + iscore = 0; + } void PamTrack::Delete(){ // cout << "PamTrack::Delete() "< load all trees/branches in the input files + * +(-)ALL --> inlcude(exclude) all trees/branches + * +(-)TRK1+(-)TRK2+(-)CAL1+(-)CAL2+(-)TOF+(-)TRG+(-)ND+(-)S4+(-)ORB+(-)AC --> inlcude(exclude) trees and branches + * +(-)TRK0 --> include(exclude) tracker level0 tree + * +(-)GP --> include exclude GPAMELA output tree + * If no options are specified, the default is assumed. Default is: + * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB */ PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ Initialize(); @@ -101,7 +391,11 @@ }; /** - * Constructor with given dir and list + * Constructor + * @param ddir Name of directory where level2 files are stored. + * @param list Name of an ascii file containing the list of file names + * Default trees/branches are loaded. Default is: + * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB */ PamLevel2::PamLevel2(TString ddir,TString list){ Initialize(); @@ -112,18 +406,6 @@ void PamLevel2::Initialize(){ -// trk2_obj = TrkLevel2::GetTrkLevel2(); -// trk1_obj = TrkLevel1::GetTrkLevel1(); -// trkh_obj = TrkHough::GetTrkHough(); -// calo1_obj = CaloLevel1::GetCaloLevel1(); -// calo2_obj = CaloLevel2::GetCaloLevel2(); -// tof_obj = ToFLevel2::GetToFLevel2(); -// trig_obj = TrigLevel2::GetTrigLevel2(); -// s4_obj = S4Level2::GetS4Level2(); -// nd_obj = NDLevel2::GetNDLevel2(); -// ac_obj = AcLevel2::GetAcLevel2(); -// orb_obj = OrbitalInfo::GetOrbitalInfo(); - h0_obj = 0; trk0_obj = 0; calo0_obj = 0; @@ -139,6 +421,7 @@ nd_obj = 0; ac_obj = 0; orb_obj = 0; + gp_obj = 0; run_obj = 0;//new GL_RUN(); soft_obj = 0;// Emiliano @@ -152,6 +435,7 @@ dbc = 0; prevshift = 0; + maxshift = 10; //EMILIANO run_tree = NULL; run_tree_clone = NULL; @@ -162,6 +446,9 @@ pam_tree = NULL; for(Int_t i=0; iDelete(); @@ -304,10 +595,10 @@ if(h0_obj) h0_obj->Clear(); // if(trk0_obj) trk0_obj->Clear(); - if(calo0_obj) calo0_obj->Clear(); if(trk1_obj) trk1_obj->Clear(); if(trk2_obj) trk2_obj->Clear(); if(trkh_obj) trkh_obj->Clear(); + if(calo0_obj) calo0_obj->Clear(); if(calo1_obj)calo1_obj->Clear(); if(calo2_obj)calo2_obj->Clear(); if(tof_obj) tof_obj->Clear(); @@ -316,6 +607,7 @@ if(nd_obj) nd_obj->Clear(); if(ac_obj) ac_obj->Clear(); if(orb_obj) orb_obj->Clear(); + if(gp_obj) gp_obj->Clear(); // if(sorted_tracks)sorted_tracks->Clear(); // sorted_tracks.Clear(); @@ -392,6 +684,7 @@ nd_obj = 0; ac_obj = 0; orb_obj = 0; + gp_obj = 0; // // Reset run pointers // @@ -401,6 +694,9 @@ runfirstentry = 0ULL; runlastentry = 0ULL; // + totdltime[0] = 0LL; + totdltime[1] = 0LL; + // }; Bool_t PamLevel2::IsGood(){ @@ -480,6 +776,10 @@ if(!orb_obj) orb_obj = new OrbitalInfo(); return &orb_obj; }; + if(!objname.CompareTo("GPamela")){ + if(!gp_obj) gp_obj = new GPamela(); + return &gp_obj; + }; if(!objname.CompareTo("RunInfo"))return &run_obj; @@ -635,7 +935,7 @@ void PamLevel2::SortTracks(){ TString how = howtosort; - // cout <<" PamLevel2::SortTracks(TString how) "<TrkLevel2::GetNTracks(); i++){ TrkTrack *ts = 0; @@ -680,15 +1000,21 @@ ToFTrkVar *os = 0; // get tracker tracks - TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker + TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); - TrkTrack *ti = 0; //tracker (image) + TrkTrack *ti = 0; //tracker (image) CaloTrkVar *ci = 0; ToFTrkVar *oi = 0; // cout << "trk track n. "<HasImage()){ ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) @@ -698,46 +1024,72 @@ // cout << "its image "<npcfit[1] > 5 && //no. of fit planes on Y view - calo2_obj->varcfit[1] < 1000. && //fit variance on Y view +// calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view +// calo2_obj->varcfit[1] < 1000. && //fit variance on Y view cp && ci && true){ - Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; - Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; +// Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; +// Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; - if(resy_p <= resy_i) tp_score++; - else ti_score++; +// if(resy_p <= resy_i) tp_score++; +// else ti_score++; + + if( cp->npresh > ci->npresh){ + tp_score++; + totp_score++; + }; + if( cp->npresh < ci->npresh){ + ti_score++; + toti_score++; + }; + // cout << "CALO "<npmtadc; ih++){ @@ -749,7 +1101,7 @@ if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); }; // - if ( sen >= sortthr ){ + if ( sen >= sortthr && false){ // temporary disabled NUCLEI special algorithm since the new one should work for every particle (to be checked!) //printf(" IS A NUCLEUS! en = %f \n",sen); // // is a nucleus use a different algorithm @@ -842,7 +1194,7 @@ if( - use_TOF && + (use_TOF || use_S1 || use_S2 || use_S3) && (nphit_p+nphit_i) !=0 && true){ @@ -875,56 +1227,112 @@ cout << "image: npmtadc "<< oi->npmtadc << endl; cout << "image: npmttdc "<< oi->npmttdc << endl;*/ - for (Int_t ih=0; ih < op->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); - if(pl == 1 || pl == 2 || pl == 5)nphit_p++; +// for (Int_t ih=0; ih < op->npmtadc; ih++){ +// Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); +// if(pl == 1 || pl == 2 || pl == 5)nphit_p++; +// }; + +// for (Int_t ih=0; ih < oi->npmtadc; ih++){ +// Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); +// if(pl == 1 || pl == 2 || pl == 5)nphit_i++; +// }; + // --- modified to count tdc signals (more efficient?) + // --- and to implement check on tdcflag + for (Int_t ih=0; ih < op->npmttdc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (op->pmttdc).At(ih) ); +// if( (op->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_p++; + if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ + if( (op->tdcflag).At(ih)==0 )nphit_p++; + }; }; - for (Int_t ih=0; ih < oi->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); - if(pl == 1 || pl == 2 || pl == 5)nphit_i++; + for (Int_t ih=0; ih < oi->npmttdc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); +// if( (oi->tdcflag).At(ih)==0 && (pl == 1 || pl == 2 || pl == 5) )nphit_i++; + if ( (use_S1 && ( pl == 0 || pl == 1 )) || (use_S2 && ( pl == 2 || pl == 3 )) || (use_S3 && ( pl == 4 || pl == 5 )) ){ + if( (oi->tdcflag).At(ih)==0 )nphit_i++; + }; }; if( - use_TOF && (nphit_p+nphit_i) !=0 && true){ - if( nphit_p >= nphit_i) tp_score++; - else ti_score++; + if ( nphit_p != nphit_i ){ + totp_score += nphit_p; + toti_score += nphit_i; + tp_score+=nphit_p; + ti_score+=nphit_i; + }; + // if ( nphit_p > nphit_i) tp_score+=nphit_p; + // else if( nphit_p < nphit_i) ti_score+=nphit_i; + // else ;//niente }; }; // cout << "TOF "<chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; - else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; +// if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; +// else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; + + // CHECK 1 : number of points along X + if ( tp->GetNX() >= ti->GetNX() ){ + tp_score++ ; + totp_score++ ; + }; + if ( tp->GetNX() <= ti->GetNX() ){ + ti_score++ ; + toti_score++ ; + }; + // CHECK 2 : number of points along Y + if ( tp->GetNY() >= ti->GetNY() ){ + tp_score++ ; + totp_score++ ; + }; + if ( tp->GetNY() <= ti->GetNY() ){ + ti_score++ ; + toti_score++ ; + }; + // CHECK 3 : chi**2 along X +// if( tp->GetChi2X() > 0 && (tp->GetChi2X() < ti->GetChi2X() || ti->GetChi2X() <=0) ) tp_score++ ; +// if( ti->GetChi2X() > 0 && (ti->GetChi2X() < tp->GetChi2X() || tp->GetChi2X() <=0) ) ti_score++ ; + // CHECK 4 : chi**2 along Y +// if( tp->GetChi2Y() > 0 && (tp->GetChi2Y() < ti->GetChi2Y() || ti->GetChi2Y() <=0) ) tp_score++ ; +// if( ti->GetChi2Y() > 0 && (ti->GetChi2Y() < tp->GetChi2Y() || tp->GetChi2Y() <=0) ) ti_score++ ; + // CHECK 5 : total chi**2 +// if( tp->chi2 > 0 && (tp->chi2 < ti->chi2 || ti->chi2 <=0) ) tp_score++ ; +// if( ti->chi2 > 0 && (ti->chi2 < tp->chi2 || tp->chi2 <=0) ) ti_score++ ; + // cout << "TRK "< ti_score) { - // ts = tp;//the track sorted by the tracker!! - // cs = cp; - // os = op; - // cout << "It's primary!" << endl; + }else if (tp_score < ti_score) { - // cout << "It's image!" << endl; ts = ti;//its image!! cs = ci; os = oi; + Int_t totis = toti_score; ti = tp;//its image!! ci = cp; @@ -934,16 +1342,20 @@ cp = cs; op = os; + toti_score = totp_score; + totp_score = totis; + }else { - // ts = tp; - // cs = cp; - // os = op; + // cout << "Warning - track image ambiguity not solved" << endl; - // cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; + }; }else{ + totp_score = 1; + toti_score = 0; + // ts = tp; // cs = cp; // os = op; @@ -957,8 +1369,14 @@ // cout<<"o "<SetPScore(totp_score); + ((PamTrack*)(ttsorted[i]))->SetIScore(toti_score); + ((PamTrack*)(ttimage[i]))->SetPScore(totp_score); + ((PamTrack*)(ttimage[i]))->SetIScore(toti_score); }; if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ @@ -1124,17 +1542,21 @@ */ TTree *PamLevel2::GetPamTree(TFile *f, TString detlist ){ -// if( !detlist.IsNull() ) SetWhichTrees(detlist); -// else GetWhichTrees(f); - if ( pam_tree ){ - printf("WARNING: TTree *PamLevel2::GetPamTree(TFile *fl, TString detlist) -- pam_tree already exists!\n "); - return pam_tree; - }; + if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { + cout << "+AUTO"<>> Found selection-list <<<"<Get("h20"); + if(G && GP) { + if(!gp_obj)gp_obj=new GPamela(); +// ------------------------------------ +// ATTENZIONE!!! +// non so per quale arcano motivo, +// per l'albero di gpamela il branch address lo devo settare +// DOPO aver fatto friend +// FGRRRVZZZZUTSALKJMSLKJ!!! +// ------------------------------------ +// gp_obj->SetBranchAddress(G); //ho dovuto fare in maniera diversa dagli altri +// cout << "h20 : set branch address GPamela "<AddFriend(G); + }else{ +// cout << "h20 : missing tree"<Get("SelectionList"); if(L && SELLI==1) { // L->SetBranchAddress("RunEntry",&irun); @@ -1269,6 +1712,20 @@ cout<GetEntries()<SetBranchAddress(Trout); //ho dovuto fare in maniera diversa dagli altri + cout << "h20 : set branch address GPamela "< "; - if(TRK1)cout<<"TRK1 "; - if(TRK2)cout<<"TRK2 "; - if(TRKh)cout<<"TRKH "; - if(CAL1)cout<<"CAL1 "; - if(CAL2)cout<<"CAL2 "; - if(TOF)cout<<"TOF "; - if(TRG)cout<<"TRG "; - if(AC)cout<<"AC "; - if(ND)cout<<"ND "; - if(S4)cout<<"S4 "; - if(ORB)cout<<"ORB "; - cout << endl; + if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { + if( fl->GetEntries()>0 ){ + cout << "+AUTO"<At(0)->GetName() ); + GetWhichTrees(fprimo); + fprimo->Delete(); + } + }; + SetWhichTrees(detlist); + + +// if( !detlist.IsNull() )SetWhichTrees(detlist); +// TChain *T = 0; TChain *C = 0; TChain *O = 0; @@ -1455,6 +1910,7 @@ TChain *N = 0; TChain *A = 0; TChain *B = 0; + TChain *G = 0; TChain *L = 0; @@ -1466,7 +1922,8 @@ if(ND) N = new TChain("NeutronD"); if(AC) A = new TChain("Anticounter"); if(ORB) B = new TChain("OrbitalInfo"); - L = new TChain("SelectionList"); + if(GP) G = new TChain("h20"); + L = new TChain("SelectionList"); // loop over files and create chains TIter next(fl); @@ -1483,6 +1940,7 @@ if(ND) N->Add(name); if(AC) A->Add(name); if(ORB) B->Add(name); + if(GP) G->Add(name); if(SELLI==1) L->Add(name); }; }; @@ -1493,87 +1951,105 @@ // UInt_t *found=0; // Tracker if(T && (TRK2||TRK1||TRKh)) { - if(TRK2)T->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); -// else T->SetBranchStatus("TrkLevel2",0,found); - if(TRK2)cout << "Tracker : set branch address TrkLevel2"<SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); -// else T->SetBranchStatus("TrkLevel1",0,found); - if(TRK1)cout << "Tracker : set branch address TrkLevel1"<SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); -// else T->SetBranchStatus("TrkHough",0,found); - if(TRKh)cout << "Tracker : set branch address TrkHough"<SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); +// if(TRK2)cout << "Tracker : set branch address TrkLevel2"<SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); +// if(TRK1)cout << "Tracker : set branch address TrkLevel1"<SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); +// if(TRKh)cout << "Tracker : set branch address TrkHough"<AddFriend("Tracker"); }else{ - cout << "Tracker : missing tree"<SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); -// else C->SetBranchStatus("CaloLevel2",0,found); - if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); -// else C->SetBranchStatus("CaloLevel1",0,found); - if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<SetBranchAddress("CaloLevel2", GetPointerTo("CaloLevel2")); +// if(CAL2)cout << "Calorimeter : set branch address CaloLevel2"<SetBranchAddress("CaloLevel1", GetPointerTo("CaloLevel1")); +// if(CAL1)cout << "Calorimeter : set branch address CaloLevel1"<AddFriend("Calorimeter"); }else{ - cout << "Calorimeter : missing tree"<SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); - cout << "ToF : set branch address ToFLevel2"<SetBranchAddress("ToFLevel2", GetPointerTo("ToFLevel2")); +// cout << "ToF : set branch address ToFLevel2"<AddFriend("ToF"); }else{ - cout << "ToF : missing tree"<SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); - cout << "Trigger : set branch address TrigLevel2"<SetBranchAddress("TrigLevel2", GetPointerTo("TrigLevel2")); +// cout << "Trigger : set branch address TrigLevel2"<AddFriend("Trigger"); }else{ - cout << "Trigger : missing tree"<SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); - cout << "S4 : set branch address S4Level2"<SetBranchAddress("S4Level2", GetPointerTo("S4Level2")); +// cout << "S4 : set branch address S4Level2"<AddFriend("S4"); }else{ - cout << "S4 : missing tree"<SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); - cout << "NeutronD : set branch address NDLevel2"<SetBranchAddress("NDLevel2", GetPointerTo("NDLevel2")); +// cout << "NeutronD : set branch address NDLevel2"<AddFriend("NeutronD"); }else{ - cout << "NeutronD : missing tree"<SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); - cout << "Anticounter : set branch address AcLevel2"<SetBranchAddress("AcLevel2", GetPointerTo("AcLevel2")); +// cout << "Anticounter : set branch address AcLevel2"<AddFriend("Anticounter"); }else{ - cout << "Anticounter : missing tree"<SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); - cout << "OrbitalInfo : set branch address OrbitalInfo"<SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); +// cout << "OrbitalInfo : set branch address OrbitalInfo"<AddFriend("OrbitalInfo"); }else{ - cout << "OrbitalInfo : missing tree"<SetBranchAddress(G); //ho dovuto fare in maniera diversa dagli altri +// cout << "h20 : set branch address GPamela "<AddFriend("h20"); + }else{ +// cout << "h20 : missing tree"<GetEntries()<SetBranchAddress(Trout); //ho dovuto fare in maniera diversa dagli altri +// cout << "h20 : set branch address GPamela "<GetBranchStatus("NDLevel2"); AC = AC & t->GetBranchStatus("AcLevel2"); ORB = ORB & t->GetBranchStatus("OrbitalInfo"); + GP = GP & t->GetBranchStatus("h20"); // Tracker @@ -1677,6 +2170,13 @@ t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); cout << "OrbitalInfo : set branch address OrbitalInfo"<SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri + cout << "h20 : set branch address GPamela "<SetBranchAddress("RunEntry", &irun); @@ -1691,17 +2191,18 @@ */ void PamLevel2::SetBranchAddress(TChain *t){ - TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); - TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); - TRKh = TRKh & t->GetBranchStatus("TrkHough"); - CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); - CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); - TOF = TOF & t->GetBranchStatus("ToFLevel2"); - TRG = TRG & t->GetBranchStatus("TrigLevel2"); - S4 = S4 & t->GetBranchStatus("S4Level2"); - ND = ND & t->GetBranchStatus("NDLevel2"); - AC = AC & t->GetBranchStatus("AcLevel2"); - ORB = ORB & t->GetBranchStatus("OrbitalInfo"); +// TRK2 = TRK2 & t->GetBranchStatus("TrkLevel2"); +// TRK1 = TRK1 & t->GetBranchStatus("TrkLevel1"); +// TRKh = TRKh & t->GetBranchStatus("TrkHough"); +// CAL1 = CAL1 & t->GetBranchStatus("CaloLevel1"); +// CAL2 = CAL2 & t->GetBranchStatus("CaloLevel2"); +// TOF = TOF & t->GetBranchStatus("ToFLevel2"); +// TRG = TRG & t->GetBranchStatus("TrigLevel2"); +// S4 = S4 & t->GetBranchStatus("S4Level2"); +// ND = ND & t->GetBranchStatus("NDLevel2"); +// AC = AC & t->GetBranchStatus("AcLevel2"); +// ORB = ORB & t->GetBranchStatus("OrbitalInfo"); +// GP = GP & t->GetBranchStatus("h20"); // Tracker if(TRK2) { @@ -1757,6 +2258,14 @@ t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); cout << "OrbitalInfo : set branch address OrbitalInfo"<SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri + cout << "h20 : set branch address GPamela "<SetBranchAddress("RunEntry", &irun); @@ -1856,7 +2365,7 @@ // // check if we have already called once GetEntry, if not call it // - cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev) --- NON FUNZIONA BENISSIMO.... "<absTime; + + // // the first time the routine is called, set run search from the beginning // @@ -1889,11 +2402,19 @@ runfirstentry = 0LL; runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; + + if( ISGP && run->GetEntries()!=1 ){ + cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run->GetEntries() << endl; + cout << "** WARNING ** run will not be updated"<GetEntries()-1LL && - !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && - GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) + if(ISGP)abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO + // + if ( irun == run->GetEntries()-1LL && + !(abstime >= GetRunInfo()->RUNHEADER_TIME && + abstime <= GetRunInfo()->RUNTRAILER_TIME) ){ irun = -1LL; runfirstentry = 0LL; @@ -1904,7 +2425,7 @@ // bool fromfirst = true; // - while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ + while ( !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ // while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ irun++; run->GetEntry(irun); @@ -1914,12 +2435,12 @@ // cout << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); - // printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); + // printf(" abstime %u trailertime %u \n",abstime,GetRunInfo()->RUNTRAILER_TIME); // printf(" IDRUN %u \n",GetRunInfo()->ID); // // prevshift = 0; // - if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ + if ( irun == (Long64_t)(run->GetEntries()-1LL) && fromfirst && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)){ printf(" resetting irun (it should NOT happen!!!)\n"); fromfirst = false; irun = 0; @@ -1932,10 +2453,10 @@ }; // if ( - !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && - GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) + !(abstime >= GetRunInfo()->RUNHEADER_TIME && + abstime <= GetRunInfo()->RUNTRAILER_TIME) ) { - printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); + printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime); return false; } // @@ -1987,9 +2508,29 @@ if(SELLI==0){ // --------------------------------------------------------------- + // increment dead and live-time counters + // --------------------------------------------------------------- + if( GetTrigLevel2() ){ + totdltime[0]+=GetTrigLevel2()->dltime[0]; + totdltime[1]+=GetTrigLevel2()->dltime[1]; + } + totdltime[2]++; + +// cout << setw(10)<absTime; + obt = GetOrbitalInfo()->OBT; + } + // --------------------------------------------------------------- // the absolute time is necessary to relate the event with the run // --------------------------------------------------------------- - if( !GetOrbitalInfo() ){ + if( !GetOrbitalInfo() && !ISGP ){ cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- ERROR -- missing OrbitalInfo "<GetEntry(irun); + + if( ISGP && run_tree->GetEntries()!=1 ){ + cout << "** WARNING ** simulated files are assumed to have 1 single run, not "<< run_tree->GetEntries() << endl; + cout << "** WARNING ** run will not be updated"<RUNHEADER_TIME; // BARBATRUCCO + obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO + } // bool fromfirst = true; // first loop over runs @@ -2016,16 +2570,56 @@ while ( ( ( - !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) - GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && - !(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) - GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) + !(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) + abstime <= GetRunInfo()->RUNTRAILER_TIME) && + !(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) + obt <= GetRunInfo()->RUNTRAILER_OBT) ) || GetRunInfo()->NEVENTS==0 - || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) +// || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento + || !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) ) && irun < run_tree->GetEntries() ){ + // - - - - - - - - - - - - - + // irunentry = position of current entry, relative to the run + // prevshift = shift needed to synchronize l0 and l2 data (nested events) + // - - - - - - - - - - - - - + + // ----------------------------------------- + // store dead and live-time of previous run + // ----------------------------------------- + if(fromfirst){ + if(oldrun==irun){ + /// decrement counters + if( GetTrigLevel2()){ + totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time + totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time + } + totdltime[2]--; //event counter + cout << endl; + cout << "n.events : "<GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) + run_tree_clone->GetBranch("DeadLiveTime")->Fill(); + /// reset counters + if( GetTrigLevel2() ){ + totdltime[0]=GetTrigLevel2()->dltime[0];//live-time + totdltime[1]=0; //dead-time + } + totdltime[2]=1; //event counter + } + + irun++; // ------------------------------------ // if the end of run tree is reached... @@ -2053,7 +2647,7 @@ // ------------------------------------------------------------------- if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; irunentry = 0; - prevshift = 0; + prevshift = 0; run_tree->GetEntry(irun); if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<=RUNTRAILER_OBT " <1){ +// ULong64_t temp[3]; +// temp[0]=totdltime[0]; +// temp[1]=totdltime[1]; +// temp[2]=totdltime[2]; +// for(int i=oldrun+1; iGetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) +// run_tree_clone->GetBranch("DeadLiveTime")->Fill(); +// } +// totdltime[0]=temp[0]; +// totdltime[1]=temp[1]; +// totdltime[2]=temp[2]; +// } +// /// decrement counters +// if( GetTrigLevel2() ){ +// totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time +// totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time +// } +// totdltime[2]--; //event counter +// /// add an entry +// if(irun>0 ){ +// cout << endl; +// cout << "n.events : "<GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) +// run_tree_clone->GetBranch("DeadLiveTime")->Fill(); +// } +// /// reset counters +// if( GetTrigLevel2() ){ +// totdltime[0]=GetTrigLevel2()->dltime[0];//live-time +// totdltime[1]=0; //dead-time +// } +// totdltime[2]=1; //event counter + + + // -------------------------------------- // ---> exit with TRUE // -------------------------------------- cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "< "; + if(TRK0)cout<<"TRK0 "; + if(TRK1)cout<<"TRK1 "; + if(TRK2)cout<<"TRK2 "; + if(TRKh)cout<<"TRKH "; + if(CAL0)cout<<"CAL0 "; + if(CAL1)cout<<"CAL1 "; + if(CAL2)cout<<"CAL2 "; + if(TOF)cout<<"TOF "; + if(TRG)cout<<"TRG "; + if(AC)cout<<"AC "; + if(ND)cout<<"ND "; + if(S4)cout<<"S4 "; + if(ORB)cout<<"ORB "; + if(GP)cout<<"GP "; + cout << endl; // cout<< "Set detector list --> "; // if(TRK1)cout<<"TRK1 "; // if(TRK2)cout<<"TRK2 "; // if(TRKh)cout<<"TRKH "; // if(CAL1)cout<<"CAL1 "; // if(CAL2)cout<<"CAL2 "; +// if(TOF0)cout<<"TOF0 "; // if(TOF)cout<<"TOF "; // if(TRG)cout<<"TRG "; // if(AC)cout<<"AC "; @@ -2253,7 +2933,7 @@ - cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<Delete(); +// T->Delete(); }; //========================================================= if( !strcmp(key->GetName(),"Calorimeter" ) ){ @@ -2374,26 +3055,36 @@ CAL1 = false; CAL2 = false; }else nev=nevt; - T->Delete(); +// T->Delete(); }; + //========================================================= + if( !strcmp(key->GetName(),"h20") ){ + GP = true; + Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); + if( nev && nevt!=nev){ + cout << "File: "<< f->GetName() <<" h20 tree has "< "; -// if(TRK1)cout<<"TRK1 "; -// if(TRK2)cout<<"TRK2 "; -// if(TRKh)cout<<"TRKH "; -// if(CAL1)cout<<"CAL1 "; -// if(CAL2)cout<<"CAL2 "; -// if(TOF)cout<<"TOF "; -// if(TRG)cout<<"TRG "; -// if(AC)cout<<"AC "; -// if(ND)cout<<"ND "; -// if(S4)cout<<"S4 "; -// if(ORB)cout<<"ORB "; -// cout << endl; + cout<< "Get detector list from input file --> "; + if(TRK1)cout<<"TRK1 "; + if(TRK2)cout<<"TRK2 "; + if(TRKh)cout<<"TRKH "; + if(CAL1)cout<<"CAL1 "; + if(CAL2)cout<<"CAL2 "; + if(TOF)cout<<"TOF "; + if(TRG)cout<<"TRG "; + if(AC)cout<<"AC "; + if(ND)cout<<"ND "; + if(S4)cout<<"S4 "; + if(ORB)cout<<"ORB "; + if(GP)cout<<"GP "; + cout << endl; return ; @@ -2422,6 +3113,7 @@ Bool_t ND__ok = false; Bool_t AC__ok = false; Bool_t ORB__ok = false; + Bool_t GP__ok = false; Bool_t RUN__ok = false; @@ -2453,6 +3145,9 @@ // return false; // }; + //========================================================= + // check if the file + if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; @@ -2579,6 +3274,19 @@ }; T->Delete(); }; + //========================================================= + if( !strcmp(key->GetName(),"h20") ){ + ISGP = true; + GP__ok = true; + if(GP){ + Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); + if( nev && nevt!=nev){ + cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<GetName() <<" discarded ---- Missing Trigger tree"<< endl; return false; }; + if(GP && !GP__ok){ + cout << "File: "<< f->GetName() <<" discarded ---- Missing h20 tree"<< endl; + return false; + }; // lk->Delete(); @@ -2686,6 +3398,7 @@ // if(ND)cout<<"ND "; // if(S4)cout<<"S4 "; // if(ORB)cout<<"ORB "; +// if(GP)cout<<"GP "; // cout << endl; return true; @@ -2767,6 +3480,12 @@ } cout << "----------------------------------------------------"<Branch("DeadLiveTime",totdltime,"dltime[3]/l"); + cout << "Run : branch DeadLiveTime"<Branch("RunEntry",&irun,"runentry/L"); @@ -2849,6 +3568,13 @@ cout << "OrbitalInfo : branch OrbitalInfo"<Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split + cout << "OrbitalInfo : branch OrbitalInfo"<GetName()<GetName()<GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) + run_tree_clone->GetBranch("DeadLiveTime")->Fill(); run_tree_clone->Write(); cout << sel_tree_clone->GetName()<Write(); @@ -2937,6 +3665,8 @@ cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<P0 "<P0<NEVENTS<< endl; - if( TRK0 || CAL0 || TOF0 ){ - if( !GetYodaEntry( ) ){ - cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<IsConnected())){ cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); } - //--------------------------------------------------- + //-------------------------------------------------- // CALORIMETER: if(CAL0){ if(!calo0_obj){ @@ -3067,11 +3818,14 @@ cout << "PamLevel2::GetYodaTree() --- level0 TOF not implemented "<Close(); + + }; - if(!dbc || (dbc && !dbc->IsConnected())){ - cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<IsConnected())){ +// cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<EV_FROM "<EV_FROM <<" quella giusta "<ID_ROOT_L0 "<ID_ROOT_L0<absTime << endl; +// cout << " time "<< abstime << endl; // cout << " trk_calib_used "<TRK_CALIB_USED<< endl; - if( !GetOrbitalInfo() ){ + ULong64_t obt = 0; + ULong64_t pktn = 0; + if( GetOrbitalInfo() ){ + obt = GetOrbitalInfo()->OBT; + pktn = GetOrbitalInfo()->pkt_num; + } + + if( !GetOrbitalInfo() && !ISGP){ cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<OBT==0 && GetOrbitalInfo()->pkt_num==0 ){ + if( obt==0 && pktn==0 && !ISGP ){ cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- level2 event corrupted ?? "<0){ - cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<GetPscuHeader()->GetCounter()<ID << " ID_ROOT_L0 "<ID_ROOT_L0<<" ID_RUN_FRAG "<ID_RUN_FRAG << " EV_FROM "<EV_FROM < L0 mismatch ( irun "<pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<GetPscuHeader()->GetOrbitalTime()); //BARBATRUCCO + pktn = (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()); //BARBATRUCCO + } + +// cout << "PKTNUM "<GetPscuHeader()->GetCounter()<GetPscuHeader()->GetOrbitalTime()<GetEntries()+1 )cout << ">>> end of level0 tree <<<"<OBT "<< GetOrbitalInfo()->OBT << endl; +// cout << " obt "<< obt << endl; // cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; -// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; +// cout << " pktn "<< pktn << endl; // cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; // printf(" IDRUN %u \n",GetRunInfo()->ID); // @@ -3167,7 +3934,9 @@ shift = -1; }; - }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( ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || + pktn != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter()) ) + && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { cout << " Big trouble here, no such event in Level0 data! " <IsConnected() )return false; + cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<GetListOfFiles() ); + Int_t nf = 0; + TChainElement* element = 0; + while ((element = (TChainElement*) next())) { + c->Add(element->GetTitle()); + nf++; + } + + GetPamTree()->AddFriend(cname.Data()); + + cout << "external chain created and added to pamela friends :"<