ATLAS Offline Software
Loading...
Searching...
No Matches
IMCTruthClassifier.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MCTRUTHCLASSIFIER_IMCTRUTHCLASSIFIER_H
5#define MCTRUTHCLASSIFIER_IMCTRUTHCLASSIFIER_H
6
12
14#include "AsgTools/IAsgTool.h"
19
20#include <memory>
21#include <unordered_map>
22#include <vector>
23
24#ifndef GENERATIONBASE
28#include "xAODJet/Jet.h"
29#include "xAODMuon/Muon.h"
31#endif
32
33#ifndef XAOD_ANALYSIS
36#endif
37
38#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
40#endif
41
42namespace MCTruthPartClassifier {
43 // Additional information that can be returned by the classifier.
44 // Originally, these were all held in member variables in the classifier,
45 // but that prevents the classifier methods from being made const.
46 // Not all of these are filled by all classifier calls; it would probably
47 // be better to split this up into a hierarchy of structures.
48 class Info
49 {
50 public:
51 Info() : eventContext(Gaudi::Hive::currentContext()) {}
52 Info(const EventContext& ctx) : eventContext(ctx) {}
53
54 ~Info() = default;
55
56 const EventContext& eventContext;
57 const xAOD::TruthParticle* genPart = nullptr;
58
60
61 const xAOD::TruthParticle* mother = nullptr;
62 const xAOD::TruthParticle* Mother() const { return mother;}
63 inline void setMotherProperties(const xAOD::TruthParticle* from) {
64 mother = from;
65 if (!from) return;
66 }
67 inline void resetMotherProperties() { mother = nullptr; }
68
71
72#ifndef GENERATIONBASE /*Disable when no reconstruction packages are expected*/
73 float deltaRMatch = -999;
74 float deltaPhi = -999;
75 float probTrkToTruth = 0;
76 uint8_t numOfSiHits = 0;
77
78 std::vector<const xAOD::TruthParticle*> egPartPtr;
79 std::vector<float> egPartdR;
80 std::vector<std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>> egPartClas;
81
82 std::vector<const xAOD::TrackParticle*> cnvPhotTrkPtr;
83 std::vector<const xAOD::TruthParticle*> cnvPhotTrkToTruthPart;
84 std::vector<MCTruthPartClassifier::ParticleType> cnvPhotPartType;
85 std::vector<MCTruthPartClassifier::ParticleOrigin> cnvPhotPartOrig;
86#endif
87 };
88
89}
90
91class IMCTruthClassifier : virtual public asg::IAsgTool
92{
94public:
96 virtual ~IMCTruthClassifier() = default;
97
98 // Methods for Reco object to Truth association
99#ifndef GENERATIONBASE
100 // Method for Track to Truth association
102 const xAOD::TrackParticle*,
103 MCTruthPartClassifier::Info* info = nullptr) const = 0;
104#ifndef XAOD_ANALYSIS
105 // Method for egamma clusters to Truth Particle association
107 const xAOD::CaloCluster*, bool,
108 MCTruthPartClassifier::Info* info = nullptr) const = 0;
109#endif
110#endif
111
112// Methods for Truth Particle classification
113 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
115
116#ifndef XAOD_ANALYSIS /*These can not run in Analysis Base*/
117 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
119#endif
120
121#ifndef GENERATIONBASE
122 // Methods for Reco Particle classification
123 // Rely on the Reco to Truth association and then the Truth classification
124 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
126
127 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
129
130 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
132
133 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
135
136 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
138
139 virtual std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin>
140 particleTruthClassifier(const xAOD::Jet*, bool DR, MCTruthPartClassifier::Info* info = nullptr) const = 0;
141
142#endif
143};
144
145#endif // MCTRUTHCLASSIFIER_IMCTRUTHCLASSIFIER_H
#define ASG_TOOL_INTERFACE(CLASSNAME)
virtual ~IMCTruthClassifier()=default
Virtual destructor.
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::TrackParticle *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::Muon *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::Electron *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual const xAOD::TruthParticle * getGenPart(const xAOD::TrackParticle *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::CaloCluster *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::Jet *, bool DR, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::TruthParticle *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::Photon *, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual const xAOD::TruthParticle * egammaClusMatch(const xAOD::CaloCluster *, bool, MCTruthPartClassifier::Info *info=nullptr) const =0
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleHepMCTruthClassifier(const HepMcParticleLink &theLink, MCTruthPartClassifier::Info *info=nullptr) const =0
std::vector< MCTruthPartClassifier::ParticleType > cnvPhotPartType
std::vector< MCTruthPartClassifier::ParticleOrigin > cnvPhotPartOrig
Info(const EventContext &ctx)
std::vector< const xAOD::TruthParticle * > egPartPtr
std::vector< const xAOD::TrackParticle * > cnvPhotTrkPtr
void setMotherProperties(const xAOD::TruthParticle *from)
const xAOD::TruthParticle * Mother() const
std::vector< const xAOD::TruthParticle * > cnvPhotTrkToTruthPart
const EventContext & eventContext
std::vector< std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > > egPartClas
const xAOD::TruthParticle * genPart
const xAOD::TruthParticle * PhotonMother() const
MCTruthPartClassifier::ParticleOutCome particleOutCome
std::vector< float > egPartdR
const xAOD::TruthParticle * mother
const xAOD::TruthParticle * photonMother
Base class for the dual-use tool interface classes.
Definition IAsgTool.h:41
=============================================================================
Jet_v1 Jet
Definition of the current "jet version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".