18 #include <TIterator.h>
21 #include <boost/algorithm/string.hpp>
22 #include <boost/algorithm/string/finder.hpp>
23 #include <boost/algorithm/string/iter_find.hpp>
32 : m_cfg(cfg), m_inputFile(nullptr) {
35 throw std::invalid_argument(
"Missing ROOT folder name");
37 throw std::invalid_argument(
"Missing file name");
39 throw std::invalid_argument(
"Missing logger");
41 throw std::invalid_argument(
"Missing service name");
47 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
fileName);
52 auto tIter = tlist->MakeIterator();
56 while (TKey* key = (TKey*)(tIter->Next())) {
58 std::shared_ptr<const Acts::ISurfaceMaterial> sMaterial =
nullptr;
61 std::string tdName(key->GetName());
66 std::vector<std::string> splitNames;
67 iter_split(splitNames, tdName,
69 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
72 iter_split(splitNames, tdName,
74 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
77 iter_split(splitNames, tdName,
79 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
82 iter_split(splitNames, tdName,
84 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
87 iter_split(splitNames, tdName,
101 std::string nName = tdName +
"/" +
m_cfg.
ntag;
102 std::string vName = tdName +
"/" +
m_cfg.
vtag;
103 std::string oName = tdName +
"/" +
m_cfg.
otag;
106 std::string tName = tdName +
"/" +
m_cfg.
ttag;
107 std::string x0Name = tdName +
"/" +
m_cfg.
x0tag;
108 std::string l0Name = tdName +
"/" +
m_cfg.
l0tag;
109 std::string aName = tdName +
"/" +
m_cfg.
atag;
110 std::string zName = tdName +
"/" +
m_cfg.
ztag;
114 TH1F*
n =
dynamic_cast<TH1F*
>(
m_inputFile->Get(nName.c_str()));
115 TH1F*
v =
dynamic_cast<TH1F*
>(
m_inputFile->Get(vName.c_str()));
116 TH1F* o =
dynamic_cast<TH1F*
>(
m_inputFile->Get(oName.c_str()));
117 TH1F*
min =
dynamic_cast<TH1F*
>(
m_inputFile->Get(minName.c_str()));
118 TH1F*
max =
dynamic_cast<TH1F*
>(
m_inputFile->Get(maxName.c_str()));
119 TH2F*
t =
dynamic_cast<TH2F*
>(
m_inputFile->Get(tName.c_str()));
120 TH2F* x0 =
dynamic_cast<TH2F*
>(
m_inputFile->Get(x0Name.c_str()));
121 TH2F* l0 =
dynamic_cast<TH2F*
>(
m_inputFile->Get(l0Name.c_str()));
122 TH2F*
A =
dynamic_cast<TH2F*
>(
m_inputFile->Get(aName.c_str()));
123 TH2F*
Z =
dynamic_cast<TH2F*
>(
m_inputFile->Get(zName.c_str()));
124 TH2F* rho =
dynamic_cast<TH2F*
>(
m_inputFile->Get(rhoName.c_str()));
127 if (n and v and o and min and max and t and x0 and l0 and A and Z and rho) {
129 int nbins0 = t->GetNbinsX();
130 int nbins1 = t->GetNbinsY();
138 if (nbins0 * nbins1 > 1) {
140 for (
int ib0 = 1; ib0 <= nbins0; ++ib0) {
141 for (
int ib1 = 1; ib1 <= nbins1; ++ib1) {
142 double dt = t->GetBinContent(ib0, ib1);
144 double dx0 = x0->GetBinContent(ib0, ib1);
145 double dl0 = l0->GetBinContent(ib0, ib1);
146 double da = A->GetBinContent(ib0, ib1);
147 double dz = Z->GetBinContent(ib0, ib1);
148 double drho = rho->GetBinContent(ib0, ib1);
150 materialMatrix[ib1 - 1][ib0 - 1] =
158 for (
int ib = 1; ib < n->GetNbinsX() + 1; ++ib) {
159 size_t nbins = size_t(n->GetBinContent(ib));
162 float rmin = min->GetBinContent(ib);
163 float rmax = max->GetBinContent(ib);
169 sMaterial = std::make_shared<const Acts::BinnedSurfaceMaterial>(
170 bUtility, std::move(materialMatrix));
174 double dt = t->GetBinContent(1, 1);
175 double dx0 = x0->GetBinContent(1, 1);
176 double dl0 = l0->GetBinContent(1, 1);
177 double da = A->GetBinContent(1, 1);
178 double dz = Z->GetBinContent(1, 1);
179 double drho = rho->GetBinContent(1, 1);
181 sMaterial = std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
185 ACTS_VERBOSE(
"Successfully read Material for : " << geoID);
193 m_inputFile->Close();