| 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; |
| 119 |
|
|
| 120 |
run_obj = 0;//new GL_RUN(); |
run_obj = 0;//new GL_RUN(); |
| 121 |
soft_obj = 0;// Emiliano |
soft_obj = 0;// Emiliano |
| 122 |
irun = -1; |
irun = -1LL; |
| 123 |
runfirstentry = 0ULL; |
runfirstentry = 0LL; |
| 124 |
runlastentry = 0ULL; |
runlastentry = 0LL; |
| 125 |
|
|
| 126 |
l0_file = NULL; |
l0_file = NULL; |
| 127 |
l0_tree = NULL; |
l0_tree = NULL; |
| 128 |
iroot = -1; |
iroot = -1; |
| 129 |
dbc = 0; |
dbc = 0; |
| 130 |
|
|
| 131 |
|
prevshift = 0; |
| 132 |
|
|
|
irun = -1; |
|
| 133 |
run_tree = NULL; |
run_tree = NULL; |
| 134 |
run_tree_clone = NULL; |
run_tree_clone = NULL; |
| 135 |
sel_tree = NULL; |
sel_tree = NULL; |
| 136 |
sel_tree_clone = NULL; |
sel_tree_clone = NULL; |
| 137 |
|
|
| 138 |
irunentry = -1; |
irunentry = -1LL; |
| 139 |
pam_tree = NULL; |
pam_tree = NULL; |
| 140 |
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
for(Int_t i=0; i<NCLONES; i++ )pam_tree_clone[i]=NULL; |
| 141 |
|
|
| 190 |
// cout << "void PamLevel2::Clear()"<<endl; |
// cout << "void PamLevel2::Clear()"<<endl; |
| 191 |
if(h0_obj) delete h0_obj; |
if(h0_obj) delete h0_obj; |
| 192 |
if(trk0_obj) delete trk0_obj; |
if(trk0_obj) delete trk0_obj; |
| 193 |
|
if(calo0_obj) delete calo0_obj; |
| 194 |
if(trk1_obj) delete trk1_obj; |
if(trk1_obj) delete trk1_obj; |
| 195 |
if(trk2_obj) delete trk2_obj; |
if(trk2_obj) delete trk2_obj; |
| 196 |
if(trkh_obj) delete trkh_obj; |
if(trkh_obj) delete trkh_obj; |
| 244 |
// if(soft_obj) soft_obj->Clear(); |
// if(soft_obj) soft_obj->Clear(); |
| 245 |
|
|
| 246 |
if(h0_obj) h0_obj->Clear(); |
if(h0_obj) h0_obj->Clear(); |
| 247 |
if(trk0_obj) trk0_obj->Clear(); |
// if(trk0_obj) trk0_obj->Clear(); |
| 248 |
|
if(calo0_obj) calo0_obj->Clear(); |
| 249 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
| 250 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
| 251 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
| 558 |
use_CAL && |
use_CAL && |
| 559 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
| 560 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
| 561 |
|
cp && ci && |
| 562 |
true){ |
true){ |
| 563 |
|
|
| 564 |
|
|
| 580 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
| 581 |
return; |
return; |
| 582 |
}; |
}; |
| 583 |
if( use_TOF ){ |
if( use_TOF && op && oi ){ |
| 584 |
|
|
| 585 |
Int_t nphit_p =0; |
Int_t nphit_p =0; |
| 586 |
Int_t nphit_i =0; |
Int_t nphit_i =0; |
| 973 |
}; |
}; |
| 974 |
|
|
| 975 |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
cout<<endl<<" Number of entries: "<<Trout->GetEntries()<<endl<<endl; |
|
|
|
|
pam_tree = (TChain*)Trout; |
|
| 976 |
|
|
| 977 |
|
pam_tree = (TChain*)Trout; |
| 978 |
|
|
| 979 |
return Trout; |
return Trout; |
| 980 |
|
|
| 981 |
} |
} |
| 1004 |
// char *fullpath; |
// char *fullpath; |
| 1005 |
// const char *fullpath; |
// const char *fullpath; |
| 1006 |
|
|
| 1007 |
// if input file list is given: |
// if no input file list is given: |
| 1008 |
if ( flisttxt != "" ){ |
if ( flisttxt != "" ){ |
| 1009 |
|
|
| 1010 |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ |
| 1013 |
// return 0; |
// return 0; |
| 1014 |
// } |
// } |
| 1015 |
// flisttxt = fullpath; |
// flisttxt = fullpath; |
|
|
|
| 1016 |
if ( !flisttxt.EndsWith(".root") ){ |
if ( !flisttxt.EndsWith(".root") ){ |
| 1017 |
|
|
| 1018 |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
| 1019 |
|
|
| 1020 |
if( !gSystem->ChangeDirectory(ddir) ){ |
if( !gSystem->ChangeDirectory(ddir) ){ |
| 1059 |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); |
| 1060 |
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 |
| 1061 |
delete fullpath; |
delete fullpath; |
| 1062 |
}; |
}; |
| 1063 |
}else{ |
}else{ |
| 1064 |
|
|
| 1065 |
cout << "No input file list given."<<endl; |
cout << "No input file list given."<<endl; |
| 1520 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
| 1521 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
| 1522 |
*/ |
*/ |
| 1523 |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TChain *run, Long64_t iev){ |
| 1524 |
// |
// |
| 1525 |
// check if we have already called once GetEntry, if not call it |
// check if we have already called once GetEntry, if not call it |
| 1526 |
// |
// |
| 1527 |
if ( run->GetEntries() <= 0 ) return(false); |
if ( run->GetEntries() <= 0 ) return(false); |
| 1528 |
// |
// |
| 1529 |
|
|
| 1530 |
Int_t oldrun = irun; |
// Int_t oldrun = irun; |
| 1531 |
|
Long64_t oldrun = irun; |
| 1532 |
// -------------------------------------- |
// -------------------------------------- |
| 1533 |
// if it is a full file (not preselected) |
// if it is a full file (not preselected) |
| 1534 |
// -------------------------------------- |
// -------------------------------------- |
| 1535 |
if(SELLI==0){ |
if(SELLI==0){ |
|
if ( irun < 0 ){ |
|
|
irun = 0; |
|
|
run->GetEntry(0); |
|
|
runfirstentry = 0ULL; |
|
|
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL; |
|
|
}; |
|
| 1536 |
|
|
| 1537 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() ){ |
| 1538 |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
| 1539 |
return(false); |
return(false); |
| 1540 |
} |
} |
| 1541 |
|
|
| 1542 |
|
if ( irun < 0 ){ |
| 1543 |
|
irun = 0; |
| 1544 |
|
run->GetEntry(irun); |
| 1545 |
|
runfirstentry = 0LL; |
| 1546 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
| 1547 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
| 1548 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 1549 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
| 1550 |
|
// return(true); |
| 1551 |
|
}; |
| 1552 |
|
|
| 1553 |
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
// modificato il controllo sull'aggiornamento del run, per evitare problemi |
| 1554 |
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
// dovuti agli eventi annidati (NB! NEVENTS conta anche questi!!) |
| 1555 |
while ( GetOrbitalInfo()->absTime > GetRunInfo()->RUNTRAILER_TIME && irun < run->GetEntries() ){ |
// |
| 1556 |
|
bool fromfirst = true; |
| 1557 |
|
// |
| 1558 |
|
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries()-1 ){ |
| 1559 |
// 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))); |
|
| 1560 |
irun++; |
irun++; |
| 1561 |
run->GetEntry(irun); |
run->GetEntry(irun); |
| 1562 |
runfirstentry = runlastentry+1ULL; |
runfirstentry = runlastentry; |
| 1563 |
runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS); |
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runfirstentry += 1LL; |
| 1564 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
| 1565 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 1566 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
| 1567 |
|
// printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS))); |
| 1568 |
|
// printf(" abstime %u trailertime %u \n",GetOrbitalInfo()->absTime,GetRunInfo()->RUNTRAILER_TIME); |
| 1569 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
| 1570 |
|
// |
| 1571 |
|
// prevshift = 0; |
| 1572 |
|
// |
| 1573 |
|
if ( irun == run->GetEntries()-1 && fromfirst && !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME)){ |
| 1574 |
|
printf(" resetting irun (it should NOT happen!!!)\n"); |
| 1575 |
|
fromfirst = false; |
| 1576 |
|
irun = 0; |
| 1577 |
|
run->GetEntry(irun); |
| 1578 |
|
runfirstentry = 0ULL; |
| 1579 |
|
runlastentry += (Long64_t)(this->GetRunInfo()->NEVENTS); |
| 1580 |
|
if ( (Long64_t)(this->GetRunInfo()->NEVENTS) > 0LL ) runlastentry -= 1LL; |
| 1581 |
|
}; |
| 1582 |
|
// |
| 1583 |
}; |
}; |
| 1584 |
|
// |
| 1585 |
|
if ( !fromfirst && |
| 1586 |
|
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && |
| 1587 |
|
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) |
| 1588 |
|
) { |
| 1589 |
|
printf(" Something very wrong here: cannot find RUN containing absolute time %u \n",GetOrbitalInfo()->absTime); |
| 1590 |
|
return false; |
| 1591 |
|
} |
| 1592 |
// |
// |
| 1593 |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
if ( irun == oldrun || irun >= run->GetEntries() ) return(false); |
| 1594 |
// |
// |
| 1595 |
// 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); |
| 1596 |
// |
// |
| 1597 |
|
prevshift = 0; |
| 1598 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 1599 |
|
cout << "runfirstentry "<<runfirstentry<<endl; |
| 1600 |
return(true); |
return(true); |
| 1601 |
}; |
}; |
| 1602 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
| 1607 |
sel_tree->GetEntry(iev); |
sel_tree->GetEntry(iev); |
| 1608 |
if(irun != oldrun){ |
if(irun != oldrun){ |
| 1609 |
run->GetEntry(irun); |
run->GetEntry(irun); |
| 1610 |
|
cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 1611 |
|
prevshift = 0; |
| 1612 |
return true; |
return true; |
| 1613 |
} |
} |
| 1614 |
return false; |
return false; |
| 1617 |
return false; |
return false; |
| 1618 |
// |
// |
| 1619 |
}; |
}; |
| 1620 |
|
|
| 1621 |
|
// Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev){ |
| 1622 |
|
// // |
| 1623 |
|
// // check if we have already called once GetEntry, if not call it |
| 1624 |
|
// // |
| 1625 |
|
// if(!run_tree){ |
| 1626 |
|
// cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree not loaded"<<endl; |
| 1627 |
|
// return false; |
| 1628 |
|
// } |
| 1629 |
|
// if ( run_tree->GetEntries() <= 0 ) { |
| 1630 |
|
// cout << " Bool_t PamLevel2::UpdateRunInfo(ULong64_t iev) -- ERROR -- run tree is empty"<<endl; |
| 1631 |
|
// return(false); |
| 1632 |
|
// } |
| 1633 |
|
// // |
| 1634 |
|
|
| 1635 |
|
// Int_t oldrun = irun; |
| 1636 |
|
// // -------------------------------------- |
| 1637 |
|
// // if it is a full file (not preselected) |
| 1638 |
|
// // -------------------------------------- |
| 1639 |
|
// if(SELLI==0){ |
| 1640 |
|
|
| 1641 |
|
// if( !GetOrbitalInfo() ){ |
| 1642 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- missing OrbitalInfo "<<endl; |
| 1643 |
|
// return(false); |
| 1644 |
|
// } |
| 1645 |
|
|
| 1646 |
|
// if ( irun < 0 ){ |
| 1647 |
|
// irun = 0; |
| 1648 |
|
// run_tree->GetEntry(irun); |
| 1649 |
|
// runfirstentry = iev; |
| 1650 |
|
// if( iev != 0){ |
| 1651 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- WARNING -- "<<endl; |
| 1652 |
|
// } |
| 1653 |
|
// }; |
| 1654 |
|
|
| 1655 |
|
// bool fromfirst = true; |
| 1656 |
|
|
| 1657 |
|
// while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && irun < run->GetEntries() ){ |
| 1658 |
|
// irun++; |
| 1659 |
|
// if( irun == run->GetEntries() ){ |
| 1660 |
|
// if(!fromfirst){ |
| 1661 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- event entry #"<<iev<<" does not belong to any run (should not happen)" <<endl; |
| 1662 |
|
// return false; |
| 1663 |
|
// } |
| 1664 |
|
// cout << "Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev) -- ERROR -- reached end of run tree. searchin again from beginning (should not happen)" <<endl; |
| 1665 |
|
// fromfirst = false; |
| 1666 |
|
// irun =0; |
| 1667 |
|
// } |
| 1668 |
|
// run_tree->GetEntry(irun); |
| 1669 |
|
// runfirstentry = iev; |
| 1670 |
|
// }; |
| 1671 |
|
// // |
| 1672 |
|
// if ( irun == oldrun ) return(false); |
| 1673 |
|
// // |
| 1674 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 1675 |
|
// cout << "runfirstentry "<<runfirstentry<<endl; |
| 1676 |
|
// prevshift = 0; |
| 1677 |
|
// return(true); |
| 1678 |
|
// }; |
| 1679 |
|
// // ---------------------------------------------------- |
| 1680 |
|
// // if it is a preselected file (there is SelectionList) |
| 1681 |
|
// // NBNB - the event tree MUST be read first |
| 1682 |
|
// // ---------------------------------------------------- |
| 1683 |
|
// if(SELLI==1){ |
| 1684 |
|
// sel_tree->GetEntry(iev); |
| 1685 |
|
// if(irun != oldrun){ |
| 1686 |
|
// run->GetEntry(irun); |
| 1687 |
|
// cout << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 1688 |
|
// prevshift = 0; |
| 1689 |
|
// return true; |
| 1690 |
|
// } |
| 1691 |
|
// return false; |
| 1692 |
|
// } |
| 1693 |
|
|
| 1694 |
|
// return false; |
| 1695 |
|
// // |
| 1696 |
|
// }; |
| 1697 |
/** |
/** |
| 1698 |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
* Update the runinfo informations (to be used to have Run infos event by event basis) |
| 1699 |
* @param run Pointer to the chain/tree which contains run infos |
* @param run Pointer to the chain/tree which contains run infos |
| 1700 |
* @return true if a new run has been read, false if it is still the same run |
* @return true if a new run has been read, false if it is still the same run |
| 1701 |
*/ |
*/ |
| 1702 |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){ |
Bool_t PamLevel2::UpdateRunInfo(TTree *run, Long64_t iev){ |
| 1703 |
return(UpdateRunInfo((TChain*)run,iev)); |
return(UpdateRunInfo((TChain*)run,iev)); |
| 1704 |
}; |
}; |
| 1705 |
|
|
| 2479 |
/** |
/** |
| 2480 |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
* Method to get level2-trees entry, the corresponding run entry and (if required) the level0 entry. |
| 2481 |
*/ |
*/ |
| 2482 |
Int_t PamLevel2::GetEntry(Int_t iee){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
| 2483 |
|
Int_t PamLevel2::GetEntry(Long64_t iee){ |
| 2484 |
|
|
| 2485 |
if(!pam_tree){ |
if(!pam_tree){ |
| 2486 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
| 2487 |
return 0; |
return 0; |
| 2488 |
} |
} |
| 2489 |
|
|
| 2490 |
Int_t ii=0; |
|
| 2491 |
|
// |
| 2492 |
|
// 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... |
| 2493 |
|
// |
| 2494 |
|
// if(!run_tree ){ |
| 2495 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loeaded"<<endl; |
| 2496 |
|
// return 0; |
| 2497 |
|
// } |
| 2498 |
|
|
| 2499 |
|
Long64_t ii=0; |
| 2500 |
//------------------------------- |
//------------------------------- |
| 2501 |
ii = iee; |
ii = iee; |
| 2502 |
if( !pam_tree->GetEntry(ii) ) return 0; |
if( !pam_tree->GetEntry(ii) ){ |
| 2503 |
//------------------------------- |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<<endl; |
|
|
|
|
if(!run_tree ){ |
|
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
|
| 2504 |
return 0; |
return 0; |
| 2505 |
} |
} |
| 2506 |
|
// |
| 2507 |
|
// ... 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. |
| 2508 |
|
// 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 |
| 2509 |
|
// a problem if you don't check the return code of getentry. |
| 2510 |
|
// |
| 2511 |
|
if(!run_tree ){ |
| 2512 |
|
if ( TRK0 || CAL0 || TOF0 || RUN ) { //forse cosi` va bene per tornare 1? |
| 2513 |
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- run tree not loaded"<<endl; |
| 2514 |
|
return 0; |
| 2515 |
|
} else { |
| 2516 |
|
return 1; //cosi` se non c'e` run esce qua... |
| 2517 |
|
} |
| 2518 |
|
} |
| 2519 |
|
|
| 2520 |
|
//------------------------------- |
| 2521 |
ii = iee; |
ii = iee; |
| 2522 |
Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
// Bool_t UPDATED = UpdateRunInfo(run_tree,ii); |
| 2523 |
|
Bool_t UPDATED = UpdateRunInfo(ii); |
| 2524 |
if(SELLI==0)irunentry = iee-runfirstentry; |
if(SELLI==0)irunentry = iee-runfirstentry; |
| 2525 |
if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
if(UPDATED && run_tree_clone)run_tree_clone->Fill(); |
| 2526 |
|
|
| 2601 |
l0_tree = (TTree*)l0_file->Get("Physics"); |
l0_tree = (TTree*)l0_file->Get("Physics"); |
| 2602 |
if(!h0_obj)h0_obj = new EventHeader(); |
if(!h0_obj)h0_obj = new EventHeader(); |
| 2603 |
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
l0_tree->SetBranchAddress("Header" ,&h0_obj); |
| 2604 |
|
prevshift = 0; |
| 2605 |
//--------------------------------------------------- |
//--------------------------------------------------- |
| 2606 |
// TRACKER: |
// TRACKER: |
| 2607 |
if(TRK0){ |
if(TRK0){ |
| 2610 |
trk0_obj->Set(); |
trk0_obj->Set(); |
| 2611 |
}; |
}; |
| 2612 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
|
TrkParams::SetCalib(run_obj,dbc); |
|
| 2613 |
} |
} |
| 2614 |
//--------------------------------------------------- |
//--------------------------------------------------- |
| 2615 |
// CALORIMETER: |
// CALORIMETER: |
| 2616 |
if(CAL0){ |
if(CAL0){ |
| 2617 |
cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
if(!calo0_obj){ |
| 2618 |
|
calo0_obj = new CaloLevel0(); |
| 2619 |
|
calo0_obj->Set(); |
| 2620 |
|
}; |
| 2621 |
|
l0_tree->SetBranchAddress("Calorimeter" ,calo0_obj->GetPointerToCalorimeterEvent()); |
| 2622 |
|
// cout << "PamLevel2::GetYodaTree() --- level0 calorimeter not implemented "<<endl; |
| 2623 |
} |
} |
| 2624 |
//--------------------------------------------------- |
//--------------------------------------------------- |
| 2625 |
// TOF: |
// TOF: |
| 2629 |
|
|
| 2630 |
}; |
}; |
| 2631 |
|
|
| 2632 |
|
if(!dbc || (dbc && !dbc->IsConnected())){ |
| 2633 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- no DB connected... hai fatto qualche cazzata "<<endl; |
| 2634 |
|
} |
| 2635 |
|
|
| 2636 |
|
if ( TRK0 ){ |
| 2637 |
|
TrkParams::Load(6); |
| 2638 |
|
if( !TrkParams::IsLoaded(6) ){ |
| 2639 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
| 2640 |
|
}; |
| 2641 |
|
TrkParams::SetCalib(run_obj,dbc); |
| 2642 |
|
TrkParams::LoadCalib( ); |
| 2643 |
|
if( !TrkParams::CalibIsLoaded() ){ |
| 2644 |
|
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl; |
| 2645 |
|
}; |
| 2646 |
|
} |
| 2647 |
|
|
| 2648 |
// cout << l0_tree << endl; |
// cout << l0_tree << endl; |
| 2649 |
|
|
| 2650 |
return l0_tree; |
return l0_tree; |
| 2659 |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
// cout << "Int_t PamLevel2::GetYodaEntry()"<<endl; |
| 2660 |
if(!GetYodaTree())return 0; |
if(!GetYodaTree())return 0; |
| 2661 |
|
|
| 2662 |
|
// patch |
| 2663 |
|
if( irunentry < 0){ |
| 2664 |
|
cout << "Int_t PamLevel2::GetYodaEntry() -- ATTENZIONE -- irunentry negativo?!?! "<<(Int_t)irunentry<<endl; |
| 2665 |
|
irunentry=0LL; |
| 2666 |
|
} |
| 2667 |
// --------------------------------- |
// --------------------------------- |
| 2668 |
// if file is NOT a preselected file |
// if file is NOT a preselected file |
| 2669 |
// --------------------------------- |
// --------------------------------- |
| 2670 |
Int_t quellagiusta = irunentry + run_obj->EV_FROM; |
Long64_t quellagiusta = irunentry + (Long64_t)(run_obj->EV_FROM); |
| 2671 |
|
|
| 2672 |
|
|
| 2673 |
|
// cout << " irun "<< irun << " irunentry "<< irunentry<<" run_obj->EV_FROM "<<run_obj->EV_FROM <<" quella giusta "<<quellagiusta << endl; |
| 2674 |
|
// cout << " iroot "<<iroot<<" run_obj->ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<endl; |
| 2675 |
|
// cout << " time "<< GetOrbitalInfo()->absTime << endl; |
| 2676 |
|
// cout << " trk_calib_used "<<run_obj->TRK_CALIB_USED<< endl; |
| 2677 |
|
|
| 2678 |
if( !GetOrbitalInfo() ){ |
if( !GetOrbitalInfo() ){ |
| 2679 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing OrbitalInfo "<<endl; |
| 2680 |
return 0; |
return 0; |
| 2693 |
// --------------------------------------------------------------------- |
// --------------------------------------------------------------------- |
| 2694 |
Int_t answer = 0; |
Int_t answer = 0; |
| 2695 |
Int_t shift =0; |
Int_t shift =0; |
| 2696 |
|
// printf(" siamo qui %i %i \n",shift,prevshift); |
| 2697 |
do{ |
do{ |
| 2698 |
// if(shift>0){ |
if(shift>0){ |
| 2699 |
// cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" )"<<endl; |
cout << " level0 <--> level2 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
| 2700 |
// } |
} |
| 2701 |
answer = GetYodaTree()->GetEntry(quellagiusta+shift); |
answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift); |
| 2702 |
shift++; |
shift++; |
| 2703 |
if( !GetEventHeader() ){ |
if( !GetEventHeader() ){ |
| 2704 |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
cout << "Int_t PamLevel2::GetYodaEntry() -- ERROR -- missing EventHeader "<<endl; |
| 2705 |
return 0; |
return 0; |
| 2706 |
} |
} |
| 2707 |
// if( (quellagiusta+shift) == GetYodaTree()->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
cout << "PKTNUM "<<shift<<" == L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
| 2708 |
}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 << " L2 --- "<< GetOrbitalInfo()->OBT << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime()<<endl; |
| 2709 |
|
// if( (quellagiusta+shift) == l0_tree->GetEntries()+1 )cout << ">>> end of level0 tree <<<"<<endl; |
| 2710 |
|
// cout << " GetOrbitalInfo()->OBT "<< GetOrbitalInfo()->OBT << endl; |
| 2711 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetOrbitalTime() "<< GetEventHeader()->GetPscuHeader()->GetOrbitalTime() << endl; |
| 2712 |
|
// cout << " GetOrbitalInfo()->pkt_num "<< GetOrbitalInfo()->pkt_num << endl; |
| 2713 |
|
// cout << " GetEventHeader()->GetPscuHeader()->GetCounter() "<< GetEventHeader()->GetPscuHeader()->GetCounter() << endl; |
| 2714 |
|
// printf(" IDRUN %u \n",GetRunInfo()->ID); |
| 2715 |
|
// |
| 2716 |
|
if ( prevshift != 0 && (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ){ |
| 2717 |
|
prevshift = 0; |
| 2718 |
|
shift = -1; |
| 2719 |
|
}; |
| 2720 |
|
|
| 2721 |
|
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() ); |
| 2722 |
|
|
| 2723 |
|
if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() ) cout << " Big trouble here, no such event in Level0 data! " <<endl; |
| 2724 |
|
|
| 2725 |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
// cout << "LA ENTRY GIUSTA E`: "<<quellagiusta<<" (spero...)"<<endl; |
| 2726 |
// return GetYodaTree()->GetEntry(quellagiusta); |
// return GetYodaTree()->GetEntry(quellagiusta); |
| 2727 |
|
if ( shift > 1 ) prevshift += (shift-1); |
| 2728 |
|
|
| 2729 |
return answer; |
return answer; |
| 2730 |
|
|
| 2731 |
} |
} |
| 2732 |
|
|
| 2733 |
|
|