--- PamelaLevel2/src/PamLevel2.cpp 2008/12/11 10:41:38 1.71 +++ PamelaLevel2/src/PamLevel2.cpp 2008/12/16 12:43:08 1.74 @@ -449,6 +449,7 @@ irunt = -1LL; runfirstentry = 0LL; runlastentry = 0LL; + gltsync = 0; // Emiliano l0_file = NULL; l0_tree = NULL; @@ -558,6 +559,8 @@ dbc->Close(); delete dbc; } + + if ( gltsync ) delete gltsync; if(l0_file)l0_file->Close(); // if(pam_tree)pam_tree->Delete();; @@ -737,11 +740,11 @@ 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 != 0 || ((ac_obj->status[0]>>3)&1) || ((ac_obj->status[0]>>3)&1)) ) goodev = false; + if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>2)&1) || ((ac_obj->status[1]>>2)&1)) ) goodev = false; // if(orb_obj) } else { if(nd_obj && nd_obj->unpackError != 0) goodev = false; - if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>3)&1) || ((ac_obj->status[0]>>3)&1)) ) goodev = false; + if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>2)&1) || ((ac_obj->status[1]>>2)&1)) ) goodev = false; }; return(goodev); }; @@ -1704,7 +1707,7 @@ if(ORB)cout<<"ORB "; if(GP)cout<<"GP "; cout << endl; - if(SELLI)cout<<">>> Found selection-list <<<"<>> Found selection-list <<<"<cd(); @@ -2632,25 +2635,30 @@ prevshift = 0; run_tree->GetEntry(irun); if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<IsConnected()) )SetDBConnection(); //Emiliano + gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); //Emiliano + if ( dbc ) dbc->Close();// Emiliano }; // --------------------------------------------------------------- // retrieve OBT and absolute time of the event // --------------------------------------------------------------- ULong64_t abstime = 0LL; - ULong64_t obt = 0LL; + // ULong64_t obt = 0LL; // Emiliano + Long64_t obt = 0LL; // Emiliano, Long64_t GL_TIMESYNC::DBobt(UInt_t obt) since depending on the situation OBT is lowered or boosted if( GetOrbitalInfo() ){ abstime = GetOrbitalInfo()->absTime; - obt = GetOrbitalInfo()->OBT; + obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano }else{ abstime = GetRunInfo()->RUNHEADER_TIME; - obt = GetRunInfo()->RUNHEADER_OBT; + obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano } // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- // if it is a full file (not preselected) // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - if(SELLI==0){ + if(SELLI==0 || SELLI==2){ // Emiliano // --------------------------------------------------------------- // increment dead and live-time counters @@ -2683,8 +2691,8 @@ !(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) + !(obt >= gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) && // additional check on OBT (ms) // Emiliano + obt <= gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) // Emiliano || GetRunInfo()->NEVENTS==0 // || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento @@ -2707,6 +2715,7 @@ // store dead and live-time of previous run // ----------------------------------------- // if(SELLI==0){ + if(SELLI!=2){ if(fromfirst){ if(oldrun==irun){ /// decrement counters @@ -2736,7 +2745,8 @@ } totdltime[2]=1; //event counter } -// } + } + // } irun++; // ------------------------------------ @@ -2768,7 +2778,11 @@ prevshift = 0; run_tree->GetEntry(irun);//update runinfo irunt = irun - irunoffset[run_tree->GetTreeNumber()]; - if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ + if ( gltsync ) delete gltsync; // Emiliano + if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano + gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); // Emiliano + if ( dbc ) dbc->Close(); // Emiliano + if(gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT)>gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ){ // Emiliano cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<=RUNTRAILER_OBT " <Branch("DeadLiveTime",totdltime,"dltime[3]/l"); - cout << "Run : branch DeadLiveTime"<Branch("DeadLiveTime",totdltime,"dltime[3]/l"); + cout << "Run : branch DeadLiveTime"<Branch("RunEntry",&irun,"runentry/L"); - sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW - sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); - + sel_tree_clone = new TTree("SelectionList","List of selected events "); + // 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"); + }; Int_t i=0; if(TRK1||TRK2||TRKh){ @@ -3715,14 +3730,14 @@ }; // OrbitalInfo if(ORB) { - pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); + pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA orbital info "); pam_tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); cout << "OrbitalInfo : branch OrbitalInfo"<Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split cout << "OrbitalInfo : branch OrbitalInfo"<GetName()<GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) + if ( SELLI != 2){// Emiliano + if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) run_tree_clone->GetBranch("DeadLiveTime")->Fill(); + }; run_tree_clone->Write(); - cout << sel_tree_clone->GetName()<Write(); + if ( SELLI != 2){ //Emiliano + cout << sel_tree_clone->GetName()<Write(); + }; for(Int_t i=0; iGetName()<Fill(); // cout << "PamLevel2::GetEntry("<