44 constexpr Int_t PERIOD{9}, SETUP{0};
55 Plane targetPlane{0.0, 0.0, 0.0, 0.0, 0.0};
56 if (
nullptr != targetGeoFile) {
57 std::ifstream geo{targetGeoFile};
59 LOG(error) <<
" <!> BmnRun9DM : cannot open target geometry " << targetGeoFile;
62 std::vector<std::string> fields;
63 for (std::string line; std::getline(geo, line);) {
64 const size_t first{line.find_first_not_of(
" \t\r")};
65 if (std::string::npos == first ||
'/' == line[first])
67 fields.push_back(line.substr(first, line.find_last_not_of(
" \t\r") - first + 1));
69 if (fields.size() < 8 ||
"TUBE" != fields[2]) {
70 LOG(error) <<
" <!> BmnRun9DM : " << targetGeoFile
71 <<
" is not a TUBE target in FairRoot ASCII geometry format";
74 Double_t x{0.0}, y{0.0}, xUpper{0.0}, yUpper{0.0}, rMin{0.0}, rMax{0.0}, xPlacement{0.0}, yPlacement{0.0},
76 std::istringstream lower{fields[4]}, radii{fields[5]}, upper{fields[6]}, placement{fields[7]};
77 if (!(lower >> x >> y >>
fTarget.zStart) || !(radii >> rMin >> rMax)
78 || !(upper >> xUpper >> yUpper >>
fTarget.zEnd) || !(placement >> xPlacement >> yPlacement >> zPlacement))
80 LOG(error) <<
" <!> BmnRun9DM : cannot read the target tube from " << targetGeoFile;
93 targetPlane = {x - rMax, x + rMax, y - rMax, y + rMax, 0.5 * (
fTarget.zStart +
fTarget.zEnd)};
96 const std::unique_ptr<BmnVSPStationSet> vsp{BmnVSPStationSet ::Create(PERIOD, SETUP)};
97 const std::unique_ptr<BmnSiliconStationSet> sil{BmnSiliconStationSet ::Create(PERIOD, SETUP)};
102 <<
" is left out of the model, its hits, if any, are ignored";
111 auto append = [
this](
auto* set,
Int_t station,
Int_t module,
Int_t zone) {
112 if (station < 0 || station >= set->GetNStations())
114 auto* sta{set->GetStation(station)};
115 if (
nullptr == sta || module < 0 || module >= sta->GetNModules())
117 auto* mod{sta->GetModule(module)};
120 Double_t xMin{mod->GetXMinModule()}, xMax{mod->GetXMaxModule()}, yMin{mod->GetYMinModule()},
121 yMax{mod->GetYMaxModule()};
125 if (2 * zone + 1 >= mod->GetNStripLayers())
127 auto& lower{mod->GetStripLayer(2 * zone)};
128 auto& upper{mod->GetStripLayer(2 * zone + 1)};
129 xMin = std::min(lower.GetXMinLayer(), upper.GetXMinLayer());
130 xMax = std::max(lower.GetXMaxLayer(), upper.GetXMaxLayer());
131 yMin = std::min(lower.GetYMinLayer(), upper.GetYMinLayer());
132 yMax = std::max(lower.GetYMaxLayer(), upper.GetYMaxLayer());
134 if (xMax <= xMin || yMax <= yMin)
138 fPlanes.push_back({-xMax, -xMin, yMin, yMax, mod->GetZStartModulePosition() + 0.5 * mod->GetModuleThickness()});
143 const Int_t ID{
EncodedID(idx)}, system{ID >> 24}, station{(ID >> 16) & 0xFF},
module{(ID >> 4) & 0xFFF};
146 fPlanes.push_back(targetPlane);
160 LOG(error) <<
" <!> BmnRun9DM : no geometry for element " << idx <<
" (system " << system <<
", station "
161 << station <<
", module " << module <<
")";