--- PamelaLevel2/src/PamLevel2.cpp 2007/09/12 09:51:57 1.48 +++ PamelaLevel2/src/PamLevel2.cpp 2008/09/30 07:45:24 1.63 @@ -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); + +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// //-------------------------------------- // // @@ -93,25 +367,42 @@ * Default Constructor */ PamLevel2::PamLevel2(){ - Initialize(); + Initialize(); }; /** - * Constructor with given dir, list and detectors + * Constructor + * @param ddir Name of directory where level2 files are stored. + * @param list Name of an ascii file containing the list of file names + * @param detlist Options to chose what to load. + * Possible options are: + * +AUTO --> 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(); - GetPamTree(GetListOfLevel2Files(ddir,list),detlist); - GetRunTree(GetListOfLevel2Files(ddir,list)); + Initialize(); + TList* listf = GetListOfLevel2Files(ddir,list); + GetPamTree(listf,detlist); + GetRunTree(listf); }; /** - * 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(); - GetPamTree(GetListOfLevel2Files(ddir,list),""); - GetRunTree(GetListOfLevel2Files(ddir,list)); + Initialize(); + TList* listf = GetListOfLevel2Files(ddir,list); + GetPamTree(listf,""); + GetRunTree(listf); }; @@ -132,10 +423,12 @@ nd_obj = 0; ac_obj = 0; orb_obj = 0; + gp_obj = 0; run_obj = 0;//new GL_RUN(); soft_obj = 0;// Emiliano irun = -1LL; + irunt = -1LL; runfirstentry = 0LL; runlastentry = 0LL; @@ -145,6 +438,7 @@ dbc = 0; prevshift = 0; + maxshift = 10; //EMILIANO run_tree = NULL; run_tree_clone = NULL; @@ -157,6 +451,7 @@ totdltime[0] = 0LL; totdltime[1] = 0LL; + totdltime[2] = 0LL; host = "mysql://localhost/pamelaprod"; user = "anonymous"; @@ -180,7 +475,7 @@ CAL2 = true; TRK2 = true; TRK1 = false; - TRKh = false; + TRK0 = false; TRKh = false; TRG = true; TOF = true; @@ -188,14 +483,17 @@ S4 = true; ND = true; AC = true; - ORB = true; - + ORB = true; + GP = false; + RUN = true; SELLI = -1; ISGP = false; + DBG = false; + tsorted=0; timage=0; @@ -227,6 +525,7 @@ if(nd_obj) delete nd_obj; if(ac_obj) delete ac_obj; if(orb_obj) delete orb_obj; + if(gp_obj) delete gp_obj; if(tsorted){ tsorted->Delete(); @@ -245,36 +544,36 @@ if(l0_file)l0_file->Close(); // if(pam_tree)pam_tree->Delete();; - if ( pam_tree ){ - // - // we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... - // - TList *temp = pam_tree->GetListOfFriends(); - TList *contents = new TList; // create chain friend list - contents->SetOwner(); - TIter next(temp); - TChain *questo = 0; - while ( (questo = (TChain*) next()) ){ - TString name = questo->GetName(); - contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list - }; - // - // deleting the main chain - // - pam_tree->Delete(); - // - // deleting the friends... - // - TIter next2(contents); - TChain *questa = 0; - while ( questa = (TChain*)next2() ){ - TString name = questa->GetName(); - questa->Delete(); - questa=NULL; + if ( pam_tree ){ + // + // we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... + // + TList *temp = pam_tree->GetListOfFriends(); + TList *contents = new TList; // create chain friend list + contents->SetOwner(); + TIter next(temp); + TChain *questo = 0; + while ( (questo = (TChain*) next()) ){ + TString name = questo->GetName(); + contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list + }; + // + // deleting the main chain + // + pam_tree->Delete(); + // + // deleting the friends... + // + TIter next2(contents); + TChain *questa = 0; + while ( questa = (TChain*)next2() ){ + TString name = questa->GetName(); + questa->Delete(); + questa=NULL; + }; + // }; - // - }; - pam_tree = NULL; + pam_tree = NULL; if(run_tree)run_tree->Delete();; if(sel_tree)sel_tree->Delete();; @@ -282,6 +581,7 @@ if(run_tree_clone)run_tree_clone->Delete();; if(sel_tree_clone)sel_tree_clone->Delete();; + if(irunoffset) delete [] irunoffset; }; @@ -314,6 +614,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(); @@ -327,94 +628,97 @@ }; void PamLevel2::Reset(){ - // - // First of all clear everything - // - Clear(); - // - // close and reset chains and pointers - // - if ( pam_tree ){ // - // we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... + // First of all clear everything + // + Clear(); + // + // close and reset chains and pointers + // + if ( pam_tree ){ + // + // we have first to find which chains we have to delete, then delete the main chain and only after delete the friend chains. Any other order causes a segfault... + // + TList *temp = pam_tree->GetListOfFriends(); + TList *contents = new TList; // create chain friend list + contents->SetOwner(); + TIter next(temp); + TChain *questo = 0; + while ( (questo = (TChain*) next()) ){ + TString name = questo->GetName(); + contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list + }; + // + // deleting the main chain + // + pam_tree->Delete(); + // + // deleting the friends... + // + TIter next2(contents); + TChain *questa = 0; + while ( questa = (TChain*)next2() ){ + TString name = questa->GetName(); + questa->Delete(); + questa=NULL; + }; + // + }; + pam_tree = NULL; + // + if(run_tree)run_tree->Delete();; + run_tree = NULL; + if(sel_tree)sel_tree->Delete();; + sel_tree = NULL; + // + // Close file + // + if(l0_file)l0_file->Close("R"); + l0_file = NULL; + // + h0_obj = 0; + trk0_obj = 0; + calo0_obj = 0; + // + trk2_obj = 0; + trk1_obj = 0; + trkh_obj = 0; + calo1_obj = 0; + calo2_obj = 0; + tof_obj = 0; + trig_obj = 0; + s4_obj = 0; + nd_obj = 0; + ac_obj = 0; + orb_obj = 0; + gp_obj = 0; + // + // Reset run pointers + // + run_obj = 0;//new GL_RUN(); + soft_obj = 0;// Emiliano + irun = -1; + irunt = -1; + runfirstentry = 0ULL; + runlastentry = 0ULL; + // + totdltime[0] = 0LL; + totdltime[1] = 0LL; + totdltime[2] = 0LL; // - TList *temp = pam_tree->GetListOfFriends(); - TList *contents = new TList; // create chain friend list - contents->SetOwner(); - TIter next(temp); - TChain *questo = 0; - while ( (questo = (TChain*) next()) ){ - TString name = questo->GetName(); - contents->Add((TChain*)gROOT->FindObject(name.Data()));// add object to the list - }; - // - // deleting the main chain - // - pam_tree->Delete(); - // - // deleting the friends... - // - TIter next2(contents); - TChain *questa = 0; - while ( questa = (TChain*)next2() ){ - TString name = questa->GetName(); - questa->Delete(); - questa=NULL; - }; - // - }; - pam_tree = NULL; - // - if(run_tree)run_tree->Delete();; - run_tree = NULL; - if(sel_tree)sel_tree->Delete();; - sel_tree = NULL; - // - // Close file - // - if(l0_file)l0_file->Close("R"); - l0_file = NULL; - // - h0_obj = 0; - trk0_obj = 0; - calo0_obj = 0; - // - trk2_obj = 0; - trk1_obj = 0; - trkh_obj = 0; - calo1_obj = 0; - calo2_obj = 0; - tof_obj = 0; - trig_obj = 0; - s4_obj = 0; - nd_obj = 0; - ac_obj = 0; - orb_obj = 0; - // - // Reset run pointers - // - run_obj = 0;//new GL_RUN(); - soft_obj = 0;// Emiliano - irun = -1; - runfirstentry = 0ULL; - runlastentry = 0ULL; - // - totdltime[0] = 0LL; - totdltime[1] = 0LL; - // }; Bool_t PamLevel2::IsGood(){ - Bool_t goodev=true; - // if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; - if(calo2_obj && calo2_obj->good != 1) goodev = false; - if(tof_obj && tof_obj->unpackError != 0) goodev = false; - if(trig_obj && trig_obj->unpackError != 0) goodev = false; - if(s4_obj && s4_obj->unpackError != 0) goodev = false; - if(nd_obj && nd_obj->unpackError != 0) goodev = false; - if(ac_obj && ac_obj->unpackError != 255) goodev = false; + Bool_t goodev=true; + // if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; + if(calo2_obj && calo2_obj->good != 1) goodev = false; + if(tof_obj && tof_obj->unpackError != 0) goodev = false; + if(trig_obj && trig_obj->unpackError != 0) goodev = false; + if(s4_obj && s4_obj->unpackError != 0) goodev = false; + if(nd_obj && nd_obj->unpackError != 0) goodev = false; + if(ac_obj && ac_obj->unpackError != 255) goodev = false; // if(orb_obj) - return goodev; + return goodev; }; //-------------------------------------- @@ -481,6 +785,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; @@ -496,87 +804,87 @@ * Retrieves the calorimeter track matching the seqno-th tracker stored track. * (If seqno = -1 retrieves the self-trigger calorimeter track) */ - CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ +CaloTrkVar *PamLevel2::GetCaloStoredTrack(int seqno){ - if( !calo2_obj )return 0; + if( !calo2_obj )return 0; - if( calo2_obj->CaloLevel2::ntrk()==0 ){ - cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<CaloLevel2::ntrk()==0 ){ + cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no Calorimeter tracks are stored"<CaloLevel2::GetCaloTrkVar(it_calo); - it_calo++; - } while( c && seqno != c->trkseqno && it_calo < calo2_obj->CaloLevel2::ntrk()); + do{ + c = calo2_obj->CaloLevel2::GetCaloTrkVar(it_calo); + it_calo++; + } while( c && seqno != c->trkseqno && it_calo < calo2_obj->CaloLevel2::ntrk()); - if(!c || seqno != c->trkseqno){ - c = 0; - if(seqno!=-1)cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match Calorimeter stored tracks"<trkseqno){ + c = 0; + if(seqno!=-1)cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match Calorimeter stored tracks"<ToFLevel2::ntrk()==0 ){ - cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<ToFLevel2::ntrk()==0 ){ + cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no ToF tracks are stored"<ToFLevel2::GetToFTrkVar(it_tof); - it_tof++; - } while( c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); + do{ + c = tof_obj->ToFLevel2::GetToFTrkVar(it_tof); + it_tof++; + } while( c && seqno != c->trkseqno && it_tof < tof_obj->ToFLevel2::ntrk()); - if(!c || seqno != c->trkseqno){ - c = 0; - if(seqno!=-1)cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match ToF stored tracks"<trkseqno){ + c = 0; + if(seqno!=-1)cout << "PamLevel2::GetToFStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match ToF stored tracks"<GetSeqNo()); - if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); + if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); + if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); // if(t && c && o)track = new PamTrack(t,c,o); - PamTrack *track = new PamTrack(t,c,o); + PamTrack *track = new PamTrack(t,c,o); - return track; + return track; - }; +}; //-------------------------------------- // // @@ -612,321 +920,321 @@ // /** - * 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. + * Sort physical (tracker) tracks. Left here as backward compatibility method. **/ void PamLevel2::SortTracks(TString how){ - printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data()); - howtosort = how; - SortTracks(); + printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data()); + howtosort = how; + SortTracks(); }; // //-------------------------------------- /** - * Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. + * Sort physical (tracker) tracks. * @param how String to set the sorting cryterium (es: "CAL" or "TRK+CAL+TOF" ecc...). * Sorting cryteria: * TRK: lower chi**2 * CAL: lower Y spatial residual on the first calorimeter plane * TOF: bigger numebr of hit PMTs along the track, on S12 S21 S32 (where paddles are along the Y axis). + * S1: (ask Emiliano) + * S2: (ask Emiliano) + * S3: (ask Emiliano) + * GP: more GP hits * The default sorting cryterium is "TOF+CAL". * * 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). */ void PamLevel2::SortTracks(){ - TString how = howtosort; + TString how = howtosort; + + // cout <<" PamLevel2::SortTracks(TString how) "<Clear(); - // sorted_tracks.Clear(); - - if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); - tsorted->Delete(); - TClonesArray &ttsorted = *tsorted; - if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); - timage->Delete(); - TClonesArray &ttimage = *timage; + // create TCloneArrays to store tracks and its images + if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); + tsorted->Delete(); + TClonesArray &ttsorted = *tsorted; + + if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); + timage->Delete(); + TClonesArray &ttimage = *timage; - //-------------------------------------------------- - // retrieve sorting method - //-------------------------------------------------- - Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); - Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); - Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); - Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); - Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); - Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); + //-------------------------------------------------- + // retrieve sorting method + //-------------------------------------------------- + Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); + Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); + Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); + Bool_t use_S1 = how.Contains("S1", TString::kIgnoreCase); + Bool_t use_S2 = how.Contains("S2", TString::kIgnoreCase); + Bool_t use_S3 = how.Contains("S3", TString::kIgnoreCase); + Bool_t use_GP = how.Contains("GP", TString::kIgnoreCase); - if ( use_TOF ){ - use_S1 = true; - use_S2 = true; - use_S3 = true; - }; - if( !CAL2 && use_CAL) use_CAL = false; - if( !TOF ){ - use_TOF = false; - use_S1 = false; - use_S2 = false; - use_S3 = false; - } - - if( !TRK2 ){ - // cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; - return; - }; + if ( use_TOF ){ + use_S1 = true; + use_S2 = true; + use_S3 = true; + }; + if( !CAL2 && use_CAL) use_CAL = false; + if( !TOF ){ + use_TOF = false; + use_S1 = false; + use_S2 = false; + use_S3 = false; + } + if( !GP ){ + use_GP = false; + } - // cout << "use_CAL "<TrkLevel2::GetNTracks(); i++){ - - TrkTrack *ts = 0; - CaloTrkVar *cs = 0; - ToFTrkVar *os = 0; - - // get tracker tracks - TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker - CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); - ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); - - TrkTrack *ti = 0; //tracker (image) - CaloTrkVar *ci = 0; - ToFTrkVar *oi = 0; - // cout << "trk track n. "<TrkLevel2::GetNTracks(); i++){ + + TrkTrack *ts = 0; + CaloTrkVar *cs = 0; + ToFTrkVar *os = 0; + + // get tracker tracks + TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker + CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); + ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); + + TrkTrack *ti = 0; //tracker (image) + CaloTrkVar *ci = 0; + ToFTrkVar *oi = 0; + // cout << "trk track n. "<HasImage()){ + if(tp->HasImage()){ - ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) - ci = GetCaloStoredTrack(ti->GetSeqNo()); - oi = GetToFStoredTrack(ti->GetSeqNo()); + ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) + ci = GetCaloStoredTrack(ti->GetSeqNo()); + oi = GetToFStoredTrack(ti->GetSeqNo()); - // cout << "its image "<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; - -// 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++){ - Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); - if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih); - }; - for (Int_t ih=0; ih < oi->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); - if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); - }; - // - 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 - // - Int_t nz = 6; Float_t zin[6]; // << define TOF z-coordinates - for(Int_t ip=0; ipToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates - Trajectory *tr = new Trajectory(nz,zin); - // - Int_t nphit_p =0; - Int_t nphit_i =0; - Float_t enhit_p = 0.; - Float_t enhit_i = 0.; - // - 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++; - enhit_p += (op->dedx).At(ih); - }; - }; - // - tp->DoTrack2(tr); - // - if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ - for (Int_t ih=0; ih < op->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); - if(pl == 0){ - nphit_p++; - enhit_p += (op->dedx).At(ih); - }; + // ----------------------------------------------------------------------------------------- + // ***************************************************************************************** + // ----------------------------------------------------------------------------------------- + // calorimeter check + // ----------------------------------------------------------------------------------------- + if( use_CAL && !calo2_obj ){ + cout << "void PamLevel2::SortTracks(): howtosort= "<y[3]-oi->ytofpos[1]) < 2. ){ - for (Int_t ih=0; ih < op->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); - if(pl == 3){ - nphit_p++; - enhit_p += (op->dedx).At(ih); - }; + if( use_CAL && !cp && ci ){ + ti_score++; + toti_score++; }; - }; - if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ - for (Int_t ih=0; ih < op->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); - if(pl == 4){ - nphit_p++; - enhit_p += (op->dedx).At(ih); - }; + if( use_CAL && cp && !ci ){ + tp_score++; + totp_score++; }; - }; + if( + use_CAL && + cp && ci && + true){ + + + if( + cp->npresh > ci->npresh && + true){ + tp_score++; + totp_score++; + }; + if( + cp->npresh < ci->npresh && + true){ + ti_score++; + toti_score++; + }; + + // cout << "CALO "<npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); - if(pl == 1 || pl == 2 || pl == 5){ - nphit_i++; - enhit_i += (op->dedx).At(ih); }; - }; - // - ti->DoTrack2(tr); - // - if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ - for (Int_t ih=0; ih < oi->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); - if(pl == 0){ - nphit_i++; - enhit_i += (op->dedx).At(ih); - }; + // ----------------------------------------------------------------------------------------- + // ***************************************************************************************** + // ----------------------------------------------------------------------------------------- + // TOF check + // ----------------------------------------------------------------------------------------- + // check the number of hit pmts along the track + // on S12 S21 and S32, where paddles are parallel to Y axis + if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !tof_obj ){ + cout << "void PamLevel2::SortTracks(): howtosort= "<y[3]-oi->ytofpos[1]) < 2. ){ - for (Int_t ih=0; ih < oi->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); - if(pl == 3){ - nphit_i++; - enhit_i += (op->dedx).At(ih); - }; + // + if( (use_TOF || use_S1 || use_S2 || use_S3 ) && !op && oi ){ + ti_score++; + toti_score++; }; - }; - if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ - for (Int_t ih=0; ih < oi->npmtadc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); - if(pl == 4){ - nphit_i++; - enhit_i += (op->dedx).At(ih); - }; + if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && !oi ){ + tp_score++; + totp_score++; }; - }; + if( (use_TOF || use_S1 || use_S2 || use_S3 ) && op && oi ){ + // + Float_t sen = 0.; + for (Int_t ih=0; ih < op->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); + if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih); + }; + for (Int_t ih=0; ih < oi->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); + if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); + }; + // + 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 + // + Int_t nz = 6; Float_t zin[6]; // << define TOF z-coordinates + for(Int_t ip=0; ipToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates + Trajectory *tr = new Trajectory(nz,zin); + // + Int_t nphit_p =0; + Int_t nphit_i =0; + Float_t enhit_p = 0.; + Float_t enhit_i = 0.; + // + 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++; + enhit_p += (op->dedx).At(ih); + }; + }; + // + tp->DoTrack2(tr); + // + if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ + for (Int_t ih=0; ih < op->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); + if(pl == 0){ + nphit_p++; + enhit_p += (op->dedx).At(ih); + }; + }; + }; + if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ + for (Int_t ih=0; ih < op->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); + if(pl == 3){ + nphit_p++; + enhit_p += (op->dedx).At(ih); + }; + }; + }; + if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ + for (Int_t ih=0; ih < op->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); + if(pl == 4){ + nphit_p++; + enhit_p += (op->dedx).At(ih); + }; + }; + }; + + 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++; + enhit_i += (op->dedx).At(ih); + }; + }; + // + ti->DoTrack2(tr); + // + if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ + for (Int_t ih=0; ih < oi->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); + if(pl == 0){ + nphit_i++; + enhit_i += (op->dedx).At(ih); + }; + }; + }; + if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ + for (Int_t ih=0; ih < oi->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); + if(pl == 3){ + nphit_i++; + enhit_i += (op->dedx).At(ih); + }; + }; + }; + if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ + for (Int_t ih=0; ih < oi->npmtadc; ih++){ + Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); + if(pl == 4){ + nphit_i++; + enhit_i += (op->dedx).At(ih); + }; + }; + }; - if( - (use_TOF || use_S1 || use_S2 || use_S3) && - (nphit_p+nphit_i) !=0 && - true){ + if( + (use_TOF || use_S1 || use_S2 || use_S3) && + (nphit_p+nphit_i) !=0 && + true){ - // 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); - // printf(" score p %i score i %i \n",tp_score,ti_score); - // if( enhit_p > enhit_i ) tp_score++; - // if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; - if ( nphit_p > nphit_i ) tp_score++; - if ( nphit_p < nphit_i ) ti_score++; - if ( nphit_p == nphit_i ){ - if ( enhit_p > enhit_i ) tp_score++; - else ti_score++; - }; - // printf(" dopo score p %i score i %i \n",tp_score,ti_score); - }; - delete tr; - // - } else { - // - // NOT a NUCLEUS - // - //printf(" NOT a NUCLEUS! en = %f \n",sen); + // 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); + // printf(" score p %i score i %i \n",tp_score,ti_score); + // if( enhit_p > enhit_i ) tp_score++; + // if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; + if ( nphit_p > nphit_i ) tp_score++; + if ( nphit_p < nphit_i ) ti_score++; + if ( nphit_p == nphit_i ){ + if ( enhit_p > enhit_i ) tp_score++; + else ti_score++; + }; + // printf(" dopo score p %i score i %i \n",tp_score,ti_score); + }; + delete tr; + // + } else { + // ------------- + // NOT a NUCLEUS + // ------------- + //printf(" NOT a NUCLEUS! en = %f \n",sen); - Int_t nphit_p =0; - Int_t nphit_i =0; + Int_t nphit_p =0; + Int_t nphit_i =0; - /* cout << "track: npmtadc "<< op->npmtadc << endl; - cout << "track: npmttdc "<< op->npmttdc << endl; - cout << "image: npmtadc "<< oi->npmtadc << endl; - cout << "image: npmttdc "<< oi->npmttdc << endl;*/ + /* cout << "track: npmtadc "<< op->npmtadc << endl; + cout << "track: npmttdc "<< op->npmttdc << endl; + 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) ); @@ -937,159 +1245,191 @@ // 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) ); + // --- 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++; - }; - }; + 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->npmttdc; ih++){ - Int_t pl = tof_obj->GetPlaneIndex( (oi->pmttdc).At(ih) ); + 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_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( - (nphit_p+nphit_i) !=0 && - true){ + if( + (nphit_p+nphit_i) !=0 && + true){ - 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 ){ + 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 "< 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++ ; - // 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++ ; + // 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++ ; + }; - // cout << "TRK "<Nthspe; ih++){ + int ip = (Int_t) GetGPamela()->Itrpb[ih] - 1; + if( + tp && + tp->YGood(ip) && + fabs(tp->ym[ip]- GetGPamela()->Yavspe[ih])YGood(ip) && + fabs(ti->ym[ip]- GetGPamela()->Yavspe[ih]) ngphits_i && + true){ + tp_score++ ; + totp_score++ ; + } + if( + ngphits_p < ngphits_i && + true){ + ti_score++ ; + toti_score++ ; + } + } + - // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - // the winner is.... - // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* - if (tp_score > ti_score) { + // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // the winner is.... + // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + if (tp_score > ti_score) { - }else if (tp_score < ti_score) { + }else if (tp_score < ti_score) { - ts = ti;//its image!! - cs = ci; - os = oi; - Int_t totis = toti_score; + ts = ti;//its image!! + cs = ci; + os = oi; + Int_t totis = toti_score; - ti = tp;//its image!! - ci = cp; - oi = op; + ti = tp;//its image!! + ci = cp; + oi = op; - tp = ts;//its image!! - cp = cs; - op = os; + tp = ts;//its image!! + cp = cs; + op = os; - toti_score = totp_score; - totp_score = totis; + toti_score = totp_score; + totp_score = totis; - }else { + }else { // cout << "Warning - track image ambiguity not solved" << endl; - }; + }; - }else{ - totp_score = 1; - toti_score = 0; + }else{ + totp_score = 1; + toti_score = 0; - // ts = tp; - // cs = cp; - // os = op; - }; - - // cout <<" SortTracks() "<Add(ts);//save the track in the sorted array - // sorted_tracks.Add(ts);//save the track in the sorted array - // sorted_tracks.Add(tp);//save the track in the sorted array - // cout << "SortTracks:: sorted_tracks->Add(it) "<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() ){ - cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<GetEntries()<<" != trk2_obj->GetNTracks() = "<GetNTracks() <Delete(); tsorted=0; - timage->Delete(); timage=0; - } - - //Restore Object count - //To save space in the table keeping track of all referenced objects - //We reset the object count to what it was at the beginning of the event. - TProcessID::SetObjectCount(ObjectNumber); + // ts = tp; + // cs = cp; + // os = op; + }; + + // cout <<" SortTracks() "<Add(ts);//save the track in the sorted array + // sorted_tracks.Add(ts);//save the track in the sorted array + // sorted_tracks.Add(tp);//save the track in the sorted array + // cout << "SortTracks:: sorted_tracks->Add(it) "<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() ){ + cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<GetEntries()<<" != trk2_obj->GetNTracks() = "<GetNTracks() <Delete(); tsorted=0; + timage->Delete(); timage=0; + } + + //Restore Object count + //To save space in the table keeping track of all referenced objects + //We reset the object count to what it was at the beginning of the event. + TProcessID::SetObjectCount(ObjectNumber); }; //-------------------------------------- @@ -1118,10 +1458,10 @@ return tsorted; - }; +}; //-------------------------------------- - // - // +// +// //-------------------------------------- /** * Retrieves the it-th Pamela "physical" track. @@ -1182,31 +1522,6 @@ */ PamTrack *PamLevel2::GetTrackImage(int it){ -// if(!trk2_obj) return 0; - -// // *-*-*-*-*-*-*-*-*-*-*-*-* -// SortTracks("+CAL+TOF"); -// // *-*-*-*-*-*-*-*-*-*-*-*-* -// // if(!sorted_tracks)return 0; -// if(sorted_tracks.IsEmpty())return 0; - -// PamTrack *image = 0; - -// if( it >=0 && it < trk2_obj->TrkLevel2::GetNTracks() ){ -// TrkTrack *temp = (TrkTrack*)sorted_tracks.At(it); -// if( temp->HasImage() ){ -// TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(temp->GetImageSeqNo()); -// image = GetPamTrackAlong(t); -// }else{ -// cout <<"PamLevel2::GetTrackImage(int) : Track SeqNo "<>> 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); -// cout << "SelectionList: set branch address RunEntry"<SetBranchAddress("EventEntry",&irunentry); -// cout << "SelectionList: set branch address EventEntry"<AddFriend("SelectionList"); - cout << " TTree *PamLevel2::GetPamTree(TFile, TString) >>> SelectionList not implemente!!!!"<>> SelectionList not implemented!!!!"<GetEntries()<SetBranchAddress(Trout); //ho dovuto fare in maniera diversa dagli altri + cout << "h20 : set branch address GPamela "<BaseName(ddir),ddir); if ( ddir != ""){ - cout << "Level2 data directory : "<< ddir << endl; + cout << "Level2 data directory : "<< ddir << endl; } else { - cout << "Level2 data directory not given as input: trying to evaluate from list or taking working directory " << endl; + cout << "Level2 data directory not given as input: trying to evaluate from list or taking working directory " << endl; }; TList *contents = new TList; // create output list contents->SetOwner(); @@ -1430,69 +1778,69 @@ // return 0; // } // flisttxt = fullpath; - if ( !flisttxt.EndsWith(".root") ){ + if ( !flisttxt.EndsWith(".root") ){ - flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); + flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); - if( !gSystem->ChangeDirectory(ddir) ){ - cout << "Cannot change directory : "<ChangeDirectory(wdir); // back to the working directory - return 0; - } - int line=0; - while (1) { - TString file; - in >> file; - if (!in.good()) break; - line++; -// cout <<"(1) " << file << endl; - if(file.IsNull()){ - cout << "-- list interrupted at line "<ChangeDirectory(ddir) ){ + cout << "Cannot change directory : "<ChangeDirectory(wdir); // back to the working directory + return 0; + } + int line=0; + while (1) { + TString file; + in >> file; + if (!in.good()) break; + line++; +// cout <<"(1) " << file << endl; + if(file.IsNull()){ + cout << "-- list interrupted at line "<IsFileInIncludePath(file,&fullpath) ){ // if( (fullpath = gSystem->FindFile(ddir,file)) ){ - if( file.EndsWith(".root") ){ - TString filedir; - if (ddir != ""){ - filedir = ddir; // take the input dir - } else { - gSystem->ChangeDirectory(wdir); // back to the working directory - filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir - }; - char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); - contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list - delete fullpath; - } + if( file.EndsWith(".root") ){ + TString filedir; + if (ddir != ""){ + filedir = ddir; // take the input dir + } else { + gSystem->ChangeDirectory(wdir); // back to the working directory + filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir + }; + char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); + contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list + delete fullpath; + } // }else{ // if(file.Data()!="")cout << "File: "< missing "<< endl; // }; - }; - in.close(); - } else { - if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); - char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); - contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list - delete fullpath; - }; + }; + in.close(); + } else { + if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); + char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); + contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list + delete fullpath; + }; }else{ cout << "No input file list given."<WorkingDirectory()<< endl; if ( ddir == "" ){ - ddir = wdir; - cout << "Level2 data directory : "<< ddir << endl; + ddir = wdir; + cout << "Level2 data directory : "<< ddir << endl; }; TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); @@ -1538,44 +1886,46 @@ * @return Pointer to a TChain */ TChain *PamLevel2::GetPamTree(TList *fl, TString detlist ){ - // - // - // - if ( pam_tree ){ - printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); - return pam_tree; - }; - // + // + // + // + if ( pam_tree ){ + printf("WARNING: TChain *PamLevel2::GetPamTree(TList *fl, TString detlist) -- pam_tree already exists!\n "); + return pam_tree; + }; + // TChain *Trout =0; -// if( !detlist.IsNull() )SetWhichTrees(detlist); - SetWhichTrees(detlist); - - cout<< "GetPamTree(TList*,TString): input detector list --> "; - 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; - - TChain *T = 0; - TChain *C = 0; - TChain *O = 0; - TChain *R = 0; - TChain *S = 0; - TChain *N = 0; - TChain *A = 0; - TChain *B = 0; + // ------------------------------------------- + // set flags to include/exclude trees/branches + // ------------------------------------------- + if( detlist.Contains("+AUTO", TString::kIgnoreCase) ) { + if( fl->GetEntries()>0 ){ + cout << "+AUTO"<At(0)->GetName() ); + GetWhichTrees(fprimo); + fprimo->Close();// AAAAARGGGGGHHHHH!!!!!!! non commentare questa riga, altrimenti si incasina il TChain + fprimo->Delete(); + } + }; + SetWhichTrees(detlist); + + + // ------------------------------------------- + // build chains + // ------------------------------------------- + TChain *T = 0; + TChain *C = 0; + TChain *O = 0; + TChain *R = 0; + TChain *S = 0; + TChain *N = 0; + TChain *A = 0; + TChain *B = 0; + TChain *G = 0; - TChain *L = 0; + TChain *L = 0; if(TRK2||TRK1||TRKh) T = new TChain("Tracker"); if(CAL2||CAL1) C = new TChain("Calorimeter"); @@ -1585,7 +1935,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); @@ -1602,119 +1953,112 @@ 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); }; }; - cout << "done chain \n"; + cout << "done chains\n"; cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <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"<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"<AddFriend("Calorimeter"); - }else{ - cout << "Calorimeter : missing tree"<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"<AddFriend("Trigger"); - }else{ - cout << "Trigger : missing tree"<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"<AddFriend("NeutronD"); - }else{ - cout << "NeutronD : missing tree"<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"<AddFriend("OrbitalInfo"); - }else{ - cout << "OrbitalInfo : missing tree"<AddFriend("h20"); +// cout << "+h20"<>> Found selection-list <<<"<SetBranchAddress("RunEntry",&irun); +// L->SetBranchAddress("RunEntry",&irun); + L->SetBranchAddress("RunEntry",&irunt);//NEWNEW cout << "SelectionList: set branch address RunEntry"<SetBranchAddress("EventEntry",&irunentry); cout << "SelectionList: set branch address EventEntry"<AddFriend("SelectionList"); - cout << "----------------------------------------------------" <AddFriend("SelectionList"); + cout << "+SelectionList"<Delete(); }; - -// cout<GetEntries()<GetBranchStatus("NDLevel2"); AC = AC & t->GetBranchStatus("AcLevel2"); ORB = ORB & t->GetBranchStatus("OrbitalInfo"); + GP = GP & t->GetBranchStatus("h20"); // Tracker @@ -1796,12 +2141,16 @@ t->SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); cout << "OrbitalInfo : set branch address OrbitalInfo"<SetBranchAddress("RunEntry", &irun); - cout << "SelectionList: set branch address RunEntry"<SetBranchAddress("EventEntry", &irunentry); - cout << "SelectionList: set branch address EventEntry"<SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri +// // t->SetBranchAddress("GPamela", GetPointerTo("GPamela")); + if(SELLI) t->SetBranchAddress("GPamela", GetPointerTo("GPamela")); + else gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri + + cout << "h20 : set branch address GPamela "<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) { + if(TRK2) { t->SetBranchAddress("TrkLevel2", GetPointerTo("TrkLevel2")); cout << "Tracker : set branch address TrkLevel2"<SetBranchAddress("TrkLevel1", GetPointerTo("TrkLevel1")); cout << "Tracker : set branch address TrkLevel1"<SetBranchAddress("TrkHough", GetPointerTo("TrkHough")); cout << "Tracker : set branch address TrkHough"<SetBranchAddress("OrbitalInfo", GetPointerTo("OrbitalInfo")); cout << "OrbitalInfo : set branch address OrbitalInfo"<SetBranchAddress("RunEntry", &irun); - cout << "SelectionList: set branch address RunEntry"<SetBranchAddress("EventEntry", &irunentry); - cout << "SelectionList: set branch address EventEntry"<SetBranchAddress("GPamela", GetPointerTo("GPamela")); + else gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri +// gp_obj->SetBranchAddress(t); //ho dovuto fare in maniera diversa dagli altri + cout << "h20 : set branch address GPamela "<SetBranchAddress("RunEntry",&irunt);//NEWNEW +// cout << "SelectionList: set branch address RunEntry"<SetBranchAddress("EventEntry",&irunentry); +// cout << "SelectionList: set branch address EventEntry"<Add(name); }; } + - if(R->GetNtrees()){ + if(RUN && R->GetNtrees()){ R->SetBranchAddress("RunInfo", GetPointerTo("RunInfo")); cout << "Run : set branch address RunInfo"<SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano cout << "Software : set branch address SoftInfo"<GetNtrees()]; + if(DBG){ + cout << "----------------------------------------------------"<GetEntries(); ii++){ + R->GetEntry(ii); + if(DBG){ + cout << ii<< "\t | "; + cout << R->GetTreeNumber()<< "\t |"; +// cout << R->GetChainOffset()<< "\t |"; + cout <ID<<"\t"; + cout <ID_RUN_FRAG<<"\t"; + cout <NEVENTS<< "\t"; + cout <RUNHEADER_TIME<<" <---> "<RUNTRAILER_TIME <<"\t"; + cout <RUNHEADER_OBT<<" <---> "<RUNTRAILER_OBT<<"\t"; + cout <GetTreeNumber()]=R->GetChainOffset(); + } + cout << "N.run = "<GetEntries()<SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano cout << "Software : set branch address SoftInfo"<GetEntries() <= 0 ) return(false); - // + // - // Int_t oldrun = irun; - Long64_t oldrun = irun; + // Int_t oldrun = irun; + Long64_t oldrun = irun; + + // -------------------------------------- + // if it is a full file (not preselected) + // -------------------------------------- + if(SELLI==0){ + + // + // the absolute time is necessary to relate the event with the run + // + if( !GetOrbitalInfo() && !ISGP){ + cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<absTime; - - - // - // the first time the routine is called, set run search from the beginning - // - if ( irun < 0LL ){ - irun = 0LL; - run->GetEntry(irun); - runfirstentry = 0LL; - runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); - if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; + ULong64_t abstime = 0; + if( GetOrbitalInfo() )abstime=GetOrbitalInfo()->absTime; + + + // + // the first time the routine is called, set run search from the beginning + // + if ( irun < 0LL ){ + irun = 0LL; + run->GetEntry(irun); + 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"<RUNHEADER_TIME; // BARBATRUCCO - // - if ( irun == run->GetEntries()-1LL && - !(abstime >= GetRunInfo()->RUNHEADER_TIME && - abstime <= GetRunInfo()->RUNTRAILER_TIME) + 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"<RUNHEADER_TIME; // BARBATRUCCO + // + if ( irun == run->GetEntries()-1LL && + !(abstime >= GetRunInfo()->RUNHEADER_TIME && + abstime <= GetRunInfo()->RUNTRAILER_TIME) ){ - irun = -1LL; - runfirstentry = 0LL; - runlastentry = -1LL; - }; - // modificato il controllo sull'aggiornamento del run, per evitare problemi - // dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) - // - bool fromfirst = true; - // - while ( !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1LL ){ + irun = -1LL; + irunt = -1LL; + runfirstentry = 0LL; + runlastentry = -1LL; + }; + // modificato il controllo sull'aggiornamento del run, per evitare problemi + // dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) + // + bool fromfirst = true; + // + 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); - runfirstentry = runlastentry; - if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL; - runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); + irun++; + run->GetEntry(irun); + runfirstentry = runlastentry; + if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL; + runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); // cout << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); - // printf(" abstime %u trailertime %u \n",abstime,GetRunInfo()->RUNTRAILER_TIME); - // printf(" IDRUN %u \n",GetRunInfo()->ID); - // + // printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); + // 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 && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)){ - printf(" resetting irun (it should NOT happen!!!)\n"); - fromfirst = false; - irun = 0; - run->GetEntry(irun); - runfirstentry = 0ULL; - runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); - if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; - }; - // - }; - // - if ( - !(abstime >= GetRunInfo()->RUNHEADER_TIME && - abstime <= GetRunInfo()->RUNTRAILER_TIME) - ) { - printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime); - return false; - } - // - if ( irun == oldrun || irun >= run->GetEntries() ) return(false); - // - // printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); - // - prevshift = 0; - cout << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetEntries()-1LL) && fromfirst && !(abstime >= GetRunInfo()->RUNHEADER_TIME && abstime <= GetRunInfo()->RUNTRAILER_TIME)){ + printf(" resetting irun (it should NOT happen!!!)\n"); + fromfirst = false; + irun = 0; + run->GetEntry(irun); + runfirstentry = 0ULL; + runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); + if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; + }; + // + }; + // + if ( + !(abstime >= GetRunInfo()->RUNHEADER_TIME && + abstime <= GetRunInfo()->RUNTRAILER_TIME) + ) { + printf(" Something very wrong here: cannot find RUN containing absolute time %llu \n",abstime); + return false; + } + // + if ( irun == oldrun || irun >= run->GetEntries() ) return(false); + // + // printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); + // + prevshift = 0; + cout << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetEntry(iev); + return(true); + }; + // ---------------------------------------------------- + // if it is a preselected file (there is SelectionList) + // NBNB - the event tree MUST be read first + // ---------------------------------------------------- + if(SELLI==1){ + sel_tree->GetEntry(iev); // cout << irun << " "<< irunentry << endl; - if(irun != oldrun){ - run->GetEntry(irun); - cout << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetEntry(irun); + cout << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetEntry(irun); + if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<absTime; + obt = GetOrbitalInfo()->OBT; + }else{ + abstime = GetRunInfo()->RUNHEADER_TIME; + obt = GetRunInfo()->RUNHEADER_OBT; + } + + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- // if it is a full file (not preselected) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 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; - } + // increment dead and live-time counters + // (only when reading a file not preselected) // --------------------------------------------------------------- - // the absolute time is necessary to relate the event with the run - // --------------------------------------------------------------- - 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"<dltime[0]; + totdltime[1]+=GetTrigLevel2()->dltime[1]; } - }; - - // ----------------------------------------------------------------------- - // if it is simulation, assigh abstime by hand (temporaneo!!!) - // ----------------------------------------------------------------------- - if(ISGP){ - abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO - obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO + totdltime[2]++; } + // bool fromfirst = true; // first loop over runs -// Bool_t hasfrag = false; -// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; -// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; // ------------------------------------------------------ // loop over runs to find the one that contains the event // ------------------------------------------------------ while ( ( - ( - !(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) +// ( +// !(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) +// ) + + !(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) // ERRORE!!! fa saltare i run con 1 evento + || + !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) ) - && irun < run_tree->GetEntries() ){ - + && irun < run_tree->GetEntries() ){ +// if( !(abstime >= GetRunInfo()->RUNHEADER_TIME &&abstime <= GetRunInfo()->RUNTRAILER_TIME) )cout << "ABS TIME "<RUNTRAILER_TIME <= GetRunInfo()->RUNHEADER_OBT && obt <= GetRunInfo()->RUNTRAILER_OBT) )cout << "OBT TIME "<< obt <<" "<< GetRunInfo()->RUNTRAILER_OBT << endl; +// if( GetRunInfo()->NEVENTS==0 )cout <<"GetRunInfo()->NEVENTS==0 "<NEVENTS-1-prevshift) ) cout << "irunentry > "<NEVENTS-1-prevshift << endl; + // - - - - - - - - - - - - - + // 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(SELLI==0){ if(fromfirst){ if(oldrun==irun){ /// decrement counters @@ -2225,9 +2627,9 @@ } totdltime[2]=1; //event counter } +// } - - irun++; + irun++; // ------------------------------------ // if the end of run tree is reached... // ------------------------------------ @@ -2255,7 +2657,8 @@ if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; irunentry = 0; prevshift = 0; - run_tree->GetEntry(irun); + run_tree->GetEntry(irun);//update runinfo + irunt = irun - irunoffset[run_tree->GetTreeNumber()]; 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 // -------------------------------------- @@ -2348,11 +2701,78 @@ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- // if it is a preselected file (there is SelectionList) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- + // irun = run entry relative to the chain + // irunt = run entry relative to the tree if(SELLI==1){ - sel_tree->GetEntry(iev); - if(irun != oldrun){ - run_tree->GetEntry(irun); - cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" irun "<GetEntry(iev);// read irunt from SelectionList + irun = irunt + irunoffset[sel_tree->GetTreeNumber()];//NEWNEW + if(irun != oldrun ){ + if( irun < run_tree->GetEntries() )run_tree->GetEntry(irun); + // check if the time is ok (with merged files it is not...) + // if not loop over run and look for the proper entry + bool SECONDO_GIRO=false; + // Long64_t irun_start = irun; + int offset_start = irunoffset[sel_tree->GetTreeNumber()]; + while ( + ( + ( + !(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 + ) +// && irun < run_tree->GetEntries() + ){ + + if(DBG){ + cout << " (test) "; + cout << " tree "<GetTreeNumber(); + cout << " irunt "<GetTreeNumber()]; + cout << " abs "<> "<RUNHEADER_TIME<<" "<RUNTRAILER_TIME; + cout << " obt "<> "<RUNHEADER_OBT<<" "<RUNTRAILER_OBT; + cout << " *** JUMP RUN *** irun "<GetTreeNumber()]++; + irun = irunt + irunoffset[sel_tree->GetTreeNumber()];//NEWNEW + if(irun == run_tree->GetEntries() && SECONDO_GIRO){ +// if(irun == irun_start ){ + cout << " ...grrrvzzkhhhajsdkj!!!! "<GetTreeNumber()] = offset_start; + return false; + } + if( irun >= run_tree->GetEntries() || irun < 0){ + cout << "irun = "<> search from the beginning... <<"<GetTreeNumber()]=-irunt; + } + run_tree->GetEntry(irun); + } + + + if(DBG){ + cout << " (test) "; + cout << " tree "<GetTreeNumber(); + cout << " irunt "<GetTreeNumber()]; + cout << " abs "<> "<RUNHEADER_TIME<<" "<RUNTRAILER_TIME; + cout << " obt "<> "<RUNHEADER_OBT<<" "<RUNTRAILER_OBT; + } + cout << endl; + cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<ID<<" (run-entry "< "; + 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 "; @@ -2508,7 +2960,7 @@ - cout << "void PamLevel2::GetWhichTrees(TFile* f) --- WARNING!! --- ...potrebbe non funzionare "<GetName()<GetName()<IsZombie() ){ cout << "File: "<< f->GetName() <<" Non valid root file"<< endl; return; @@ -2613,7 +3066,7 @@ TRK2 = false; TRKh = false; }else nev=nevt; - T->Delete(); +// T->Delete(); }; //========================================================= if( !strcmp(key->GetName(),"Calorimeter" ) ){ @@ -2629,26 +3082,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<< "tree/branch list from 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 ; @@ -2677,12 +3140,13 @@ 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; Bool_t SELLI__ok = false; - cout << "Checking file: "<IsZombie() ){ cout << "File: "<< f->GetName() <<" discarded ---- Non valid root file"<< endl; return false; @@ -2708,6 +3172,9 @@ // return false; // }; + //========================================================= + // check if the file + if( !strcmp(key->GetName(),"Run" ) )RUN__ok = true; @@ -2834,6 +3301,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() <<" *WARNING* ---- Missing RunInfo tree"<< endl; -// return false; + cout << "File: "<< f->GetName() <<" *WARNING* ---- Missing RunInfo tree (NB: RUN infos will not be updated)"<< endl; + RUN = false; }; if(CAL1 && !CAL1__ok){ @@ -2923,6 +3403,10 @@ cout << "File: "<< f->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(); @@ -2941,6 +3425,7 @@ // if(ND)cout<<"ND "; // if(S4)cout<<"S4 "; // if(ORB)cout<<"ORB "; +// if(GP)cout<<"GP "; // cout << endl; return true; @@ -2993,6 +3478,7 @@ // if the pointer is null, create a default file + if(!run_tree)return; if(!ofile){ cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<GetEntries(); i++){ run_tree->GetEntry(i); - cout << i<< "\t | "<ID<<"\t "<NEVENTS<< "\t "<RUNHEADER_TIME<<" <---> "<RUNTRAILER_TIME<ID<<"\t "<NEVENTS<< "\t "<RUNHEADER_TIME<<" <---> "<RUNTRAILER_TIME<Fill(); } cout << "----------------------------------------------------"<Branch("RunEntry",&irun,"runentry/L"); +// sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); + sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); @@ -3110,6 +3597,13 @@ cout << "OrbitalInfo : branch OrbitalInfo"<Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split + cout << "OrbitalInfo : branch OrbitalInfo"<IsConnected())){ - cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<IsConnected() )return NULL; -// cout<<"...done"<IsConnected()))SetDBConnection(); GL_ROOT glroot = GL_ROOT(); if( glroot.Query_GL_ROOT(iroot,dbc) ){ cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<Close(); // EMILIANO, do not leave open connections, open only when needed + + }; - 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 "<IsConnected()))SetDBConnection(); TrkParams::SetCalib(run_obj,dbc); TrkParams::LoadCalib( ); if( !TrkParams::CalibIsLoaded() ){ cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<Close(); // EMILIANO, do not leave open connections, open only when needed } + // cout << l0_tree << endl; - return l0_tree; } @@ -3431,7 +3918,7 @@ Int_t answer = 0; Int_t shift =0; // printf(" siamo qui %i %i \n",shift,prevshift); - Int_t maxshift = 10; + // Int_t maxshift = 50; // EMILIANO do{ if(shift>0){ cout << " PKTNUM L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<ID); // if ( prevshift != 0 && (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ){ - prevshift = 0; - shift = -1; + prevshift = 0; + shift = -1; }; }while( ( obt != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || @@ -3484,15 +3971,21 @@ */ Bool_t PamLevel2::SetDBConnection(){ - cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<IsConnected() )return false; - cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<Query(myquery.str().c_str()); // EMILIANO + if(DBG)cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<