ATLAS Offline Software
InDetPhysValTruthDecoratorAlg.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 INDETPHYSVALMONITORING_INDETPHYSVALTRUTHDECORATORTOOL_H
6 #define INDETPHYSVALMONITORING_INDETPHYSVALTRUTHDECORATORTOOL_H
7 
13 // STL includes
14 #include <string>
17 #include "GaudiKernel/ToolHandle.h"
25 #include "GaudiKernel/EventContext.h"
29 #include <atomic>
30 #include <utility>
31 #include <vector>
32 
33 
34 // class to decorate xAOD::TruthParticles with additional information required by validation
36 public:
37  InDetPhysValTruthDecoratorAlg(const std::string& name, ISvcLocator* pSvcLocator);
38  virtual
40  virtual StatusCode initialize();
41  virtual StatusCode finalize();
42  virtual StatusCode execute(const EventContext &ctx) const;
43 
44 private:
48  bool > > &float_decor,
49  const Amg::Vector3D& beamPos,
50  const std::vector<std::array<uint16_t, kNClusterTypes> > &counts) const;
51 
52  PublicToolHandle<Trk::IExtrapolator> m_extrapolator
53  {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""};
55  {this, "BeamSpotDecoKeys",
56  {"EventInfo.beamPosX", "EventInfo.beamPosY", "EventInfo.beamPosZ"},
57  "Beamspot position decoration keys"};
58 
59  PublicToolHandle<IAthSelectionTool> m_truthSelectionTool
60  {this,"TruthSelectionTool","",""};
61 
63  mutable CutFlow m_cutFlow ATLAS_THREAD_SAFE; // Guarded by m_mutex
64 
65  mutable std::atomic<std::size_t> m_nMissingTruthParticles = 0u;
66  mutable std::atomic<bool> m_errorEmitted{false};
67 
70  {this, "TruthParticleContainerName", "TruthParticles", ""};
71 
72  Gaudi::Property<std::string> m_prefix
73  {this, "Prefix", "", "Decoration prefix to avoid clashes."};
74 
77  {this, "PixelClusterContainerName", "PixelClusters", ""};
78 
80  {this, "SCTClusterContainerName", "SCT_Clusters", ""};
81 
83  {this, "TruthParticleIndexDecoration", "origTruthIndex", "decoration name for the original truth particle index."};
84 
85  // decoration helper
86  enum EDecorations {
97  };
98  std::vector< std::pair<SG::WriteDecorHandleKey<xAOD::TruthParticleContainer>,SG::AuxElement::ConstAccessor<float> > > m_decor;
99 };
100 #endif
InDetPhysValTruthDecoratorAlg::kNClusterTypes
@ kNClusterTypes
Definition: InDetPhysValTruthDecoratorAlg.h:45
InDetPhysValTruthDecoratorAlg::kDecorProdR
@ kDecorProdR
Definition: InDetPhysValTruthDecoratorAlg.h:93
InDetPhysValTruthDecoratorAlg::m_truthSelectionTool
PublicToolHandle< IAthSelectionTool > m_truthSelectionTool
Definition: InDetPhysValTruthDecoratorAlg.h:60
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
InDetPhysValTruthDecoratorAlg::~InDetPhysValTruthDecoratorAlg
virtual ~InDetPhysValTruthDecoratorAlg()
Definition: InDetPhysValTruthDecoratorAlg.cxx:34
InDetPhysValTruthDecoratorAlg::kDecorTheta
@ kDecorTheta
Definition: InDetPhysValTruthDecoratorAlg.h:90
InDetPhysValTruthDecoratorAlg::EDecorations
EDecorations
Definition: InDetPhysValTruthDecoratorAlg.h:86
InDetPhysValTruthDecoratorAlg::m_beamSpotDecoKey
SG::ReadDecorHandleKeyArray< xAOD::EventInfo > m_beamSpotDecoKey
Definition: InDetPhysValTruthDecoratorAlg.h:55
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
InDetPhysValTruthDecoratorAlg::kPixel
@ kPixel
Definition: InDetPhysValTruthDecoratorAlg.h:45
InDetPhysValTruthDecoratorAlg::decorateTruth
bool decorateTruth(const xAOD::TruthParticle &particle, std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > &float_decor, const Amg::Vector3D &beamPos, const std::vector< std::array< uint16_t, kNClusterTypes > > &counts) const
Definition: InDetPhysValTruthDecoratorAlg.cxx:197
TruthParticleContainer.h
InDetPhysValTruthDecoratorAlg::m_decor
std::vector< std::pair< SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >, SG::AuxElement::ConstAccessor< float > > > m_decor
Definition: InDetPhysValTruthDecoratorAlg.h:98
InDetPhysValTruthDecoratorAlg::kDecorZ0
@ kDecorZ0
Definition: InDetPhysValTruthDecoratorAlg.h:88
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
IExtrapolator.h
IAthSelectionTool.h
InDetPhysValTruthDecoratorAlg::m_nMissingTruthParticles
std::atomic< std::size_t > m_nMissingTruthParticles
Definition: InDetPhysValTruthDecoratorAlg.h:65
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
InDetPhysValTruthDecoratorAlg::kDecorProdZ
@ kDecorProdZ
Definition: InDetPhysValTruthDecoratorAlg.h:94
InDetPhysValTruthDecoratorAlg::initialize
virtual StatusCode initialize()
Definition: InDetPhysValTruthDecoratorAlg.cxx:39
InDetPhysValTruthDecoratorAlg::m_errorEmitted
std::atomic< bool > m_errorEmitted
Definition: InDetPhysValTruthDecoratorAlg.h:66
SG::ReadHandleKey< xAOD::TruthParticleContainer >
InDetPhysValTruthDecoratorAlg::ATLAS_THREAD_SAFE
CutFlow m_cutFlow ATLAS_THREAD_SAFE
Definition: InDetPhysValTruthDecoratorAlg.h:63
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
InDetPhysValTruthDecoratorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition: InDetPhysValTruthDecoratorAlg.cxx:84
CutFlow.h
InDetPhysValTruthDecoratorAlg::finalize
virtual StatusCode finalize()
Definition: InDetPhysValTruthDecoratorAlg.cxx:72
InDetPhysValTruthDecoratorAlg::kSCT
@ kSCT
Definition: InDetPhysValTruthDecoratorAlg.h:45
InDetPhysValTruthDecoratorAlg
Definition: InDetPhysValTruthDecoratorAlg.h:35
InDetPhysValTruthDecoratorAlg::kDecorZ0st
@ kDecorZ0st
Definition: InDetPhysValTruthDecoratorAlg.h:91
InDetPhysValTruthDecoratorAlg::kDecorD0
@ kDecorD0
Definition: InDetPhysValTruthDecoratorAlg.h:87
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
InDetPhysValTruthDecoratorAlg::kNDecorators
@ kNDecorators
Definition: InDetPhysValTruthDecoratorAlg.h:96
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
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
InDetPhysValTruthDecoratorAlg::kDecorQOverP
@ kDecorQOverP
Definition: InDetPhysValTruthDecoratorAlg.h:92
CutFlow
Definition: CutFlow.h:166
InDetPhysValTruthDecoratorAlg::m_truthParticleName
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
TruthParticle container's name needed to create decorators.
Definition: InDetPhysValTruthDecoratorAlg.h:70
AthReentrantAlgorithm.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
EventInfo.h
InDetPhysValTruthDecoratorAlg::m_prefix
Gaudi::Property< std::string > m_prefix
Definition: InDetPhysValTruthDecoratorAlg.h:73
InDetPhysValTruthDecoratorAlg::InDetPhysValTruthDecoratorAlg
InDetPhysValTruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: InDetPhysValTruthDecoratorAlg.cxx:29
InDetPhysValTruthDecoratorAlg::m_truthPixelClusterName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthPixelClusterName
TruthPixelClusterContainer and TruthSCTClusterContainer needed for truth silicon hit cut.
Definition: InDetPhysValTruthDecoratorAlg.h:77
InDetPhysValTruthDecoratorAlg::kDecorPhi
@ kDecorPhi
Definition: InDetPhysValTruthDecoratorAlg.h:89
InDetPhysValTruthDecoratorAlg::m_mutex
std::mutex m_mutex
Definition: InDetPhysValTruthDecoratorAlg.h:62
InDetPhysValTruthDecoratorAlg::m_extrapolator
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: InDetPhysValTruthDecoratorAlg.h:53
InDetPhysValTruthDecoratorAlg::m_truthParticleIndexDecor
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_truthParticleIndexDecor
Definition: InDetPhysValTruthDecoratorAlg.h:83
TrackMeasurementValidationContainer.h
InDetPhysValTruthDecoratorAlg::m_truthSCTClusterName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthSCTClusterName
Definition: InDetPhysValTruthDecoratorAlg.h:80
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer >
checker_macros.h
Define macros for attributes used to control the static checker.
InDetPhysValTruthDecoratorAlg::kDecorNSilHits
@ kDecorNSilHits
Definition: InDetPhysValTruthDecoratorAlg.h:95
ReadDecorHandleKeyArray.h
AuxElement.h
Base class for elements of a container that can have aux data.