25 #include <TIterator.h>
28 #include <boost/algorithm/string.hpp>
29 #include <boost/algorithm/string/finder.hpp>
30 #include <boost/algorithm/string/iter_find.hpp>
34 : m_cfg(cfg), m_inputFile(nullptr) {
37 throw std::invalid_argument(
"Missing ROOT folder name");
39 throw std::invalid_argument(
"Missing file name");
41 throw std::invalid_argument(
"Missing logger");
43 throw std::invalid_argument(
"Missing service name");
49 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
fileName);
54 auto tIter = tlist->MakeIterator();
58 while (TKey* key = (TKey*)(tIter->Next())) {
60 std::shared_ptr<const Acts::ISurfaceMaterial> sMaterial =
nullptr;
63 std::string tdName(key->GetName());
68 std::vector<std::string> splitNames;
69 iter_split(splitNames, tdName,
71 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
74 iter_split(splitNames, tdName,
76 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
79 iter_split(splitNames, tdName,
81 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
84 iter_split(splitNames, tdName,
86 boost::split(splitNames, splitNames[1], boost::is_any_of(
"_"));
89 iter_split(splitNames, tdName,
100 ACTS_VERBOSE(
"GeometryIdentifier re-constructed as " << geoID);
103 std::string nName = tdName +
"/" +
m_cfg.
ntag;
104 std::string vName = tdName +
"/" +
m_cfg.
vtag;
105 std::string oName = tdName +
"/" +
m_cfg.
otag;
108 std::string tName = tdName +
"/" +
m_cfg.
ttag;
109 std::string x0Name = tdName +
"/" +
m_cfg.
x0tag;
110 std::string l0Name = tdName +
"/" +
m_cfg.
l0tag;
111 std::string aName = tdName +
"/" +
m_cfg.
atag;
112 std::string zName = tdName +
"/" +
m_cfg.
ztag;
116 TH1F*
n =
dynamic_cast<TH1F*
>(
m_inputFile->Get(nName.c_str()));
117 TH1F*
v =
dynamic_cast<TH1F*
>(
m_inputFile->Get(vName.c_str()));
118 TH1F* o =
dynamic_cast<TH1F*
>(
m_inputFile->Get(oName.c_str()));
119 TH1F*
min =
dynamic_cast<TH1F*
>(
m_inputFile->Get(minName.c_str()));
120 TH1F*
max =
dynamic_cast<TH1F*
>(
m_inputFile->Get(maxName.c_str()));
121 TH2F*
t =
dynamic_cast<TH2F*
>(
m_inputFile->Get(tName.c_str()));
122 TH2F* x0 =
dynamic_cast<TH2F*
>(
m_inputFile->Get(x0Name.c_str()));
123 TH2F* l0 =
dynamic_cast<TH2F*
>(
m_inputFile->Get(l0Name.c_str()));
124 TH2F* A =
dynamic_cast<TH2F*
>(
m_inputFile->Get(aName.c_str()));
125 TH2F* Z =
dynamic_cast<TH2F*
>(
m_inputFile->Get(zName.c_str()));
126 TH2F* rho =
dynamic_cast<TH2F*
>(
m_inputFile->Get(rhoName.c_str()));
129 if (n and v and o and min and max and t and x0 and l0 and A and Z and rho) {
131 int nbins0 = t->GetNbinsX();
132 int nbins1 = t->GetNbinsY();
139 if (nbins0 * nbins1 > 1) {
141 for (
int ib0 = 1; ib0 <= nbins0; ++ib0) {
142 for (
int ib1 = 1; ib1 <= nbins1; ++ib1) {
143 double dt = t->GetBinContent(ib0, ib1);
145 double dx0 = x0->GetBinContent(ib0, ib1);
146 double dl0 = l0->GetBinContent(ib0, ib1);
147 double da = A->GetBinContent(ib0, ib1);
148 double dz = Z->GetBinContent(ib0, ib1);
149 double drho = rho->GetBinContent(ib0, ib1);
153 materialMatrix[ib1 - 1][ib0 - 1] =
161 for (
int ib = 1; ib < n->GetNbinsX() + 1; ++ib) {
162 size_t nbins = size_t(n->GetBinContent(ib));
165 float rmin = min->GetBinContent(ib);
166 float rmax = max->GetBinContent(ib);
172 sMaterial = std::make_shared<const Acts::BinnedSurfaceMaterial>(
173 bUtility, std::move(materialMatrix));
177 double dt = t->GetBinContent(1, 1);
178 double dx0 = x0->GetBinContent(1, 1);
179 double dl0 = l0->GetBinContent(1, 1);
180 double da = A->GetBinContent(1, 1);
181 double dz = Z->GetBinContent(1, 1);
182 double drho = rho->GetBinContent(1, 1);
186 sMaterial = std::make_shared<const Acts::HomogeneousSurfaceMaterial>(
190 ACTS_VERBOSE(
"Successfully read Material for : " << geoID);
198 m_inputFile->Close();