| 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 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
| 2391 |
|
return 0; |
| 2392 |
|
} |
| 2393 |
|
|
| 2394 |
//------------------------------- |
//------------------------------- |
| 2395 |
ii = iee; |
ii = iee; |
| 2396 |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
| 2426 |
return NULL; |
return NULL; |
| 2427 |
} |
} |
| 2428 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
| 2429 |
// cout << "iroot "<<iroot<<endl; |
// cout << "iroot "<<iroot<<endl; |
| 2430 |
// cout << "irootnew "<<irootnew<<endl; |
// cout << "irootnew "<<irootnew<<endl; |
| 2431 |
|
|
| 2432 |
//=================================== |
//=================================== |
| 2433 |
// load the level0 file |
// load the level0 file |
| 2454 |
// cout<<"DB already connected"<<endl; |
// cout<<"DB already connected"<<endl; |
| 2455 |
} |
} |
| 2456 |
GL_ROOT glroot = GL_ROOT(); |
GL_ROOT glroot = GL_ROOT(); |
| 2457 |
if( glroot.Query_GL_ROOT(iroot,dbc) )return NULL; |
if( glroot.Query_GL_ROOT(iroot,dbc) ){ |
| 2458 |
|
cout << "TTree* PamLevel2::GetYodaTree( ) -- ERROR -- level0 file iroot = "<<iroot<< " does not exists"<<endl; |
| 2459 |
|
return NULL; |
| 2460 |
|
}; |
| 2461 |
TString filename = glroot.PATH + glroot.NAME; |
TString filename = glroot.PATH + glroot.NAME; |
| 2462 |
if(l0_file){ |
if(l0_file){ |
| 2463 |
l0_file->Close(); |
l0_file->Close(); |
| 2482 |
trk0_obj->Set(); |
trk0_obj->Set(); |
| 2483 |
}; |
}; |
| 2484 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
|
TrkParams::SetCalib(run_obj,dbc); |
|
| 2485 |
} |
} |
| 2486 |
//--------------------------------------------------- |
//--------------------------------------------------- |
| 2487 |
// CALORIMETER: |
// CALORIMETER: |
| 2496 |
|
|
| 2497 |
}; |
}; |
| 2498 |
|
|
| 2499 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
| 2500 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
| 2501 |
|
} |
| 2502 |
|
|
| 2503 |
|
TrkParams::SetCalib(run_obj,dbc); |
| 2504 |
|
|
| 2505 |
|
|
| 2506 |
|
// cout << l0_tree << endl; |
| 2507 |
|
|
| 2508 |
return l0_tree; |
return l0_tree; |
| 2509 |
|
|
| 2510 |
} |
} |
| 2517 |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
| 2518 |
if(!GetYodaTree())return 0; |
if(!GetYodaTree())return 0; |
| 2519 |
|
|
| 2520 |
|
// patch |
| 2521 |
|
if( (Int_t)irunentry < 0){ |
| 2522 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
| 2523 |
|
irunentry=0; |
| 2524 |
|
} |
| 2525 |
// --------------------------------- |
// --------------------------------- |
| 2526 |
// if file is NOT a preselected file |
// if file is NOT a preselected file |
| 2527 |
// --------------------------------- |
// --------------------------------- |
| 2528 |
Int_t quellagiusta = irunentry + run_obj->EV_FROM; |
UInt_t quellagiusta = irunentry + run_obj->EV_FROM; |
| 2529 |
// ------------------------------------------ |
|
| 2530 |
// otherwise read the "preselected-list" tree |
|
| 2531 |
// ------------------------------------------ |
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
| 2532 |
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
| 2533 |
|
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
| 2534 |
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
| 2535 |
|
|
| 2536 |
|
if( !GetOrbitalInfo() ){ |
| 2537 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
| 2538 |
|
return 0; |
| 2539 |
|
} |
| 2540 |
|
|
| 2541 |
|
// --------------------------------------------------------------------- |
| 2542 |
|
// ATTENTION!!! |
| 2543 |
|
// If data are not pre-processed with cleaner, the level0 tree may contain |
| 2544 |
|
// spurious nested physics packets. |
| 2545 |
|
// The GL_RUN variables EV_FROM, EV_TO and NEVENTS counts also these entries |
| 2546 |
|
// while level2 tree DOES NOT!! |
| 2547 |
|
// This means that "quellagiusta" in these cases is not correct. |
| 2548 |
|
// In order to retrieve the correct level0 event, I implemented a check |
| 2549 |
|
// of the OBT and pkt-number. In case of mismatch, the level0 entry number |
| 2550 |
|
// is shift forward until when the packets match. |
| 2551 |
|
// --------------------------------------------------------------------- |
| 2552 |
|
Int_t answer = 0; |
| 2553 |
|
Int_t shift =0; |
| 2554 |
|
do{ |
| 2555 |
|
if(shift>0){ |
| 2556 |
|
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
| 2557 |
|
} |
| 2558 |
|
answer = l0_tree->GetEntry(quellagiusta+shift); |
| 2559 |
|
shift++; |
| 2560 |
|
if( !GetEventHeader() ){ |
| 2561 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
| 2562 |
|
return 0; |
| 2563 |
|
} |
| 2564 |
|
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
| 2565 |
|
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
| 2566 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
| 2567 |
|
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
| 2568 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
| 2569 |
|
|
| 2570 |
|
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+shift) < GetYodaTree()->GetEntries() ); |
| 2571 |
|
|
| 2572 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
| 2573 |
return GetYodaTree()->GetEntry(quellagiusta); |
// return GetYodaTree()->GetEntry(quellagiusta); |
| 2574 |
|
|
| 2575 |
return 1; |
return answer; |
| 2576 |
|
|
| 2577 |
} |
} |