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"
28 
30 {
31 public:
33  virtual StatusCode initialize() override;
34  virtual StatusCode finalize() override;
35  virtual StatusCode execute(const EventContext& ctx) const override final;
36 
38  void ancestors(const xAOD::TruthParticle*,
39  std::vector<bool>&,
40  std::unordered_set<int>&) const;
41  void descendants(const xAOD::TruthParticle*,
42  std::vector<bool>&,
43  std::unordered_set<int>&) const;
44 
45 private:
46  StringProperty m_streamName{ this,
47  "StreamName",
48  "",
49  "Stream for which thinning is to be done." };
50 
51  Gaudi::Property<float> m_etaMaxEgTruth{ this,
52  "EtaMaxEGammaTruth",
53  2.525,
54  "Max eta value for e-gamma truth particles" };
55 
56  Gaudi::Property<bool> m_keepMuons{ this, "keepMuons", true };
57  Gaudi::Property<bool> m_keepEGamma{ this, "keepEGamma", true };
58 
59  Gaudi::Property<std::vector<int>> m_longlived{
60  this,
61  "LongLivedParticleList",
62  { 310, 3122, 3222, 3112, 3322, 3312 },
63  "List of long lifetime particles which are likely to be decayed by "
64  "Geant but whose children must be kept"
65  };
66 
68  this,
69  "TruthParticlesKey",
70  "TruthParticles",
71  "Name of the input Truth Particle container"
72  };
73 
75  this,
76  "TruthVerticesKey",
77  "TruthVertices",
78  "Name of the input Truth Vertices container"
79  };
80 
82  this,
83  "ElectronsKey",
84  "Electrons",
85  "Name of the input electron container"
86  };
87 
89  this,
90  "FwdElectronsKey",
91  "",
92  "Name of the input forward electron container"
93  };
94 
96  this,
97  "PhotonsKey",
98  "Photons",
99  "Name of the input photon container"
100  };
101 
103  m_muonsKey{ this, "MuonsKey", "Muons", "Name of the input muon container" };
104 
106  this,
107  "EGammaTruthKey",
108  "egammaTruthParticles",
109  "Name of the input egammaTruth container"
110  };
111 
113  mutable std::atomic<unsigned long> m_nEventsProcessed{};
114  mutable std::atomic<unsigned long> m_nParticlesProcessed{};
115  mutable std::atomic<unsigned long> m_nVerticesProcessed{};
116  mutable std::atomic<unsigned long> m_nParticlesThinned{};
117  mutable std::atomic<unsigned long> m_nVerticesThinned{};
118 };
119 
120 #endif //> !THINNINGUTILS_ThinGeantTruthAlg_H
ThinGeantTruthAlg::m_etaMaxEgTruth
Gaudi::Property< float > m_etaMaxEgTruth
Definition: ThinGeantTruthAlg.h:51
ThinGeantTruthAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: ThinGeantTruthAlg.cxx:72
ThinGeantTruthAlg::descendants
void descendants(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
Definition: ThinGeantTruthAlg.cxx:342
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
ThinGeantTruthAlg::m_truthParticlesKey
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticlesKey
Definition: ThinGeantTruthAlg.h:67
SG::ReadHandleKey< xAOD::ElectronContainer >
ThinGeantTruthAlg::m_electronsKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey
Definition: ThinGeantTruthAlg.h:81
ThinGeantTruthAlg::m_muonsKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsKey
Definition: ThinGeantTruthAlg.h:103
ThinGeantTruthAlg::m_nParticlesThinned
std::atomic< unsigned long > m_nParticlesThinned
Definition: ThinGeantTruthAlg.h:116
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ThinGeantTruthAlg::m_photonsKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsKey
Definition: ThinGeantTruthAlg.h:95
ThinGeantTruthAlg::ancestors
void ancestors(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
Inline method.
Definition: ThinGeantTruthAlg.cxx:307
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
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:30
ThinGeantTruthAlg::m_longlived
Gaudi::Property< std::vector< int > > m_longlived
Definition: ThinGeantTruthAlg.h:59
ThinGeantTruthAlg::m_truthVerticesKey
SG::ThinningHandleKey< xAOD::TruthVertexContainer > m_truthVerticesKey
Definition: ThinGeantTruthAlg.h:74
ThinGeantTruthAlg::m_keepEGamma
Gaudi::Property< bool > m_keepEGamma
Definition: ThinGeantTruthAlg.h:57
ThinGeantTruthAlg::m_fwdElectronsKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_fwdElectronsKey
Definition: ThinGeantTruthAlg.h:88
AthReentrantAlgorithm.h
ThinGeantTruthAlg::m_nVerticesProcessed
std::atomic< unsigned long > m_nVerticesProcessed
Definition: ThinGeantTruthAlg.h:115
ThinGeantTruthAlg::finalize
virtual StatusCode finalize() override
Definition: ThinGeantTruthAlg.cxx:60
ThinGeantTruthAlg::m_nEventsProcessed
std::atomic< unsigned long > m_nEventsProcessed
Counters.
Definition: ThinGeantTruthAlg.h:113
MuonContainer.h
ThinGeantTruthAlg::m_nParticlesProcessed
std::atomic< unsigned long > m_nParticlesProcessed
Definition: ThinGeantTruthAlg.h:114
ThinGeantTruthAlg::m_egammaTruthKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_egammaTruthKey
Definition: ThinGeantTruthAlg.h:105
ThinningHandleKey.h
HandleKey object for adding thinning to an object.
ThinGeantTruthAlg::m_keepMuons
Gaudi::Property< bool > m_keepMuons
Definition: ThinGeantTruthAlg.h:56
PhotonContainer.h
ThinGeantTruthAlg::m_nVerticesThinned
std::atomic< unsigned long > m_nVerticesThinned
Definition: ThinGeantTruthAlg.h:117
ThinGeantTruthAlg::m_streamName
StringProperty m_streamName
Definition: ThinGeantTruthAlg.h:46