ATLAS Offline Software
TruthDecayCollectionMaker.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DERIVATIONFRAMEWORK_TRUTHDECAYCOLLECTIONMAKER_H
6 #define DERIVATIONFRAMEWORK_TRUTHDECAYCOLLECTIONMAKER_H
7 
8 // Base classes
11 // EDM -- typedefs so these are includes
14 // Handles and keys
19 // Standard library includes
20 #include <vector>
21 #include <string>
22 
23 namespace DerivationFramework {
24 
25 
26  class TruthDecayCollectionMaker : public extends<AthAlgTool, IAugmentationTool> {
27  public:
28  TruthDecayCollectionMaker(const std::string& t, const std::string& n, const IInterface* p);
31  virtual StatusCode addBranches() const;
32 
33  private:
34  Gaudi::Property<std::vector<int> > m_pdgIdsToKeep
35  {this, "PDGIDsToKeep", {}, "PDG IDs of particles to build the collection from"};
36  Gaudi::Property<bool> m_keepBHadrons
37  {this, "KeepBHadrons", false, "Keep b-hadrons (easier than by PDG ID)"};
38  Gaudi::Property<bool> m_keepCHadrons
39  {this, "KeepCHadrons", false, "Keep c-hadrons (easier than by PDG ID)"};
40  Gaudi::Property<bool> m_keepBSM
41  {this, "KeepBSM", false, "Keep BSM particles (easier than by PDG ID)"};
42  Gaudi::Property<bool> m_rejectHadronChildren
43  {this, "RejectHadronChildren", false, "Drop hadron descendants"};
44 
45  // Read(Decor)HandleKeys
47  {this, "ParticlesKey", "TruthParticles", "ReadHandleKey for input TruthParticleContainer"};
49  {this, "Input_classifierParticleOrigin", m_particlesKey, "classifierParticleOrigin","Name of the decoration which records the particle origin as determined by the MCTruthClassifier"};
51  {this, "Input_classifierParticleType", m_particlesKey, "classifierParticleType","Name of the decoration which records the particle type as determined by the MCTruthClassifier"};
53  {this, "Input_classifierParticleOutCome", m_particlesKey, "classifierParticleOutCome","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
55  {this, "Input_Classification", m_particlesKey, "Classification","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
56 
57  // Write(Decor)HandleKeys
59  {this, "NewVertexKey", "", "WriteHandleKey for new TruthVertexContainer"};
61  {this, "NewParticleKey", "", "WriteHandleKey for new TruthParticleContainer"};
64  {this, "classifierParticleOrigin", m_outputParticlesKey, "classifierParticleOrigin","Name of the decoration which records the particle origin as determined by the MCTruthClassifier"};
66  {this, "classifierParticleType", m_outputParticlesKey, "classifierParticleType","Name of the decoration which records the particle type as determined by the MCTruthClassifier"};
68  {this, "classifierParticleOutCome", m_outputParticlesKey, "classifierParticleOutCome","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
70  {this, "Classification", m_outputParticlesKey, "Classification","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
72  {this, "motherID", m_outputParticlesKey, "motherID","Name of the decoration which records the ID of the particle's mother"};
74  {this, "daughterID", m_outputParticlesKey, "daughterID","Name of the decoration which records the ID of the particle's daughter"};
76 
77  Gaudi::Property<int> m_generations
78  {this, "Generations", -1, "Number of generations after the particle in question to keep (-1 for all)"};
79 
80  // Helper functions for building up the decay product collections
81  int addTruthParticle( const EventContext& ctx,
82  const xAOD::TruthParticle& old_part, xAOD::TruthParticleContainer* part_cont,
83  xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles,
84  const int generations=-1) const;
85  int addTruthVertex( const EventContext&,
86  const xAOD::TruthVertex& old_vert, xAOD::TruthParticleContainer* part_cont,
87  xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles,
88  const int generations=-1) const;
89  bool id_ok( const xAOD::TruthParticle& part ) const;
90  };
91 }
92 
93 #endif // DERIVATIONFRAMEWORK_TRUTHDECAYCOLLECTIONMAKER_H
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
DerivationFramework::TruthDecayCollectionMaker::m_rejectHadronChildren
Gaudi::Property< bool > m_rejectHadronChildren
< Option to reject hadron descendants
Definition: TruthDecayCollectionMaker.h:43
IAugmentationTool.h
DerivationFramework::TruthDecayCollectionMaker::m_outputParticlesKey
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_outputParticlesKey
Definition: TruthDecayCollectionMaker.h:61
TruthVertexContainer.h
TruthParticleContainer.h
DerivationFramework::TruthDecayCollectionMaker::TruthDecayCollectionMaker
TruthDecayCollectionMaker(const std::string &t, const std::string &n, const IInterface *p)
Definition: TruthDecayCollectionMaker.cxx:30
DerivationFramework::TruthDecayCollectionMaker::m_keepBSM
Gaudi::Property< bool > m_keepBSM
< Option to keep all BSM particles (better than giving PDG IDs)
Definition: TruthDecayCollectionMaker.h:41
DerivationFramework::TruthDecayCollectionMaker::initialize
StatusCode initialize()
Definition: TruthDecayCollectionMaker.cxx:42
DerivationFramework::TruthDecayCollectionMaker::m_keepBHadrons
Gaudi::Property< bool > m_keepBHadrons
< Option to keep all b-hadrons (better than giving PDG IDs)
Definition: TruthDecayCollectionMaker.h:37
DerivationFramework::TruthDecayCollectionMaker::m_outcomeAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeAccessorKey
Definition: TruthDecayCollectionMaker.h:53
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::ReadHandleKey< xAOD::TruthParticleContainer >
HepMC::BarcodeBased::generations
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (only to be used in...
Definition: MagicNumbers.h:211
DerivationFramework::TruthDecayCollectionMaker::m_originAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_originAccessorKey
Definition: TruthDecayCollectionMaker.h:49
DerivationFramework::TruthDecayCollectionMaker::m_keepCHadrons
Gaudi::Property< bool > m_keepCHadrons
< Option to keep all c-hadrons (better than giving PDG IDs)
Definition: TruthDecayCollectionMaker.h:39
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
DerivationFramework::TruthDecayCollectionMaker::addTruthVertex
int addTruthVertex(const EventContext &, const xAOD::TruthVertex &old_vert, xAOD::TruthParticleContainer *part_cont, xAOD::TruthVertexContainer *vert_cont, std::vector< int > &seen_particles, const int generations=-1) const
Definition: TruthDecayCollectionMaker.cxx:182
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
DerivationFramework::TruthDecayCollectionMaker::addTruthParticle
int addTruthParticle(const EventContext &ctx, const xAOD::TruthParticle &old_part, xAOD::TruthParticleContainer *part_cont, xAOD::TruthVertexContainer *vert_cont, std::vector< int > &seen_particles, const int generations=-1) const
Definition: TruthDecayCollectionMaker.cxx:117
beamspotman.n
n
Definition: beamspotman.py:727
DerivationFramework::TruthDecayCollectionMaker::m_typeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_typeDecoratorKey
Definition: TruthDecayCollectionMaker.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::TruthDecayCollectionMaker::m_motherIDDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_motherIDDecoratorKey
Definition: TruthDecayCollectionMaker.h:72
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
AthAlgTool.h
DerivationFramework::TruthDecayCollectionMaker::m_outputVerticesKey
SG::WriteHandleKey< xAOD::TruthVertexContainer > m_outputVerticesKey
Definition: TruthDecayCollectionMaker.h:59
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::TruthDecayCollectionMaker::m_classificationDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_classificationDecoratorKey
Definition: TruthDecayCollectionMaker.h:70
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
DerivationFramework::TruthDecayCollectionMaker::m_classificationAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_classificationAccessorKey
Definition: TruthDecayCollectionMaker.h:55
DerivationFramework::TruthDecayCollectionMaker::m_particlesKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
Definition: TruthDecayCollectionMaker.h:47
DerivationFramework::TruthDecayCollectionMaker::id_ok
bool id_ok(const xAOD::TruthParticle &part) const
Definition: TruthDecayCollectionMaker.cxx:220
DerivationFramework::TruthDecayCollectionMaker::m_typeAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_typeAccessorKey
Definition: TruthDecayCollectionMaker.h:51
DerivationFramework::TruthDecayCollectionMaker::m_generations
Gaudi::Property< int > m_generations
^^^^ These should be replaced by SG::Accessor.
Definition: TruthDecayCollectionMaker.h:78
DerivationFramework::TruthDecayCollectionMaker::m_outcomeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeDecoratorKey
Definition: TruthDecayCollectionMaker.h:68
DerivationFramework::TruthDecayCollectionMaker::~TruthDecayCollectionMaker
~TruthDecayCollectionMaker()
Definition: TruthDecayCollectionMaker.cxx:38
DerivationFramework::TruthDecayCollectionMaker::m_pdgIdsToKeep
Gaudi::Property< std::vector< int > > m_pdgIdsToKeep
< List of PDG IDs to build this collection from
Definition: TruthDecayCollectionMaker.h:35
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer >
DerivationFramework::TruthDecayCollectionMaker::m_originDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_originDecoratorKey
FIXME Using WriteDecorHandles for decorations on a Container created in the current algorithm is unne...
Definition: TruthDecayCollectionMaker.h:64
DerivationFramework::TruthDecayCollectionMaker::m_daughterIDDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_daughterIDDecoratorKey
Definition: TruthDecayCollectionMaker.h:74
DerivationFramework::TruthDecayCollectionMaker
Definition: TruthDecayCollectionMaker.h:26
DerivationFramework::TruthDecayCollectionMaker::addBranches
virtual StatusCode addBranches() const
Definition: TruthDecayCollectionMaker.cxx:80