34 #include <type_traits>
47 if (
m_cfg.folderSurfaceNameBase.empty()) {
48 throw std::invalid_argument(
"Missing surface folder name base");
49 }
else if (
m_cfg.folderVolumeNameBase.empty()) {
50 throw std::invalid_argument(
"Missing volume folder name base");
51 }
else if (
m_cfg.filePath.empty()) {
52 throw std::invalid_argument(
"Missing file name");
56 m_outputFile = TFile::Open(
m_cfg.filePath.c_str(),
m_cfg.fileMode.c_str());
57 if (m_outputFile ==
nullptr) {
58 throw std::ios_base::failure(
"Could not open '" +
m_cfg.filePath);
67 auto& surfaceMaps = detMaterial.first;
68 for (
auto& [key,
value] : surfaceMaps) {
75 const auto gvolID = geoID.
volume();
76 const auto gbouID = geoID.
boundary();
77 const auto glayID = geoID.
layer();
78 const auto gappID = geoID.
approach();
88 m_outputFile->mkdir(tdName.c_str());
89 m_outputFile->cd(tdName.c_str());
93 size_t bins0 = 1, bins1 = 1;
105 size_t binningBins = binningData.size();
108 TH1F*
n =
new TH1F(
m_cfg.ntag.c_str(),
"bins; bin", binningBins, -0.5,
112 TH1F*
v =
new TH1F(
m_cfg.vtag.c_str(),
"binning values; bin", binningBins,
113 -0.5, binningBins - 0.5);
116 TH1F* o =
new TH1F(
m_cfg.otag.c_str(),
"binning options; bin",
117 binningBins, -0.5, binningBins - 0.5);
120 TH1F*
min =
new TH1F(
m_cfg.mintag.c_str(),
"min; bin", binningBins, -0.5,
124 TH1F* max =
new TH1F(
m_cfg.maxtag.c_str(),
"max; bin", binningBins, -0.5,
129 for (
auto bData : binningData) {
131 n->SetBinContent(b,
int(binningData[b - 1].
bins()));
132 v->SetBinContent(b,
int(binningData[b - 1].binvalue));
133 o->SetBinContent(b,
int(binningData[b - 1].option));
134 min->SetBinContent(b, binningData[b - 1].min);
135 max->SetBinContent(b, binningData[b - 1].max);
145 TH2F*
t =
new TH2F(
m_cfg.ttag.c_str(),
"thickness [mm] ;b0 ;b1", bins0,
146 -0.5, bins0 - 0.5, bins1, -0.5, bins1 - 0.5);
147 TH2F*
x0 =
new TH2F(
m_cfg.x0tag.c_str(),
"X_{0} [mm] ;b0 ;b1", bins0, -0.5,
148 bins0 - 0.5, bins1, -0.5, bins1 - 0.5);
149 TH2F* l0 =
new TH2F(
m_cfg.l0tag.c_str(),
"#Lambda_{0} [mm] ;b0 ;b1", bins0,
150 -0.5, bins0 - 0.5, bins1, -0.5, bins1 - 0.5);
151 TH2F*
A =
new TH2F(
m_cfg.atag.c_str(),
"X_{0} [mm] ;b0 ;b1", bins0, -0.5,
152 bins0 - 0.5, bins1, -0.5, bins1 - 0.5);
153 TH2F*
Z =
new TH2F(
m_cfg.ztag.c_str(),
"#Lambda_{0} [mm] ;b0 ;b1", bins0,
154 -0.5, bins0 - 0.5, bins1, -0.5, bins1 - 0.5);
155 TH2F*
rho =
new TH2F(
m_cfg.rhotag.c_str(),
"#rho [g/mm^3] ;b0 ;b1", bins0,
156 -0.5, bins0 - 0.5, bins1, -0.5, bins1 - 0.5);
159 for (
size_t b0 = 0; b0 < bins0; ++b0) {
160 for (
size_t b1 = 0;
b1 < bins1; ++
b1) {
164 t->SetBinContent(b0 + 1,
b1 + 1, mat.thickness());
165 x0->SetBinContent(b0 + 1,
b1 + 1, mat.material().X0());
166 l0->SetBinContent(b0 + 1,
b1 + 1, mat.material().L0());
167 A->SetBinContent(b0 + 1,
b1 + 1, mat.material().Ar());
168 Z->SetBinContent(b0 + 1,
b1 + 1, mat.material().Z());
169 rho->SetBinContent(b0 + 1,
b1 + 1, mat.material().massDensity());
181 auto& volumeMaps = detMaterial.second;
182 for (
auto& [key,
value] : volumeMaps) {
189 const auto gvolID = geoID.
volume();
196 m_outputFile->mkdir(tdName.c_str());
197 m_outputFile->cd(tdName.c_str());
208 if (bvMaterial3D !=
nullptr || bvMaterial2D !=
nullptr) {
210 std::vector<Acts::BinningData> binningData;
211 if (bvMaterial3D !=
nullptr) {
212 binningData = bvMaterial3D->binUtility().binningData();
214 points = grid.
size();
216 binningData = bvMaterial2D->binUtility().binningData();
218 points = grid.
size();
222 size_t binningBins = binningData.size();
225 TH1F*
n =
new TH1F(
m_cfg.ntag.c_str(),
"bins; bin", binningBins, -0.5,
229 TH1F*
v =
new TH1F(
m_cfg.vtag.c_str(),
"binning values; bin", binningBins,
230 -0.5, binningBins - 0.5);
233 TH1F* o =
new TH1F(
m_cfg.otag.c_str(),
"binning options; bin",
234 binningBins, -0.5, binningBins - 0.5);
237 TH1F*
min =
new TH1F(
m_cfg.mintag.c_str(),
"min; bin", binningBins, -0.5,
241 TH1F* max =
new TH1F(
m_cfg.maxtag.c_str(),
"max; bin", binningBins, -0.5,
246 for (
auto bData : binningData) {
248 n->SetBinContent(b,
int(binningData[b - 1].
bins()));
249 v->SetBinContent(b,
int(binningData[b - 1].binvalue));
250 o->SetBinContent(b,
int(binningData[b - 1].option));
251 min->SetBinContent(b, binningData[b - 1].min);
252 max->SetBinContent(b, binningData[b - 1].max);
262 TH1F*
x0 =
new TH1F(
m_cfg.x0tag.c_str(),
"X_{0} [mm] ;gridPoint", points,
264 TH1F* l0 =
new TH1F(
m_cfg.l0tag.c_str(),
"#Lambda_{0} [mm] ;gridPoint",
265 points, -0.5, points - 0.5);
266 TH1F*
A =
new TH1F(
m_cfg.atag.c_str(),
"X_{0} [mm] ;gridPoint", points,
268 TH1F*
Z =
new TH1F(
m_cfg.ztag.c_str(),
"#Lambda_{0} [mm] ;gridPoint",
269 points, -0.5, points - 0.5);
270 TH1F*
rho =
new TH1F(
m_cfg.rhotag.c_str(),
"#rho [g/mm^3] ;gridPoint",
271 points, -0.5, points - 0.5);
274 auto mat = vMaterial->
material({0, 0, 0});
275 x0->SetBinContent(1, mat.X0());
276 l0->SetBinContent(1, mat.L0());
277 A->SetBinContent(1, mat.Ar());
278 Z->SetBinContent(1, mat.Z());
279 rho->SetBinContent(1, mat.massDensity());
282 if (bvMaterial3D !=
nullptr) {
287 x0->SetBinContent(
point + 1, mat.X0());
288 l0->SetBinContent(
point + 1, mat.L0());
289 A->SetBinContent(
point + 1, mat.Ar());
290 Z->SetBinContent(
point + 1, mat.Z());
291 rho->SetBinContent(
point + 1, mat.massDensity());
296 else if (bvMaterial2D !=
nullptr) {
301 x0->SetBinContent(
point + 1, mat.X0());
302 l0->SetBinContent(
point + 1, mat.L0());
303 A->SetBinContent(
point + 1, mat.Ar());
304 Z->SetBinContent(
point + 1, mat.Z());
305 rho->SetBinContent(
point + 1, mat.massDensity());
319 if (m_outputFile !=
nullptr) {
320 m_outputFile->Close();
330 collectMaterial(*
hVolume, detMatMap);
333 writeMaterial(detMatMap);
347 collectMaterial(*lay, detMatMap);
352 if (
m_cfg.processBoundaries) {
354 const auto& bSurface = bou->surfaceRepresentation();
355 if (bSurface.surfaceMaterialSharedPtr() !=
nullptr) {
356 detMatMap.first[bSurface.geometryId()] =
357 bSurface.surfaceMaterialSharedPtr();
365 collectMaterial(*tvol, detMatMap);
374 if (rSurface.surfaceMaterialSharedPtr() !=
nullptr and
375 m_cfg.processRepresenting) {
376 detMatMap.first[rSurface.geometryId()] =
383 if (aSurface->surfaceMaterialSharedPtr() !=
nullptr) {
384 detMatMap.first[aSurface->geometryId()] =
385 aSurface->surfaceMaterialSharedPtr();
394 if (sSurface->surfaceMaterialSharedPtr() !=
nullptr) {
395 detMatMap.first[sSurface->geometryId()] =
396 sSurface->surfaceMaterialSharedPtr();