ATLAS Offline Software
TauTruthMatchingTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TAUANALYSISTOOLS_TAUTRUTHMATCHINGTOOL_H
6 #define TAUANALYSISTOOLS_TAUTRUTHMATCHINGTOOL_H
7 
8 /*
9  author: Dirk Duschinger
10  mail: dirk.duschinger@cern.ch
11  documentation in: ../README.rst
12 */
13 
14 // Local include(s):
17 #include "CxxUtils/CachedValue.h"
18 
19 namespace TauAnalysisTools
20 {
21 
23  : public virtual TauAnalysisTools::BuildTruthTaus
25 {
30 
31 public: // Interface functions
32 
33  TauTruthMatchingTool( const std::string& name );
34 
35  virtual ~TauTruthMatchingTool() = default;
36 
37  // initialize the tool
38  virtual StatusCode initialize() override final;
39 
40  virtual std::unique_ptr<ITruthTausEvent> getEvent() const override final;
41 
42  // get pointer to the truth matched particle, if no truth particle was found a null pointer is returned
43  virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau) override final;
44  virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau,
45  ITruthTausEvent& truthTausEVent) const override final;
46  virtual std::vector<const xAOD::TruthParticle*> getTruth(const std::vector<const xAOD::TauJet*>& vTaus) override final;
47 
48 public: // Wrapper functions
49 
50  // wrapper function to get truth tau visible TLorentzvector
51  virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) override final;
52  virtual TLorentzVector getTruthTauP4Vis(const xAOD::TruthParticle& xTruthTau) const override final;
53 
54  // wrapper function to get truth tau invisible TLorentzvector
55  virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau) override final;
56  virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau) const override final;
57 
58  // get type of truth match particle (hadronic tau, leptonic tau, electron, muon, jet)
60 
61  // wrapper function to count number of decay particles of given pdg id
62  virtual int getNTauDecayParticles(const xAOD::TauJet& xTau, int iPdgId, bool bCompareAbsoluteValues = false) override final;
63  virtual int getNTauDecayParticles(const xAOD::TruthParticle& xTruthTau, int iPdgId, bool bCompareAbsoluteValues = false) const override final;
64 
65  // wrapper function to obtain truth verion of xAOD::TauJetParameters::DecayMode
66  virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet& xTau) override final;
67  virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TruthParticle& xTruthTau) const override final;
68 
74  virtual StatusCode lockDecorations (const xAOD::TauJetContainer& taus) const override final;
75 
76 private: // private helper functions
77 
79  TruthTausEvent& truthTausEvent) const;
80  StatusCode checkTruthMatch (const xAOD::TauJet& xTau, const xAOD::TruthParticleContainer& xTauContainer, const TruthTausEvent& truthTausEvent) const;
81 
82 private: // steering variables
83 
84  double m_dMaxDeltaR;
85 
88 
89 private: // private helper variables
90 
95 
96 }; // class TauTruthMatchingTool
97 
98 }
99 #endif // TAUANALYSISTOOLS_TAUTRUTHMATCHINGTOOL_H
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
TauAnalysisTools::TauTruthMatchingTool::m_accPhiVis
SG::ConstAccessor< double > m_accPhiVis
Definition: TauTruthMatchingTool.h:93
TauAnalysisTools::TauTruthMatchingTool::getTruthTauP4Vis
virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet &xTau) override final
Definition: TauTruthMatchingTool.cxx:121
TauAnalysisTools::TauTruthMatchingTool::getTruthTauP4Invis
virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet &xTau) override final
Definition: TauTruthMatchingTool.cxx:155
TauAnalysisTools::IBuildTruthTaus::ITruthTausEvent
Declare the interface that the class provides.
Definition: IBuildTruthTaus.h:35
ASG_TOOL_CLASS2
#define ASG_TOOL_CLASS2(CLASSNAME, INT1, INT2)
Definition: AsgToolMacros.h:77
TauAnalysisTools::TauTruthMatchingTool::checkTruthMatch
StatusCode checkTruthMatch(const xAOD::TauJet &xTau, const xAOD::TruthParticleContainer &xTauContainer, const TruthTausEvent &truthTausEvent) const
Definition: TauTruthMatchingTool.cxx:329
TauAnalysisTools::TauTruthMatchingTool::getEvent
virtual std::unique_ptr< ITruthTausEvent > getEvent() const override final
Definition: TauTruthMatchingTool.cxx:49
TauAnalysisTools::TauTruthMatchingTool::getTruthParticleType
virtual TauAnalysisTools::TruthMatchedParticleType getTruthParticleType(const xAOD::TauJet &xTau) override final
Definition: TauTruthMatchingTool.cxx:197
SG::ConstAccessor< double >
xAOD::TauJetParameters::DecayMode
DecayMode
Definition: TauDefs.h:385
TauAnalysisTools::BuildTruthTaus
Definition: BuildTruthTaus.h:34
ITauTruthMatchingTool.h
TauAnalysisTools::TauTruthMatchingTool::m_bIsTruthParticleLinkAvailable
CxxUtils::CachedValue< bool > m_bIsTruthParticleLinkAvailable
Definition: TauTruthMatchingTool.h:87
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauAnalysisTools::TauTruthMatchingTool::m_dMaxDeltaR
double m_dMaxDeltaR
Definition: TauTruthMatchingTool.h:84
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
TauAnalysisTools::TauTruthMatchingTool::m_accEtaVis
SG::ConstAccessor< double > m_accEtaVis
Definition: TauTruthMatchingTool.h:92
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
CxxUtils::CachedValue< bool >
TauAnalysisTools::ITauTruthMatchingTool
Definition: ITauTruthMatchingTool.h:34
TauAnalysisTools::TauTruthMatchingTool::findTruthTau
StatusCode findTruthTau(const xAOD::TauJet &xTau, TruthTausEvent &truthTausEvent) const
Definition: TauTruthMatchingTool.cxx:299
TauAnalysisTools::TauTruthMatchingTool
Definition: TauTruthMatchingTool.h:25
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
BuildTruthTaus.h
CachedValue.h
Cached value with atomic update.
TauAnalysisTools::TruthMatchedParticleType
TruthMatchedParticleType
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:95
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TauAnalysisTools::TauTruthMatchingTool::m_accMVis
SG::ConstAccessor< double > m_accMVis
Definition: TauTruthMatchingTool.h:94
TauAnalysisTools::TauTruthMatchingTool::lockDecorations
virtual StatusCode lockDecorations(const xAOD::TauJetContainer &taus) const override final
Decorations produced by an algorithm need to be locked; otherwise, they will be ignored by deep copie...
Definition: TauTruthMatchingTool.cxx:460
TauAnalysisTools::IBuildTruthTaus
Definition: IBuildTruthTaus.h:28
TauAnalysisTools::TauTruthMatchingTool::getDecayMode
virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet &xTau) override final
Definition: TauTruthMatchingTool.cxx:244
TauAnalysisTools::TauTruthMatchingTool::initialize
virtual StatusCode initialize() override final
Definition: TauTruthMatchingTool.cxx:33
TauAnalysisTools::TauTruthMatchingTool::getTruth
virtual const xAOD::TruthParticle * getTruth(const xAOD::TauJet &xTau) override final
Definition: TauTruthMatchingTool.cxx:59
TauAnalysisTools::TauTruthMatchingTool::m_bIsTruthMatchedAvailable
CxxUtils::CachedValue< bool > m_bIsTruthMatchedAvailable
Definition: TauTruthMatchingTool.h:86
TauAnalysisTools::TauTruthMatchingTool::getNTauDecayParticles
virtual int getNTauDecayParticles(const xAOD::TauJet &xTau, int iPdgId, bool bCompareAbsoluteValues=false) override final
Definition: TauTruthMatchingTool.cxx:203
TauAnalysisTools::TauTruthMatchingTool::m_accPtVis
SG::ConstAccessor< double > m_accPtVis
Definition: TauTruthMatchingTool.h:91