ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::HGTDTruthTrackDecorationAlg Class Reference

#include <HGTDTruthTrackDecorationAlg.h>

Inheritance diagram for ActsTrk::HGTDTruthTrackDecorationAlg:

Classes

struct  TruthTrackExtensionData
 Data structure to hold truth information about the HGTD track extension. More...
struct  ClusterTruthInfo

Public Member Functions

virtual ~HGTDTruthTrackDecorationAlg ()=default
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

using HgtdLayerFlags = std::array<char, s_nHgtdLayers>
 Per-layer flags for a single truth particle.
using PrimaryExpectedLookup = std::unordered_map<std::size_t, HgtdLayerFlags>
 Maps the index of a truth particle onto the HGTD layers it deposited a hit in.
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

TruthTrackExtensionData createTruthDecoration (const xAOD::TruthParticle *truthParticle, const typename ActsTrk::TrackContainer::ConstTrackProxy trackProxy, const ActsTrk::MeasurementToTruthParticleAssociation *association_map) const
 Generate TruthTrackExtensionData from extension.
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 particle contributed to a cluster.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::TrackParticleContainerm_trackParticleContainerName {this, "TrackParticleContainerName", "", "Name of the TrackParticle container"}
SG::ReadHandleKey< ActsTrk::TrackContainerm_trackContainerKey {this, "ACTSTracksLocation", "HgtdTracks", "Output track collection (ActsTrk variant)"}
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainerm_uncalibratedMeasurementContainerKey_HGTD {this, "UncalibratedMeasurementContainerKey_HGTD", "HGTD_Clusters", "input cluster collections for HGTD"}
SG::ReadHandleKey< MeasurementToTruthParticleAssociationm_hgtdClustersToTruth { this, "HgtdClustersToTruthAssociationMap", "HgtdClustersToTruthParticles", "Association map from HGTD measurements to generator particles." }
SG::ReadDecorHandleKey< xAOD::TrackParticleContainerm_hgtdTrackLinkKey {this, "hgtdTrackLink", m_trackParticleContainerName, "hgtdTrackLink", "Link to Hgtd track"}
SG::ReadDecorHandleKey< xAOD::TrackParticleContainerm_truthParticleLinkKey {this, "truthParticleLink", m_trackParticleContainerName, "truthParticleLink", "Link to Truth particle"}
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_layerClusterTruthClassKey { this, "HGTD_cluster_truth_class", m_trackParticleContainerName, "HGTD_cluster_truth_class", "Decoration for cluster truth classification" }
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_layerClusterShadowedKey { this, "HGTD_cluster_shadowed", m_trackParticleContainerName, "HGTD_cluster_shadowed", "Decoration for shadowed cluster" }
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_layerClusterMergedKey { this, "HGTD_cluster_merged", m_trackParticleContainerName, "HGTD_cluster_merged", "Decoration for merged cluster" }
SG::WriteDecorHandleKey< xAOD::TrackParticleContainerm_layerPrimaryExpectedKey { this, "HGTD_primary_expected", m_trackParticleContainerName, "HGTD_primary_expected", "Decoration for primary expected cluster" }
ActsTrk::detail::xAODUncalibMeasSurfAcc m_surfAcc {}
ServiceHandle< ActsTrk::ITrackingGeometrySvcm_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
std::unique_ptr< SG::AuxElement::Accessor< int > > m_acc_nHgtdHits
const HGTD_IDm_id_helper {nullptr}
 Handle to the ID helper.
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static constexpr std::size_t s_nHgtdLayers = 4
 Number of HGTD layers the per-track decorations are indexed by.

Detailed Description

Definition at line 47 of file HGTDTruthTrackDecorationAlg.h.

Member Typedef Documentation

◆ HgtdLayerFlags

Per-layer flags for a single truth particle.

Definition at line 119 of file HGTDTruthTrackDecorationAlg.h.

◆ PrimaryExpectedLookup

using ActsTrk::HGTDTruthTrackDecorationAlg::PrimaryExpectedLookup = std::unordered_map<std::size_t, HgtdLayerFlags>
private

Maps the index of a truth particle onto the HGTD layers it deposited a hit in.

Definition at line 121 of file HGTDTruthTrackDecorationAlg.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~HGTDTruthTrackDecorationAlg()

virtual ActsTrk::HGTDTruthTrackDecorationAlg::~HGTDTruthTrackDecorationAlg ( )
virtualdefault

Member Function Documentation

◆ buildPrimaryExpectedLookup()

