ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkTau
src
TauTruthMatchingWrapper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// TauTruthMatchingWrapper.cxx
7
// Author: Evelina Bouhova-Thacker (e.bouhova@cern.ch)
9
10
#include "
DerivationFrameworkTau/TauTruthMatchingWrapper.h
"
11
#include "
StoreGate/ReadHandle.h
"
12
#include "
StoreGate/WriteDecorHandle.h
"
13
#include "
TauAnalysisTools/HelperFunctions.h
"
14
15
namespace
DerivationFramework
{
16
17
StatusCode
TauTruthMatchingWrapper::initialize
()
18
{
19
ATH_CHECK
(
m_tauKey
.initialize());
20
ATH_CHECK
(
m_isTruthMatchedKey
.initialize());
21
ATH_CHECK
(
m_truthJetLinkKey
.initialize());
22
ATH_CHECK
(
m_truthParticleLinkKey
.initialize());
23
ATH_CHECK
(
m_tauOriginKey
.initialize());
24
CHECK
(
m_tTauTruthMatchingTool
.retrieve() );
25
return
StatusCode::SUCCESS;
26
}
27
28
29
StatusCode
TauTruthMatchingWrapper::addBranches
(
const
EventContext& ctx)
const
30
{
31
// Event context
32
33
// Read handle
34
SG::ReadHandle<xAOD::TauJetContainer>
xTauContainer(
m_tauKey
,ctx);
35
if
(!xTauContainer.
isValid
()) {
36
ATH_MSG_ERROR
(
"Couldn't retrieve TauJetContainer with name "
<<
m_tauKey
);
37
return
StatusCode::FAILURE;
38
}
39
40
// Loop over taus
41
std::unique_ptr<TauAnalysisTools::ITauTruthMatchingTool::ITruthTausEvent>
42
truthTausEvent =
m_tTauTruthMatchingTool
->getEvent();
43
SG::WriteDecorHandle<xAOD::TauJetContainer, int>
dec_tauOrigin(
m_tauOriginKey
, ctx);
44
for
(
auto
xTau : *xTauContainer) {
45
m_tTauTruthMatchingTool
->getTruth(*xTau, *truthTausEvent);
46
dec_tauOrigin(*xTau) =
TauAnalysisTools::tauOrigin
(*xTau);
47
}
48
ATH_CHECK
(
m_tTauTruthMatchingTool
->lockDecorations(*xTauContainer) );
49
50
return
StatusCode::SUCCESS;
51
}
52
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
HelperFunctions.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
TauTruthMatchingWrapper.h
DerivationFramework::TauTruthMatchingWrapper::initialize
virtual StatusCode initialize() override final
Definition
TauTruthMatchingWrapper.cxx:17
DerivationFramework::TauTruthMatchingWrapper::m_tauOriginKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_tauOriginKey
Definition
TauTruthMatchingWrapper.h:53
DerivationFramework::TauTruthMatchingWrapper::m_tauKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauKey
Definition
TauTruthMatchingWrapper.h:39
DerivationFramework::TauTruthMatchingWrapper::m_truthParticleLinkKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_truthParticleLinkKey
Definition
TauTruthMatchingWrapper.h:50
DerivationFramework::TauTruthMatchingWrapper::m_isTruthMatchedKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_isTruthMatchedKey
Definition
TauTruthMatchingWrapper.h:44
DerivationFramework::TauTruthMatchingWrapper::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition
TauTruthMatchingWrapper.cxx:29
DerivationFramework::TauTruthMatchingWrapper::m_truthJetLinkKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_truthJetLinkKey
Definition
TauTruthMatchingWrapper.h:47
DerivationFramework::TauTruthMatchingWrapper::m_tTauTruthMatchingTool
ToolHandle< TauAnalysisTools::ITauTruthMatchingTool > m_tTauTruthMatchingTool
Definition
TauTruthMatchingWrapper.h:41
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
TauAnalysisTools::tauOrigin
int tauOrigin(const xAOD::TauJet &xTau)
return truth origin class of the tau: -1 no truth match, 0 no hadron ancestor, 1 b-hadron,...
Definition
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:520
Generated on
for ATLAS Offline Software by
1.17.0