ATLAS Offline Software
TauTruthMatchingWrapper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
15  TauTruthMatchingWrapper::TauTruthMatchingWrapper(const std::string& t, const std::string& n, const IInterface* p) :
16  AthAlgTool(t,n,p),
17  m_tauKey("TauJets"),
18  m_tTauTruthMatchingTool("TauAnalysisTools::TauTruthMatchingTool")
19  {
20  declareInterface<DerivationFramework::IAugmentationTool>(this);
21  declareProperty("TauContainerName", m_tauKey);
22  declareProperty("TauTruthMatchingTool", m_tTauTruthMatchingTool);
23  }
24 
26  {
27  ATH_CHECK(m_tauKey.initialize());
28  CHECK( m_tTauTruthMatchingTool.retrieve() );
29  return StatusCode::SUCCESS;
30  }
31 
33  {
34  return StatusCode::SUCCESS;
35  }
36 
38  {
39  // Event context
40  const EventContext& ctx = Gaudi::Hive::currentContext();
41 
42  // Read handle
44  if (!xTauContainer.isValid()) {
45  ATH_MSG_ERROR("Couldn't retrieve TauJetContainer with name " << m_tauKey);
46  return StatusCode::FAILURE;
47  }
48 
49  // Loop over taus
50  std::unique_ptr<TauAnalysisTools::ITauTruthMatchingTool::ITruthTausEvent>
51  truthTausEvent = m_tTauTruthMatchingTool->getEvent();
52  for(auto xTau : *xTauContainer)
53  m_tTauTruthMatchingTool->getTruth(*xTau, *truthTausEvent);
54  ATH_CHECK( m_tTauTruthMatchingTool->lockDecorations(*xTauContainer) );
55 
56  return StatusCode::SUCCESS;
57  }
58 }
DerivationFramework::TauTruthMatchingWrapper::m_tTauTruthMatchingTool
ToolHandle< TauAnalysisTools::ITauTruthMatchingTool > m_tTauTruthMatchingTool
Definition: TauTruthMatchingWrapper.h:41
DerivationFramework::TauTruthMatchingWrapper::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: TauTruthMatchingWrapper.cxx:37
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::TauTruthMatchingWrapper::initialize
StatusCode initialize()
Definition: TauTruthMatchingWrapper.cxx:25
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::TauTruthMatchingWrapper::TauTruthMatchingWrapper
TauTruthMatchingWrapper(const std::string &t, const std::string &n, const IInterface *p)
Definition: TauTruthMatchingWrapper.cxx:15
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?
DerivationFramework::TauTruthMatchingWrapper::finalize
StatusCode finalize()
Definition: TauTruthMatchingWrapper.cxx:32
TauTruthMatchingWrapper.h
DerivationFramework::TauTruthMatchingWrapper::m_tauKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauKey
Definition: TauTruthMatchingWrapper.h:38
ReadHandle.h
Handle class for reading from StoreGate.
AthAlgTool
Definition: AthAlgTool.h:26