40 return StatusCode::SUCCESS;
49 ATH_CHECK(outputCands.
record(std::make_unique<L0Muon::RPCCandDataContainer>()));
61 ATH_MSG_ERROR(
"No valid option selected for building candidates.");
62 return StatusCode::FAILURE;
75 return StatusCode::SUCCESS;
77 std::vector<const xAOD::MuonSimHit*>
79 const EventContext& ctx)
const {
82 using SegLinkVec_t = std::vector<SegLink_t>;
85 std::vector<const xAOD::MuonSimHit*> rpcHits{};
87 for (
const SegLink_t& link : acc_link(truthPart)) {
93 std::ranges::copy_if(simHits, std::back_inserter(rpcHits),
99 return a->identify() < b->identify();
105 const EventContext &ctx)
const
118 std::vector<const xAOD::MuonSimHit*> rpcHits =
collectHits(*truthMuon, ctx);
119 if (rpcHits.empty()) {
123 ATH_MSG_DEBUG(
"Found a muon with pdgId: " << truthMuon->pdgId());
124 const auto muonP4 = truthMuon->p4();
127 float eta = truthMuon->eta();
128 float phi = truthMuon->phi();
129 float pt = truthMuon->pt();
131 uint8_t
charge = truthMuon->charge() < 0 ? 0 : 1;
135 uint16_t subdetectorId =
eta > 0 ? 0x65 : 0x66;
136 auto cand = std::make_unique<L0Muon::RPCCandData>(subdetectorId, 0, 0);
141 cand->setThreshold(0);
145 std::array<float, 4> zPos{};
146 std::array<int, 4> nZPos{};
164 const int dR = id_helper.
doubletR(
id);
179 for (
int i = 0; i < 4; ++i) {
181 zPos[i] = std::abs(zPos[i]);
185 cand->setZPos(
static_cast<uint16_t
>(zPos[i]/
193 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
double charge(const T &p)
ATLAS-specific HepMC functions.
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink implementation for ROOT usage.
static constexpr float s_zPosRange
range of the RPC hits z positions
static constexpr uint16_t s_zPosBitRange
12 bits for z position
StatusCode buildFromTruth(L0Muon::RPCCandDataContainer &outputCands, const EventContext &ctx) const
build the candidates from the MC truth
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthPartKey
truth containers
virtual StatusCode initialize() override
Gaudi::Property< bool > m_usePatterns
Gaudi::Property< bool > m_useTruth
configuration options
std::vector< const xAOD::MuonSimHit * > collectHits(const xAOD::TruthParticle &truthPart, const EventContext &ctx) const
SG::WriteHandleKey< L0Muon::RPCCandDataContainer > m_outputCandKey
Output Trigger candidates.
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_segmentLinkKey
SG::ReadHandleKey< xAOD::NRPCRDOContainer > m_keyRpcRdo
RPC Rdo.
const MuonGMR4::MuonDetectorManager * m_detMgr
ToolHandle< GenericMonitoringTool > m_monTool
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
helper service
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
virtual StatusCode execute(const EventContext &ctx) const override
Declare a monitored scalar variable.
Amg::Vector3D stripPosition(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
int doubletR(const Identifier &id) const
Handle class for reading a decoration on an object.
bool isPresent() const
Is the referenced object present in SG?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
DataVector< RPCCandData > RPCCandDataContainer
std::unordered_set< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
StIndex
enum to classify the different station layers in the muon spectrometer
bool isBarrel(const ChIndex index)
Returns true if the chamber index points to a barrel chamber.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
TruthParticle_v1 TruthParticle
Typedef to implementation.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.