10 #include <fmt/printf.h>
35 if (strcasecmp(splitmode.c_str(),
"NearestLayer") == 0) {
37 }
else if (strcasecmp(splitmode.c_str(),
"InnerLayer") == 0) {
39 }
else if (strcasecmp(splitmode.c_str(),
"OuterLayer") == 0) {
44 <<
"Invalid SplitMode \"" << splitmode
45 <<
"\". Acceptable values are \"NearestLayer\", \"InnerLayer\", \"OuterLayer\".";
78 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
81 std::cout << fmt::sprintf(
"\tnumber of hits: %9d",
layer.tracks()) << std::endl;
83 "\tnormalized segment length: %9.1f ± %9.1f cm",
layer.averageLength(),
layer.sigmaLength())
85 std::cout << fmt::sprintf(
"\tnormalized radiation lengths: %9.3f ± %9.3f",
86 layer.averageRadiationLengths(),
87 layer.sigmaRadiationLengths())
89 std::cout << fmt::sprintf(
"\tnormalized energy loss: %6.5fe-03 ± %6.5fe-03 GeV",
90 layer.averageEnergyLoss(),
91 layer.sigmaEnergyLoss())
93 parameters << fmt::sprintf(
"%-20s\t%7d\t%5.1f ± %5.1f cm\t%6.4f ± %6.4f \t%6.4fe-03 ± %6.4fe-03 GeV",
96 layer.averageLength(),
98 layer.averageRadiationLengths(),
99 layer.sigmaRadiationLengths(),
100 layer.averageEnergyLoss(),
101 layer.sigmaEnergyLoss())
111 std::ofstream xml(
name);
112 xml <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl;
113 xml <<
"<Groups>" << std::endl;
114 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
116 xml <<
" <Group name=\"" <<
layer.name() <<
"\">\n"
117 <<
" <Parameter name=\"TrackerRadLength\" value=\"" <<
layer.averageRadiationLengths() <<
"\"/>\n"
118 <<
" <Parameter name=\"TrackerXi\" value=\"" <<
layer.averageEnergyLoss() <<
"\"/>\n"
122 xml <<
"</Groups>" << std::endl;
127 for (
unsigned int i = 0;
i <
m_groups.size(); ++
i) {
166 LogInfo(
"TrackingMaterialAnalyser") <<
"TrackingMaterialAnalyser: List of the tracker groups: " << std::endl;
168 LogInfo(
"TrackingMaterialAnalyser") <<
i <<
" TrackingMaterialAnalyser:\t" <<
m_groups[
i]->info() << std::endl;
173 for (std::vector<MaterialAccountingTrack>::const_iterator
t = h_tracks->begin(),
end = h_tracks->end();
t !=
end;
192 std::vector<int>
group(
track.detectors().size());
193 for (
unsigned int i = 0;
i <
track.detectors().size(); ++
i)
196 for (
unsigned int i = 0;
i <
group.size(); ++
i)
198 LogInfo(
"TrackingMaterialAnalyser") <<
"For detector i: " <<
i <<
" index: " <<
group[
i]
199 <<
" R-ranges: " <<
m_groups[
group[
i] - 1]->getBoundingR().first <<
", "
201 <<
" Z-ranges: " <<
m_groups[
group[
i] - 1]->getBoundingZ().first <<
", "
209 for (
unsigned int i = 1;
i <
track.steps().size(); ++
i)
212 const double TOLERANCE = 0.0001;
217 limits[0] =
track.detectors()[0].m_curvilinearIn - TOLERANCE;
232 limits[
i] = (
track.detectors()[
i - 1].m_curvilinearOut +
track.detectors()[
i].m_curvilinearIn) / 2.;
240 limits[
i] =
track.detectors()[
i].m_curvilinearIn - TOLERANCE;
247 limits[
i] =
track.detectors()[
i - 1].m_curvilinearOut + TOLERANCE;
274 unsigned int index = 0;
275 while (
i <
track.steps().size()) {
294 std::cerr <<
"MaterialAccountingTrack::split(): ERROR: internal logic error, expected " <<
limits[
index]
295 <<
" < " << begin <<
" < " <<
limits[
index + 1] << std::endl;
308 std::pair<MaterialAccountingStep, MaterialAccountingStep>
parts =
step.split(
fraction);
334 for (
unsigned int i = 0;
i <
track.detectors().size(); ++
i)
357 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): ERROR: detector does not belong to any DetLayer"
360 <<
" (r: " << std::setprecision(1) << std::setw(5) <<
detector.position().perp()
361 <<
", z: " << std::setprecision(1) << std::setw(6) <<
detector.position().z()
362 <<
", phi: " << std::setprecision(3) << std::setw(6) <<
detector.position().phi() <<
")" << std::endl;
366 std::cerr <<
"TrackingMaterialAnalyser::findLayer(...): ERROR: detector belongs to " << inside <<
" DetLayers"
369 <<
" (r: " << std::setprecision(1) << std::setw(5) <<
detector.position().perp()
370 <<
", z: " << std::setprecision(1) << std::setw(6) <<
detector.position().z()
371 <<
", phi: " << std::setprecision(3) << std::setw(6) <<
detector.position().phi() <<
")" << std::endl;