40 return StatusCode::SUCCESS;
49 ATH_CHECK(outputCands_handle.
record(std::make_unique<xAOD::RPCCandDataContainer>(), std::make_unique<xAOD::RPCCandDataAuxContainer>()));
50 auto outputCands = outputCands_handle.
ptr();
62 ATH_MSG_ERROR(
"No valid option selected for building candidates.");
63 return StatusCode::FAILURE;
76 return StatusCode::SUCCESS;
78 std::vector<const xAOD::MuonSimHit*>
80 const EventContext& ctx)
const {
86 std::vector<const xAOD::MuonSimHit*> rpcHits{};
88 for (
const SegLink_t& link : acc_link(truthPart)) {
94 std::ranges::copy_if(simHits, std::back_inserter(rpcHits),
100 return a->identify() < b->identify();
106 const EventContext &ctx)
const
119 std::vector<const xAOD::MuonSimHit*> rpcHits =
collectHits(*truthMuon, ctx);
120 if (rpcHits.empty()) {
124 ATH_MSG_DEBUG(
"Found a muon with pdgId: " << truthMuon->pdgId());
125 const auto muonP4 = truthMuon->p4();
128 float eta = truthMuon->eta();
129 float phi = truthMuon->phi();
130 float pt = truthMuon->pt();
132 uint8_t
charge = truthMuon->charge() < 0 ? 0 : 1;
136 uint16_t subdetectorId =
eta > 0 ? 0x65 : 0x66;
137 auto* cand = outputCands.
push_back(std::make_unique<xAOD::RPCCandData>());
143 cand->setThreshold(0);
144 cand->setCandCharge(
charge);
147 std::array<float, 4> zPos{};
148 std::array<int, 4> nZPos{};
166 const int dR = id_helper.
doubletR(
id);
181 for (
int i = 0; i < 4; ++i) {
183 zPos[i] = std::abs(zPos[i]);
200 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.
ElementLink< xAOD::MuonSegmentContainer > SegLink_t
std::vector< SegLink_t > SegLinkVec_t
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.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthPartKey
truth containers
virtual StatusCode initialize() override
Gaudi::Property< bool > m_usePatterns
SG::WriteHandleKey< xAOD::RPCCandDataContainer > m_outputCandKey
Output Trigger candidates.
Gaudi::Property< bool > m_useTruth
configuration options
StatusCode buildFromTruth(xAOD::RPCCandDataContainer &outputCands, const EventContext &ctx) const
build the candidates from the MC truth
std::vector< const xAOD::MuonSimHit * > collectHits(const xAOD::TruthParticle &truthPart, const EventContext &ctx) const
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.
pointer_type ptr()
Dereference the pointer.
void initialize(uint16_t subdetectorId, uint16_t sectorId, uint16_t bcTag)
Initialize candidate with basic properties.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
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.
RPCCandDataContainer_v1 RPCCandDataContainer
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.