ATLAS Offline Software
Loading...
Searching...
No Matches
MCTruthClassifier Class Reference

#include <MCTruthClassifier.h>

Inheritance diagram for MCTruthClassifier:
Collaboration diagram for MCTruthClassifier:

Public Member Functions

 MCTruthClassifier (const std::string &type)
virtual ~MCTruthClassifier ()=default
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
const xAOD::TruthParticle * getGenPart (const xAOD::TrackParticle *) const
const xAOD::TruthParticle * egammaClusMatch (const EventContext &ctx, const xAOD::CaloCluster *, bool isFwrdEle) const
template<typename T>
std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier (const T *p, std::optional< std::reference_wrapper< const EventContext > > ctx=std::nullopt) const
template<typename T>
Result particleTruthClassifier_full (const T *p, std::optional< std::reference_wrapper< const EventContext > > ctx=std::nullopt) const
 Returns more info than the particleTruthClassifier.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Types

using Result

Protected Member Functions

virtual Result particleTruthClassifier (const EventContext &ctx, const xAOD::TruthParticle *thePart) const override final
virtual Result particleTruthClassifier (const EventContext &ctx, const xAOD::TrackParticle *) const override final
virtual Result particleTruthClassifier (const EventContext &ctx, const xAOD::Electron *) const override final
virtual Result particleTruthClassifier (const EventContext &ctx, const xAOD::Photon *) const override final
virtual Result particleTruthClassifier (const EventContext &ctx, const xAOD::Muon *) const override final
virtual Result particleTruthClassifier (const EventContext &ctx, const xAOD::CaloCluster *) const override final
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

bool genPartToCalo (const EventContext &ctx, const xAOD::CaloCluster *clus, const xAOD::TruthParticle *thePart, bool isFwrdEle, double &dRmatch, bool &isNarrowCone, const CaloDetDescrManager &caloDDMgr) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey {this,"xAODTruthParticleContainerName","TruthParticles","ReadHandleKey for xAOD::TruthParticleContainer"}
 Key of the xAOD truth particle container that is searched when classifying (ancestors, decay products, ...).
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtensionTool {this,"ParticleCaloExtensionTool",""}
 Extrapolates truth particles to the calorimeter (egammaClusMatch); optional, disabled if empty.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey {this,"CaloDetDescrManager",""}
 Calorimeter detector description, needed together with the extension tool; optional, may be empty.
ToolHandle< xAOD::ITruthParticlesInConeTool > m_truthInConeTool {this,"TruthInConeTool","xAOD::TruthParticlesInConeTool/TruthParticlesInConeTool"}
 Finds the truth particles in a cone around a cluster (egammaClusMatch); optional, disabled if empty.
bool m_FwdElectronUseG4Sel
 skip Geant4 particles also for forward electrons
float m_FwdElectronTruthExtrEtaCut
 forward electrons: truth particles with |eta| below this are not extrapolated
float m_FwdElectronTruthExtrEtaWindowCut
 forward electrons: max |delta eta| to the cluster for a truth particle to be extrapolated
float m_partExtrConeEta
 eta half-width of the cone in which truth particles are extrapolated
float m_partExtrConePhi
 phi half-width of the cone in which truth particles are extrapolated
float m_phtClasConePhi
 phi half-width of the narrow cone around the cluster (not forward electrons)
float m_phtClasConeEta
 eta half-width of the narrow cone around the cluster (not forward electrons)
float m_phtdRtoTrCut
 max dR cluster - extrapolated truth particle (not forward electrons)
float m_fwrdEledRtoTrCut
 max dR cluster - extrapolated truth particle (forward electrons)
bool m_ROICone
 only extrapolate truth particles inside the partExtrCone ellipse
float m_pTChargePartCut
 minimum pT of charged truth particles considered
float m_pTNeutralPartCut
 minimum pT of neutral truth particles considered
bool m_inclG4part
 also try Geant4 particles if no generator particle matched
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthLinkVecReadHandleKey {this,"xAODTruthLinkVector","xAODTruthLinks", "ReadHandleKey for xAODTruthParticleLinkVector"}
float m_deltaRMatchCut
 max dR track - truth particle if the track has more than NumOfSiHitsCut Si hits
float m_deltaPhiMatchCut
 max delta phi track - truth particle if the track has at most NumOfSiHitsCut Si hits
int m_NumOfSiHitsCut
 Si (pixel + SCT) hit count selecting between deltaRMatchCut and deltaPhiMatchCut.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 56 of file MCTruthClassifier.h.

Member Typedef Documentation

◆ Result

