ATLAS Offline Software
ThinGeantTruthAlg.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef THINNINGUTILS_ThinGeantTruthAlg_H
8 #define THINNINGUTILS_ThinGeantTruthAlg_H
9 
14 // STL includes
15 #include <atomic>
16 #include <string>
17 
18 // FrameWork includes
20 #include "GaudiKernel/ServiceHandle.h"
21 #include "GaudiKernel/ToolHandle.h"
25 #include "xAODMuon/MuonContainer.h"
29 
31 {
32 public:
33  using AthReentrantAlgorithm::AthReentrantAlgorithm;
34  virtual StatusCode initialize() override;
35  virtual StatusCode finalize() override;
36  virtual StatusCode execute(const EventContext& ctx) const override final;
37 
39  void ancestors(const xAOD::TruthParticle*,
40  std::vector<bool>&,
41  std::unordered_set<int>&) const;
42  void descendants(const xAOD::TruthParticle*,
43  std::vector<bool>&,
44  std::unordered_set<int>&) const;
45 
46 private:
47  StringProperty m_streamName{ this,
48  "StreamName",
49  "",
50  "Stream for which thinning is to be done." };
51 
52  Gaudi::Property<float> m_etaMaxEgTruth{ this,
53  "EtaMaxEGammaTruth",
54  2.525,
55  "Max eta value for e-gamma truth particles" };
56 
57  Gaudi::Property<bool> m_keepMuons{ this, "keepMuons", true };
58  Gaudi::Property<bool> m_keepEGamma{ this, "keepEGamma", true };
59 
61  Gaudi::Property<std::string> m_truthLinkDecor{this, "TruthLinkDecor", "truthParticleLink"};
64 
65  Gaudi::Property<std::vector<int>> m_longlived{
66  this,
67  "LongLivedParticleList",
68  { 310, 3122, 3222, 3112, 3322, 3312 },
69  "List of long lifetime particles which are likely to be decayed by "
70  "Geant but whose children must be kept"
71  };
72 
74  this,
75  "TruthParticlesKey",
76  "TruthParticles",
77  "Name of the input Truth Particle container"
78  };
79 
81  this,
82  "TruthVerticesKey",
83  "TruthVertices",
84  "Name of the input Truth Vertices container"
85  };
86 
88  this,
89  "ElectronsKey",
90  "Electrons",
91  "Name of the input electron container"
92  };
93 
95  this,
96  "FwdElectronsKey",
97  "",
98  "Name of the input forward electron container"
99  };
100 
102  this,
103  "PhotonsKey",
104  "Photons",
105  "Name of the input photon container"
106  };
107 
109  m_muonsKey{ this, "MuonsKey", "Muons", "Name of the input muon container" };
110 
112  this,
113  "EGammaTruthKey",
114  "egammaTruthParticles",
115  "Name of the input egammaTruth container"
116  };
117 
119  mutable std::atomic<unsigned long> m_nEventsProcessed{};
120  mutable std::atomic<unsigned long> m_nParticlesProcessed{};
121  mutable std::atomic<unsigned long> m_nVerticesProcessed{};
122  mutable std::atomic<unsigned long> m_nParticlesThinned{};
123  mutable std::atomic<unsigned long> m_nVerticesThinned{};
124 };
125 
126 #endif //> !THINNINGUTILS_ThinGeantTruthAlg_H
ThinGeantTruthAlg::m_etaMaxEgTruth
Gaudi::Property< float > m_etaMaxEgTruth
Definition: ThinGeantTruthAlg.h:52
ThinGeantTruthAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: ThinGeantTruthAlg.cxx:85
ThinGeantTruthAlg::descendants
void descendants(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
Definition: ThinGeantTruthAlg.cxx:359
SG::ThinningHandleKey
HandleKey object for adding thinning to an object.
Definition: ThinningHandleKey.h:38
TruthVertexContainer.h
TruthParticleContainer.h
ThinGeantTruthAlg::initialize
virtual StatusCode initialize() override
Definition: ThinGeantTruthAlg.cxx:41
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
ThinGeantTruthAlg::m_truthParticlesKey
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticlesKey
Definition: ThinGeantTruthAlg.h:73
SG::ReadHandleKey< xAOD::ElectronContainer >
ThinGeantTruthAlg::m_electronsKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey
Definition: ThinGeantTruthAlg.h:87
ThinGeantTruthAlg::m_truthLinkDecor
Gaudi::Property< std::string > m_truthLinkDecor
Truth particle link decorations.
Definition: ThinGeantTruthAlg.h:61
ThinGeantTruthAlg::m_muonsKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsKey
Definition: ThinGeantTruthAlg.h:109
ThinGeantTruthAlg::m_nParticlesThinned
std::atomic< unsigned long > m_nParticlesThinned
Definition: ThinGeantTruthAlg.h:122
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
ThinGeantTruthAlg::m_photonsKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsKey
Definition: ThinGeantTruthAlg.h:101
ThinGeantTruthAlg::ancestors
void ancestors(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
Inline method.
Definition: ThinGeantTruthAlg.cxx:324
ElectronContainer.h
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:37
ThinGeantTruthAlg
Definition: ThinGeantTruthAlg.h:31
ThinGeantTruthAlg::m_longlived
Gaudi::Property< std::vector< int > > m_longlived
Definition: ThinGeantTruthAlg.h:65
ThinGeantTruthAlg::m_truthVerticesKey
SG::ThinningHandleKey< xAOD::TruthVertexContainer > m_truthVerticesKey
Definition: ThinGeantTruthAlg.h:80
ThinGeantTruthAlg::m_keepEGamma
Gaudi::Property< bool > m_keepEGamma
Definition: ThinGeantTruthAlg.h:58
ThinGeantTruthAlg::m_fwdElectronsKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_fwdElectronsKey
Definition: ThinGeantTruthAlg.h:94
columnar::final
CM final
Definition: ColumnAccessor.h:106
AthReentrantAlgorithm.h
ThinGeantTruthAlg::m_nVerticesProcessed
std::atomic< unsigned long > m_nVerticesProcessed
Definition: ThinGeantTruthAlg.h:121
ThinGeantTruthAlg::finalize
virtual StatusCode finalize() override
Definition: ThinGeantTruthAlg.cxx:73
ThinGeantTruthAlg::m_nEventsProcessed
std::atomic< unsigned long > m_nEventsProcessed
Counters.
Definition: ThinGeantTruthAlg.h:119
MuonContainer.h
ThinGeantTruthAlg::m_nParticlesProcessed
std::atomic< unsigned long > m_nParticlesProcessed
Definition: ThinGeantTruthAlg.h:120
ThinGeantTruthAlg::m_egammaTruthKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_egammaTruthKey
Definition: ThinGeantTruthAlg.h:111
ThinGeantTruthAlg::m_readDecorKeys
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_readDecorKeys
Schedule the algorithm's dependency on the truth particle link.
Definition: ThinGeantTruthAlg.h:63
ThinningHandleKey.h
HandleKey object for adding thinning to an object.
ThinGeantTruthAlg::m_keepMuons
Gaudi::Property< bool > m_keepMuons
Definition: ThinGeantTruthAlg.h:57
PhotonContainer.h
ReadDecorHandleKeyArray.h
ThinGeantTruthAlg::m_nVerticesThinned
std::atomic< unsigned long > m_nVerticesThinned
Definition: ThinGeantTruthAlg.h:123
ThinGeantTruthAlg::m_streamName
StringProperty m_streamName
Definition: ThinGeantTruthAlg.h:47