41 LOG(info) << fName <<
": configuration file was not provided. Using default settings";
54 if (!pRecoSetupManager->IsInitialized()) {
58 const auto& recoSetup = pRecoSetupManager->GetSetup();
60 if (
fConfig.fbTrackingStations) {
61 std::set<MaterialSlice> mSlice;
63 recoSetup.ForEachUnit([&mSlice, &fName = this->fName](
const auto& unit) {
64 using Unit_t = std::remove_reference_t<std::remove_cv_t<
decltype(unit)>>;
65 LOG(info) << fName <<
": generating material budget maps for " << Unit_t::GetDetectorName();
66 int nSt = unit.GetNofTrackingStations();
67 for (
int iSt = 0; iSt < nSt; ++iSt) {
68 const auto& vol = unit.GetFullVolume(iSt);
69 mSlice.insert(std::move(
MaterialSlice{.fName = fmt::format(
"{}_station_{}", Unit_t::GetDetectorName(), iSt),
70 .fRefZ = vol.GetCenterZ(),
71 .fMinZ = vol.GetMinZ(),
72 .fMaxZ = vol.GetMaxZ(),
73 .fMaxXY = std::max(std::fabs(vol.GetMaxX()), std::fabs(vol.GetMaxY()))}));
79 for (
auto it = mSlice.begin(); it != mSlice.end(); ++it) {
80 LOG(info) <<
"Creating material map for " << it->fName;
81 double z1 = it->fMaxZ;
83 auto itNext = std::next(it, 1);
84 if (itNext != mSlice.end()) {
87 double zRef = it->fRefZ;
88 double zNew = 0.5 * (z1 + z2);
90 int nBins =
static_cast<int>(std::ceil(2. * xyMax /
fConfig.fPitch));
92 LOG(fatal) << fName <<
": selected pitch " <<
fConfig.fPitch <<
" gives wrong number of bins = " << nBins;
94 if (nBins >
fConfig.fMaxNofBins) {
103 for (
const auto& slice :
fConfig.fvUserSlices) {
104 LOG(info) <<
"Creating material map for " << slice.fName;
106 LOG(warn) << fName <<
": Material for slice " << slice.fName <<
" was already prepared. "
107 <<
"Please, check your configuration file";
111 double zMin = slice.fMinZ;
112 double zMax = slice.fMaxZ;
113 double zRef = slice.fRefZ;
115 int nBins =
static_cast<int>(std::ceil(2. * xyMax /
fConfig.fPitch));
118 throw std::runtime_error(fmt::format(
"selected pitch {} gives wrong number of bins ({})",
fConfig.fPitch, nBins));
120 if (nBins >
fConfig.fMaxNofBins) {
129catch (
const std::exception& err) {
130 LOG(error) << fName <<
": task initialization failed. Reason: " << err.what();
144 for (
const auto& [name, material] :
fmMaterial) {
145 double zMin = material.GetZmin();
146 double zMax = material.GetZmax();
147 std::string title = Form(
"Material thickness in X_{0}, z region [%.2f,%.2f] cm (%s)", zMin, zMax, name.c_str());
149 title +=
"; horizontal projection";
152 title += Form(
"; radial projection from z=%f cm",
fTargetZ);