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 
29  using base_class::base_class;
30 
31  virtual StatusCode initialize() override final;
32  virtual StatusCode addBranches(const EventContext& ctx) const override final;
33 
34  private:
35  Gaudi::Property<std::vector<int> > m_pdgIdsToKeep
36  {this, "PDGIDsToKeep", {}, "PDG IDs of particles to build the collection from"};
37  Gaudi::Property<bool> m_keepBHadrons
38  {this, "KeepBHadrons", false, "Keep b-hadrons (easier than by PDG ID)"};
39  Gaudi::Property<bool> m_keepCHadrons
40  {this, "KeepCHadrons", false, "Keep c-hadrons (easier than by PDG ID)"};
41  Gaudi::Property<bool> m_keepBSM
42  {this, "KeepBSM", false, "Keep BSM particles (easier than by PDG ID)"};
43  Gaudi::Property<bool> m_rejectHadronChildren
44  {this, "RejectHadronChildren", false, "Drop hadron descendants"};
45 
46  // Read(Decor)HandleKeys
48  {this, "ParticlesKey", "TruthParticles", "ReadHandleKey for input TruthParticleContainer"};
50  {this, "Input_classifierParticleOrigin", m_particlesKey, "classifierParticleOrigin","Name of the decoration which records the particle origin as determined by the MCTruthClassifier"};
52  {this, "Input_classifierParticleType", m_particlesKey, "classifierParticleType","Name of the decoration which records the particle type as determined by the MCTruthClassifier"};
54  {this, "Input_classifierParticleOutCome", m_particlesKey, "classifierParticleOutCome","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
56  {this, "Input_Classification", m_particlesKey, "Classification","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
57 
58  // Write(Decor)HandleKeys
60  {this, "NewVertexKey", "", "WriteHandleKey for new TruthVertexContainer"};
62  {this, "NewParticleKey", "", "WriteHandleKey for new TruthParticleContainer"};
65  {this, "classifierParticleOrigin", m_outputParticlesKey, "classifierParticleOrigin","Name of the decoration which records the particle origin as determined by the MCTruthClassifier"};
67  {this, "classifierParticleType", m_outputParticlesKey, "classifierParticleType","Name of the decoration which records the particle type as determined by the MCTruthClassifier"};
69  {this, "classifierParticleOutCome", m_outputParticlesKey, "classifierParticleOutCome","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
71  {this, "Classification", m_outputParticlesKey, "Classification","Name of the decoration which records the particle outcome as determined by the MCTruthClassifier"};
73  {this, "motherID", m_outputParticlesKey, "motherID","Name of the decoration which records the ID of the particle's mother"};
75  {this, "daughterID", m_outputParticlesKey, "daughterID","Name of the decoration which records the ID of the particle's daughter"};
77 
78  Gaudi::Property<int> m_generations
79  {this, "Generations", -1, "Number of generations after the particle in question to keep (-1 for all)"};
80 
81  // Helper functions for building up the decay product collections
82  int addTruthParticle( const EventContext& ctx,
83  const xAOD::TruthParticle& old_part, xAOD::TruthParticleContainer* part_cont,
84  xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles,
85  const int generations=-1) const;
86  int addTruthVertex( const EventContext&,
87  const xAOD::TruthVertex& old_vert, xAOD::TruthParticleContainer* part_cont,
88  xAOD::TruthVertexContainer* vert_cont, std::vector<int>& seen_particles,
89  const int generations=-1) const;
90  bool id_ok( const xAOD::TruthParticle& part ) const;
91  };
92 }
93 
94 #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:44
IAugmentationTool.h
DerivationFramework::TruthDecayCollectionMaker::m_outputParticlesKey
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_outputParticlesKey
Definition: TruthDecayCollectionMaker.h:62
TruthVertexContainer.h
TruthParticleContainer.h
DerivationFramework::TruthDecayCollectionMaker::m_keepBSM
Gaudi::Property< bool > m_keepBSM
< Option to keep all BSM particles (better than giving PDG IDs)
Definition: TruthDecayCollectionMaker.h:42
DerivationFramework::TruthDecayCollectionMaker::m_keepBHadrons
Gaudi::Property< bool > m_keepBHadrons
< Option to keep all b-hadrons (better than giving PDG IDs)
Definition: TruthDecayCollectionMaker.h:38
DerivationFramework::TruthDecayCollectionMaker::m_outcomeAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeAccessorKey
Definition: TruthDecayCollectionMaker.h:54
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:212
DerivationFramework::TruthDecayCollectionMaker::m_originAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_originAccessorKey
Definition: TruthDecayCollectionMaker.h:50
DerivationFramework::TruthDecayCollectionMaker::m_keepCHadrons
Gaudi::Property< bool > m_keepCHadrons
< Option to keep all c-hadrons (better than giving PDG IDs)
Definition: TruthDecayCollectionMaker.h:40
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:169
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:104
DerivationFramework::TruthDecayCollectionMaker::m_typeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_typeDecoratorKey
Definition: TruthDecayCollectionMaker.h:67
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:73
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:60
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:795
DerivationFramework::TruthDecayCollectionMaker::m_classificationDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_classificationDecoratorKey
Definition: TruthDecayCollectionMaker.h:71
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:56
DerivationFramework::TruthDecayCollectionMaker::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition: TruthDecayCollectionMaker.cxx:68
DerivationFramework::TruthDecayCollectionMaker::m_particlesKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
Definition: TruthDecayCollectionMaker.h:48
DerivationFramework::TruthDecayCollectionMaker::id_ok
bool id_ok(const xAOD::TruthParticle &part) const
Definition: TruthDecayCollectionMaker.cxx:207
DerivationFramework::TruthDecayCollectionMaker::m_typeAccessorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_typeAccessorKey
Definition: TruthDecayCollectionMaker.h:52
DerivationFramework::TruthDecayCollectionMaker::m_generations
Gaudi::Property< int > m_generations
^^^^ These should be replaced by SG::Accessor.
Definition: TruthDecayCollectionMaker.h:79
DerivationFramework::TruthDecayCollectionMaker::m_outcomeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeDecoratorKey
Definition: TruthDecayCollectionMaker.h:69
DerivationFramework::TruthDecayCollectionMaker::initialize
virtual StatusCode initialize() override final
Definition: TruthDecayCollectionMaker.cxx:30
DerivationFramework::TruthDecayCollectionMaker::m_pdgIdsToKeep
Gaudi::Property< std::vector< int > > m_pdgIdsToKeep
< List of PDG IDs to build this collection from
Definition: TruthDecayCollectionMaker.h:36
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:65
DerivationFramework::TruthDecayCollectionMaker::m_daughterIDDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_daughterIDDecoratorKey
Definition: TruthDecayCollectionMaker.h:75
DerivationFramework::TruthDecayCollectionMaker
Definition: TruthDecayCollectionMaker.h:26