StatusCode ActsTrk::HGTDTruthTrackDecorationAlg::buildPrimaryExpectedLookup ( const xAOD::UncalibratedMeasurementContainer & measurementContainer,
const ActsTrk::MeasurementToTruthParticleAssociation * association_map,
PrimaryExpectedLookup & lookup ) const
private

Builds, once per event, the map from truth particle index onto the set of HGTD layers in which that particle contributed to a cluster.

The information is a property of the measurements alone and does not depend on the track being decorated, so it is evaluated once instead of once per track. This replaces a scan of the full HGTD measurement container for every TrackParticle.

Parameters
measurementContainer- measurement container with HGTD clusters
association_map- hgtd cluster to truth particles map (may be nullptr)
lookup- filled with one entry per truth particle that has an HGTD cluster

Definition at line 260 of file HGTDTruthTrackDecorationAlg.cxx.

263 {
264
265 if (association_map == nullptr) {
266 return StatusCode::SUCCESS;
267 }
268
269 for (const xAOD::UncalibratedMeasurement* uncalibMeas : measurementContainer) {
270
271 const Acts::Surface* surface = m_surfAcc.get(uncalibMeas);
272 const auto* detElem = getActsDetectorElement(surface);
273 if (detElem == nullptr || detElem->detectorType() != DetectorType::Hgtd) {
274 continue;
275 }
276
277 const std::size_t layerIndex = m_id_helper->layer(detElem->identify());
278
279 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - "<<uncalibMeas->type()
280 <<", geoID: "<<surface->geometryId()<<", layerIndex: "<<layerIndex);
281 if (layerIndex >= s_nHgtdLayers) {
282 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - "<<uncalibMeas->type()
283 <<", geoID: "<<surface->geometryId()<<" results in an invalid index "<<layerIndex);
284 continue;
285 }
286
287 for (const xAOD::TruthParticle* measTruthParticle : association_map->at(uncalibMeas->index())) {
288 lookup.try_emplace(measTruthParticle->index(), HgtdLayerFlags{})
289 .first->second[layerIndex] = true;
290 }
291 }
292
293 return StatusCode::SUCCESS;
294 }
const ActsDetectorElement * getActsDetectorElement(const Acts::Surface &surf)
Attempts to retrieve the ActsDetectorElement associated to the passed ActsSurface.
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
const HGTD_ID * m_id_helper
Handle to the ID helper.
std::array< char, s_nHgtdLayers > HgtdLayerFlags
Per-layer flags for a single truth particle.
static constexpr std::size_t s_nHgtdLayers
Number of HGTD layers the per-track decorations are indexed by.
ActsTrk::detail::xAODUncalibMeasSurfAcc m_surfAcc
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ createTruthDecoration()

HGTDTruthTrackDecorationAlg::TruthTrackExtensionData ActsTrk::HGTDTruthTrackDecorationAlg::createTruthDecoration ( const xAOD::TruthParticle * truthParticle,
const typename ActsTrk::TrackContainer::ConstTrackProxy trackProxy,
const ActsTrk::MeasurementToTruthParticleAssociation * association_map ) const
private

Generate TruthTrackExtensionData from extension.

Parameters
truthParticle- truth particle associated with track
trackProxy- measurement container with HGTD clusters
association_map- hgtd cluster to truth particles map

Definition at line 185 of file HGTDTruthTrackDecorationAlg.cxx.

