 |
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include <unordered_set>
13 using IdSet_t = std::unordered_set<Identifier>;
15 using TruthPartWithIds_t = std::tuple<const xAOD::TruthParticle*, IdSet_t>;
38 return StatusCode::SUCCESS;
50 std::vector<IdDecorHandle_t> idDecorHandles{};
52 idDecorHandles.emplace_back(hitKey, ctx);
55 std::vector<TruthPartWithIds_t> truthWithIds{};
64 for (
const IdDecorHandle_t& hitDecor : idDecorHandles) {
66 [
this](
unsigned long long rawId) {
67 const Identifier id{rawId};
72 truthWithIds.emplace_back(std::make_tuple(
truthMuon, std::move(assocIds)));
78 ATH_MSG_ERROR(
"Associated reconstructed track is not available for "<<m_trkKey);
79 return StatusCode::FAILURE;
89 const Identifier measId = m_edmHelperSvc->getIdentifier(*meas);
90 if (!measId.
is_valid() || !m_idHelperSvc->isMuon(measId)){
94 trackIds.insert(measId);
97 int bestMatchFrac{-1};
99 for (
const auto& [truthPart, truthIds]: truthWithIds) {
100 const int matchedReco = std::ranges::count_if(trackIds,[&truthIds](
const Identifier& recoId){
101 return truthIds.count(recoId);
104 if (!matchedReco || matchedReco < bestMatchFrac){
107 bestMatchFrac = matchedReco;
108 bestMatch = truthPart;
118 return StatusCode::SUCCESS;
TruthDecor_t m_truMuOriginKey
TrkWriteDecorKey_t m_originWriteKey
Decorations to be written to the TrackParticle truthOrigin/truthType/truthParticleLink.
TruthReadKey_t m_truthMuonKey
TruthDecor_t m_truMuTypeKey
#define ATH_MSG_VERBOSE(x)
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Helper service to handle the Identifiers of measurements.
bool is_valid() const
Check if id is in a valid state.
TrkWriteDecorKey_t m_typeWriteKey
Handle class for reading a decoration on an object.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
Handle class for adding a decoration to an object.
Handle class for adding a decoration to an object.
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
ElementLink implementation for ROOT usage.
represents the track state (measurement, material, fit parameters and quality) at a surface.
StatusCode initialize(bool used=true)
forward the initialization to the member VarHandleKeys
StatusCode execute(const EventContext &ctx) const override final
TrkWriteDecorKey_t m_linkWriteKey
TruthDecorArr_t m_simHitKeys
Declaration of the dependency on the simHit decorations.
StatusCode initialize() override final
int getParticleTruthOrigin(const xAOD::IParticle &p)
Return the particle's truth origin (as defined by the MC Truth Classifier)
This header ties the generic definitions in this package.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc to decode the Identifiers.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
index_type index() const
Get the index of the element inside of its container.
Class describing a TrackParticle.
Gaudi::Property< std::vector< std::string > > m_simHitIds
List of simHit id decorations to read from the truth particle.
int getParticleTruthType(const xAOD::IParticle &p)
Return the particle's truth type (as defined by the MC Truth Classifier)