115 return StatusCode::SUCCESS;
121 auto writeCdo = std::make_unique<RegSelSiLUT>();
129 gctx.
setStore(std::make_unique<ActsTrk::DetectorAlignStore>(*alignDeltas));
135 struct TempSelTable {
136 std::optional<double> centralPhi{};
137 double zMin{std::numeric_limits<double>::max()};
138 double zMax{-std::numeric_limits<double>::max()};
139 double rMin{std::numeric_limits<double>::max()};
140 double rMax{-std::numeric_limits<double>::max()};
141 double dPhiMin{std::numeric_limits<double>::max()};
142 double dPhiMax{-std::numeric_limits<double>::max()};
146 rMin = std::min(rMin, v.perp()); rMax = std::max(rMax, v.perp());
147 zMin = std::min(zMin, v.z()); zMax = std::max(zMax, v.z());
148 dPhiMin = std::min(dPhiMin, dPhi); dPhiMax = std::max(dPhiMax, dPhi);
155 std::vector<std::unique_ptr<Acts::Volume>> objVolumes{};
158 const Acts::Surface& surface{reEle->surface()};
160 const double halfTck = 0.5*reEle->thickness();
162 std::vector<Amg::Vector3D> localVertices{};
163 localVertices.reserve(8);
165 std::ranges::for_each(
static_cast<const Acts::PlanarBounds&
>(surface.bounds()).vertices(),
167 ATH_MSG_VERBOSE(__LINE__<<
" - Local vertex: "<<Amg::toString(v)<<
", half thickness: "<<halfTck);
168 localVertices.emplace_back(v.x(), v.y(), halfTck);
169 localVertices.emplace_back(v.x(), v.y(), -halfTck);
173 std::unique_ptr<Acts::VolumeBounds> volBounds{};
174 switch (surface.bounds().type()) {
175 using enum Acts::SurfaceBounds::BoundsType;
177 using vEnum = Acts::RectangleBounds::BoundValues;
178 const auto& bounds{
static_cast<const Acts::RectangleBounds&
>(surface.bounds())};
179 volBounds = std::make_unique<Acts::CuboidVolumeBounds>(bounds.get(vEnum::eMaxX),
180 bounds.get(vEnum::eMaxY),
184 using vEnum = Acts::TrapezoidBounds::BoundValues;
185 const auto& bounds{
static_cast<const Acts::TrapezoidBounds&
>(surface.bounds())};
186 volBounds = std::make_unique<Acts::TrapezoidVolumeBounds>(bounds.get(vEnum::eHalfLengthXnegY),
187 bounds.get(vEnum::eHalfLengthXposY),
188 bounds.get(vEnum::eHalfLengthY),
194 objVolumes.emplace_back(std::make_unique<Acts::Volume>(surface.localToGlobalTransform(gctx.
context()),
195 std::move(volBounds)));
198 ATH_MSG_VERBOSE(__LINE__<<
" - Fetched "<<localVertices.size()<<
" vertices.");
201 auto& lut = luts.at(modHash);
202 if (!lut.centralPhi) {
203 lut.centralPhi = loc2Glob.translation().phi();
208 <<std::format(
"{:.2f}/{:.2f}/{:.2f}", globVtx.perp(), globVtx.z(), globVtx.phi()));
215 module_itr != idHelper.
module_end(); ++module_itr) {
217 const auto& lut = luts.at(modHash);
219 if(!lut.centralPhi) {
225 ATH_MSG_DEBUG(__LINE__<<
" - Failed retrieving ExpandedIdentifier for PRD Identifier = "
226 <<
m_idHelperSvc->toString(*module_itr) <<
". Skipping to the next PRD.");
229 const int detid = ( exp_id[2]<0 ? -1 : 1 );
230 const int layerid = exp_id[1]+1;
232 const double phiMin = lut.centralPhi.value_or(0) + lut.dPhiMin;
233 const double phiMax = lut.centralPhi.value_or(0) + lut.dPhiMax;
236 for (
const std::uint32_t robID :
getRobIDs(ctx, *module_itr)) {
238 phiMin, phiMax, layerid, detid, robID, modHash};
241 writeCdo->addModule(m);
246 if (
const auto *lut =
dynamic_cast<const RegSelSiLUT*
>(writeCdo.get())) {
247 lut->write(std::format(
"{:}.map", name()));
250 if (!objVolumes.empty()) {
251 Acts::ObjVisualization3D visualHelper{};
252 for (
const auto& volume : objVolumes) {
253 Acts::GeometryView3D::drawVolume(visualHelper, *volume,
256 visualHelper.write(std::format(
"RegSelVolumes_{:}.obj", alignDeltas->
detType));
260 ATH_CHECK(writeHandle.
record(std::make_unique<IRegSelLUTCondData>(std::move(writeCdo))));
261 return StatusCode::SUCCESS;
void setStore(AlignmentStorePtr store)
Adds the store to the Geometry context.