2532 |
if( GetOrbitalInfo() ){ |
if( GetOrbitalInfo() ){ |
2533 |
abstime = GetOrbitalInfo()->absTime; |
abstime = GetOrbitalInfo()->absTime; |
2534 |
obt = GetOrbitalInfo()->OBT; |
obt = GetOrbitalInfo()->OBT; |
|
// cout << " ABS >>> "<<abstime<<" OBT >>> "<<obt<<" "<<endl; |
|
2535 |
}else{ |
}else{ |
2536 |
abstime = GetRunInfo()->RUNHEADER_TIME; |
abstime = GetRunInfo()->RUNHEADER_TIME; |
2537 |
obt = GetRunInfo()->RUNHEADER_OBT; |
obt = GetRunInfo()->RUNHEADER_OBT; |
2538 |
} |
} |
|
// cout << ISGP << " "<<abstime<<endl; |
|
|
// --------------------------------------------------------------- |
|
|
// 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 "<<endl; |
|
|
// return(false); |
|
|
// } |
|
|
// ----------------------------------------------------------------------- |
|
|
// if it is simulation, assign abstime by hand (temporaneo!!!) |
|
|
// ----------------------------------------------------------------------- |
|
|
// if(ISGP){ |
|
|
// abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
|
|
// obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO |
|
|
// } |
|
2539 |
|
|
2540 |
|
|
2541 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
2554 |
} |
} |
2555 |
totdltime[2]++; |
totdltime[2]++; |
2556 |
} |
} |
|
// cout << setw(10)<<totdltime[0]<<setw(10)<<totdltime[1]<<setw(10)<<totdltime[2]<<endl; |
|
2557 |
|
|
|
// // --------------------------------------------------------------- |
|
|
// // retrieve OBT and absolute time of the event |
|
|
// // --------------------------------------------------------------- |
|
|
// ULong64_t abstime = 0; |
|
|
// ULong64_t obt = 0; |
|
|
// if( GetOrbitalInfo() ){ |
|
|
// abstime = GetOrbitalInfo()->absTime; |
|
|
// obt = GetOrbitalInfo()->OBT; |
|
|
// } |
|
|
// // --------------------------------------------------------------- |
|
|
// // 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 "<<endl; |
|
|
// return(false); |
|
|
// } |
|
|
|
|
|
// // ----------------------------------------------------------------------- |
|
|
// // the first time the routine is called, set run search from the beginning |
|
|
// // ----------------------------------------------------------------------- |
|
|
// if ( irun < 0 ){ |
|
|
// irun = 0LL; |
|
|
// irunt = 0LL; |
|
|
// irunentry = 0; |
|
|
// prevshift = 0; |
|
|
// run_tree->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"<<endl; |
|
|
// } |
|
|
// }; |
|
|
|
|
|
// // ----------------------------------------------------------------------- |
|
|
// // if it is simulation, assign abstime by hand (temporaneo!!!) |
|
|
// // ----------------------------------------------------------------------- |
|
|
// if(ISGP){ |
|
|
// abstime = GetRunInfo()->RUNHEADER_TIME; // BARBATRUCCO |
|
|
// obt = GetRunInfo()->RUNHEADER_OBT; // BARBATRUCCO |
|
|
// } |
|
2558 |
// |
// |
2559 |
bool fromfirst = true; // first loop over runs |
bool fromfirst = true; // first loop over runs |
2560 |
|
|
|
// 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; |
|
2561 |
|
|
2562 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
2563 |
// loop over runs to find the one that contains the event |
// loop over runs to find the one that contains the event |
2564 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
2565 |
while ( |
while ( |
2566 |
( |
( |
2567 |
( |
// ( |
2568 |
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
// !(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2569 |
abstime <= GetRunInfo()->RUNTRAILER_TIME) && |
// abstime <= GetRunInfo()->RUNTRAILER_TIME) && |
2570 |
!(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
// !(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2571 |
obt <= GetRunInfo()->RUNTRAILER_OBT) |
// obt <= GetRunInfo()->RUNTRAILER_OBT) |
2572 |
) |
// ) |
2573 |
|| GetRunInfo()->NEVENTS==0 |
|
2574 |
|
!(abstime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
2575 |
|
abstime <= GetRunInfo()->RUNTRAILER_TIME) |
2576 |
|
|| |
2577 |
|
!(obt >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
2578 |
|
obt <= GetRunInfo()->RUNTRAILER_OBT) |
2579 |
|
|| |
2580 |
|
GetRunInfo()->NEVENTS==0 |
2581 |
// || !(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 |
2582 |
|| !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) |
|| |
2583 |
|
!(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) |
2584 |
) |
) |
2585 |
&& irun < run_tree->GetEntries() ){ |
&& irun < run_tree->GetEntries() ){ |
2586 |
|
|
2587 |
|
|
2588 |
|
// if( !(abstime >= GetRunInfo()->RUNHEADER_TIME &&abstime <= GetRunInfo()->RUNTRAILER_TIME) )cout << "ABS TIME "<<abstime << " " <<GetRunInfo()->RUNTRAILER_TIME <<endl; |
2589 |
|
// if( !(obt >= GetRunInfo()->RUNHEADER_OBT && obt <= GetRunInfo()->RUNTRAILER_OBT) )cout << "OBT TIME "<< obt <<" "<< GetRunInfo()->RUNTRAILER_OBT << endl; |
2590 |
|
// if( GetRunInfo()->NEVENTS==0 )cout <<"GetRunInfo()->NEVENTS==0 "<<endl; |
2591 |
|
// if( !(irunentry <= GetRunInfo()->NEVENTS-1-prevshift) ) cout << "irunentry > "<<GetRunInfo()->NEVENTS-1-prevshift << endl; |
2592 |
// - - - - - - - - - - - - - |
// - - - - - - - - - - - - - |
2593 |
// irunentry = position of current entry, relative to the run |
// irunentry = position of current entry, relative to the run |
2594 |
// prevshift = shift needed to synchronize l0 and l2 data (nested events) |
// prevshift = shift needed to synchronize l0 and l2 data (nested events) |
2598 |
// store dead and live-time of previous run |
// store dead and live-time of previous run |
2599 |
// ----------------------------------------- |
// ----------------------------------------- |
2600 |
// if(SELLI==0){ |
// if(SELLI==0){ |
2601 |
if(fromfirst){ |
if(fromfirst){ |
2602 |
if(oldrun==irun){ |
if(oldrun==irun){ |
2603 |
/// decrement counters |
/// decrement counters |
2604 |
if( GetTrigLevel2()){ |
if( GetTrigLevel2()){ |
2605 |
totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time |
totdltime[0]-=GetTrigLevel2()->dltime[0];//live-time |
2606 |
totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time |
|
} |
|
|
totdltime[2]--; //event counter |
|
|
cout << endl; |
|
|
cout << "n.events : "<<totdltime[2]<<endl; |
|
|
cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
|
|
cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
|
|
}else{ |
|
|
totdltime[0]=0;//live-time |
|
|
totdltime[1]=0;//dead-time |
|
|
totdltime[2]=0; //event counter |
|
|
cout << " *** JUMP RUN *** irun "<<irun<<endl; |
|
|
} |
|
|
/// add an entry |
|
|
if(run_tree_clone) |
|
|
if(run_tree_clone->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 |
|
2607 |
} |
} |
2608 |
totdltime[2]=1; //event counter |
totdltime[2]--; //event counter |
2609 |
|
cout << endl; |
2610 |
|
cout << "n.events : "<<totdltime[2]<<endl; |
2611 |
|
cout << "RUN LIVE-TIME: "<<totdltime[0]*0.16<<" ms"<<endl; |
2612 |
|
cout << "RUN DEAD-TIME: "<<totdltime[1]*0.01<<" ms"<<endl; |
2613 |
|
}else{ |
2614 |
|
totdltime[0]=0;//live-time |
2615 |
|
totdltime[1]=0;//dead-time |
2616 |
|
totdltime[2]=0; //event counter |
2617 |
|
cout << " *** JUMP RUN *** irun "<<irun<<endl; |
2618 |
|
} |
2619 |
|
/// add an entry |
2620 |
|
if(run_tree_clone) |
2621 |
|
if(run_tree_clone->GetBranch("DeadLiveTime")->GetEntries() < run_tree->GetEntries()) |
2622 |
|
run_tree_clone->GetBranch("DeadLiveTime")->Fill(); |
2623 |
|
/// reset counters |
2624 |
|
if( GetTrigLevel2() ){ |
2625 |
|
totdltime[0]=GetTrigLevel2()->dltime[0];//live-time |
2626 |
|
totdltime[1]=0; //dead-time |
2627 |
} |
} |
2628 |
|
totdltime[2]=1; //event counter |
2629 |
|
} |
2630 |
// } |
// } |
2631 |
|
|
2632 |
irun++; |
irun++; |
2657 |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
2658 |
irunentry = 0; |
irunentry = 0; |
2659 |
prevshift = 0; |
prevshift = 0; |
2660 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun);//update runinfo |
2661 |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
irunt = irun - irunoffset[run_tree->GetTreeNumber()]; |
2662 |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
2663 |
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; |
2680 |
// -------------------------------------- |
// -------------------------------------- |
2681 |
|
|
2682 |
|
|
|
|
|
|
|
|
2683 |
// -------------------------------------- |
// -------------------------------------- |
2684 |
// ---> exit with TRUE |
// ---> exit with TRUE |
2685 |
// -------------------------------------- |
// -------------------------------------- |