3 #include <unordered_map>
7 #include "TGeoNavigator.h"
8 #include "TGeoManager.h"
25 int main(
int argc,
char **argv)
27 const std::string stiTreeName =
"t";
28 const std::string geantStepTreeName =
"stepping";
37 Fatal(__PRETTY_FUNCTION__,
"Cannot load TGeo geometry from %s", prgOpts.
PathToGeometryFile().c_str());
40 TGeoNavigator* geoNav =
gGeoManager->GetCurrentNavigator();
61 int nTreeEvents = stiChain->GetEntries();
64 Info(
"loop_over_tree",
"Found tree/chain with N entries: %d", nTreeEvents);
66 nTreeEvents = (prgOpts.GetMaxEventsUser() < nTreeEvents) ? prgOpts.GetMaxEventsUser() : nTreeEvents;
68 Info(
"loop_over_tree",
"Will process %d events", nTreeEvents);
71 stiChain->SetBranchAddress(
"e.", &stiScanEvent);
72 stiChain->SetBranchStatus(
"e.TStiEvent*",
false);
73 stiChain->SetBranchStatus(
"e.TStiEvent.fTStiKalmanTracks*",
true);
80 geantStepChain->SetBranchAddress(
"TGeaEvent", &geantEvent);
84 Info(
"loop_over_tree",
"Looping over tree/chain...");
86 for (
int iEvent = 1; iEvent <= nTreeEvents; iEvent++, nProcEvents++)
88 if ( nTreeEvents >= 10 && iEvent %
int(nTreeEvents*0.1) == 0 )
89 Info(
"loop_over_tree",
"Analyzing event %d", iEvent);
91 if (myRandom.Rndm() > prgOpts.GetSparsity())
continue;
93 stiChain->GetEntry(iEvent-1);
98 geantStepChain->GetEntry(iEvent-1);
114 TGeoNode* currNode = geoNav.GetCurrentNode();
117 Warning(
"create_volume_hash_map",
"Invalid TGeoNode provided as input. Skipping...");
122 static int level = 0;
124 std::string currentPath( geoNav.GetPath() );
126 int nDaughters = currNode->GetVolume()->GetNdaughters();
130 TGeoNode* motherNode = currNode;
131 for (
int iDaughter = 0; iDaughter < nDaughters; iDaughter++)
133 TGeoNode *daughter = motherNode->GetVolume()->GetNode(iDaughter);
135 geoNav.CdDown(daughter);
144 std::string hashedPath(currentPath);
147 size_t first_pos = hashedPath.find(
"TpcRefSys_1/");
148 if (first_pos != std::string::npos) {
149 hashedPath.replace(first_pos, std::string(
"TpcRefSys_1/").length(),
"");
152 std::hash<std::string> hash_fn;
153 std::size_t hash_value = hash_fn(hashedPath);
155 std::pair<size_t, std::string> hash2Path(hash_value, hashedPath);
157 hash2PathMap.insert(hash2Path);
159 geoNav.cd(currentPath.c_str());
static void * fgHash2PathMap
std::unordered_map< size_t, std::string > Hash2StringMap
void FillHists(const StiScanEvent &stiEvent, const std::set< std::string > *volumeList=0)
int main(int argc, char **argv)
Processes and controls user options provided in the command line.
void ProcessOptions()
Takes the standard command line arguments and parses them with the boost program_options utility...
bool DoGeantStepTree() const
TGeoManager * gGeoManager
void loop_over_tree(StiScanPrgOptions &prgOpts)
std::string PathToGeometryFile() const
TChain * GetGeantStepChain()
const std::set< std::string > & GetVolumeList() const
void create_volume_hash_map(TGeoNavigator &geoNav, Hash2StringMap &hash2PathMap)