ATLAS Offline Software
TrackToTruthAssociationAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRKFINDING_TRACKTOTRUTHASSOCIATIONALG_H
6 #define ACTSTRKFINDING_TRACKTOTRUTHASSOCIATIONALG_H 1
7 
8 // Base Class
10 
11 // Gaudi includes
12 #include "Gaudi/Property.h"
13 
14 // Handle Keys
17 
23 
24 #include <mutex>
25 #include "ActsInterop/StatUtils.h"
26 
27 #include <string>
28 #include <memory>
29 #include <array>
30 #include <atomic>
31 #include <type_traits>
32 
33 #include <cmath>
34 #include <iomanip>
35 #include <ostream>
36 #include <string>
37 #include <sstream>
38 #include <vector>
39 
40 namespace ActsTrk
41 {
43 
45  {
46  public:
47  TrackToTruthAssociationAlg(const std::string &name,
48  ISvcLocator *pSvcLocator);
49 
50  virtual StatusCode initialize() override;
51  virtual StatusCode finalize() override;
52  virtual StatusCode execute(const EventContext &ctx) const override;
53 
54  private:
55  PublicToolHandle<ActsTrk::ITrackingGeometryTool> m_trackingGeometryTool
56  {this, "TrackingGeometryTool", ""};
57 
59  {this, "ACTSTracksLocation", "","Track collection (ActsTrk variant)"};
60 
62  {this, "PixelClustersToTruthAssociationMap", "", "Association map from pixel measurements to generator particles." };
64  {this, "StripClustersToTruthAssociationMap", "", "Association map from strip measurements to generator particles." };
66  {this, "HgtdClustersToTruthAssociationMap", "", "Association map from HGTD measurements to generator particles." };
67 
69  {this, "AssociationMapOut", "", "Output association map from measurements to generator particles." };
70 
71  Gaudi::Property<float> m_maxEnergyLoss
72  {this, "MaxEnergyLoss", 10e12, "Stop moving up the decay chain if the energy loss is above this value." };
73 
75  static constexpr float s_unitGeV = 1e3;
77  Gaudi::Property<std::vector<float> >,
79  {this, "EnergyLossBinning", {20.,0.,5.*s_unitGeV}, "Binning to be used for the energy loss histograms." };
80 
81  template <bool IsDebug>
83  struct Empty {
84  template <typename... T_Args>
85  Empty(T_Args... ) {}
86  };
87  mutable typename std::conditional<IsDebug,
88  std::mutex,
89  Empty>::type m_mutex ATLAS_THREAD_SAFE;
90  mutable typename std::conditional<IsDebug,
92  Empty>::type m_measPerTrack ATLAS_THREAD_SAFE {20,-.5,40.-.5};
93  mutable typename std::conditional<IsDebug,
95  Empty>::type m_truthParticlesPerTrack ATLAS_THREAD_SAFE {20,-.5,20.-.5};
96 
97  template <class T_OutStream>
98  void dumpStatistics(T_OutStream &out) const;
99  void fillStatistics(unsigned int n_measurements, unsigned int n_particles) const;
100  };
102  static constexpr unsigned int s_NCounterForAssociatedTruth = 4;
103  mutable std::array<std::atomic<std::size_t>,s_NCounterForAssociatedTruth> m_nTracksWithAssociatedTruth ATLAS_THREAD_SAFE {};
104  mutable std::atomic<std::size_t> m_nIncompatibleMeasurementContainer{};
105  mutable std::atomic<std::size_t> m_nCcompatibleMeasurementContainer{};
106  };
107 
108 } // namespace
109 
110 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
ActsTrk::TrackToTruthAssociationAlg::finalize
virtual StatusCode finalize() override
Definition: TrackToTruthAssociationAlg.cxx:76
ActsTrk::TrackToTruthAssociationAlg::TrackToTruthAssociationAlg
TrackToTruthAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackToTruthAssociationAlg.cxx:30
ElasticDecayUtil< TrackToTruthParticleAssociationDebugHists >
ElasticDecayUtil.h
ActsTrk::TrackToTruthAssociationAlg::m_hgtdClustersToTruth
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_hgtdClustersToTruth
Definition: TrackToTruthAssociationAlg.h:66
ActsTrk::TrackToTruthAssociationAlg::initialize
virtual StatusCode initialize() override
Definition: TrackToTruthAssociationAlg.cxx:36
createSimpleDistributions.IsDebug
bool IsDebug
Definition: createSimpleDistributions.py:11
ActsTrk::TrackToTruthAssociationAlg::ATLAS_THREAD_SAFE
std::array< std::atomic< std::size_t >, s_NCounterForAssociatedTruth > m_nTracksWithAssociatedTruth ATLAS_THREAD_SAFE
Definition: TrackToTruthAssociationAlg.h:103
ActsTrk::TrackToTruthAssociationAlg::m_associationCounter
AssociationCounter< TrackToTruthParticleAssociationDebugHists > m_associationCounter
Definition: TrackToTruthAssociationAlg.h:101
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::Empty::Empty
Empty(T_Args...)
Definition: TrackToTruthAssociationAlg.h:85
ActsTrk::TrackToTruthAssociationAlg::m_maxEnergyLoss
Gaudi::Property< float > m_maxEnergyLoss
Definition: TrackToTruthAssociationAlg.h:72
StatUtils.h
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
ActsUtils::StatHist
Extend Stat helper by an equidistant binned histogram.
Definition: StatUtils.h:81
SG::ReadHandleKey< ActsTrk::TrackContainer >
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::fillStatistics
void fillStatistics(unsigned int n_measurements, unsigned int n_particles) const
Definition: TrackToTruthAssociationAlg.cxx:60
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
TrackToTruthParticleAssociation.h
ActsTrk::TrackToTruthAssociationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrackToTruthAssociationAlg.cxx:111
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::Empty
Definition: TrackToTruthAssociationAlg.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::TrackToTruthAssociationAlg::s_unitGeV
static constexpr float s_unitGeV
Definition: TrackToTruthAssociationAlg.h:75
ActsTrk::TrackToTruthAssociationAlg::m_elasticDecayUtil
ElasticDecayUtil< TrackToTruthParticleAssociationDebugHists > m_elasticDecayUtil
Definition: TrackToTruthAssociationAlg.h:74
ActsTrk::TrackToTruthAssociationAlg::m_trackingGeometryTool
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
Definition: TrackToTruthAssociationAlg.h:56
ActsTrk::TrackToTruthAssociationAlg::m_stripClustersToTruth
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_stripClustersToTruth
Definition: TrackToTruthAssociationAlg.h:64
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsTrk::TrackToTruthAssociationAlg::m_energyLossBinning
std::conditional< TrackToTruthParticleAssociationDebugHists, Gaudi::Property< std::vector< float > >, EmptyProperty >::type m_energyLossBinning
Definition: TrackToTruthAssociationAlg.h:79
ActsTrk::TrackToTruthAssociationAlg::m_nCcompatibleMeasurementContainer
std::atomic< std::size_t > m_nCcompatibleMeasurementContainer
Definition: TrackToTruthAssociationAlg.h:105
ActsTrk::TrackToTruthParticleAssociationDebugHists
constexpr bool TrackToTruthParticleAssociationDebugHists
Definition: TrackToTruthAssociationAlg.h:42
ActsTrk::TrackToTruthAssociationAlg::m_pixelClustersToTruth
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_pixelClustersToTruth
Definition: TrackToTruthAssociationAlg.h:62
ActsTrk::TrackToTruthAssociationAlg::m_nIncompatibleMeasurementContainer
std::atomic< std::size_t > m_nIncompatibleMeasurementContainer
Definition: TrackToTruthAssociationAlg.h:104
ActsTrk::TrackToTruthAssociationAlg::s_NCounterForAssociatedTruth
static constexpr unsigned int s_NCounterForAssociatedTruth
Definition: TrackToTruthAssociationAlg.h:102
ITrackingGeometryTool.h
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::ATLAS_THREAD_SAFE
std::conditional< IsDebug, std::mutex, Empty >::type m_mutex ATLAS_THREAD_SAFE
Definition: TrackToTruthAssociationAlg.h:89
ActsTrk::TrackToTruthAssociationAlg
Definition: TrackToTruthAssociationAlg.h:45
ActsTrk::TrackToTruthAssociationAlg::m_tracksContainerKey
SG::ReadHandleKey< ActsTrk::TrackContainer > m_tracksContainerKey
Definition: TrackToTruthAssociationAlg.h:59
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter::dumpStatistics
void dumpStatistics(T_OutStream &out) const
Definition: TrackToTruthAssociationAlg.cxx:51
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MSTrackingVolumeBuilder.cxx:24
ActsTrk::TrackToTruthAssociationAlg::AssociationCounter
Definition: TrackToTruthAssociationAlg.h:82
MeasurementToTruthParticleAssociation.h
EmptyProperty
Definition: ElasticDecayUtil.h:18
TrackContainer.h
ActsTrk::TrackToTruthAssociationAlg::m_trackToTruthOut
SG::WriteHandleKey< TrackToTruthParticleAssociation > m_trackToTruthOut
Definition: TrackToTruthAssociationAlg.h:69