ATLAS Offline Software
MenuTruthThinning.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // MenuTruthThinning, (c) ATLAS Detector software
8 
9 #ifndef DERIVATIONFRAMEWORK_MENUTRUTHTHINNINGTOOL_H
10 #define DERIVATIONFRAMEWORK_MENUTRUTHTHINNINGTOOL_H
11 
12 #include <string>
13 #include <unordered_set>
14 #include <atomic>
15 
21 #include "GaudiKernel/ToolHandle.h"
23 
24 
25 namespace DerivationFramework {
26 
27  class MenuTruthThinning : public extends<AthAlgTool, IThinningTool> {
28  public:
29  MenuTruthThinning(const std::string& t, const std::string& n, const IInterface* p);
30  virtual ~MenuTruthThinning();
31  virtual StatusCode initialize() override;
32  virtual StatusCode finalize() override;
33  virtual StatusCode doThinning() const override;
34 
35  bool isAccepted(const xAOD::TruthParticle*) const;
36  bool matchHadronIncTau(const xAOD::TruthParticle* part) const;
37  bool matchQuarkIncTau(const xAOD::TruthParticle* part) const;
38  bool isOrphanIncTau(const xAOD::TruthParticle* part) const;
40  std::vector<int> &targetIDs, std::vector<int> &intermediateIDs,
41  bool targetsAreRange) const;
42  bool isLeptonFromTau(const xAOD::TruthParticle*) const;
43  bool isFromTau(const xAOD::TruthParticle*,
44  std::unordered_set<int>& barcode_trace) const;
45  static bool isttHFHadron(const xAOD::TruthParticle*) ;
46  bool isFsrFromLepton(const xAOD::TruthParticle*) const;
47  bool parentIsLongLived(const xAOD::TruthParticle*) const;
48 
49 
50  private:
51  // THE MENU
52 
53  StringProperty m_streamName
54  { this, "StreamName", "", "Name of the stream being thinned" };
56  { this, "ParticlesKey", "TruthParticles", "TruthParticle container name" };
58  { this, "VerticesKey", "TruthVertices", "TruthVertex container name" };
59 
60  std::string m_eventsKey;
61 
64 
67 
70 
73 
76 
80 
83 
85  bool m_writeBSM;
86 
90 
93 
96 
99 
102 
105 
108 
111 
114 
117 
120 
123 
128  bool m_preserveImmediate; // parents, siblings, children only
129  bool m_preserveHadVtx; // hadronization vertices for above
130 
132  std::vector<int> m_pdgIdsToKeep;
133 
135  std::vector<int> m_longLivedPdgIds;
136 
137  // counters
138  mutable std::atomic<unsigned int> m_totpart;
139  mutable std::atomic<unsigned int> m_removedpart;
140  mutable std::atomic<int> m_eventCount{};
141 
142  };
143 }
144 
145 #endif // DERIVATIONFRAMEWORK_MENUTRUTHTHINNING_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
DerivationFramework::MenuTruthThinning::m_particlesKey
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_particlesKey
Definition: MenuTruthThinning.h:56
DerivationFramework::MenuTruthThinning::m_writeAllLeptons
bool m_writeAllLeptons
Parameter: Write all leptons.
Definition: MenuTruthThinning.h:107
DerivationFramework::MenuTruthThinning::matchGenParticle
bool matchGenParticle(const xAOD::TruthParticle *part, std::vector< int > &targetIDs, std::vector< int > &intermediateIDs, bool targetsAreRange) const
Definition: MenuTruthThinning.cxx:449
DerivationFramework::MenuTruthThinning::m_geantPhotonPtThresh
float m_geantPhotonPtThresh
Parameter: Write Geant photons with Pt above this threshold.
Definition: MenuTruthThinning.h:79
DerivationFramework::MenuTruthThinning::m_writeBSMProducts
bool m_writeBSMProducts
Parameter: Write BSM decay products.
Definition: MenuTruthThinning.h:101
DerivationFramework::MenuTruthThinning::initialize
virtual StatusCode initialize() override
Definition: MenuTruthThinning.cxx:164
DerivationFramework::MenuTruthThinning::m_photonPtCut
float m_photonPtCut
Definition: MenuTruthThinning.h:89
SG::ThinningHandleKey
HandleKey object for adding thinning to an object.
Definition: ThinningHandleKey.h:38
DerivationFramework::MenuTruthThinning::m_writePartons
bool m_writePartons
Parameter: Keep partons?
Definition: MenuTruthThinning.h:63
DerivationFramework::MenuTruthThinning::m_totpart
std::atomic< unsigned int > m_totpart
Definition: MenuTruthThinning.h:138
DerivationFramework::MenuTruthThinning::matchQuarkIncTau
bool matchQuarkIncTau(const xAOD::TruthParticle *part) const
Definition: MenuTruthThinning.cxx:403
TruthVertexContainer.h
TruthParticleContainer.h
DerivationFramework::MenuTruthThinning::m_pdgIdsToKeep
std::vector< int > m_pdgIdsToKeep
Parameter: List of PDG IDs to always keep.
Definition: MenuTruthThinning.h:132
IThinningTool.h
DerivationFramework::MenuTruthThinning::m_eventsKey
std::string m_eventsKey
Definition: MenuTruthThinning.h:60
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::MenuTruthThinning::m_preserveGeneratorDescendants
bool m_preserveGeneratorDescendants
Definition: MenuTruthThinning.h:126
DerivationFramework::MenuTruthThinning::m_verticesKey
SG::ThinningHandleKey< xAOD::TruthVertexContainer > m_verticesKey
Definition: MenuTruthThinning.h:58
DerivationFramework::MenuTruthThinning
Definition: MenuTruthThinning.h:27
DerivationFramework::MenuTruthThinning::m_preserveHadVtx
bool m_preserveHadVtx
Definition: MenuTruthThinning.h:129
DerivationFramework::MenuTruthThinning::matchHadronIncTau
bool matchHadronIncTau(const xAOD::TruthParticle *part) const
Definition: MenuTruthThinning.cxx:395
DerivationFramework::MenuTruthThinning::m_writeCHadrons
bool m_writeCHadrons
Parameter: Keep c-hadrons?
Definition: MenuTruthThinning.h:72
DerivationFramework::MenuTruthThinning::m_removedpart
std::atomic< unsigned int > m_removedpart
Definition: MenuTruthThinning.h:139
DerivationFramework::MenuTruthThinning::isttHFHadron
static bool isttHFHadron(const xAOD::TruthParticle *)
Definition: MenuTruthThinning.cxx:611
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::MenuTruthThinning::m_writeBHadrons
bool m_writeBHadrons
Parameter: Keep b-hadrons?
Definition: MenuTruthThinning.h:69
DerivationFramework::MenuTruthThinning::~MenuTruthThinning
virtual ~MenuTruthThinning()
Definition: MenuTruthThinning.cxx:160
DerivationFramework::MenuTruthThinning::finalize
virtual StatusCode finalize() override
Definition: MenuTruthThinning.cxx:183
beamspotman.n
n
Definition: beamspotman.py:731
DerivationFramework::MenuTruthThinning::m_writeTauHad
bool m_writeTauHad
Parameter: Keep hadronic tau decays?
Definition: MenuTruthThinning.h:82
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::MenuTruthThinning::isFromTau
bool isFromTau(const xAOD::TruthParticle *, std::unordered_set< int > &barcode_trace) const
Definition: MenuTruthThinning.cxx:553
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
AthAlgTool.h
DerivationFramework::MenuTruthThinning::m_preserveImmediate
bool m_preserveImmediate
Definition: MenuTruthThinning.h:128
DerivationFramework::MenuTruthThinning::isLeptonFromTau
bool isLeptonFromTau(const xAOD::TruthParticle *) const
Definition: MenuTruthThinning.cxx:519
DerivationFramework::MenuTruthThinning::doThinning
virtual StatusCode doThinning() const override
Definition: MenuTruthThinning.cxx:192
DerivationFramework::MenuTruthThinning::m_preserveAncestors
bool m_preserveAncestors
Definition: MenuTruthThinning.h:127
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::MenuTruthThinning::m_streamName
StringProperty m_streamName
Definition: MenuTruthThinning.h:54
DerivationFramework::MenuTruthThinning::m_writeLeptonsNotFromHadrons
bool m_writeLeptonsNotFromHadrons
Parameter: Write all leptons.
Definition: MenuTruthThinning.h:110
DerivationFramework::MenuTruthThinning::m_partonPtThresh
float m_partonPtThresh
Parameter: Write partons with Pt above this threshold.
Definition: MenuTruthThinning.h:92
DerivationFramework::MenuTruthThinning::m_writeNotPhysical
bool m_writeNotPhysical
Parameter: Write particles with status code 3.
Definition: MenuTruthThinning.h:116
DerivationFramework::MenuTruthThinning::MenuTruthThinning
MenuTruthThinning(const std::string &t, const std::string &n, const IInterface *p)
Definition: MenuTruthThinning.cxx:32
DerivationFramework::MenuTruthThinning::m_writeEverything
bool m_writeEverything
Parameter: Write absolutely everything.
Definition: MenuTruthThinning.h:95
DerivationFramework::MenuTruthThinning::m_writeTopAndDecays
bool m_writeTopAndDecays
Parameter: Write top and decay products.
Definition: MenuTruthThinning.h:104
DerivationFramework::MenuTruthThinning::m_writeBosonProducts
bool m_writeBosonProducts
Parameter: Write boson decay products.
Definition: MenuTruthThinning.h:98
DerivationFramework::MenuTruthThinning::m_writeAllStable
bool m_writeAllStable
Definition: MenuTruthThinning.h:113
DecayGraphHelper.h
DerivationFramework::MenuTruthThinning::m_writettHFHadrons
bool m_writettHFHadrons
Parameter: Write particles for tt+HF classification.
Definition: MenuTruthThinning.h:119
DerivationFramework::MenuTruthThinning::isFsrFromLepton
bool isFsrFromLepton(const xAOD::TruthParticle *) const
Definition: MenuTruthThinning.cxx:630
DerivationFramework::MenuTruthThinning::m_writeGeant
bool m_writeGeant
Parameter: Keep geant particles?
Definition: MenuTruthThinning.h:75
DerivationFramework::MenuTruthThinning::m_writeHadrons
bool m_writeHadrons
Parameter: Keep hadrons?
Definition: MenuTruthThinning.h:66
DerivationFramework::MenuTruthThinning::isAccepted
bool isAccepted(const xAOD::TruthParticle *) const
Definition: MenuTruthThinning.cxx:280
ThinningHandleKey.h
HandleKey object for adding thinning to an object.
DerivationFramework::MenuTruthThinning::m_longLivedPdgIds
std::vector< int > m_longLivedPdgIds
Parameter: List of PDG IDs of long lived particles so that one can keep their children.
Definition: MenuTruthThinning.h:135
DerivationFramework::MenuTruthThinning::isOrphanIncTau
bool isOrphanIncTau(const xAOD::TruthParticle *part) const
Definition: MenuTruthThinning.cxx:411
DerivationFramework::MenuTruthThinning::parentIsLongLived
bool parentIsLongLived(const xAOD::TruthParticle *) const
Definition: MenuTruthThinning.cxx:657
DerivationFramework::MenuTruthThinning::m_writeFirstN
int m_writeFirstN
Parameter: First N particles to write.
Definition: MenuTruthThinning.h:122
DerivationFramework::MenuTruthThinning::m_preserveDescendants
bool m_preserveDescendants
Parameter: preserve descendant/ancestor graph completeness.
Definition: MenuTruthThinning.h:125
DerivationFramework::MenuTruthThinning::m_writeBSM
bool m_writeBSM
Parameter: Keep BSM particles?
Definition: MenuTruthThinning.h:85
DerivationFramework::MenuTruthThinning::m_eventCount
std::atomic< int > m_eventCount
Definition: MenuTruthThinning.h:140
DerivationFramework::MenuTruthThinning::m_writeBosons
bool m_writeBosons
Parameter: Keep bosons?
Definition: MenuTruthThinning.h:88