using IMCTruthClassifier::Result
protectedinherited
Initial value:
ParticleOutCome
Outcome of a (simulated) truth particle: what happened to it after being produced,...
ParticleOrigin
Origin of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the second mem...
ParticleType
Type of a truth particle, as assigned by MCTruthClassifier::particleTruthClassifier (the first member...
TruthParticle_v1 TruthParticle
Typedef to implementation.

Definition at line 40 of file IMCTruthClassifier.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MCTruthClassifier()

MCTruthClassifier::MCTruthClassifier ( const std::string & type)
inline

Definition at line 61 of file MCTruthClassifier.h.

61 : asg::AsgTool(type) {
62#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
63 // Properties used by egammaClusMatch (calorimeter cluster -> truth particle matching).
64 // Angular sizes are in eta/phi units, transverse momentum cuts in GeV.
65 declareProperty("FwdElectronUseG4Sel", m_FwdElectronUseG4Sel = true,
66 "Use Geant4 selection for forward electrons calo clusters. "
67 "Geant4 particles are always skipped for non-forward candidates; "
68 "if true they are skipped for forward electrons as well, if false they are considered for them");
69 declareProperty("FwdElectronTruthExtrEtaCut",
71 "Cut on the eta of the truth Particles to be extrapolated "
72 "for Fwd electrons: particles with |eta| below it are not extrapolated");
74 "FwdElectronTruthExtrEtaWindowCut",
76 "Cut on the delta eta of the truth Particles to be extrapolated for "
77 "Fwd electrons and the current FwdElectron: particles further away in eta are not extrapolated. "
78 "Truth particles in the opposite eta hemisphere are never extrapolated");
79 declareProperty("partExtrConePhi", m_partExtrConePhi = 0.4,
80 "Half-width in phi of the elliptical cone around the cluster in which truth particles are "
81 "extrapolated to the calorimeter (used if ROICone is true, and for the Geant4 particles of inclG4part)");
82 declareProperty("partExtrConeEta", m_partExtrConeEta = 0.2,
83 "Half-width in eta of the elliptical cone around the cluster in which truth particles are "
84 "extrapolated to the calorimeter (used if ROICone is true, and for the Geant4 particles of inclG4part)");
85 declareProperty("phtClasConePhi", m_phtClasConePhi = 0.05,
86 "Half-width in phi of the narrow elliptical cone around the cluster, "
87 "applied to the extrapolated truth particle positions; not used for forward electrons");
88 declareProperty("phtClasConeEta", m_phtClasConeEta = 0.025,
89 "Half-width in eta of the narrow elliptical cone around the cluster, "
90 "applied to the extrapolated truth particle positions; not used for forward electrons");
91 declareProperty("phtdRtoTrCut", m_phtdRtoTrCut = 0.1,
92 "Maximum distance dR between the cluster and the extrapolated truth particle for "
93 "a match (not forward electrons)");
94 declareProperty("fwrdEledRtoTrCut", m_fwrdEledRtoTrCut = 0.15,
95 "Maximum distance dR between the cluster and the extrapolated truth particle for "
96 "a match (forward electrons)");
97 declareProperty("ROICone", m_ROICone = false,
98 "Before the extrapolation, keep only truth particles inside the elliptical cone "
99 "partExtrConePhi x partExtrConeEta around the cluster (not forward electrons). "
100 "The truth particles are always taken from a fixed dR = 0.5 cone around the cluster");
101 //AV: those below are needed in egammaClusMatch
102 declareProperty("pTChargePartCut", m_pTChargePartCut = 1.0,
103 "Minimum pT in GeV of the charged truth particles considered for the cluster matching");
104 declareProperty("pTNeutralPartCut", m_pTNeutralPartCut = 0.,
105 "Minimum pT in GeV of the neutral truth particles considered for the cluster matching");
106 declareProperty("inclG4part", m_inclG4part = false,
107 "If no generator particle was matched to the cluster (not forward electrons), "
108 "also try stable Geant4 particles without a decay vertex");
109#endif
110#ifndef GENERATIONBASE
111 // Properties used to match a track to a truth particle (getGenPart).
112 declareProperty("deltaRMatchCut", m_deltaRMatchCut = 0.2,
113 "Maximum dR between a track and its truth particle for tracks with more than "
114 "NumOfSiHitsCut silicon (pixel + SCT) hits; otherwise the match is dropped");
115 declareProperty("deltaPhiMatchCut", m_deltaPhiMatchCut = 0.2,
116 "Maximum delta phi between a track and its truth particle for tracks with at most "
117 "NumOfSiHitsCut silicon (pixel + SCT) hits; otherwise the match is dropped");
118 declareProperty("NumOfSiHitsCut", m_NumOfSiHitsCut = 3,
119 "Number of silicon (pixel + SCT) hits on a track that decides whether deltaRMatchCut "
120 "(more hits than this) or deltaPhiMatchCut (this many or fewer) is applied");
121#endif
122 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
int m_NumOfSiHitsCut
Si (pixel + SCT) hit count selecting between deltaRMatchCut and deltaPhiMatchCut.
float m_partExtrConePhi
phi half-width of the cone in which truth particles are extrapolated
bool m_ROICone
only extrapolate truth particles inside the partExtrCone ellipse
float m_pTNeutralPartCut
minimum pT of neutral truth particles considered
float m_phtdRtoTrCut
max dR cluster - extrapolated truth particle (not forward electrons)
float m_phtClasConeEta
eta half-width of the narrow cone around the cluster (not forward electrons)
float m_partExtrConeEta
eta half-width of the cone in which truth particles are extrapolated
float m_deltaPhiMatchCut
max delta phi track - truth particle if the track has at most NumOfSiHitsCut Si hits
float m_deltaRMatchCut
max dR track - truth particle if the track has more than NumOfSiHitsCut Si hits
float m_FwdElectronTruthExtrEtaWindowCut
forward electrons: max |delta eta| to the cluster for a truth particle to be extrapolated
bool m_FwdElectronUseG4Sel
skip Geant4 particles also for forward electrons
float m_fwrdEledRtoTrCut
max dR cluster - extrapolated truth particle (forward electrons)
float m_pTChargePartCut
minimum pT of charged truth particles considered
float m_phtClasConePhi
phi half-width of the narrow cone around the cluster (not forward electrons)
float m_FwdElectronTruthExtrEtaCut
forward electrons: truth particles with |eta| below this are not extrapolated
bool m_inclG4part
also try Geant4 particles if no generator particle matched

◆ ~MCTruthClassifier()

virtual MCTruthClassifier::~MCTruthClassifier ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ egammaClusMatch()

const xAOD::TruthParticle * MCTruthClassifier::egammaClusMatch ( const EventContext & ctx,
const xAOD::CaloCluster * clus,
bool isFwrdEle ) const

Definition at line 44 of file MCTruthClassifierAthena.cxx.

45{
46 ATH_MSG_DEBUG("Executing egammaClusMatch ");
47 const xAOD::TruthParticle* theMatchPart = nullptr;
48 // retrieve collection and get a pointer
49 SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainerReadHandle(m_truthParticleContainerKey, ctx);
50
51 if (!truthParticleContainerReadHandle.isValid()) {
52 ATH_MSG_WARNING( " Invalid ReadHandle for xAOD::TruthParticleContainer with key: " << truthParticleContainerReadHandle.key());
53 return theMatchPart;
54 }
55
56 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{ m_caloMgrKey, ctx };
57 if (!caloMgrHandle.isValid()) {
58 ATH_MSG_WARNING(" Invalid ReadCondHandle for CaloDetDescrManager with key: " << m_caloMgrKey.key());
59 return theMatchPart;
60 }
61
62 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
63 const xAOD::TruthParticle* theEgamma(nullptr);
64 const xAOD::TruthParticle* theLeadingPartInCone(nullptr);
65 const xAOD::TruthParticle* theBestPartOutCone(nullptr);
66 const xAOD::TruthParticle* theBestPartdR(nullptr);
67 double LeadingPhtPT(0);
68 double LeadingPartPT(0);
69 double BestPartdR(999.);
70 double etaClus = clus->etaBE(2);
71 double phiClus = clus->phiBE(2);
72 if (etaClus < -900) {
73 etaClus = clus->eta();
74 }
75 if (phiClus < -900) {
76 phiClus = clus->phi();
77 }
78 std::vector<const xAOD::TruthParticle*> tps;
79 if (!m_truthInConeTool->particlesInCone(ctx, etaClus, phiClus, 0.5, tps)) {
80 ATH_MSG_WARNING("Truth Particle in Cone failed");
81 return theMatchPart;
82 }
83
84 for (const auto* const thePart : tps) {
85 if (!thePart)[[unlikely]] continue;
86 // loop over the stable particle
87 if (!MC::isStable(thePart)) continue;
88 // excluding G4 particle
89 if ((!isFwrdEle || (isFwrdEle && m_FwdElectronUseG4Sel)) && HepMC::is_simulation_particle(thePart)) continue;
90 long iParticlePDG = thePart->pdgId();
91 // excluding neutrino
92 if (std::abs(iParticlePDG) == 12 || std::abs(iParticlePDG) == 14 || std::abs(iParticlePDG) == 16) continue;
93 double pt = thePart->pt() / Athena::Units::GeV;
94 double q = thePart->charge();
95 // exclude charged particles with pT<1 GeV
96 if (q != 0 && pt < m_pTChargePartCut) continue;
97 if (q == 0 && pt < m_pTNeutralPartCut) continue;
98 float deltaPhi = std::abs(std::remainder(phiClus - thePart->phi(), 2*std::numbers::pi));
99 float deteta = std::abs(etaClus - thePart->eta());
100 // eleptical cone for extrapolations m_partExtrConePhi X m_partExtrConeEta
101 if (!isFwrdEle && m_ROICone && std::hypot( deltaPhi/m_partExtrConePhi, deteta/m_partExtrConeEta) > 1.0) {
102 continue;
103 }
104 // Also check if the clus and true have different sign , i they need both to be <0 or >0
105 if (isFwrdEle && // It is forward and
106 (((etaClus < 0) - (thePart->eta() < 0) != 0)
107 // The truth eta has different sign wrt to the fwd electron
108 || (std::fabs(thePart->eta()) < m_FwdElectronTruthExtrEtaCut) // or the truth is less than 2.4 (default cut)
109 || (std::fabs(thePart->eta() - etaClus) > m_FwdElectronTruthExtrEtaWindowCut) // or if the delta Eta between el and truth is > 0.15
110 ) // then do no extrapolate this truth Particle for this fwd electron
111 ) {
112 continue;
113 }
114 double dR(-999.);
115 bool isNCone = false;
116 bool isExt = genPartToCalo(ctx, clus, thePart, isFwrdEle, dR, isNCone, *caloDDMgr);
117 if (!isExt) continue;
118 // Gen particles Not forward
119 if (!isFwrdEle) {
120 // the leading photon or electron inside narrow eleptical cone
121 // m_phtClasConePhi X m_phtClasConeEta
122 if ((iParticlePDG == 22 || std::abs(iParticlePDG) == 11) && isNCone && pt > LeadingPhtPT) {
123 theEgamma = thePart;
124 LeadingPhtPT = pt;
125 }
126 // leading particle (excluding photon and electron) inside narrow eleptic
127 // cone m_phtClasConePhi X m_phtClasConeEta
128 if ((iParticlePDG != 22 && std::abs(iParticlePDG) != 11) && isNCone && pt > LeadingPartPT) {
129 theLeadingPartInCone = thePart;
130 LeadingPartPT = pt;
131 };
132 // the best dR matched particle outside narrow eleptic cone cone
133 // m_phtClasConePhi X m_phtClasConeEta
134 if (!isNCone && dR < BestPartdR) {
135 theBestPartOutCone = thePart;
136 BestPartdR = dR;
137 };
138 } else {
139 if (dR < BestPartdR) {
140 theBestPartdR = thePart;
141 BestPartdR = dR;
142 };
143 }
144 }
145
146 if (theEgamma != nullptr) {
147 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(), theEgamma);
148 } else if (theLeadingPartInCone != nullptr) {
149 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(),theLeadingPartInCone);
150 } else if (theBestPartOutCone != nullptr) {
151 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(),theBestPartOutCone);
152 } else if (isFwrdEle && theBestPartdR != nullptr) {
153 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(),theBestPartdR );
154 } else {
155 theMatchPart = nullptr;
156 }
157 if (isFwrdEle || theMatchPart != nullptr || !m_inclG4part) return theMatchPart;
158
159 // additional loop over G4 particles,
160 for (const auto* const thePart : tps) {
161 if (!MC::isStable(thePart)) continue;
162 if (!HepMC::is_simulation_particle(thePart)) continue;
163 long iParticlePDG = thePart->pdgId();
164 // exclude neutrino
165 if (std::abs(iParticlePDG) == 12 || std::abs(iParticlePDG) == 14 || std::abs(iParticlePDG) == 16) continue;
166 if (thePart->decayVtx() != nullptr) continue;
167 const double dPhi = std::abs(std::remainder(phiClus - thePart->phi(), 2*std::numbers::pi));
168 const double dEta = std::abs(etaClus - thePart->eta());
169 if (std::hypot( dPhi/m_partExtrConePhi, dEta/m_partExtrConeEta ) > 1.0) continue;
170
171 double pt = thePart->pt() / Athena::Units::GeV;
172 double q = thePart->charge();
173 // exclude charged particles with pT<1 GeV
174 if (q != 0 && pt < m_pTChargePartCut) continue;
175 if (q == 0 && pt < m_pTNeutralPartCut) continue;
176
177 double dR(-999.);
178 bool isNCone = false;
179 bool isExt = genPartToCalo(ctx, clus, thePart, isFwrdEle, dR, isNCone, *caloDDMgr);
180 if (!isExt) continue;
181
182 // the leading photon or electron inside narrow eleptical cone
183 // m_phtClasConePhi X m_phtClasConeEta
184 if ((iParticlePDG == 22 || std::abs(iParticlePDG) == 11) && isNCone && pt > LeadingPhtPT) {
185 theEgamma = thePart;
186 LeadingPhtPT = pt;
187 }
188 // leading particle (excluding photon or electron) inside narrow eleptic
189 // cone m_phtClasConePhi X m_phtClasConeEta
190 if ((iParticlePDG != 22 && std::abs(iParticlePDG) != 11) && isNCone && pt > LeadingPartPT) {
191 theLeadingPartInCone = thePart;
192 LeadingPartPT = pt;
193 }
194 // the best dR matched particle outside narrow eleptic cone cone
195 // m_phtClasConePhi X m_phtClasConeEta
196 if (!isNCone && dR < BestPartdR) {
197 theBestPartOutCone = thePart;
198 BestPartdR = dR;
199 }
200 }
201
202 if (theEgamma != nullptr) {
203 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(),theEgamma);
204 } else if (theLeadingPartInCone != nullptr) {
205 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(),theLeadingPartInCone);
206 } else if (theBestPartOutCone != nullptr) {
207 theMatchPart = MC::findMatching(truthParticleContainerReadHandle.ptr(),theBestPartOutCone);
208 } else {
209 theMatchPart = nullptr;
210 }
211 ATH_MSG_DEBUG("succeeded egammaClusMatch ");
212 return theMatchPart;
213}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
ToolHandle< xAOD::ITruthParticlesInConeTool > m_truthInConeTool
Finds the truth particles in a cone around a cluster (egammaClusMatch); optional, disabled if empty.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Calorimeter detector description, needed together with the extension tool; optional,...
bool genPartToCalo(const EventContext &ctx, const xAOD::CaloCluster *clus, const xAOD::TruthParticle *thePart, bool isFwrdEle, double &dRmatch, bool &isNarrowCone, const CaloDetDescrManager &caloDDMgr) const
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
Key of the xAOD truth particle container that is searched when classifying (ancestors,...
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
bool is_simulation_particle(const T &p)
Method to establish if a particle was created during the simulation (based on the status value).
T findMatching(C TruthContainer, T p)
Function to find in the container the particle that p descends from in the simulation (see HepMC::is_...
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
#define unlikely(x)

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ genPartToCalo()

bool MCTruthClassifier::genPartToCalo ( const EventContext & ctx,
const xAOD::CaloCluster * clus,
const xAOD::TruthParticle * thePart,
bool isFwrdEle,
double & dRmatch,
bool & isNarrowCone,
const CaloDetDescrManager & caloDDMgr ) const
private

Definition at line 215 of file MCTruthClassifierAthena.cxx.

222{
223 dRmatch = -999.;
224 isNarrowCone = false;
225 if (thePart == nullptr) return false;
226 double phiClus = clus->phiBE(2);
227 double etaClus = clus->etaBE(2);
228 if (etaClus < -900) {
229 etaClus = clus->eta();
230 }
231 if (phiClus < -900) {
232 phiClus = clus->phi();
233 }
234 //--FixMe
235 if (isFwrdEle || (etaClus == 0. && phiClus == 0.)) {
236 phiClus = clus->phi();
237 etaClus = clus->eta();
238 }
239 // define calo sample
240 CaloSampling::CaloSample sample = CaloSampling::EMB2;
241 if ((clus->inBarrel() && !clus->inEndcap()) ||
242 (clus->inBarrel() && clus->inEndcap() && clus->eSample(CaloSampling::EMB2) >= clus->eSample(CaloSampling::EME2))) {
243 // Barrel
244 sample = CaloSampling::EMB2;
245 } else if ((!clus->inBarrel() && clus->inEndcap() && !isFwrdEle) ||
246 (clus->inBarrel() && clus->inEndcap() && clus->eSample(CaloSampling::EME2) > clus->eSample(CaloSampling::EMB2))) {
247 // End-cap
248 sample = CaloSampling::EME2;
249 } else if (isFwrdEle && clus->inEndcap()) {
250 // FCAL
251 sample = CaloSampling::FCAL2;
252 } else {
253 return false;
254 }
255 std::unique_ptr<Trk::CurvilinearParameters> params = extractParamFromTruth(*thePart);
256 if (!params) return false;
257 // create extension to sample
258 std::vector<CaloSampling::CaloSample> samples = { sample };
259 auto extension = m_caloExtensionTool->layersCaloExtension(ctx, *params, samples, etaClus, caloDDMgr);
260 bool extensionOK = (!extension.empty());
261 if (!extensionOK) {
262 ATH_MSG_WARNING("extrapolation of Truth Particle with eta " << thePart->eta() << " , charge " << thePart->charge() << " , Pt " << thePart->pt() << " to calo failed");
263 return false;
264 }
265 double etaCalo = extension[0].second->position().eta();
266 double phiCalo = extension[0].second->position().phi();
267
268 const double dPhi = std::abs(std::remainder(phiCalo - phiClus, 2*std::numbers::pi));
269 const double dEta = std::abs(etaCalo - etaClus);
270 dRmatch = std::hypot(dPhi, dEta);
271
272 if ((!isFwrdEle && dRmatch > m_phtdRtoTrCut) || (isFwrdEle && dRmatch > m_fwrdEledRtoTrCut)) return false;
273 if (!isFwrdEle && std::hypot( dPhi/m_phtClasConePhi, dEta/m_phtClasConeEta ) <= 1.0) isNarrowCone = true;
274 return true;
275}
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtensionTool
Extrapolates truth particles to the calorimeter (egammaClusMatch); optional, disabled if empty.
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
float eSample(const CaloSample sampling) const
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
double charge() const
Physical charge.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.

◆ getGenPart()

const xAOD::TruthParticle * MCTruthClassifier::getGenPart ( const xAOD::TrackParticle * trk) const

Definition at line 98 of file MCRecoToTruth.cxx.

99{
100 // return GenParticle corresponding to given TrackParticle
101 ATH_MSG_DEBUG("Executing getGenPart ");
102 if (!trk) return nullptr;
103 uint8_t NumOfPixHits = 0;
104 uint8_t NumOfSCTHits = 0;
105 typedef ElementLink<xAOD::TruthParticleContainer> TruthLink_t;
106
107 static const SG::Accessor<TruthLink_t> tPL("truthParticleLink");
108 if (!tPL.isAvailable(*trk)) {
109 ATH_MSG_DEBUG("Track particle is not associated to truth particle");
110 return nullptr;
111 }
112
113 const auto& truthLink = tPL(*trk);
114 if (!truthLink.isValid()) {
115 ATH_MSG_DEBUG("Invalid link to truth particle");
116 return nullptr;
117 }
118
119 const xAOD::TruthParticle* theGenParticle = (*truthLink);
120 if (!theGenParticle) {
121 ATH_MSG_DEBUG("Could not find truth matching for track");
122 return nullptr;
123 }
124
125 if (theGenParticle->status() == 3) {
126 ATH_MSG_WARNING("track matched to the truth with status " << theGenParticle->status());
127 }
128 else if (MC::isDecayed(theGenParticle)) {
129 // Matching to status == 2 particles is to be expected if
130 // quasi-stable particle simulation was used.
131 ATH_MSG_DEBUG("track matched to the truth with status " << theGenParticle->status());
132 }
133
134 if (MC::isDecayed(theGenParticle) && (MC::isElectron(theGenParticle) || MC::isMuon(theGenParticle))) {
135 const xAOD::TruthVertex* EndVrtx = theGenParticle->decayVtx();
136 const xAOD::TruthParticle* theGenPartTmp(nullptr);
137
138 if (EndVrtx != nullptr) {
139 int itr = 0;
140 do {
141 theGenPartTmp = nullptr;
142 for (const auto & theDaugt: EndVrtx->particles_out()) {
143 if (!theDaugt) continue;
144 if (theDaugt->pdgId() == theGenParticle->pdgId()) theGenPartTmp = theDaugt;
145 if (theDaugt->pdgId() != theGenParticle->pdgId() && !MC::isPhoton(theDaugt)) theGenPartTmp = nullptr;
146 }
147 itr++;
148 if (itr > 100) {
149 ATH_MSG_WARNING("getGenPart infinite while");
150 break;
151 }
152 EndVrtx = theGenPartTmp ? theGenPartTmp->decayVtx() : nullptr;
153 } while (theGenPartTmp && theGenPartTmp->pdgId() == theGenParticle->pdgId() && MC::isDecayed(theGenPartTmp) && EndVrtx != nullptr);
154
155 if (theGenPartTmp && theGenPartTmp->pdgId() == theGenParticle->pdgId()) theGenParticle = theGenPartTmp;
156 }
157 }
158
159 if (!trk->summaryValue(NumOfSCTHits, xAOD::numberOfSCTHits)) ATH_MSG_DEBUG("Could not retrieve number of SCT hits");
160 if (!trk->summaryValue(NumOfPixHits, xAOD::numberOfPixelHits)) ATH_MSG_DEBUG("Could not retrieve number of Pixel hits");
161
162 uint8_t NumOfSiHits = NumOfSCTHits + NumOfPixHits;
163
164 float deltaPhi = std::abs(std::remainder(theGenParticle->phi() - trk->phi(), 2*std::numbers::pi));
165 float deteta = std::abs(theGenParticle->eta() - trk->eta());
166 float deltaRMatch = std::hypot(deltaPhi, deteta);
167 if ((NumOfSiHits > m_NumOfSiHitsCut && deltaRMatch > m_deltaRMatchCut) ||
168 (NumOfSiHits <= m_NumOfSiHitsCut && deltaPhi > m_deltaPhiMatchCut)) theGenParticle = nullptr;
169
170 ATH_MSG_DEBUG("getGenPart succeeded ");
171 return (theGenParticle);
172}
ElementLink< xAOD::TruthParticleContainer > TruthLink_t
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
int status() const
Status code.
int pdgId() const
PDG ID code.
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
std::vector< const TruthParticle * > particles_out() const
Get the outgoing particles.
bool isPhoton(const T &p)
bool isElectron(const T &p)
bool isMuon(const T &p)
bool isDecayed(const T &p)
Identify if the particle decayed.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::Event, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::Event both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::Event, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

virtual StatusCode MCTruthClassifier::initialize ( void )
inlineoverridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Reimplemented in D3PD::D3PDMCTruthClassifier.

Definition at line 126 of file MCTruthClassifier.h.

126 {
127 ATH_MSG_INFO(" Initializing MCTruthClassifier");
128#ifndef XAOD_ANALYSIS
129 // Only needed for GenParticle interface
131#endif
133
134#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
135 if (!m_caloExtensionTool.empty()) {
136 ATH_CHECK(m_caloExtensionTool.retrieve());
137 } else {
138 m_caloExtensionTool.disable();
139 }
140
142
143 if (!m_truthInConeTool.empty()) {
144 ATH_CHECK(m_truthInConeTool.retrieve());
145 } else {
146 m_truthInConeTool.disable();
147 }
148#endif
149 return StatusCode::SUCCESS;
150 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x,...)
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthLinkVecReadHandleKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ particleTruthClassifier() [1/7]

virtual Result MCTruthClassifier::particleTruthClassifier ( const EventContext & ctx,
const xAOD::CaloCluster *  ) const
finaloverrideprotectedvirtual

Implements IMCTruthClassifier.

Reimplemented in D3PD::D3PDMCTruthClassifier.

◆ particleTruthClassifier() [2/7]

IMCTruthClassifier::Result MCTruthClassifier::particleTruthClassifier ( const EventContext & ctx,
const xAOD::Electron * elec ) const
finaloverrideprotectedvirtual

Implements IMCTruthClassifier.

Reimplemented in D3PD::D3PDMCTruthClassifier.

Definition at line 21 of file MCRecoToTruth.cxx.

22{
23 ATH_MSG_DEBUG("Executing egamma electron Classifier");
24 const xAOD::TruthParticle* genPart = nullptr;
25 const xAOD::TrackParticle* trkPtr = elec->trackParticle();
26 if (elec->author() != xAOD::EgammaParameters::AuthorFwdElectron ||trkPtr) {
27 // Central electron or forward electron with track (when reco
28 // implemented in the future)
29 if (!trkPtr){
30 return {Unknown, NonDefined, nullptr, UnknownOutCome};
31 }
32 genPart = getGenPart(trkPtr);
33 } else {
34#ifndef XAOD_ANALYSIS // cluster matching available only in Athena
35 const xAOD::CaloCluster* clus = elec->caloCluster();
36 genPart = egammaClusMatch(ctx, clus, true);
37#else
38 ATH_MSG_WARNING("Forward Electron classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
39#endif
40 }
41
42 if (!genPart) return {Unknown, NonDefined, nullptr, UnknownOutCome};
43 ATH_MSG_DEBUG("egamma electron Classifier succeeded ");
44 return particleTruthClassifier(ctx, genPart);
45}
const xAOD::TruthParticle * getGenPart(const xAOD::TrackParticle *) const
virtual Result particleTruthClassifier(const EventContext &ctx, const xAOD::TruthParticle *thePart) const override final
const xAOD::TruthParticle * egammaClusMatch(const EventContext &ctx, const xAOD::CaloCluster *, bool isFwrdEle) const
uint16_t author(uint16_t bitmask=EgammaParameters::AuthorALL) const
Get author.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
@ UnknownOutCome
End vertex exists, but its content matches none of the patterns below.
@ NonDefined
Origin could not be determined (no production vertex, no ancestor, or particle not classified).
@ Unknown
Not classified: not a lepton, photon, neutrino or hadron (e.g. a quark, a gluon, a boson),...
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition EgammaDefs.h:30
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ particleTruthClassifier() [3/7]

virtual Result MCTruthClassifier::particleTruthClassifier ( const EventContext & ctx,
const xAOD::Muon *  ) const
finaloverrideprotectedvirtual

Implements IMCTruthClassifier.

Reimplemented in D3PD::D3PDMCTruthClassifier.

◆ particleTruthClassifier() [4/7]

IMCTruthClassifier::Result MCTruthClassifier::particleTruthClassifier ( const EventContext & ctx,
const xAOD::Photon * phot ) const
finaloverrideprotectedvirtual

Implements IMCTruthClassifier.

Reimplemented in D3PD::D3PDMCTruthClassifier.

Definition at line 48 of file MCRecoToTruth.cxx.

49{
50 ATH_MSG_DEBUG("Executing egamma photon Classifier");
51 const xAOD::CaloCluster* clus = phot->caloCluster();
52 if (!clus) return {Unknown, NonDefined, nullptr, UnknownOutCome};
53 if (std::fabs(clus->eta()) > 10.0 || std::fabs(clus->phi()) > 6.28 || (clus->et()) <= 0.) return {Unknown, NonDefined, nullptr, UnknownOutCome};
54
55 const xAOD::TruthParticle* genPart = nullptr;
56#ifndef XAOD_ANALYSIS // Fwd electron available only in Athena
57 genPart = egammaClusMatch(ctx, clus, false);
58#else
59 ATH_MSG_WARNING("Photon Classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
60#endif
61 if (!genPart) return {Unknown, NonDefined, nullptr, UnknownOutCome};
62 ATH_MSG_DEBUG("egamma photon Classifier succeeded ");
63 return particleTruthClassifier(ctx, genPart);
64}

◆ particleTruthClassifier() [5/7]

IMCTruthClassifier::Result MCTruthClassifier::particleTruthClassifier ( const EventContext & ctx,
const xAOD::TrackParticle * trkPtr ) const
finaloverrideprotectedvirtual

Implements IMCTruthClassifier.

Reimplemented in D3PD::D3PDMCTruthClassifier.

Definition at line 11 of file MCRecoToTruth.cxx.

12{
13 ATH_MSG_DEBUG("Executing trackClassifier");
14 const xAOD::TruthParticle* genPart = getGenPart(trkPtr);
15 if (!genPart) return {Unknown, NonDefined, nullptr, UnknownOutCome};
16 ATH_MSG_DEBUG("trackClassifier succeeded ");
17 return particleTruthClassifier(ctx, genPart);
18}

◆ particleTruthClassifier() [6/7]

virtual Result MCTruthClassifier::particleTruthClassifier ( const EventContext & ctx,
const xAOD::TruthParticle * thePart ) const
inlinefinaloverrideprotectedvirtual

Implements IMCTruthClassifier.

Reimplemented in D3PD::D3PDMCTruthClassifier.

Definition at line 155 of file MCTruthClassifier.h.

155 {
156 using namespace MCTruthPartClassifier;
157 if (!thePart) {
158 return {Unknown, NonDefined, nullptr, UnknownOutCome};
159 }
160
161 // retrieve collection and get a pointer
162 SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainerReadHandle(m_truthParticleContainerKey, ctx);
163 if (!truthParticleContainerReadHandle.isValid()) {
164 ATH_MSG_WARNING(" Invalid ReadHandle for xAOD::TruthParticleContainer with key: " << truthParticleContainerReadHandle.key());
165 return {Unknown, NonDefined, thePart, UnknownOutCome};
166 }
167
169 const auto [type, origin] = classifyTruthParticle(*truthParticleContainerReadHandle, thePart, outCome);
170 return {type, origin, thePart, outCome};
171 }
struct TBPatternUnitContext Unknown
std::pair< ParticleType, ParticleOrigin > classifyTruthParticle(const xAOD::TruthParticleContainer &truthParticleContainer, const xAOD::TruthParticle *const thePart, ParticleOutCome &outCome)
Classify thePart (not nullptr), using truthParticleContainer to look up its ancestors.

◆ particleTruthClassifier() [7/7]

template<typename T>
std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > IMCTruthClassifier::particleTruthClassifier ( const T * p,
std::optional< std::reference_wrapper< const EventContext > > ctx = std::nullopt ) const
inline

Definition at line 69 of file IMCTruthClassifier.h.

70 {
72 return {std::get<0>(r), std::get<1>(r)};
73 }
std::tuple< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin, const xAOD::TruthParticle *, MCTruthPartClassifier::ParticleOutCome > Result
Result particleTruthClassifier_full(const T *p, std::optional< std::reference_wrapper< const EventContext > > ctx=std::nullopt) const
Returns more info than the particleTruthClassifier.
int r
Definition globals.cxx:22

◆ particleTruthClassifier_full()

template<typename T>
Result IMCTruthClassifier::particleTruthClassifier_full ( const T * p,
std::optional< std::reference_wrapper< const EventContext > > ctx = std::nullopt ) const
inlineinherited

Returns more info than the particleTruthClassifier.

Definition at line 64 of file IMCTruthClassifier.h.

64 {
65 return particleTruthClassifier(ctx ? ctx->get() : Gaudi::Hive::currentContext(), p);
66 }
virtual Result particleTruthClassifier(const EventContext &ctx, const xAOD::TruthParticle *) const =0

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

Print the state of the tool.

Implements asg::IAsgTool.

Reimplemented in AsgHelloTool, HI::HIPileupTool, JetFromPseudojet, JetPileupLabelingTool, JetPseudojetRetriever, JetSubStructureMomentToolsBase, JetTruthLabelingTool, and KtDeltaRTool.

Definition at line 131 of file AsgTool.cxx.

131 {
132
133 ATH_MSG_INFO( "AsgTool " << name() << " @ " << this );
134 return;
135 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloExtensionTool

ToolHandle<Trk::IParticleCaloExtensionTool> MCTruthClassifier::m_caloExtensionTool {this,"ParticleCaloExtensionTool",""}
private

Extrapolates truth particles to the calorimeter (egammaClusMatch); optional, disabled if empty.

Definition at line 215 of file MCTruthClassifier.h.

215{this,"ParticleCaloExtensionTool",""};

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> MCTruthClassifier::m_caloMgrKey {this,"CaloDetDescrManager",""}
private

Calorimeter detector description, needed together with the extension tool; optional, may be empty.

Definition at line 217 of file MCTruthClassifier.h.

217{this,"CaloDetDescrManager",""};

◆ m_deltaPhiMatchCut

float MCTruthClassifier::m_deltaPhiMatchCut
private

max delta phi track - truth particle if the track has at most NumOfSiHitsCut Si hits

Definition at line 247 of file MCTruthClassifier.h.

◆ m_deltaRMatchCut

float MCTruthClassifier::m_deltaRMatchCut
private

max dR track - truth particle if the track has more than NumOfSiHitsCut Si hits

Definition at line 246 of file MCTruthClassifier.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_FwdElectronTruthExtrEtaCut

float MCTruthClassifier::m_FwdElectronTruthExtrEtaCut
private

forward electrons: truth particles with |eta| below this are not extrapolated

Definition at line 225 of file MCTruthClassifier.h.

◆ m_FwdElectronTruthExtrEtaWindowCut

float MCTruthClassifier::m_FwdElectronTruthExtrEtaWindowCut
private

forward electrons: max |delta eta| to the cluster for a truth particle to be extrapolated

Definition at line 226 of file MCTruthClassifier.h.

◆ m_FwdElectronUseG4Sel

bool MCTruthClassifier::m_FwdElectronUseG4Sel
private

skip Geant4 particles also for forward electrons

Definition at line 224 of file MCTruthClassifier.h.

◆ m_fwrdEledRtoTrCut

float MCTruthClassifier::m_fwrdEledRtoTrCut
private

max dR cluster - extrapolated truth particle (forward electrons)

Definition at line 232 of file MCTruthClassifier.h.

◆ m_inclG4part

bool MCTruthClassifier::m_inclG4part
private

also try Geant4 particles if no generator particle matched

Definition at line 237 of file MCTruthClassifier.h.

◆ m_NumOfSiHitsCut

int MCTruthClassifier::m_NumOfSiHitsCut
private

Si (pixel + SCT) hit count selecting between deltaRMatchCut and deltaPhiMatchCut.

Definition at line 248 of file MCTruthClassifier.h.

◆ m_partExtrConeEta

float MCTruthClassifier::m_partExtrConeEta
private

eta half-width of the cone in which truth particles are extrapolated

Definition at line 227 of file MCTruthClassifier.h.

◆ m_partExtrConePhi

float MCTruthClassifier::m_partExtrConePhi
private

phi half-width of the cone in which truth particles are extrapolated

Definition at line 228 of file MCTruthClassifier.h.

◆ m_phtClasConeEta

float MCTruthClassifier::m_phtClasConeEta
private

eta half-width of the narrow cone around the cluster (not forward electrons)

Definition at line 230 of file MCTruthClassifier.h.

◆ m_phtClasConePhi

float MCTruthClassifier::m_phtClasConePhi
private

phi half-width of the narrow cone around the cluster (not forward electrons)

Definition at line 229 of file MCTruthClassifier.h.

◆ m_phtdRtoTrCut

float MCTruthClassifier::m_phtdRtoTrCut
private

max dR cluster - extrapolated truth particle (not forward electrons)

Definition at line 231 of file MCTruthClassifier.h.

◆ m_pTChargePartCut

float MCTruthClassifier::m_pTChargePartCut
private

minimum pT of charged truth particles considered

Definition at line 235 of file MCTruthClassifier.h.

◆ m_pTNeutralPartCut

float MCTruthClassifier::m_pTNeutralPartCut
private

minimum pT of neutral truth particles considered

Definition at line 236 of file MCTruthClassifier.h.

◆ m_ROICone

bool MCTruthClassifier::m_ROICone
private

only extrapolate truth particles inside the partExtrCone ellipse

Definition at line 233 of file MCTruthClassifier.h.

◆ m_truthInConeTool

ToolHandle<xAOD::ITruthParticlesInConeTool> MCTruthClassifier::m_truthInConeTool {this,"TruthInConeTool","xAOD::TruthParticlesInConeTool/TruthParticlesInConeTool"}
private

Finds the truth particles in a cone around a cluster (egammaClusMatch); optional, disabled if empty.

Definition at line 220 of file MCTruthClassifier.h.

220{this,"TruthInConeTool","xAOD::TruthParticlesInConeTool/TruthParticlesInConeTool"};

◆ m_truthLinkVecReadHandleKey

SG::ReadHandleKey<xAODTruthParticleLinkVector> MCTruthClassifier::m_truthLinkVecReadHandleKey {this,"xAODTruthLinkVector","xAODTruthLinks", "ReadHandleKey for xAODTruthParticleLinkVector"}
private

Definition at line 242 of file MCTruthClassifier.h.

242{this,"xAODTruthLinkVector","xAODTruthLinks", "ReadHandleKey for xAODTruthParticleLinkVector"};

◆ m_truthParticleContainerKey

SG::ReadHandleKey<xAOD::TruthParticleContainer> MCTruthClassifier::m_truthParticleContainerKey {this,"xAODTruthParticleContainerName","TruthParticles","ReadHandleKey for xAOD::TruthParticleContainer"}
private

Key of the xAOD truth particle container that is searched when classifying (ancestors, decay products, ...).

Definition at line 211 of file MCTruthClassifier.h.

211{this,"xAODTruthParticleContainerName","TruthParticles","ReadHandleKey for xAOD::TruthParticleContainer"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: