308 |
if(t)trk_track = t; |
if(t)trk_track = t; |
309 |
if(c)calo_track = c; |
if(c)calo_track = c; |
310 |
if(o)tof_track = o; |
if(o)tof_track = o; |
311 |
if(r)orb_track = r; |
if(r) orb_track = r; |
312 |
candeleteobj = 0; |
|
313 |
|
candeleteobj = 0; |
314 |
|
|
315 |
}; |
}; |
316 |
PamTrack::PamTrack(const PamTrack& track){ |
PamTrack::PamTrack(const PamTrack& track){ |
449 |
irunt = -1LL; |
irunt = -1LL; |
450 |
runfirstentry = 0LL; |
runfirstentry = 0LL; |
451 |
runlastentry = 0LL; |
runlastentry = 0LL; |
452 |
|
gltsync = 0; // Emiliano |
453 |
|
|
454 |
l0_file = NULL; |
l0_file = NULL; |
455 |
l0_tree = NULL; |
l0_tree = NULL; |
559 |
dbc->Close(); |
dbc->Close(); |
560 |
delete dbc; |
delete dbc; |
561 |
} |
} |
562 |
|
|
563 |
|
if ( gltsync ) delete gltsync; |
564 |
|
|
565 |
if(l0_file)l0_file->Close(); |
if(l0_file)l0_file->Close(); |
566 |
// if(pam_tree)pam_tree->Delete();; |
// if(pam_tree)pam_tree->Delete();; |
740 |
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
741 |
if(s4_obj && s4_obj->unpackError != 0) goodev = false; |
if(s4_obj && s4_obj->unpackError != 0) goodev = false; |
742 |
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
743 |
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; |
744 |
// if(orb_obj) |
// if(orb_obj) |
745 |
} else { |
} else { |
746 |
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
747 |
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; |
748 |
}; |
}; |
749 |
return(goodev); |
return(goodev); |
750 |
}; |
}; |
812 |
if(!ac_obj) ac_obj = new AcLevel2(); |
if(!ac_obj) ac_obj = new AcLevel2(); |
813 |
return &ac_obj; |
return &ac_obj; |
814 |
}; |
}; |
815 |
if(!objname.CompareTo("OrbitalInfo")){ |
if(!objname.CompareTo("OrbitalInfo")) { |
816 |
if(!orb_obj) orb_obj = new OrbitalInfo(); |
if(!orb_obj){ |
817 |
|
orb_obj = new OrbitalInfo(); |
818 |
|
orb_obj->Set(); |
819 |
|
} |
820 |
return &orb_obj; |
return &orb_obj; |
821 |
}; |
}; |
822 |
|
// if(!objname.CompareTo("OrbitalInfo")){ |
823 |
|
// if(!orb_obj) orb_obj = new OrbitalInfo(); |
824 |
|
// return &orb_obj; |
825 |
|
// }; |
826 |
if(!objname.CompareTo("GPamela")){ |
if(!objname.CompareTo("GPamela")){ |
827 |
if(!gp_obj) gp_obj = new GPamela(); |
if(!gp_obj) gp_obj = new GPamela(); |
828 |
return &gp_obj; |
return &gp_obj; |
911 |
|
|
912 |
if( !orb_obj )return 0; |
if( !orb_obj )return 0; |
913 |
|
|
914 |
|
|
915 |
if( orb_obj->OrbitalInfo::ntrk()==0 ){ |
if( orb_obj->OrbitalInfo::ntrk()==0 ){ |
916 |
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no OrbitalInfo tracks are stored"<<endl; |
// // TRICK BEGIN |
917 |
return NULL; |
// OrbitalInfoTrkVar *r = new OrbitalInfoTrkVar(); // TEMPORARY TRICK |
918 |
|
// Int_t nn = 0; |
919 |
|
// TClonesArray &tor = *orb_obj->OrbitalInfoTrk; |
920 |
|
// for(Int_t nt=0; nt < tof_obj->ToFLevel2::ntrk(); nt++){ |
921 |
|
// // |
922 |
|
// ToFTrkVar *ptt = tof_obj->ToFLevel2::GetToFTrkVar(nt); |
923 |
|
// if ( ptt->trkseqno != -1 ){ |
924 |
|
// // |
925 |
|
// r->trkseqno = ptt->trkseqno; |
926 |
|
// // |
927 |
|
// r->Eij = 0; |
928 |
|
// // |
929 |
|
// r->Sij = 0; |
930 |
|
// // |
931 |
|
// r->pitch = -1000.; |
932 |
|
// // |
933 |
|
// r->cutoff = -1000.; |
934 |
|
// // |
935 |
|
// new(tor[nn]) OrbitalInfoTrkVar(*r); |
936 |
|
// nn++; |
937 |
|
// // |
938 |
|
// r->Clear(); |
939 |
|
// // |
940 |
|
// }; |
941 |
|
// }; |
942 |
|
// delete r; |
943 |
|
// OrbitalInfoTrkVar *c = 0; |
944 |
|
// c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(0); |
945 |
|
// return c; |
946 |
|
// //TRICK END |
947 |
|
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no OrbitalInfo tracks are stored"<<endl; |
948 |
|
return NULL; |
949 |
}; |
}; |
950 |
|
|
951 |
OrbitalInfoTrkVar *c = 0; |
OrbitalInfoTrkVar *c = 0; |
1707 |
if(ORB)cout<<"ORB "; |
if(ORB)cout<<"ORB "; |
1708 |
if(GP)cout<<"GP "; |
if(GP)cout<<"GP "; |
1709 |
cout << endl; |
cout << endl; |
1710 |
if(SELLI)cout<<">>> Found selection-list <<<"<<endl; |
if(SELLI && SELLI!=2)cout<<">>> Found selection-list <<<"<<endl; //EMILIANO |
1711 |
|
|
1712 |
f->cd(); |
f->cd(); |
1713 |
|
|
2635 |
prevshift = 0; |
prevshift = 0; |
2636 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
2637 |
if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<<endl; |
if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<<endl; |
2638 |
|
if ( gltsync ) delete gltsync; //Emiliano |
2639 |
|
if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano |
2640 |
|
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc,false); //Emiliano // the "false" means not to use level0 file (not necessary here) |
2641 |
|
if ( dbc ) dbc->Close();// Emiliano |
2642 |
}; |
}; |
2643 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
2644 |
// retrieve OBT and absolute time of the event |
// retrieve OBT and absolute time of the event |
2645 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
2646 |
ULong64_t abstime = 0LL; |
ULong64_t abstime = 0LL; |
2647 |
ULong64_t obt = 0LL; |
// ULong64_t obt = 0LL; // Emiliano |
2648 |
|
Long64_t obt = 0LL; // Emiliano, Long64_t GL_TIMESYNC::DBobt(UInt_t obt) since depending on the situation OBT is lowered or boosted |
2649 |
if( GetOrbitalInfo() ){ |
if( GetOrbitalInfo() ){ |
2650 |
abstime = GetOrbitalInfo()->absTime; |
abstime = GetOrbitalInfo()->absTime; |
2651 |
obt = GetOrbitalInfo()->OBT; |
obt = gltsync->DBobt(GetOrbitalInfo()->OBT); // Emiliano |
2652 |
}else{ |
}else{ |
2653 |
abstime = GetRunInfo()->RUNHEADER_TIME; |
abstime = GetRunInfo()->RUNHEADER_TIME; |
2654 |
obt = GetRunInfo()->RUNHEADER_OBT; |
obt = gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT); // Emiliano |
2655 |
} |
} |
2656 |
|
|
2657 |
|
|
2658 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2659 |
// if it is a full file (not preselected) |
// if it is a full file (not preselected) |
2660 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2661 |
if(SELLI==0){ |
if(SELLI==0 || SELLI==2){ // Emiliano |
2662 |
|
|
2663 |
// --------------------------------------------------------------- |
// --------------------------------------------------------------- |
2664 |
// increment dead and live-time counters |
// increment dead and live-time counters |
2691 |
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2692 |
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2693 |
|| |
|| |
2694 |
!(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
!(obt >= gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT) && // additional check on OBT (ms) // Emiliano |
2695 |
obt <= GetRunInfo()->RUNTRAILER_OBT) |
obt <= gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT)) // Emiliano |
2696 |
|| |
|| |
2697 |
GetRunInfo()->NEVENTS==0 |
GetRunInfo()->NEVENTS==0 |
2698 |
// || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento |
// || !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) // ERRORE!!! fa saltare i run con 1 evento |
2715 |
// store dead and live-time of previous run |
// store dead and live-time of previous run |
2716 |
// ----------------------------------------- |
// ----------------------------------------- |
2717 |
// if(SELLI==0){ |
// if(SELLI==0){ |
2718 |
|
if(SELLI!=2){ |
2719 |
if(fromfirst){ |
if(fromfirst){ |
2720 |
if(oldrun==irun){ |
if(oldrun==irun){ |
2721 |
/// decrement counters |
/// decrement counters |
2745 |
} |
} |
2746 |
totdltime[2]=1; //event counter |
totdltime[2]=1; //event counter |
2747 |
} |
} |
2748 |
// } |
} |
2749 |
|
// } |
2750 |
|
|
2751 |
irun++; |
irun++; |
2752 |
// ------------------------------------ |
// ------------------------------------ |
2778 |
prevshift = 0; |
prevshift = 0; |
2779 |
run_tree->GetEntry(irun);//update runinfo |
run_tree->GetEntry(irun);//update runinfo |
2780 |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
2781 |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
if ( gltsync ) delete gltsync; // Emiliano |
2782 |
|
if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano |
2783 |
|
gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); // Emiliano |
2784 |
|
if ( dbc ) dbc->Close(); // Emiliano |
2785 |
|
if(gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT)>gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ){ // Emiliano |
2786 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
2787 |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
2788 |
} |
} |
3648 |
// ------------------------------------ |
// ------------------------------------ |
3649 |
// add branch with dead and live times |
// add branch with dead and live times |
3650 |
// ------------------------------------ |
// ------------------------------------ |
3651 |
run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l"); |
if ( SELLI != 2 ){ // EMILIANO |
3652 |
cout << "Run : branch DeadLiveTime"<<endl; |
run_tree_clone->Branch("DeadLiveTime",totdltime,"dltime[3]/l"); |
3653 |
|
cout << "Run : branch DeadLiveTime"<<endl; |
3654 |
|
|
3655 |
|
|
3656 |
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
sel_tree_clone = new TTree("SelectionList","List of selected events "); |
3657 |
// sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
// sel_tree_clone->Branch("RunEntry",&irun,"runentry/L"); |
3658 |
sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW |
sel_tree_clone->Branch("RunEntry",&irunt,"runentry/L");//NEWNEW |
3659 |
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); |
sel_tree_clone->Branch("EventEntry",&irunentry,"eventry/L"); |
3660 |
|
}; |
3661 |
|
|
3662 |
Int_t i=0; |
Int_t i=0; |
3663 |
if(TRK1||TRK2||TRKh){ |
if(TRK1||TRK2||TRKh){ |
3730 |
}; |
}; |
3731 |
// OrbitalInfo |
// OrbitalInfo |
3732 |
if(ORB) { |
if(ORB) { |
3733 |
pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA oribital info "); |
pam_tree_clone[i] = new TTree("OrbitalInfo","PAMELA orbital info "); |
3734 |
pam_tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
pam_tree_clone[i]->Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); |
3735 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3736 |
i++; |
i++; |
3737 |
}; |
}; |
3738 |
// GPamela |
// GPamela |
3739 |
if(GP) { |
if(GP) { |
3740 |
pam_tree_clone[i] = new TTree("h20","PAMELA oribital info "); |
pam_tree_clone[i] = new TTree("h20","PAMELA orbital info "); |
3741 |
pam_tree_clone[i]->Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split |
pam_tree_clone[i]->Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split |
3742 |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
cout << "OrbitalInfo : branch OrbitalInfo"<<endl; |
3743 |
i++; |
i++; |
3787 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
3788 |
cout << "Write clones of PAMELA trees "<<endl; |
cout << "Write clones of PAMELA trees "<<endl; |
3789 |
cout << run_tree_clone->GetName()<<endl; |
cout << run_tree_clone->GetName()<<endl; |
3790 |
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
if ( SELLI != 2){// Emiliano |
3791 |
|
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
3792 |
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
3793 |
|
}; |
3794 |
run_tree_clone->Write(); |
run_tree_clone->Write(); |
3795 |
cout << sel_tree_clone->GetName()<<endl; |
if ( SELLI != 2){ //Emiliano |
3796 |
sel_tree_clone->Write(); |
cout << sel_tree_clone->GetName()<<endl; |
3797 |
|
sel_tree_clone->Write(); |
3798 |
|
}; |
3799 |
for(Int_t i=0; i<NCLONES; i++){ |
for(Int_t i=0; i<NCLONES; i++){ |
3800 |
if(pam_tree_clone[i]){ |
if(pam_tree_clone[i]){ |
3801 |
cout << pam_tree_clone[i]->GetName()<<endl; |
cout << pam_tree_clone[i]->GetName()<<endl; |
3856 |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
3857 |
// Bool_t UPDATED = UpdateRunInfo(ii); |
// Bool_t UPDATED = UpdateRunInfo(ii); |
3858 |
UpdateRunInfo(ii); |
UpdateRunInfo(ii); |
3859 |
if(SELLI==0)irunentry = iee-runfirstentry; |
if(SELLI==0||SELLI==2)irunentry = iee-runfirstentry; |
3860 |
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
// if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
3861 |
|
|
3862 |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |