103 |
|
|
104 |
h0_obj = 0; |
h0_obj = 0; |
105 |
trk0_obj = 0; |
trk0_obj = 0; |
106 |
|
calo0_obj = 0; |
107 |
|
|
108 |
trk2_obj = 0; |
trk2_obj = 0; |
109 |
trk1_obj = 0; |
trk1_obj = 0; |
127 |
l0_tree = NULL; |
l0_tree = NULL; |
128 |
iroot = -1; |
iroot = -1; |
129 |
dbc = 0; |
dbc = 0; |
130 |
|
|
131 |
|
prevshift = 0; |
132 |
|
|
133 |
irun = -1; |
irun = -1; |
134 |
run_tree = NULL; |
run_tree = NULL; |
191 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
192 |
if(h0_obj) delete h0_obj; |
if(h0_obj) delete h0_obj; |
193 |
if(trk0_obj) delete trk0_obj; |
if(trk0_obj) delete trk0_obj; |
194 |
|
if(calo0_obj) delete calo0_obj; |
195 |
if(trk1_obj) delete trk1_obj; |
if(trk1_obj) delete trk1_obj; |
196 |
if(trk2_obj) delete trk2_obj; |
if(trk2_obj) delete trk2_obj; |
197 |
if(trkh_obj) delete trkh_obj; |
if(trkh_obj) delete trkh_obj; |
246 |
|
|
247 |
if(h0_obj) h0_obj->Clear(); |
if(h0_obj) h0_obj->Clear(); |
248 |
if(trk0_obj) trk0_obj->Clear(); |
if(trk0_obj) trk0_obj->Clear(); |
249 |
|
if(calo0_obj) calo0_obj->Clear(); |
250 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
251 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
252 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
1537 |
irun = 0; |
irun = 0; |
1538 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1539 |
runfirstentry = 0ULL; |
runfirstentry = 0ULL; |
1540 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
1541 |
|
if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runlastentry -= 1ULL; |
1542 |
return(true); |
return(true); |
1543 |
}; |
}; |
1544 |
|
|
1548 |
} |
} |
1549 |
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
1550 |
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
1551 |
while ( GetOrbitalInfo()->absTime > GetRunInfo()->RUNTRAILER_TIME && irun < run->GetEntries() ){ |
// |
1552 |
|
bool fromfirst = true; |
1553 |
|
// |
1554 |
|
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){ |
1555 |
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
|
1556 |
irun++; |
irun++; |
1557 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1558 |
runfirstentry = runlastentry+1ULL; |
runfirstentry = runlastentry; |
1559 |
|
if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runfirstentry += 1ULL; |
1560 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
1561 |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
1562 |
|
// printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); |
1563 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
1564 |
|
// |
1565 |
|
prevshift = 0; |
1566 |
|
// |
1567 |
|
if ( irun == run->GetEntries()-1 && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ |
1568 |
|
printf(" resetting irun \n"); |
1569 |
|
fromfirst = false; |
1570 |
|
irun = 0; |
1571 |
|
run->GetEntry(irun); |
1572 |
|
runfirstentry = 0ULL; |
1573 |
|
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
1574 |
|
if ( (ULong64_t)(this->GetRunInfo()->NEVENTS) > 0ULL ) runlastentry -= 1ULL; |
1575 |
|
}; |
1576 |
|
// |
1577 |
}; |
}; |
|
|
|
1578 |
// |
// |
1579 |
if |
if ( !fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) ) printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); |
1580 |
( irun == oldrun || irun >= run->GetEntries() ) return(false); |
// |
1581 |
|
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
1582 |
// |
// |
1583 |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
// printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry); |
1584 |
// |
// |
1592 |
sel_tree->GetEntry(iev); |
sel_tree->GetEntry(iev); |
1593 |
if(irun != oldrun){ |
if(irun != oldrun){ |
1594 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1595 |
|
prevshift = 0; |
1596 |
return true; |
return true; |
1597 |
} |
} |
1598 |
return false; |
return false; |
2413 |
// a problem if you don't check the return code of getentry. |
// a problem if you don't check the return code of getentry. |
2414 |
// |
// |
2415 |
if(!run_tree ){ |
if(!run_tree ){ |
2416 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1? |
2417 |
return 0; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
2418 |
|
return 0; |
2419 |
|
} else { |
2420 |
|
return 1; //cosi` se non c'e` run esce qua... |
2421 |
|
} |
2422 |
} |
} |
2423 |
|
|
2424 |
//------------------------------- |
//------------------------------- |
2504 |
l0_tree = (TTree*)l0_file->Get("Physics"); |
l0_tree = (TTree*)l0_file->Get("Physics"); |
2505 |
if(!h0_obj)h0_obj = new EventHeader(); |
if(!h0_obj)h0_obj = new EventHeader(); |
2506 |
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
2507 |
|
prevshift = 0; |
2508 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2509 |
// TRACKER: |
// TRACKER: |
2510 |
if(TRK0){ |
if(TRK0){ |
2517 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2518 |
// CALORIMETER: |
// CALORIMETER: |
2519 |
if(CAL0){ |
if(CAL0){ |
2520 |
cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
if(!calo0_obj){ |
2521 |
|
calo0_obj = new CaloLevel0(); |
2522 |
|
calo0_obj->Set(); |
2523 |
|
}; |
2524 |
|
l0_tree->SetBranchAddress("Calorimeter" ,calo0_obj->GetPointerToCalorimeterEvent()); |
2525 |
|
// cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
2526 |
} |
} |
2527 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2528 |
// TOF: |
// TOF: |
2536 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
2537 |
} |
} |
2538 |
|
|
2539 |
TrkParams::SetCalib(run_obj,dbc); |
if ( TRK0 ) TrkParams::SetCalib(run_obj,dbc); |
2540 |
|
|
2541 |
|
|
2542 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
2587 |
// --------------------------------------------------------------------- |
// --------------------------------------------------------------------- |
2588 |
Int_t answer = 0; |
Int_t answer = 0; |
2589 |
Int_t shift =0; |
Int_t shift =0; |
2590 |
|
// printf(" siamo qui %i %i \n",shift,prevshift); |
2591 |
do{ |
do{ |
2592 |
if(shift>0){ |
if(shift>0){ |
2593 |
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
2594 |
} |
} |
2595 |
answer = l0_tree->GetEntry(quellagiusta+shift); |
answer = l0_tree->GetEntry(quellagiusta+shift+prevshift); |
2596 |
shift++; |
shift++; |
2597 |
if( !GetEventHeader() ){ |
if( !GetEventHeader() ){ |
2598 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
2603 |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
2604 |
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
2605 |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
2606 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
2607 |
|
// |
2608 |
|
if ( prevshift != 0 && (quellagiusta+shift) == GetYodaTree()->GetEntries() ){ |
2609 |
|
prevshift = 0; |
2610 |
|
shift = -1; |
2611 |
|
}; |
2612 |
|
|
2613 |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
2614 |
|
|
2615 |
|
if ( (quellagiusta+shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl; |
2616 |
|
|
2617 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
2618 |
// return GetYodaTree()->GetEntry(quellagiusta); |
// return GetYodaTree()->GetEntry(quellagiusta); |
2619 |
|
if ( shift > 1 ) prevshift += (shift-1); |
2620 |
|
|
2621 |
return answer; |
return answer; |
2622 |
|
|
2623 |
} |
} |
2624 |
|
|
2625 |
|
|