188 {
189
191
192 std::vector<int> truthClassPerLayer = {-1, -1, -1, -1};
193 std::vector<char> isShadowedPerLayer = {false, false, false, false};
194 std::vector<char> isMergedPerLayer = {false, false, false, false};
195 std::vector<char> isPrimaryExistsVec = {false, false, false, false};
196
197 for (auto state : trackProxy.trackStatesReversed()) {
198 auto flags = state.typeFlags();
199 if (flags.isMeasurement()) {
200 // Check if this is an HGTD hit
201 const auto& surface = state.referenceSurface();
202 const auto* detElem = getActsDetectorElement(surface);
203 if(detElem->detectorType() != DetectorType::Hgtd){
204 continue;
205 }
206
207 Acts::GeometryIdentifier geoID = surface.geometryId();
208 std::size_t layerIndex = m_id_helper->layer(detElem->identify());
209
210 ClusterTruthInfo cluster_truth_info;
211
212 assert( state.hasUncalibratedSourceLink() );
213 auto uncalibMeas = detail::xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink());
214 if (association_map->at(uncalibMeas->index()).empty()) {
215 cluster_truth_info.origin = ActsTrk::ClusterTruthOrigin::SECONDARY;
216 ATH_MSG_DEBUG(" \\__Layer "<< layerIndex << " SECONDARY: hit doesnt have truth particle associated with it");
217 }
218 else if(association_map->at(uncalibMeas->index()).size() == 1) {
219 const xAOD::TruthParticle *truth_particle = association_map->at(uncalibMeas->index()).at(0);
220 if(truthParticle->index() == truth_particle->index()){
221 cluster_truth_info.origin = ActsTrk::ClusterTruthOrigin::TRUTH_PARTICLE;
222 ATH_MSG_DEBUG(" \\__Layer "<< layerIndex<< " TRUTH_PARTICLE: hit matches ITk track");
223 }
224 else{
225 cluster_truth_info.origin = ActsTrk::ClusterTruthOrigin::UNRELATED_PARTICLE;
226 ATH_MSG_DEBUG(" \\__Layer "<< layerIndex<< " UNRELATED_PARTICLE: hit doesnt match ITk track");
227 }
228 }
229 else {
230 cluster_truth_info.is_merged = true;
231 cluster_truth_info.origin = ActsTrk::ClusterTruthOrigin::UNRELATED_PARTICLE;
232 ATH_MSG_DEBUG(" \\__Layer "<< layerIndex<< " MERGED: hit with more than one contributing particle");
233 for (const xAOD::TruthParticle *truth_particle : association_map->at(uncalibMeas->index()) ) {
234 if(truthParticle->index() == truth_particle->index()){
235 cluster_truth_info.origin = ActsTrk::ClusterTruthOrigin::TRUTH_PARTICLE;
236 ATH_MSG_DEBUG(" \\__TRUTH_PARTICLE: hit matches ITk track");
237 }
238 }
239 }
240
241 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - "<<uncalibMeas->type()<<", geoID: "<<geoID<<", layerIndex: "<<layerIndex);
242 if (layerIndex >= truthClassPerLayer.size()) {
243 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - "<<uncalibMeas->type()<<", geoID: "<<geoID<<" results in an invalid index "<<layerIndex);
244 continue;
245 }
246 truthClassPerLayer.at(layerIndex) = Acts::toUnderlying(cluster_truth_info.origin);
247 isShadowedPerLayer.at(layerIndex) = cluster_truth_info.is_shadowed;
248 isMergedPerLayer.at(layerIndex) = cluster_truth_info.is_merged;
249 }
250 }
251
252 // Fill the data structure with results
253 data.truthClassVec = std::move(truthClassPerLayer);
254 data.isShadowedVec = std::move(isShadowedPerLayer);
255 data.isMergedVec = std::move(isMergedPerLayer);
256 data.primaryExistsVec = std::move(isPrimaryExistsVec);
257 return data;
258 }
#define ATH_MSG_DEBUG(x,...)
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
Data structure to hold truth information about the HGTD track extension.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode ActsTrk::HGTDTruthTrackDecorationAlg::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 63 of file HGTDTruthTrackDecorationAlg.cxx.

