ATLAS Offline Software
TruthHitDecoratorAlg.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 INDETTRACKPERFMON_TRUTHHITDECORATORALG_H
6 #define INDETTRACKPERFMON_TRUTHHITDECORATORALG_H
7 
19 #include "GaudiKernel/ToolHandle.h"
22 
26 
31 
33 #include <string>
34 #include <atomic>
35 #include <unordered_map>
36 #include <vector>
37 
39 #include "SafeDecorator.h"
40 
41 
42 namespace IDTPM {
43 
45  public AthReentrantAlgorithm {
46 
47  public:
48 
49  TruthHitDecoratorAlg( const std::string& name, ISvcLocator* pSvcLocator );
50 
51  virtual ~TruthHitDecoratorAlg() = default;
52 
53  virtual StatusCode initialize() override;
54 
55  virtual StatusCode execute( const EventContext& ctx ) const override;
56 
57  private:
58 
62  float > >& float_decor,
63  const Amg::Vector3D& beamPos,
64  std::unordered_map< int, float >& pixelMap,
65  std::unordered_map< int, float >& sctMap,
66  const EventContext& ctx ) const;
67 
68  PublicToolHandle< Trk::IExtrapolator > m_extrapolator {
69  this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator", "" };
70 
72  this, "BeamSpotDecoKeys",
73  { "EventInfo.beamPosX", "EventInfo.beamPosY", "EventInfo.beamPosZ" },
74  "Beamspot position decoration keys" };
75 
76  mutable std::atomic<bool> m_errorEmitted{ false };
77 
80  this, "TruthParticleContainerName", "TruthParticles", "" };
81 
82  StringProperty m_prefix { this, "Prefix", "", "Decoration prefix to avoid clashes." };
83 
85  this, "PixelClusterContainerName", "PixelClusters", "" };
86 
88  this, "SCTClusterContainerName", "SCT_Clusters", "" };
89 
91  D0,
92  Z0,
93  Phi,
101  };
102 
103  const std::vector< std::string > m_decor_names {
104  "d0",
105  "z0",
106  "phi",
107  "theta",
108  "z0st",
109  "qOverP",
110  "prodR",
111  "prodZ",
112  "nSilHits"
113  };
114 
115  std::vector< std::pair<
118  };
119 
120 } // namespace IDTPM
121 
122 #endif // > !INDETTRACKPERFMON_TRUTHHITDECORATORALG_H
IDTPM::TruthHitDecoratorAlg::m_errorEmitted
std::atomic< bool > m_errorEmitted
Definition: TruthHitDecoratorAlg.h:76
IDTPM::TruthHitDecoratorAlg::m_decor_names
const std::vector< std::string > m_decor_names
Definition: TruthHitDecoratorAlg.h:103
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
IDTPM::TruthHitDecoratorAlg::TruthDecorations
TruthDecorations
Definition: TruthHitDecoratorAlg.h:90
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
IDTPM::TruthHitDecoratorAlg::m_truthParticleName
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
TruthParticle container's name needed to create decorators.
Definition: TruthHitDecoratorAlg.h:79
IDTPM::TruthHitDecoratorAlg::m_extrapolator
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: TruthHitDecoratorAlg.h:68
IDTPM::TruthHitDecoratorAlg::QOverP
@ QOverP
Definition: TruthHitDecoratorAlg.h:96
IDTPM::TruthHitDecoratorAlg::Z0st
@ Z0st
Definition: TruthHitDecoratorAlg.h:95
TruthParticleContainer.h
IDTPM::TruthHitDecoratorAlg::Theta
@ Theta
Definition: TruthHitDecoratorAlg.h:94
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
IExtrapolator.h
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
SG::ReadHandleKey< xAOD::TruthParticleContainer >
IDTPM::TruthHitDecoratorAlg::initialize
virtual StatusCode initialize() override
Definition: TruthHitDecoratorAlg.cxx:39
IDTPM::TruthHitDecoratorAlg::ProdR
@ ProdR
Definition: TruthHitDecoratorAlg.h:97
IDTPM::TruthHitDecoratorAlg::TruthHitDecoratorAlg
TruthHitDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Local includes.
Definition: TruthHitDecoratorAlg.cxx:30
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
IDTPM::TruthHitDecoratorAlg::NSilHits
@ NSilHits
Definition: TruthHitDecoratorAlg.h:99
IDTPM::TruthHitDecoratorAlg::D0
@ D0
Definition: TruthHitDecoratorAlg.h:91
IDTPM::TruthHitDecoratorAlg::~TruthHitDecoratorAlg
virtual ~TruthHitDecoratorAlg()=default
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
IDTPM::TruthHitDecoratorAlg::m_decor
std::vector< std::pair< SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >, SG::AuxElement::ConstAccessor< float > > > m_decor
Definition: TruthHitDecoratorAlg.h:117
IDTPM::TruthHitDecoratorAlg::decorateTruth
StatusCode decorateTruth(const xAOD::TruthParticle &particle, std::vector< IDTPM::OptionalDecoration< xAOD::TruthParticleContainer, float > > &float_decor, const Amg::Vector3D &beamPos, std::unordered_map< int, float > &pixelMap, std::unordered_map< int, float > &sctMap, const EventContext &ctx) const
Definition: TruthHitDecoratorAlg.cxx:147
IDTPM::TruthHitDecoratorAlg::m_truthSCTClusterName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthSCTClusterName
Definition: TruthHitDecoratorAlg.h:87
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
IDTPM::TruthHitDecoratorAlg
Definition: TruthHitDecoratorAlg.h:45
AthReentrantAlgorithm.h
IDTPM::TruthHitDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TruthHitDecoratorAlg.cxx:64
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
IDTPM::TruthHitDecoratorAlg::m_beamSpotDecoKey
SG::ReadDecorHandleKeyArray< xAOD::EventInfo > m_beamSpotDecoKey
Definition: TruthHitDecoratorAlg.h:71
IDTPM::TruthHitDecoratorAlg::ProdZ
@ ProdZ
Definition: TruthHitDecoratorAlg.h:98
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
EventInfo.h
SafeDecorator.h
Helper functions to perform safe decoration of xAOD objects in this package.
IDTPM::TruthHitDecoratorAlg::m_prefix
StringProperty m_prefix
Definition: TruthHitDecoratorAlg.h:82
IDTPM::TruthHitDecoratorAlg::NDecorations
@ NDecorations
Definition: TruthHitDecoratorAlg.h:100
IDTPM::TruthHitDecoratorAlg::m_truthPixelClusterName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthPixelClusterName
Definition: TruthHitDecoratorAlg.h:84
TrackMeasurementValidationContainer.h
IDTPM::TruthHitDecoratorAlg::Z0
@ Z0
Definition: TruthHitDecoratorAlg.h:92
IDTPM::TruthHitDecoratorAlg::Phi
@ Phi
Definition: TruthHitDecoratorAlg.h:93
IDTPM::OptionalDecoration
std::pair< SG::WriteDecorHandle< ContainerType, VariableType >, bool > OptionalDecoration
Definition: SafeDecorator.h:47
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
ReadDecorHandleKeyArray.h