ATLAS Offline Software
TauTruthMatchingWrapper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 "xAODTracking/Vertex.h"
14 #include "StoreGate/ReadHandle.h"
15 
16 namespace DerivationFramework {
17 
18  TauTruthMatchingWrapper::TauTruthMatchingWrapper(const std::string& t, const std::string& n, const IInterface* p) :
19  AthAlgTool(t,n,p),
20  m_tauKey("TauJets"),
21  m_tTauTruthMatchingTool("TauAnalysisTools::TauTruthMatchingTool")
22  {
23  declareInterface<DerivationFramework::IAugmentationTool>(this);
24  declareProperty("TauContainerName", m_tauKey);
25  declareProperty("TauTruthMatchingTool", m_tTauTruthMatchingTool);
26  }
27 
29  {
30  ATH_CHECK(m_tauKey.initialize());
31  CHECK( m_tTauTruthMatchingTool.retrieve() );
32  return StatusCode::SUCCESS;
33  }
34 
36  {
37  return StatusCode::SUCCESS;
38  }
39 
41  {
42  // Event context
43  const EventContext& ctx = Gaudi::Hive::currentContext();
44 
45  // Read handle
47  if (!xTauContainer.isValid()) {
48  ATH_MSG_ERROR("Couldn't retrieve TauJetContainer with name " << m_tauKey);
49  return StatusCode::FAILURE;
50  }
51 
52  // Loop over taus
53  std::unique_ptr<TauAnalysisTools::ITauTruthMatchingTool::ITruthTausEvent>
54  truthTausEvent = m_tTauTruthMatchingTool->getEvent();
55  for(auto xTau : *xTauContainer)
56  m_tTauTruthMatchingTool->getTruth(*xTau, *truthTausEvent);
57 
58  return StatusCode::SUCCESS;
59  }
60 }
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:40
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:28
ITauTruthMatchingTool.h
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:18
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
TauJetContainer.h
Vertex.h
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
DerivationFramework::TauTruthMatchingWrapper::finalize
StatusCode finalize()
Definition: TauTruthMatchingWrapper.cxx:35
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