64 {
65 ATH_MSG_DEBUG("Executing " << name() << "...");
66
67 const xAOD::TrackParticleContainer* trackParticles {nullptr};
68 ATH_CHECK(SG::get(trackParticles, m_trackParticleContainerName, ctx));
69
70 ATH_MSG_DEBUG("Size of trackParticles collection " << trackParticles->size());
71 // ================================================== //
72 // ============ RETRIEVE MEASUREMENTS =============== //
73 // ================================================== //
74
75 ATH_MSG_DEBUG("Reading input collection with key " << m_uncalibratedMeasurementContainerKey_HGTD.key());
76
77 const xAOD::UncalibratedMeasurementContainer* uncalibratedMeasurementContainer{nullptr};
78 ATH_CHECK(SG::get(uncalibratedMeasurementContainer ,m_uncalibratedMeasurementContainerKey_HGTD, ctx));
79
80 ATH_MSG_DEBUG("Retrieved " << uncalibratedMeasurementContainer->size()
81 << " input elements from key " << m_uncalibratedMeasurementContainerKey_HGTD.key());
82
83
84 // ================================================== //
85 // ============ TRUTH MATCHING BLOCK ================ //
86 // ================================================== //
87
88 SG::ReadDecorHandle<xAOD::TrackParticleContainer, ElementLink<ActsTrk::TrackContainer>> hgtdTrackLink( m_hgtdTrackLinkKey, ctx );
89
90 SG::ReadDecorHandle<xAOD::TrackParticleContainer, ElementLink<xAOD::TruthParticleContainer>> truthParticleLink( m_truthParticleLinkKey, ctx );
91
92 std::array<const ActsTrk::MeasurementToTruthParticleAssociation *,
93 Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)>
94 measurement_to_truth_association_maps{};
95
96 if (!m_hgtdClustersToTruth.key().empty()) {
97 const ActsTrk::MeasurementToTruthParticleAssociation* hgtdClustersToTruthAssociation{};
98 ATH_CHECK(SG::get(hgtdClustersToTruthAssociation, m_hgtdClustersToTruth, ctx));
99 measurement_to_truth_association_maps[Acts::toUnderlying(xAOD::UncalibMeasType::HGTDClusterType)]=hgtdClustersToTruthAssociation;
100 }
101 auto assocSize = [&measurement_to_truth_association_maps](xAOD::UncalibMeasType type) {
102 const ActsTrk::MeasurementToTruthParticleAssociation *assoc = measurement_to_truth_association_maps[Acts::toUnderlying(type)];
103 return assoc ? assoc->size() : 0ul;
104 };
105
106 ATH_MSG_DEBUG("Measurement association entries: " << assocSize(xAOD::UncalibMeasType::PixelClusterType)
107 << " + " << assocSize(xAOD::UncalibMeasType::StripClusterType)
108 << " + " << assocSize(xAOD::UncalibMeasType::HGTDClusterType)
109 );
110
111
112 SG::ReadHandle<ActsTrk::TrackContainer> tracksContainer = SG::makeHandle( m_trackContainerKey, ctx);
113 if (!tracksContainer.isValid()) {
114 ATH_MSG_ERROR("No tracks for key " << m_trackContainerKey.key() );
115 return StatusCode::FAILURE;
116 }
117 // Create WriteDecorHandles for all decorations
118 SG::WriteDecorHandle<xAOD::TrackParticleContainer, std::vector<int>> layerClusterTruthClassHandle(m_layerClusterTruthClassKey, ctx);
119 SG::WriteDecorHandle<xAOD::TrackParticleContainer, std::vector<char>> layerClusterShadowedHandle(m_layerClusterShadowedKey, ctx);
120 SG::WriteDecorHandle<xAOD::TrackParticleContainer, std::vector<char>> layerClusterMergedHandle(m_layerClusterMergedKey, ctx);
121 SG::WriteDecorHandle<xAOD::TrackParticleContainer, std::vector<char>> layerPrimaryExpectedHandle(m_layerPrimaryExpectedKey, ctx);
122
123 // The HGTD layers in which a given truth particle left a cluster depend only on the
124 // measurements, not on the track being decorated. Evaluate it once per event instead
125 // of rescanning the whole HGTD measurement container for every TrackParticle.
126 PrimaryExpectedLookup primaryExpectedLookup;
128 *uncalibratedMeasurementContainer,
129 measurement_to_truth_association_maps[Acts::toUnderlying(xAOD::UncalibMeasType::HGTDClusterType)],
130 primaryExpectedLookup));
131
133
134 for (const xAOD::TrackParticle* trackParticle : *trackParticles) {
135
136 // get the truth particle
137 ElementLink<xAOD::TruthParticleContainer> link_to_truth = truthParticleLink(*trackParticle);
138 const xAOD::TruthParticle* truthParticle = nullptr;
139 if (!link_to_truth.isValid()) {
140 layerClusterTruthClassHandle(*trackParticle) = {-1, -1, -1, -1};
141 layerClusterShadowedHandle(*trackParticle) = {false, false, false, false};
142 layerClusterMergedHandle(*trackParticle) = {false, false, false, false};
143 layerPrimaryExpectedHandle(*trackParticle) = {false, false, false, false};
144 ATH_MSG_DEBUG("TrackParticle " << trackParticle->index() << ": invalid truth link");
145 continue;
146 }
147 else {
148 truthParticle = *link_to_truth;
149 }
150 // Check if the TrackParticle has a link to an hgtd extension track
151 if(hgtdTrackLink.isAvailable()){
152 ElementLink<ActsTrk::TrackContainer> link_to_track = hgtdTrackLink(*trackParticle);
153 if (!link_to_track.isValid()) {
154 ATH_MSG_DEBUG("TrackParticle " << trackParticle->index() << ": invalid extension link");
155 data.truthClassVec = {-1, -1, -1, -1};
156 data.isShadowedVec = {false, false, false, false};
157 data.isMergedVec = {false, false, false, false};
158 }
159 else{
160 std::optional<ActsTrk::TrackContainer::ConstTrackProxy> optional_track = *link_to_track;
161 const ActsTrk::TrackContainer::ConstTrackProxy& track = optional_track.value();
162 ATH_MSG_DEBUG("TrackParticle " << trackParticle->index() << ": extension with chi2 " << track.chi2() << " and nHits " << track.nMeasurements());
163 data = createTruthDecoration(truthParticle, track, measurement_to_truth_association_maps[Acts::toUnderlying(xAOD::UncalibMeasType::HGTDClusterType)]);
164 }
165 }
166
167
168 data.primaryExistsVec.assign(s_nHgtdLayers, false);
169 if (auto itr = primaryExpectedLookup.find(truthParticle->index());
170 itr != primaryExpectedLookup.end()) {
171 std::copy(itr->second.begin(), itr->second.end(), data.primaryExistsVec.begin());
172 }
173
174 layerClusterTruthClassHandle(*trackParticle) = data.truthClassVec;
175 layerClusterShadowedHandle(*trackParticle) = data.isShadowedVec;
176 layerClusterMergedHandle(*trackParticle) = data.isMergedVec;
177 layerPrimaryExpectedHandle(*trackParticle) = data.primaryExistsVec;
178
179 }
180 ATH_MSG_DEBUG("Finshed truth matching");
181
182 return StatusCode::SUCCESS;
183 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleContainerName
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterShadowedKey
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::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
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
size_type size() const noexcept
Returns the number of elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
unsigned long ul
TrackParticle_v1 TrackParticle
Reference the current persistent version:
UncalibMeasType
Define the type of the uncalibrated measurement.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
UncalibratedMeasurementContainer_v1 UncalibratedMeasurementContainer
Define the version of the uncalibrated measurement container.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ initialize()

