14#include "AthLinks/ElementLink.h"
25 using SimHitLinkVec_t = std::vector<SimHitLink_t>;
30 std::vector<const xAOD::MuonSimHit*>& appendTo) {
35 if (
hit && !std::ranges::contains(appendTo,
hit)) {
36 appendTo.push_back(
hit);
41 std::vector<typename T::element_type*> stripSmartPointer(
const std::vector<T>&
vec){
42 std::vector<typename T::element_type*> ret{};
43 ret.reserve(
vec.size());
44 std::ranges::transform(
vec, std::back_inserter(ret), [](
const T& obj){
54 if (acc.isAvailable(prdHit)) {
55 const SimHitLink_t& link{acc(prdHit)};
67 std::vector<const xAOD::MuonSimHit*> hits{};
69 hits.reserve(acc_simLink(segment).
size());
70 for (
const SimHitLink_t& link : acc_simLink(segment)) {
72 hits.emplace_back(*link);
76 for (
const PrdLink_t& link : acc_prdLink(segment)) {
87 appendHit(cmb->primaryStrip(), hits);
88 appendHit(cmb->secondaryStrip(), hits);
91 appendHit(prdHit, hits);
97 std::vector<const xAOD::MuonSimHit*>
getMatchingSimHits(std::span<const SpacePoint* const> spacePoints) {
98 std::vector<const xAOD::MuonSimHit*> hits{};
100 appendHit(
sp->primaryMeasurement(), hits);
101 appendHit(
sp->secondaryMeasurement(), hits);
106 std::vector<const xAOD::MuonSimHit*>
getMatchingSimHits(std::span<const CalibratedSpacePoint* const> measurements) {
107 std::vector<const xAOD::MuonSimHit*> hits{};
116 const auto measurements = stripSmartPointer(segment.
measurements());
128 if (acc.isAvailable(segment)){
130 if (link.isValid()) {
139 if (acc.isAvailable(segment)) {
150 if (acc.isAvailable(
hit)) {
165 std::vector<const xAOD::MuonSegment*> segments{};
167 if (!acc.isAvailable(truthMuon)) {
170 for (
const SegLink_t& link : acc(truthMuon)) {
171 segments.emplace_back(*link);
std::vector< size_t > vec
size_t size() const
Number of registered mappings.
ElementLink< xAOD::TruthParticleContainer > TruthLink_t
ElementLink< xAOD::MuonSegmentContainer > SegLink_t
std::vector< SegLink_t > SegLinkVec_t
ElementLink implementation for ROOT usage.
The calibrated Space point is created during the calibration process.
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Placeholder for what will later be the muon segment EDM representation.
const MeasVec & measurements() const
Returns the associated measurements.
: The muon space point bucket represents a collection of points that will bre processed together in t...
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual unsigned int numDimensions() const =0
Returns the number of dimensions of the measurement.
This header ties the generic definitions in this package.
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
ElementLink< PrdCont_t > PrdLink_t
const xAOD::MuonSimHit * getTruthMatchedHit(const xAOD::MuonMeasurement &prdHit)
Returns the MuonSimHit, if there's any, matched to the uncalibrated muon measurement.
std::vector< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
std::vector< const xAOD::MuonSegment * > getTruthSegments(const xAOD::TruthParticle &truthMuon)
Returns the segments associated to the truth muon.
const xAOD::MuonSegment * getMatchedTruthSegment(const xAOD::MuonSegment &segment)
Returns the truth-matched segment.
std::vector< PrdLink_t > PrdLinkVec_t
ElementLink< xAOD::MuonSegmentContainer > SegLink_t
MuonMeasurement_v1 MuonMeasurement
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
TruthParticle_v1 TruthParticle
Typedef to implementation.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
CombinedMuonStrip_v1 CombinedMuonStrip