2 #include <boost/filesystem.hpp>
15 tvx::RootFile(prgOpts, option, ftitle, compress),
20 Info(
"StiScanRootFile",
"Find auto range. Loop over tree/chain...");
37 stiChain->SetBranchAddress(
"e.", &stiEvent);
38 stiChain->SetBranchStatus(
"e.TStiEvent.*",
false);
39 stiChain->SetBranchStatus(
"e.TStiEvent.fTStiKalmanTracks*",
true);
42 double nodeZMin = DBL_MAX;
43 double nodeZMax = -DBL_MAX;
47 int nTreeEvents = stiChain->GetEntries();
49 Info(
"FindAutoRange",
"Found tree/chain with N entries: %d", nTreeEvents);
51 for (
int iEvent = 1; iEvent <= nTreeEvents; iEvent++)
53 if ( nTreeEvents >= 10 && iEvent %
int(nTreeEvents*0.1) == 0 )
54 Info(
"FindAutoRange",
"Analyzing event %d", iEvent);
56 if (myRandom.Rndm() >
fPrgOptions.GetSparsity())
continue;
58 stiChain->GetEntry(iEvent-1);
62 for (
const auto& kalmNode : kalmTrack.GetNodes())
64 if (volumeList && volumeList->size() && !kalmNode.MatchedVolName(*volumeList) )
67 if (kalmNode.GetNodeMaterialDensity() <= 0)
70 double node_z = kalmNode.GetPosition().Z();
72 if (node_z < nodeZMin) nodeZMin = node_z;
73 if (node_z > nodeZMax) nodeZMax = node_z;
76 double node_r = (float) kalmNode.GetPosition().Perp();
78 if (node_r > nodeRMax) nodeRMax = node_r;
84 if (nodeRMax == 0 && nodeZMin == DBL_MAX && nodeZMax == -DBL_MAX) {
90 Info(
"FindAutoRange",
"Updated nodeZMin, nodeZMax, nodeRMax: %g, %g, %g", nodeZMin, nodeZMax, nodeRMax);
101 hc<StiScanHistContainer>(
"sti_vol")->
FillHists(stiEvent, volumeList);
102 hc<StiScanHistContainer>(
"sti_trk")->
FillHists(stiEvent, volumeList);
108 hc<StiScanHistContainer>(
"gea")->
FillHists(geaEvent, volumeList);
114 tvx::RootFile::Finalize();
119 const tvx::HistContainer& gea = *hc(
"gea");
120 const tvx::HistContainer& sti_trk = *hc(
"sti_trk");
122 const TH1* gea_eloss = &gea[
"hELossVsPhiVsRVsZ_pyx"];
123 const TH1* sti_eloss = &sti_trk[
"hELossVsPhiVsRVsZ_pyx"];
126 gea_eloss = &gea[
"hELossVsPhiVsRVsZ_pyx_px"];
127 sti_eloss = &sti_trk[
"hELossVsPhiVsRVsZ_pyx_px"];
130 gea_eloss = &gea[
"hELossVsXVsYVsZ_pyx"];
131 sti_eloss = &sti_trk[
"hELossVsXVsYVsZ_pyx"];
bool DoAutoHistRange() const
void FindAutoRange() const
StiScanPrgOptions & fPrgOptions
Shadow base class reference.
void SetHistRMax(double maxR)
void CreateRatioHist(const TH1 *hNumer, const TH1 *hDenom)
void FillHists(const StiScanEvent &stiEvent, const std::set< std::string > *volumeList=0)
void SetHistZRange(double minZ, double maxZ)
Processes and controls user options provided in the command line.
const std::vector< TStiKalmanTrack > & GetTStiKalmanTracks() const
StiScanRootFile(StiScanPrgOptions &prgOpts, Option_t *option="", const char *ftitle="", Int_t compress=1)
const std::set< std::string > & GetVolumeList() const