StatusCode ActsTrk::HGTDTruthTrackDecorationAlg::initialize ( )
overridevirtual

Definition at line 39 of file HGTDTruthTrackDecorationAlg.cxx.

40 {
41 ATH_MSG_DEBUG("Initializing " << name() << "...");
42
44
47 ATH_CHECK( m_layerClusterMergedKey.initialize() );
49 ATH_CHECK( m_trackContainerKey.initialize() );
50 ATH_CHECK( m_hgtdTrackLinkKey.initialize() );
51 ATH_CHECK( m_truthParticleLinkKey.initialize() );
53 ATH_CHECK(detStore()->retrieve(m_id_helper, "HGTD_ID"));
55
56 // Initialize surface accessor
57 m_surfAcc = ActsTrk::detail::xAODUncalibMeasSurfAcc{m_trackingGeometrySvc.get()};
59
60 return StatusCode::SUCCESS;
61 }
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
const ServiceHandle< StoreGateSvc > & detStore() const

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_acc_nHgtdHits

std::unique_ptr<SG::AuxElement::Accessor<int> > ActsTrk::HGTDTruthTrackDecorationAlg::m_acc_nHgtdHits
private

Definition at line 77 of file HGTDTruthTrackDecorationAlg.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_hgtdClustersToTruth

SG::ReadHandleKey<MeasurementToTruthParticleAssociation> ActsTrk::HGTDTruthTrackDecorationAlg::m_hgtdClustersToTruth { this, "HgtdClustersToTruthAssociationMap", "HgtdClustersToTruthParticles", "Association map from HGTD measurements to generator particles." }
private

Definition at line 63 of file HGTDTruthTrackDecorationAlg.h.

63{ this, "HgtdClustersToTruthAssociationMap", "HgtdClustersToTruthParticles", "Association map from HGTD measurements to generator particles." };

◆ m_hgtdTrackLinkKey

SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_hgtdTrackLinkKey {this, "hgtdTrackLink", m_trackParticleContainerName, "hgtdTrackLink", "Link to Hgtd track"}
private

Definition at line 65 of file HGTDTruthTrackDecorationAlg.h.

65{this, "hgtdTrackLink", m_trackParticleContainerName, "hgtdTrackLink", "Link to Hgtd track"};

◆ m_id_helper

const HGTD_ID* ActsTrk::HGTDTruthTrackDecorationAlg::m_id_helper {nullptr}
private

Handle to the ID helper.

Definition at line 79 of file HGTDTruthTrackDecorationAlg.h.

