5#ifndef MCTRUTHCLASSIFIER_MCTRUTHCLASSIFIER_H
6#define MCTRUTHCLASSIFIER_MCTRUTHCLASSIFIER_H
30#include "GaudiKernel/ToolHandle.h"
45#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
62#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
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");
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");
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)");
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)");
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");
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");
92 "Maximum distance dR between the cluster and the extrapolated truth particle for "
93 "a match (not forward electrons)");
95 "Maximum distance dR between the cluster and the extrapolated truth particle for "
96 "a match (forward electrons)");
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");
103 "Minimum pT in GeV of the charged truth particles considered for the cluster matching");
105 "Minimum pT in GeV of the neutral truth particles considered for the cluster matching");
107 "If no generator particle was matched to the cluster (not forward electrons), "
108 "also try stable Geant4 particles without a decay vertex");
110#ifndef GENERATIONBASE
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");
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");
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");
134#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
149 return StatusCode::SUCCESS;
163 if (!truthParticleContainerReadHandle.
isValid()) {
164 ATH_MSG_WARNING(
" Invalid ReadHandle for xAOD::TruthParticleContainer with key: " << truthParticleContainerReadHandle.
key());
170 return {
type, origin, thePart, outCome};
174#ifndef GENERATIONBASE
197#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
213#if !defined(XAOD_ANALYSIS) && !defined(GENERATIONBASE)
219 ToolHandle<xAOD::ITruthParticlesInConeTool>
220 m_truthInConeTool{
this,
"TruthInConeTool",
"xAOD::TruthParticlesInConeTool/TruthParticlesInConeTool"};
244#ifndef GENERATIONBASE
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
Definition of CaloDetDescrManager.
ATLAS-specific HepMC functions.
struct TBPatternUnitContext Unknown
Wrapper to avoid constant divisions when using units.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
This class provides the client interface for accessing the detector description information common to...
virtual Result particleTruthClassifier(const EventContext &ctx, const xAOD::TruthParticle *) const =0
std::tuple< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin, const xAOD::TruthParticle *, MCTruthPartClassifier::ParticleOutCome > Result
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
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
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthLinkVecReadHandleKey
const xAOD::TruthParticle * getGenPart(const xAOD::TrackParticle *) const
float m_phtdRtoTrCut
max dR cluster - extrapolated truth particle (not forward electrons)
ToolHandle< xAOD::ITruthParticlesInConeTool > m_truthInConeTool
Finds the truth particles in a cone around a cluster (egammaClusMatch); optional, disabled if empty.
float m_phtClasConeEta
eta half-width of the narrow cone around the cluster (not forward electrons)
virtual Result particleTruthClassifier(const EventContext &ctx, const xAOD::Muon *) const override final
float m_partExtrConeEta
eta half-width of the cone in which truth particles are extrapolated
virtual Result particleTruthClassifier(const EventContext &ctx, const xAOD::CaloCluster *) const override final
float m_deltaPhiMatchCut
max delta phi track - truth particle if the track has at most NumOfSiHitsCut Si hits
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
float m_deltaRMatchCut
max dR track - truth particle if the track has more than NumOfSiHitsCut Si hits
virtual ~MCTruthClassifier()=default
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
MCTruthClassifier(const std::string &type)
virtual Result particleTruthClassifier(const EventContext &ctx, const xAOD::TruthParticle *thePart) const override final
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtensionTool
Extrapolates truth particles to the calorimeter (egammaClusMatch); optional, disabled if empty.
float m_fwrdEledRtoTrCut
max dR cluster - extrapolated truth particle (forward electrons)
float m_pTChargePartCut
minimum pT of charged truth particles considered
const xAOD::TruthParticle * egammaClusMatch(const EventContext &ctx, const xAOD::CaloCluster *, bool isFwrdEle) const
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
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
Key of the xAOD truth particle container that is searched when classifying (ancestors,...
bool m_inclG4part
also try Geant4 particles if no generator particle matched
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
ParticleOutCome
Outcome of a (simulated) truth particle: what happened to it after being produced,...
@ 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).
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.
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".