ATLAS Offline Software
TauTruthMatchingWrapper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TauTruthMatchingWrapper.cxx
7 // Author: Evelina Bouhova-Thacker (e.bouhova@cern.ch)
9 
11 #include "StoreGate/ReadHandle.h"
12 
13 namespace DerivationFramework {
14 
16  {
17  ATH_CHECK(m_tauKey.initialize());
18  CHECK( m_tTauTruthMatchingTool.retrieve() );
19  return StatusCode::SUCCESS;
20  }
21 
22 
23  StatusCode TauTruthMatchingWrapper::addBranches(const EventContext& ctx) const
24  {
25  // Event context
26 
27  // Read handle
29  if (!xTauContainer.isValid()) {
30  ATH_MSG_ERROR("Couldn't retrieve TauJetContainer with name " << m_tauKey);
31  return StatusCode::FAILURE;
32  }
33 
34  // Loop over taus
35  std::unique_ptr<TauAnalysisTools::ITauTruthMatchingTool::ITruthTausEvent>
36  truthTausEvent = m_tTauTruthMatchingTool->getEvent();
37  for(auto xTau : *xTauContainer)
38  m_tTauTruthMatchingTool->getTruth(*xTau, *truthTausEvent);
39  ATH_CHECK( m_tTauTruthMatchingTool->lockDecorations(*xTauContainer) );
40 
41  return StatusCode::SUCCESS;
42  }
43 }
DerivationFramework::TauTruthMatchingWrapper::m_tTauTruthMatchingTool
ToolHandle< TauAnalysisTools::ITauTruthMatchingTool > m_tTauTruthMatchingTool
Definition: TauTruthMatchingWrapper.h:40
DerivationFramework::TauTruthMatchingWrapper::initialize
virtual StatusCode initialize() override final
Definition: TauTruthMatchingWrapper.cxx:15
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::TauTruthMatchingWrapper::addBranches
virtual StatusCode addBranches(const EventContext &ctx) const override final
Definition: TauTruthMatchingWrapper.cxx:23
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TauTruthMatchingWrapper.h
DerivationFramework::TauTruthMatchingWrapper::m_tauKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauKey
Definition: TauTruthMatchingWrapper.h:38
ReadHandle.h
Handle class for reading from StoreGate.