79{nullptr};

◆ m_layerClusterMergedKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_layerClusterMergedKey { this, "HGTD_cluster_merged", m_trackParticleContainerName, "HGTD_cluster_merged", "Decoration for merged cluster" }
private

Definition at line 71 of file HGTDTruthTrackDecorationAlg.h.

71{ this, "HGTD_cluster_merged", m_trackParticleContainerName, "HGTD_cluster_merged", "Decoration for merged cluster" };

◆ m_layerClusterShadowedKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_layerClusterShadowedKey { this, "HGTD_cluster_shadowed", m_trackParticleContainerName, "HGTD_cluster_shadowed", "Decoration for shadowed cluster" }
private

Definition at line 70 of file HGTDTruthTrackDecorationAlg.h.

70{ this, "HGTD_cluster_shadowed", m_trackParticleContainerName, "HGTD_cluster_shadowed", "Decoration for shadowed cluster" };

◆ m_layerClusterTruthClassKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_layerClusterTruthClassKey { this, "HGTD_cluster_truth_class", m_trackParticleContainerName, "HGTD_cluster_truth_class", "Decoration for cluster truth classification" }
private

Definition at line 69 of file HGTDTruthTrackDecorationAlg.h.

69{ this, "HGTD_cluster_truth_class", m_trackParticleContainerName, "HGTD_cluster_truth_class", "Decoration for cluster truth classification" };

◆ m_layerPrimaryExpectedKey

SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_layerPrimaryExpectedKey { this, "HGTD_primary_expected", m_trackParticleContainerName, "HGTD_primary_expected", "Decoration for primary expected cluster" }
private

Definition at line 72 of file HGTDTruthTrackDecorationAlg.h.

72{ this, "HGTD_primary_expected", m_trackParticleContainerName, "HGTD_primary_expected", "Decoration for primary expected cluster" };

◆ m_surfAcc

ActsTrk::detail::xAODUncalibMeasSurfAcc ActsTrk::HGTDTruthTrackDecorationAlg::m_surfAcc {}
private

Definition at line 74 of file HGTDTruthTrackDecorationAlg.h.

74{};

◆ m_trackContainerKey

SG::ReadHandleKey<ActsTrk::TrackContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_trackContainerKey {this, "ACTSTracksLocation", "HgtdTracks", "Output track collection (ActsTrk variant)"}
private

Definition at line 61 of file HGTDTruthTrackDecorationAlg.h.

61{this, "ACTSTracksLocation", "HgtdTracks", "Output track collection (ActsTrk variant)"};

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> ActsTrk::HGTDTruthTrackDecorationAlg::m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
private

Definition at line 75 of file HGTDTruthTrackDecorationAlg.h.

75{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};

◆ m_trackParticleContainerName

SG::ReadHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_trackParticleContainerName {this, "TrackParticleContainerName", "", "Name of the TrackParticle container"}
private

Definition at line 60 of file HGTDTruthTrackDecorationAlg.h.

60{this, "TrackParticleContainerName", "", "Name of the TrackParticle container"};

◆ m_truthParticleLinkKey

SG::ReadDecorHandleKey<xAOD::TrackParticleContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_truthParticleLinkKey {this, "truthParticleLink", m_trackParticleContainerName, "truthParticleLink", "Link to Truth particle"}
private

Definition at line 66 of file HGTDTruthTrackDecorationAlg.h.

66{this, "truthParticleLink", m_trackParticleContainerName, "truthParticleLink", "Link to Truth particle"};

◆ m_uncalibratedMeasurementContainerKey_HGTD

SG::ReadHandleKey<xAOD::UncalibratedMeasurementContainer> ActsTrk::HGTDTruthTrackDecorationAlg::m_uncalibratedMeasurementContainerKey_HGTD {this, "UncalibratedMeasurementContainerKey_HGTD", "HGTD_Clusters", "input cluster collections for HGTD"}
private

Definition at line 62 of file HGTDTruthTrackDecorationAlg.h.

62{this, "UncalibratedMeasurementContainerKey_HGTD", "HGTD_Clusters", "input cluster collections for HGTD"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ s_nHgtdLayers

std::size_t ActsTrk::HGTDTruthTrackDecorationAlg::s_nHgtdLayers = 4
staticconstexprprivate

Number of HGTD layers the per-track decorations are indexed by.

Definition at line 117 of file HGTDTruthTrackDecorationAlg.h.


The documentation for this class was generated from the following files: