ATLAS Offline Software
Loading...
Searching...
No Matches
HGTDTruthTrackDecorationAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
3*/
4
5#ifndef HGTDTRACKEXTENSIONALG_TRUTHDECORATION_H
6#define HGTDTRACKEXTENSIONALG_TRUTHDECORATION_H
7
8// Base Class
10
17#include "Identifier/Identifier.h"
19
25
28
29
31
32#include <array>
33#include <cstddef>
34#include <unordered_map>
35
36namespace ActsTrk {
37
39
40 enum class ClusterTruthOrigin {
41 UNIDENTIFIED = 0, // ITk track is not associated with a truth particle, so not identified
42 TRUTH_PARTICLE = 1, // originates from the tested truth particle
43 UNRELATED_PARTICLE = 2, // originates from a particle that is unrelated to the ITk track
44 SECONDARY = 3 // originates from some secondary interaction
45 };
46
48 : public AthReentrantAlgorithm {
49
50 public:
51 using AthReentrantAlgorithm::AthReentrantAlgorithm;
52 virtual ~HGTDTruthTrackDecorationAlg() = default;
53
54 virtual StatusCode initialize() override;
55 virtual StatusCode execute(const EventContext&) const override;
56
57 private:
58
59 //HGTD Clusters and Cluster to Truth
60 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerName {this, "TrackParticleContainerName", "", "Name of the TrackParticle container"};
61 SG::ReadHandleKey<ActsTrk::TrackContainer> m_trackContainerKey{this, "ACTSTracksLocation", "HgtdTracks", "Output track collection (ActsTrk variant)"};
62 SG::ReadHandleKey<xAOD::UncalibratedMeasurementContainer> m_uncalibratedMeasurementContainerKey_HGTD{this, "UncalibratedMeasurementContainerKey_HGTD", "HGTD_Clusters", "input cluster collections for HGTD"};
63 SG::ReadHandleKey<MeasurementToTruthParticleAssociation> m_hgtdClustersToTruth { this, "HgtdClustersToTruthAssociationMap", "HgtdClustersToTruthParticles", "Association map from HGTD measurements to generator particles." };
64
65 SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> m_hgtdTrackLinkKey {this, "hgtdTrackLink", m_trackParticleContainerName, "hgtdTrackLink", "Link to Hgtd track"};
66 SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> m_truthParticleLinkKey {this, "truthParticleLink", m_trackParticleContainerName, "truthParticleLink", "Link to Truth particle"};
67
68 // Truth decorations
69 SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_layerClusterTruthClassKey { this, "HGTD_cluster_truth_class", m_trackParticleContainerName, "HGTD_cluster_truth_class", "Decoration for cluster truth classification" };
70 SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_layerClusterShadowedKey { this, "HGTD_cluster_shadowed", m_trackParticleContainerName, "HGTD_cluster_shadowed", "Decoration for shadowed cluster" };
71 SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_layerClusterMergedKey { this, "HGTD_cluster_merged", m_trackParticleContainerName, "HGTD_cluster_merged", "Decoration for merged cluster" };
72 SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_layerPrimaryExpectedKey { this, "HGTD_primary_expected", m_trackParticleContainerName, "HGTD_primary_expected", "Decoration for primary expected cluster" };
73
75 ServiceHandle<ActsTrk::ITrackingGeometrySvc> m_trackingGeometrySvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};
76
77 std::unique_ptr<SG::AuxElement::Accessor<int>> m_acc_nHgtdHits;
78
79 const HGTD_ID* m_id_helper{nullptr};
80
83 std::vector<int> truthClassVec = {-1, -1, -1, -1};
84 std::vector<char> isShadowedVec = {false, false, false, false};
85 std::vector<char> isMergedVec = {false, false, false, false};
86 std::vector<char> primaryExistsVec = {false, false, false, false};
87 };
88
103
112 const xAOD::TruthParticle* truthParticle,
113 const typename ActsTrk::TrackContainer::ConstTrackProxy trackProxy,
114 const ActsTrk::MeasurementToTruthParticleAssociation* association_map) const;
115
117 static constexpr std::size_t s_nHgtdLayers = 4;
119 using HgtdLayerFlags = std::array<char, s_nHgtdLayers>;
121 using PrimaryExpectedLookup = std::unordered_map<std::size_t, HgtdLayerFlags>;
122
136 const xAOD::UncalibratedMeasurementContainer & measurementContainer,
138 PrimaryExpectedLookup& lookup) const;
139
140 };
141
142} // namespace ActsTrk
143
144#endif
145
146
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleContainerName
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterShadowedKey
const HGTD_ID * m_id_helper
Handle to the ID helper.
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_hgtdClustersToTruth
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainer > m_uncalibratedMeasurementContainerKey_HGTD
StatusCode buildPrimaryExpectedLookup(const xAOD::UncalibratedMeasurementContainer &measurementContainer, const ActsTrk::MeasurementToTruthParticleAssociation *association_map, PrimaryExpectedLookup &lookup) const
Builds, once per event, the map from truth particle index onto the set of HGTD layers in which that p...
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterMergedKey
std::array< char, s_nHgtdLayers > HgtdLayerFlags
Per-layer flags for a single truth particle.
virtual StatusCode execute(const EventContext &) const override
static constexpr std::size_t s_nHgtdLayers
Number of HGTD layers the per-track decorations are indexed by.
std::unordered_map< std::size_t, HgtdLayerFlags > PrimaryExpectedLookup
Maps the index of a truth particle onto the HGTD layers it deposited a hit in.
SG::ReadHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_truthParticleLinkKey
ActsTrk::detail::xAODUncalibMeasSurfAcc m_surfAcc
std::unique_ptr< SG::AuxElement::Accessor< int > > m_acc_nHgtdHits
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerPrimaryExpectedKey
TruthTrackExtensionData createTruthDecoration(const xAOD::TruthParticle *truthParticle, const typename ActsTrk::TrackContainer::ConstTrackProxy trackProxy, const ActsTrk::MeasurementToTruthParticleAssociation *association_map) const
Generate TruthTrackExtensionData from extension.
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_hgtdTrackLinkKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterTruthClassKey
virtual ~HGTDTruthTrackDecorationAlg()=default
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
An algorithm that can be simultaneously executed in multiple threads.
This is an Identifier helper class for the HGTD subdetector.
Definition HGTD_ID.h:47
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
GenUncalibSourceLinkAccessor< MeasurementRangeList > UncalibSourceLinkAccessor
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
detail::UncalibSourceLinkAccessor AtlUncalibSourceLinkAccessor
TruthParticle_v1 TruthParticle
Typedef to implementation.
UncalibratedMeasurementContainer_v1 UncalibratedMeasurementContainer
Define the version of the uncalibrated measurement container.
bool is_merged
A cluster is considered to be merged if more than one particle deposited energy in a given pad.
bool is_shadowed
Shadowing means that a deposit was left by the truth particle, but it was not the first deposit and i...
Data structure to hold truth information about the HGTD track extension.
std::vector< int > truthClassVec
Truth classification per HGTD layer.
std::vector< char > isShadowedVec
Whether cluster is shadowed per layer.
std::vector< char > primaryExistsVec
Whether primary is expected per layer.
std::vector< char > isMergedVec
Whether cluster is merged per layer.