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(); |
559 |
use_CAL && |
use_CAL && |
560 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
561 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
562 |
|
cp && ci && |
563 |
true){ |
true){ |
564 |
|
|
565 |
|
|
581 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
582 |
return; |
return; |
583 |
}; |
}; |
584 |
if( use_TOF ){ |
if( use_TOF && op && oi ){ |
585 |
|
|
586 |
Int_t nphit_p =0; |
Int_t nphit_p =0; |
587 |
Int_t nphit_i =0; |
Int_t nphit_i =0; |
974 |
}; |
}; |
975 |
|
|
976 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
|
|
|
|
pam_tree = (TChain*)Trout; |
|
977 |
|
|
978 |
|
pam_tree = (TChain*)Trout; |
979 |
|
|
980 |
return Trout; |
return Trout; |
981 |
|
|
982 |
} |
} |
1005 |
// char *fullpath; |
// char *fullpath; |
1006 |
// const char *fullpath; |
// const char *fullpath; |
1007 |
|
|
1008 |
// if input file list is given: |
// if no input file list is given: |
1009 |
if ( flisttxt != "" ){ |
if ( flisttxt != "" ){ |
1010 |
|
|
1011 |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
1014 |
// return 0; |
// return 0; |
1015 |
// } |
// } |
1016 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
|
|
|
1017 |
if ( !flisttxt.EndsWith(".root") ){ |
if ( !flisttxt.EndsWith(".root") ){ |
1018 |
|
|
1019 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1020 |
|
|
1021 |
if( !gSystem->ChangeDirectory(ddir) ){ |
if( !gSystem->ChangeDirectory(ddir) ){ |
1060 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1061 |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1062 |
delete fullpath; |
delete fullpath; |
1063 |
}; |
}; |
1064 |
}else{ |
}else{ |
1065 |
|
|
1066 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
1535 |
if(SELLI==0){ |
if(SELLI==0){ |
1536 |
if ( irun < 0 ){ |
if ( irun < 0 ){ |
1537 |
irun = 0; |
irun = 0; |
1538 |
run->GetEntry(0); |
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); |
1543 |
}; |
}; |
1544 |
|
|
1545 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() ){ |
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 ( !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 |
// |
// |
1581 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
1582 |
// |
// |
2392 |
return 0; |
return 0; |
2393 |
} |
} |
2394 |
|
|
2395 |
|
|
2396 |
|
// |
2397 |
|
// This is a sort of bug: if you don't have the run tree you don't want to exit here you want to have loaded the event anyway... |
2398 |
|
// |
2399 |
|
// if(!run_tree ){ |
2400 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
2401 |
|
// return 0; |
2402 |
|
// } |
2403 |
|
|
2404 |
Int_t ii=0; |
Int_t ii=0; |
2405 |
//------------------------------- |
//------------------------------- |
2406 |
ii = iee; |
ii = iee; |
2407 |
if( !pam_tree->GetEntry(ii) ) return 0; |
if( !pam_tree->GetEntry(ii) ) return 0; |
|
//------------------------------- |
|
2408 |
|
|
2409 |
|
// |
2410 |
|
// ... that's way I put it here. Notice that nothing change in the code (is backward compatible) since in any case you return with 0. |
2411 |
|
// in theory one would like to return 1 if run is not loaded but now I don't have the will to add that 2 lines of code and it is not |
2412 |
|
// a problem if you don't check the return code of getentry. |
2413 |
|
// |
2414 |
if(!run_tree ){ |
if(!run_tree ){ |
2415 |
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? |
2416 |
return 0; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
2417 |
|
return 0; |
2418 |
|
} else { |
2419 |
|
return 1; //cosi` se non c'e` run esce qua... |
2420 |
|
} |
2421 |
} |
} |
2422 |
|
|
2423 |
|
//------------------------------- |
2424 |
ii = iee; |
ii = iee; |
2425 |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
2426 |
if(SELLI==0)irunentry = iee-runfirstentry; |
if(SELLI==0)irunentry = iee-runfirstentry; |
2503 |
l0_tree = (TTree*)l0_file->Get("Physics"); |
l0_tree = (TTree*)l0_file->Get("Physics"); |
2504 |
if(!h0_obj)h0_obj = new EventHeader(); |
if(!h0_obj)h0_obj = new EventHeader(); |
2505 |
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
2506 |
|
prevshift = 0; |
2507 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2508 |
// TRACKER: |
// TRACKER: |
2509 |
if(TRK0){ |
if(TRK0){ |
2512 |
trk0_obj->Set(); |
trk0_obj->Set(); |
2513 |
}; |
}; |
2514 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
|
TrkParams::SetCalib(run_obj,dbc); |
|
2515 |
} |
} |
2516 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2517 |
// CALORIMETER: |
// CALORIMETER: |
2518 |
if(CAL0){ |
if(CAL0){ |
2519 |
cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
if(!calo0_obj){ |
2520 |
|
calo0_obj = new CaloLevel0(); |
2521 |
|
calo0_obj->Set(); |
2522 |
|
}; |
2523 |
|
l0_tree->SetBranchAddress("Calorimeter" ,calo0_obj->GetPointerToCalorimeterEvent()); |
2524 |
|
// cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
2525 |
} |
} |
2526 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2527 |
// TOF: |
// TOF: |
2531 |
|
|
2532 |
}; |
}; |
2533 |
|
|
2534 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
2535 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
2536 |
|
} |
2537 |
|
|
2538 |
|
if ( TRK0 ) TrkParams::SetCalib(run_obj,dbc); |
2539 |
|
|
2540 |
|
|
2541 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
2542 |
|
|
2543 |
return l0_tree; |
return l0_tree; |
2552 |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
2553 |
if(!GetYodaTree())return 0; |
if(!GetYodaTree())return 0; |
2554 |
|
|
2555 |
|
// patch |
2556 |
|
if( (Int_t)irunentry < 0){ |
2557 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
2558 |
|
irunentry=0; |
2559 |
|
} |
2560 |
// --------------------------------- |
// --------------------------------- |
2561 |
// if file is NOT a preselected file |
// if file is NOT a preselected file |
2562 |
// --------------------------------- |
// --------------------------------- |
2563 |
Int_t quellagiusta = irunentry + run_obj->EV_FROM; |
UInt_t quellagiusta = irunentry + run_obj->EV_FROM; |
2564 |
|
|
2565 |
|
|
2566 |
|
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
2567 |
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
2568 |
|
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
2569 |
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
2570 |
|
|
2571 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() ){ |
2572 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
2573 |
return 0; |
return 0; |
2586 |
// --------------------------------------------------------------------- |
// --------------------------------------------------------------------- |
2587 |
Int_t answer = 0; |
Int_t answer = 0; |
2588 |
Int_t shift =0; |
Int_t shift =0; |
2589 |
|
// printf(" siamo qui %i %i \n",shift,prevshift); |
2590 |
do{ |
do{ |
2591 |
// if(shift>0){ |
if(shift>0){ |
2592 |
// cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
2593 |
// } |
} |
2594 |
answer = GetYodaTree()->GetEntry(quellagiusta+shift); |
answer = l0_tree->GetEntry(quellagiusta+shift+prevshift); |
2595 |
shift++; |
shift++; |
2596 |
if( !GetEventHeader() ){ |
if( !GetEventHeader() ){ |
2597 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
2598 |
return 0; |
return 0; |
2599 |
} |
} |
2600 |
// if( (quellagiusta+shift) == GetYodaTree()->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
2601 |
}while( ( (UInt_t)(GetOrbitalInfo()->OBT) != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < (UInt_t)(GetYodaTree()->GetEntries()) ); |
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
2602 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
2603 |
|
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
2604 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
2605 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
2606 |
|
// |
2607 |
|
if ( prevshift != 0 && (quellagiusta+shift) == GetYodaTree()->GetEntries() ){ |
2608 |
|
prevshift = 0; |
2609 |
|
shift = -1; |
2610 |
|
}; |
2611 |
|
|
2612 |
|
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
2613 |
|
|
2614 |
|
if ( (quellagiusta+shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl; |
2615 |
|
|
2616 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
2617 |
// return GetYodaTree()->GetEntry(quellagiusta); |
// return GetYodaTree()->GetEntry(quellagiusta); |
2618 |
|
if ( shift > 1 ) prevshift += (shift-1); |
2619 |
|
|
2620 |
return answer; |
return answer; |
2621 |
|
|
2622 |
} |
} |
2623 |
|
|
2624 |
|
|