11#include "Acts/Surfaces/PlanarBounds.hpp"
24 return StatusCode::SUCCESS;
26 template <
typename Key_t,
27 typename... OtherKey_t>
31 OtherKey_t... others)
const {
36 return StatusCode::FAILURE;
40 if constexpr(
sizeof...(others) > 0) {
43 return StatusCode::SUCCESS;
74 return {cabling->getROBId(
m_idHelperSvc->moduleHash(moduleID), msgStream())};
80 return {cabling->getROBId(
m_idHelperSvc->moduleHash(moduleID), msgStream())};
86 int subDetectorId{}, rodId{};
87 cabling->getReadoutIDfromElementID(moduleID, subDetectorId, rodId);
88 return {
static_cast<std::uint32_t
>(((0x0ff) & subDetectorId)<<16 | rodId)};
95 return std::set<std::uint32_t>(robIdHelper.
get_ids().begin(), robIdHelper.
get_ids().end());
107 return StatusCode::SUCCESS;
113 auto writeCdo = std::make_unique<RegSelSiLUT>();
121 gctx.
setStore(std::make_unique<ActsTrk::DetectorAlignStore>(*alignDeltas));
127 struct TempSelTable {
128 std::optional<double> centralPhi{};
129 double zMin{std::numeric_limits<double>::max()};
130 double zMax{-std::numeric_limits<double>::max()};
131 double rMin{std::numeric_limits<double>::max()};
132 double rMax{-std::numeric_limits<double>::max()};
133 double dPhiMin{std::numeric_limits<double>::max()};
134 double dPhiMax{-std::numeric_limits<double>::max()};
138 rMin = std::min(rMin, v.perp()); rMax = std::max(rMax, v.perp());
139 zMin = std::min(zMin, v.z()); zMax = std::max(zMax, v.z());
140 dPhiMin = std::min(dPhiMin, dPhi); dPhiMax = std::max(dPhiMax, dPhi);
149 const Acts::Surface& surface{reEle->surface()};
151 const double halfTck = 0.5*reEle->thickness();
153 std::vector<Amg::Vector3D> localVertices{};
154 localVertices.reserve(8);
156 std::ranges::for_each(
static_cast<const Acts::PlanarBounds&
>(surface.bounds()).vertices(),
158 ATH_MSG_VERBOSE(__LINE__<<
" - Local vertex: "<<Amg::toString(v)<<
", half thickness: "<<halfTck);
159 localVertices.emplace_back(v.x(), v.y(), halfTck);
160 localVertices.emplace_back(v.x(), v.y(), -halfTck);
162 ATH_MSG_VERBOSE(__LINE__<<
" - Fetched "<<localVertices.size()<<
" vertices.");
165 auto& lut = luts.at(modHash);
166 if (!lut.centralPhi) {
167 lut.centralPhi = loc2Glob.translation().phi();
172 <<std::format(
"{:.2f}/{:.2f}/{:.2f}", globVtx.perp(), globVtx.z(), globVtx.phi()));
179 module_itr != idHelper.
module_end(); ++module_itr) {
181 const auto& lut = luts.at(modHash);
183 if(!lut.centralPhi) {
189 ATH_MSG_DEBUG(__LINE__<<
" - Failed retrieving ExpandedIdentifier for PRD Identifier = "
190 <<
m_idHelperSvc->toString(*module_itr) <<
". Skipping to the next PRD.");
193 const int detid = ( exp_id[2]<0 ? -1 : 1 );
194 const int layerid = exp_id[1]+1;
196 const double phiMin = lut.centralPhi.value_or(0) + lut.dPhiMin;
197 const double phiMax = lut.centralPhi.value_or(0) + lut.dPhiMax;
200 for (
const std::uint32_t robID :
getRobIDs(ctx, *module_itr)) {
202 phiMin, phiMax, layerid, detid, robID, modHash};
205 writeCdo->addModule(m);
210 if (
const auto *lut =
dynamic_cast<const RegSelSiLUT*
>(writeCdo.get())) {
211 lut->write(std::format(
"{:}.map", name()));
215 ATH_CHECK(writeHandle.
record(std::make_unique<IRegSelLUTCondData>(std::move(writeCdo))));
216 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
DetectorType detType
The aligned detector element type.
Acts::GeometryContext context() const
void setStore(AlignmentStorePtr store)
Adds the store to the Geometry context.
const ServiceHandle< StoreGateSvc > & detStore() const
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
This is a "hash" representation of an Identifier.
MuonReadoutElement is an abstract class representing the geometry of a muon detector.
const_id_iterator module_end() const
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Create expanded id from compact id (return == 0 for OK)
const_id_iterator module_begin() const
Iterators over full set of ids.
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const
size_type module_hash_max() const
the maximum hash value
IdContext module_context() const
id for module
virtual StatusCode initialize() override final
Gaudi::Property< bool > m_printTable
SG::ReadCondHandleKey< Muon::TgcCablingMap > m_cablingTgcKey
Dependency on the Tgc cabling map.
const MuonGMR4::MuonDetectorManager * m_detMgr
Detector manager.
SG::ReadCondHandleKey< Muon::RpcCablingMap > m_cablingRpcKey
Dependency on the phase II Rpc cabling map.
Gaudi::Property< bool > m_splitTrfCache
Instantiate a new transform cache to ensure lazy transform population in the event processing.
const MuonIdHelper & getIdHelper(const ActsTrk::DetectorType type) const
Retrieve the idHelper for the given detector technology.
virtual StatusCode execute(const EventContext &ctx) const override final
SG::ReadCondHandleKey< ActsTrk::DetectorAlignStore > m_alignKey
Dependency on the alignment constants.
SG::WriteCondHandleKey< IRegSelLUTCondData > m_tableKey
Region selector table written by the algorithm.
StatusCode addCondDependency(const EventContext &ctx, SG::WriteCondHandle< IRegSelLUTCondData > &writeHandle, const SG::ReadCondHandleKey< Key_t > &key, OtherKey_t... others) const
Declare the dependency of the region selector table on the other keys set.
std::set< std::uint32_t > getRobIDs(const EventContext &ctx, const Identifier &moduleID) const
Returns the list of ROB ids associated with the module.
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_cablingMdtKey
Dependency on the Mdt cabling map.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
const std::vector< uint32_t > & get_ids() const
void addDependency(const EventIDRange &range)
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
std::string to_string(const DetectorType &type)
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
std::unique_ptr< ActsTrk::DetectorAlignStore > copyDeltas(const ActsTrk::DetectorAlignStore &inStore)
Copy the alignment deltas from the inStore to a new alignment store.
This header ties the generic definitions in this package.
TechnologyIndex
enum to classify the different layers in the muon spectrometer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
#define THROW_EXCEPTION(MESSAGE)