ATLAS Offline Software
Loading...
Searching...
No Matches
CachedGetAssocTruth.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef IDPVM_CachedGetAssocTruth_h
6#define IDPVM_CachedGetAssocTruth_h
7
13
14#include <unordered_map>
15#include <string>
18
20namespace IDPVM {
22 public:
31 void clear();
33 const xAOD::TruthParticle* operator () (const xAOD::TrackParticle* trackParticle);
34 const xAOD::TruthParticle* getTruth(const xAOD::TrackParticle* const trackParticle);
35
36 static void neededTrackParticleDecorations(std::vector<std::string> &decorations);
37 private:
39 std::unordered_map<const xAOD::TrackParticle*, const xAOD::TruthParticle*> m_cache;
40 static const std::string s_trackParticleLinkDecorationName;
41 };
42}// end of namespace
43#endif
const xAOD::TruthParticle * operator()(const xAOD::TrackParticle *trackParticle)
Get the associated truth particle, given a track particle.
std::unordered_map< const xAOD::TrackParticle *, const xAOD::TruthParticle * > m_cache
private cache container; map or unordered_map could be used
CachedGetAssocTruth(const CachedGetAssocTruth &)=delete
CachedGetAssocTruth(CachedGetAssocTruth &&)=default
static void neededTrackParticleDecorations(std::vector< std::string > &decorations)
static const std::string s_trackParticleLinkDecorationName
const xAOD::TruthParticle * getTruth(const xAOD::TrackParticle *const trackParticle)
CachedGetAssocTruth & operator=(CachedGetAssocTruth &&)=default
Class to retrieve associated truth from a track, implementing a cached response.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.