554 |
use_CAL && |
use_CAL && |
555 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
556 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
557 |
|
cp && ci && |
558 |
true){ |
true){ |
559 |
|
|
560 |
|
|
576 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
577 |
return; |
return; |
578 |
}; |
}; |
579 |
if( use_TOF ){ |
if( use_TOF && op && oi ){ |
580 |
|
|
581 |
Int_t nphit_p =0; |
Int_t nphit_p =0; |
582 |
Int_t nphit_i =0; |
Int_t nphit_i =0; |
969 |
}; |
}; |
970 |
|
|
971 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
972 |
|
|
973 |
|
pam_tree = (TChain*)Trout; |
974 |
|
|
975 |
return Trout; |
return Trout; |
976 |
|
|
1009 |
// return 0; |
// return 0; |
1010 |
// } |
// } |
1011 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
1012 |
|
if ( !flisttxt.EndsWith(".root") ){ |
1013 |
|
|
1014 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1015 |
|
|
1051 |
// }; |
// }; |
1052 |
}; |
}; |
1053 |
in.close(); |
in.close(); |
1054 |
|
} else { |
1055 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
1056 |
|
contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list |
1057 |
|
delete fullpath; |
1058 |
|
}; |
1059 |
}else{ |
}else{ |
1060 |
|
|
1061 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
1505 |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
R->SetBranchAddress("SoftInfo", GetPointerTo("SoftInfo")); // Emiliano |
1506 |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
cout << "Software : set branch address SoftInfo"<<endl; // Emiliano |
1507 |
} |
} |
1508 |
|
|
1509 |
|
run_tree = (TChain*)R; |
1510 |
|
|
1511 |
return R; |
return R; |
1512 |
|
|
1513 |
} |
} |
1530 |
if(SELLI==0){ |
if(SELLI==0){ |
1531 |
if ( irun < 0 ){ |
if ( irun < 0 ){ |
1532 |
irun = 0; |
irun = 0; |
1533 |
run->GetEntry(0); |
run->GetEntry(irun); |
1534 |
runfirstentry = 0ULL; |
runfirstentry = 0ULL; |
1535 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
1536 |
}; |
return(true); |
1537 |
while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
}; |
1538 |
|
|
1539 |
|
if( !GetOrbitalInfo() ){ |
1540 |
|
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
1541 |
|
return(false); |
1542 |
|
} |
1543 |
|
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
1544 |
|
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
1545 |
|
while ( GetOrbitalInfo()->absTime > GetRunInfo()->RUNTRAILER_TIME && irun < run->GetEntries() ){ |
1546 |
|
// while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){ |
1547 |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
1548 |
irun++; |
irun++; |
1549 |
run->GetEntry(irun); |
run->GetEntry(irun); |
1550 |
runfirstentry = runlastentry+1ULL; |
runfirstentry = runlastentry+1ULL; |
1551 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
1552 |
}; |
}; |
1553 |
|
|
1554 |
// |
// |
1555 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
if |
1556 |
|
( irun == oldrun || irun >= run->GetEntries() ) return(false); |
1557 |
// |
// |
1558 |
// 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); |
1559 |
// |
// |
2230 |
pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
pam_tree_clone[i]->Branch("TrkLevel1","TrkLevel1", GetPointerTo("TrkLevel1")); |
2231 |
pam_tree_clone[i]->BranchRef(); |
pam_tree_clone[i]->BranchRef(); |
2232 |
cout << "Tracker : branch TrkLevel1"<<endl; |
cout << "Tracker : branch TrkLevel1"<<endl; |
2233 |
|
cout << "CreateCloneTrees " << GetTrkLevel1()<<endl; |
2234 |
}; |
}; |
2235 |
if(TRK2) { |
if(TRK2) { |
2236 |
pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
pam_tree_clone[i]->Branch("TrkLevel2", "TrkLevel2",GetPointerTo("TrkLevel2")); |
2312 |
void PamLevel2::FillCloneTrees(){ |
void PamLevel2::FillCloneTrees(){ |
2313 |
|
|
2314 |
// cout << "PamLevel2::FillCloneTrees()" << irunentry << endl; |
// cout << "PamLevel2::FillCloneTrees()" << irunentry << endl; |
2315 |
|
|
2316 |
for(Int_t i=0; i<NCLONES; i++){ |
for(Int_t i=0; i<NCLONES; i++){ |
2317 |
if(pam_tree_clone[i])pam_tree_clone[i]->Fill(); |
if(pam_tree_clone[i])pam_tree_clone[i]->Fill(); |
2318 |
} |
} |
2319 |
if(sel_tree_clone)sel_tree_clone->Fill(); |
if(sel_tree_clone)sel_tree_clone->Fill(); |
|
// if( irunentry == 0 || run_tree_clone->GetEntries()==0 )run_tree_clone->Fill(); |
|
|
// Int_t nstoredruns = run_tree_clone->GetEntries(); |
|
|
// if( irun == nstoredruns )run_tree_clone->Fill(); |
|
|
// else if( irun > nstoredruns || irun < nstoredruns-1){ |
|
|
// cout << " PamLevel2::FillCloneTrees() -- ERROR -- current run "<< irun <<" stored runs "<< nstoredruns <<endl; |
|
|
// } |
|
2320 |
|
|
2321 |
} |
} |
2322 |
|
|
2358 |
} |
} |
2359 |
|
|
2360 |
/** |
/** |
2361 |
* Method to get both level2-trees entry and corresponding run entry. |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
2362 |
*/ |
*/ |
|
|
|
|
|
|
2363 |
Int_t PamLevel2::GetEntry(Int_t iee){ |
Int_t PamLevel2::GetEntry(Int_t iee){ |
2364 |
|
|
2365 |
if(!pam_tree){ |
if(!pam_tree){ |
2366 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loeaded"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
|
return 0; |
|
|
} |
|
|
if(!run_tree ){ |
|
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
|
2367 |
return 0; |
return 0; |
2368 |
} |
} |
2369 |
|
|
2370 |
|
|
2371 |
|
// |
2372 |
|
// 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... |
2373 |
|
// |
2374 |
|
// if(!run_tree ){ |
2375 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
2376 |
|
// return 0; |
2377 |
|
// } |
2378 |
|
|
2379 |
Int_t ii=0; |
Int_t ii=0; |
2380 |
//------------------------------- |
//------------------------------- |
2381 |
ii = iee; |
ii = iee; |
2382 |
if( !pam_tree->GetEntry(ii) ) return 0; |
if( !pam_tree->GetEntry(ii) ) return 0; |
2383 |
|
|
2384 |
|
// |
2385 |
|
// ... 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. |
2386 |
|
// 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 |
2387 |
|
// a problem if you don't check the return code of getentry. |
2388 |
|
// |
2389 |
|
if(!run_tree ){ |
2390 |
|
if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1? |
2391 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
2392 |
|
return 0; |
2393 |
|
} else { |
2394 |
|
return 1; //cosi` se non c'e` run esce qua... |
2395 |
|
} |
2396 |
|
} |
2397 |
|
|
2398 |
//------------------------------- |
//------------------------------- |
2399 |
ii = iee; |
ii = iee; |
2400 |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
2430 |
return NULL; |
return NULL; |
2431 |
} |
} |
2432 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
2433 |
// cout << "iroot "<<iroot<<endl; |
// cout << "iroot "<<iroot<<endl; |
2434 |
// cout << "irootnew "<<irootnew<<endl; |
// cout << "irootnew "<<irootnew<<endl; |
2435 |
|
|
2436 |
//=================================== |
//=================================== |
2437 |
// load the level0 file |
// load the level0 file |
2458 |
// cout<<"DB already connected"<<endl; |
// cout<<"DB already connected"<<endl; |
2459 |
} |
} |
2460 |
GL_ROOT glroot = GL_ROOT(); |
GL_ROOT glroot = GL_ROOT(); |
2461 |
if( glroot.Query_GL_ROOT(iroot,dbc) )return NULL; |
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
2462 |
|
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
2463 |
|
return NULL; |
2464 |
|
}; |
2465 |
TString filename = glroot.PATH + glroot.NAME; |
TString filename = glroot.PATH + glroot.NAME; |
2466 |
if(l0_file){ |
if(l0_file){ |
2467 |
l0_file->Close(); |
l0_file->Close(); |
2486 |
trk0_obj->Set(); |
trk0_obj->Set(); |
2487 |
}; |
}; |
2488 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
|
TrkParams::SetCalib(run_obj,dbc); |
|
2489 |
} |
} |
2490 |
//--------------------------------------------------- |
//--------------------------------------------------- |
2491 |
// CALORIMETER: |
// CALORIMETER: |
2500 |
|
|
2501 |
}; |
}; |
2502 |
|
|
2503 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
2504 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
2505 |
|
} |
2506 |
|
|
2507 |
|
TrkParams::SetCalib(run_obj,dbc); |
2508 |
|
|
2509 |
|
|
2510 |
|
// cout << l0_tree << endl; |
2511 |
|
|
2512 |
return l0_tree; |
return l0_tree; |
2513 |
|
|
2514 |
} |
} |
2521 |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
2522 |
if(!GetYodaTree())return 0; |
if(!GetYodaTree())return 0; |
2523 |
|
|
2524 |
|
// patch |
2525 |
|
if( (Int_t)irunentry < 0){ |
2526 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
2527 |
|
irunentry=0; |
2528 |
|
} |
2529 |
// --------------------------------- |
// --------------------------------- |
2530 |
// if file is NOT a preselected file |
// if file is NOT a preselected file |
2531 |
// --------------------------------- |
// --------------------------------- |
2532 |
Int_t quellagiusta = irunentry + run_obj->EV_FROM; |
UInt_t quellagiusta = irunentry + run_obj->EV_FROM; |
2533 |
// ------------------------------------------ |
|
2534 |
// otherwise read the "preselected-list" tree |
|
2535 |
// ------------------------------------------ |
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
2536 |
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
2537 |
|
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
2538 |
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
2539 |
|
|
2540 |
|
if( !GetOrbitalInfo() ){ |
2541 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
2542 |
|
return 0; |
2543 |
|
} |
2544 |
|
|
2545 |
|
// --------------------------------------------------------------------- |
2546 |
|
// ATTENTION!!! |
2547 |
|
// If data are not pre-processed with cleaner, the level0 tree may contain |
2548 |
|
// spurious nested physics packets. |
2549 |
|
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
2550 |
|
// while level2 tree DOES NOT!! |
2551 |
|
// This means that "quellagiusta" in these cases is not correct. |
2552 |
|
// In order to retrieve the correct level0 event, I implemented a check |
2553 |
|
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
2554 |
|
// is shift forward until when the packets match. |
2555 |
|
// --------------------------------------------------------------------- |
2556 |
|
Int_t answer = 0; |
2557 |
|
Int_t shift =0; |
2558 |
|
do{ |
2559 |
|
if(shift>0){ |
2560 |
|
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
2561 |
|
} |
2562 |
|
answer = l0_tree->GetEntry(quellagiusta+shift); |
2563 |
|
shift++; |
2564 |
|
if( !GetEventHeader() ){ |
2565 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
2566 |
|
return 0; |
2567 |
|
} |
2568 |
|
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
2569 |
|
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
2570 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
2571 |
|
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
2572 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
2573 |
|
|
2574 |
|
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
2575 |
|
|
2576 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
2577 |
return GetYodaTree()->GetEntry(quellagiusta); |
// return GetYodaTree()->GetEntry(quellagiusta); |
2578 |
|
|
2579 |
return 1; |
return answer; |
2580 |
|
|
2581 |
} |
} |