9#include <unordered_map>
43 return StatusCode::SUCCESS;
51 std::unordered_map<const ActsTrk::TrackContainerBase *, const ActsTrk::TrackToTruthParticleAssociation *> truth_association_map;
56 truth_association_map.insert(std::make_pair( assocMap->
sourceContainer(), assocMap));
64 std::vector<std::pair<const xAOD::TruthParticle*, const xAOD::TruthParticle*>> derivateTruthMap{};
69 ATH_MSG_ERROR(
"Link to the original truth particle contianer not present "
71 return StatusCode::FAILURE;
73 derivateTruthMap.emplace_back(parentP, linkMeTo);
83 if (
auto itr = std::ranges::find_if(derivateTruthMap, [part](
const auto& truthPair){
84 return truthPair.first == part;
85 }); itr != derivateTruthMap.end()) {
99 track_particle_handle->
size());
101 std::pair<const ActsTrk::TrackContainerBase *, const ActsTrk::TrackToTruthParticleAssociation *>
102 the_track_truth_association{
nullptr,
nullptr};
107 unsigned int classification = 0;
110 if (!optional_track.has_value()) {
114 if (track_container != the_track_truth_association.first) {
115 auto truth_association_map_iter = truth_association_map.find( track_container );
116 if (truth_association_map_iter != truth_association_map.end()) {
117 the_track_truth_association = *truth_association_map_iter;
124 (*the_track_truth_association.second).at(optional_track->index()),
133 if (!truth_particle) {
141 type = truthClass.first;
142 origin = truthClass.second;
146 truthClass_decor(*track_particle) = classification;
149 track_particle_handle->
size(),
151 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainer > m_floatDecor
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_derivateTruthKey
Muon tracks are matched to the truth particle container insert a bypass to bend the link to the desir...
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadHandleKeyArray< TrackToTruthParticleAssociation > m_trackToTruth
Hit-based truth matching from the Acts::Track -> truth particle.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkParticleName
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_truthClassDecor
SG::WriteDecorHandleKeyArray< xAOD::TrackParticleContainer > m_intDecor
virtual StatusCode initialize() override
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_linkDecor
ToolHandle< IMCTruthClassifier > m_truthClassifier
const ActsTrk::TrackContainer * sourceContainer() const
std::size_t perEtaSize() const
TruthMatchResult analyseTrackTruth(const TruthParticleHitCounts &truth_particle_hit_counts, const HitCountsPerTrack &track_hit_counts, EventStat &event_stat) const
const TruthParticleHitCounts & getTruthParticleHitCounts(const EventContext &ctx) const
EventStatBase< TrackFindingValidationDetailedStat > EventStat
std::size_t perPdgIdSize() const
void postProcessEventStat(const TruthParticleHitCounts &truth_particle_hit_counts, std::size_t n_tracks, EventStat &event_stat) const
virtual StatusCode initialize() override
ToolHandle< IAthSelectionTool > m_truthSelectionTool
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
Property holding a SG store/key/clid from which a ReadHandle is made.
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::unordered_map< const xAOD::TruthParticle *, HitCounterArray > TruthParticleHitCounts
Acts::TrackContainer< TrackBackend, TrackStateBackend, Acts::detail::ValueHolder > TrackContainerBase
std::optional< ActsTrk::TrackContainer::ConstTrackProxy > getActsTrack(const xAOD::TrackParticle &trkPart)
Return the proxy to the Acts track from which the track particle was made frome.
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
Classify a particle into a bit-word (see MCTC_bits).
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any).
TrackParticle_v1 TrackParticle
Reference the current persistent version:
std::vector< ContainerDecorator< Cont_t, dType > > createDecorators(const SG::WriteDecorHandleKeyArray< Cont_t > &keyArray, const EventContext &ctx, dType defValue={})
Factory method for a vector of ContainerDecorators instantiated from a WriteDecorHandleKeyArray.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Match result returned by analyseTrackTruth.
float m_hitPurity
fraction of hits originting from best match over total reco hits
float m_matchProbability
the matching probability based on weighted hit sums
float m_hitEfficiency
fraction of hits originting from best match over total best match hits
const xAOD::TruthParticle * m_truthParticle
best matching truth particle or nullptr