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())};
82 SmartIF<MuonTGC_CablingSvc> cabling{Gaudi::svcLocator()->service(
"MuonTGC_CablingSvc")};
83 if (!cabling.isValid()) {
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;
112 auto writeCdo = std::make_unique<RegSelSiLUT>();
120 gctx.
setStore(std::make_unique<ActsTrk::DetectorAlignStore>(*alignDeltas));
126 struct TempSelTable {
127 std::optional<double> centralPhi{};
128 double zMin{std::numeric_limits<double>::max()};
129 double zMax{-std::numeric_limits<double>::max()};
130 double rMin{std::numeric_limits<double>::max()};
131 double rMax{-std::numeric_limits<double>::max()};
132 double dPhiMin{std::numeric_limits<double>::max()};
133 double dPhiMax{-std::numeric_limits<double>::max()};
137 rMin = std::min(rMin, v.perp()); rMax = std::max(rMax, v.perp());
138 zMin = std::min(zMin, v.z()); zMax = std::max(zMax, v.z());
139 dPhiMin = std::min(dPhiMin, dPhi); dPhiMax = std::max(dPhiMax, dPhi);
148 const Acts::Surface& surface{reEle->surface()};
150 const double halfTck = 0.5*reEle->thickness();
152 std::vector<Amg::Vector3D> localVertices{};
153 localVertices.reserve(8);
155 std::ranges::for_each(
static_cast<const Acts::PlanarBounds&
>(surface.bounds()).vertices(),
157 ATH_MSG_VERBOSE(__LINE__<<
" - Local vertex: "<<Amg::toString(v)<<
", half thickness: "<<halfTck);
158 localVertices.emplace_back(v.x(), v.y(), halfTck);
159 localVertices.emplace_back(v.x(), v.y(), -halfTck);
161 ATH_MSG_VERBOSE(__LINE__<<
" - Fetched "<<localVertices.size()<<
" vertices.");
164 auto& lut = luts.at(modHash);
165 if (!lut.centralPhi) {
166 lut.centralPhi = loc2Glob.translation().phi();
171 <<std::format(
"{:.2f}/{:.2f}/{:.2f}", globVtx.perp(), globVtx.z(), globVtx.phi()));
178 module_itr != idHelper.
module_end(); ++module_itr) {
180 const auto& lut = luts.at(modHash);
182 if(!lut.centralPhi) {
188 ATH_MSG_DEBUG(__LINE__<<
" - Failed retrieving ExpandedIdentifier for PRD Identifier = "
189 <<
m_idHelperSvc->toString(*module_itr) <<
". Skipping to the next PRD.");
192 const int detid = ( exp_id[2]<0 ? -1 : 1 );
193 const int layerid = exp_id[1]+1;
195 const double phiMin = lut.centralPhi.value_or(0) + lut.dPhiMin;
196 const double phiMax = lut.centralPhi.value_or(0) + lut.dPhiMax;
199 for (
const std::uint32_t robID :
getRobIDs(ctx, *module_itr)) {
201 phiMin, phiMax, layerid, detid, robID, modHash};
204 writeCdo->addModule(m);
209 if (
const auto *lut =
dynamic_cast<const RegSelSiLUT*
>(writeCdo.get())) {
210 lut->write(std::format(
"{:}.map", name()));
214 ATH_CHECK(writeHandle.
record(std::make_unique<IRegSelLUTCondData>(std::move(writeCdo))));
215 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
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.
StatusCode addDependency(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.
SG::WriteCondHandleKey< IRegSelLUTCondData > m_tableKey
Region selector table written by the algorithm.
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)