ATLAS Offline Software
TVAAugmentationTool.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #include "TVAAugmentationTool.h"
8 
9 namespace DerivationFramework {
10 
12  const std::string& t,
13  const std::string& n,
14  const IInterface* p):
15  AthAlgTool(t, n, p)
16  {
17  declareInterface<IAugmentationTool>(this);
18  declareProperty("LinkName", m_linkName, "The name of the output links");
19  declareProperty("TrackName", m_trackName="InDetTrackParticles");
20  declareProperty("VertexName", m_vertexName="PrimaryVertices");
21  declareProperty("TVATool", m_tool);
22  }
23 
25  {
26  ATH_MSG_INFO("Initialising TVAAugmentationTool " << name() );
27  ATH_CHECK( m_tool.retrieve() );
28 
31 
32  return StatusCode::SUCCESS;
33  }
34 
36  {
37 
39 
40  const xAOD::VertexContainer* vertices = nullptr;
41  ATH_CHECK(evtStore()->retrieve(vertices, m_vertexName) );
42  const xAOD::TrackParticleContainer* tracks = nullptr;
43  ATH_CHECK(evtStore()->retrieve(tracks, m_trackName) );
44 
45  xAOD::TrackVertexAssociationMap matchMap = m_tool->getMatchMap(*tracks, *vertices);
46 
47  for (const xAOD::Vertex* ivtx : *vertices)
48  for (const xAOD::TrackParticle* itrk : matchMap[ivtx])
49  vtxDec_handle(*itrk).toContainedElement(*vertices, ivtx);
50 
51  return StatusCode::SUCCESS;
52  }
53 } //> end namespace DerivationFramework
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DerivationFramework::TVAAugmentationTool::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: TVAAugmentationTool.cxx:35
DerivationFramework::TVAAugmentationTool::m_vertexName
std::string m_vertexName
Definition: TVAAugmentationTool.h:28
DerivationFramework::TVAAugmentationTool::m_tool
ToolHandle< CP::ITrackVertexAssociationTool > m_tool
Definition: TVAAugmentationTool.h:29
xAOD::TrackVertexAssociationMap
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
Definition: TrackVertexAssociationMap.h:19
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::TVAAugmentationTool::m_linkName
std::string m_linkName
Definition: TVAAugmentationTool.h:26
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
DerivationFramework::TVAAugmentationTool::initialize
virtual StatusCode initialize()
Definition: TVAAugmentationTool.cxx:24
DerivationFramework::TVAAugmentationTool::TVAAugmentationTool
TVAAugmentationTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: TVAAugmentationTool.cxx:11
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DerivationFramework::TVAAugmentationTool::m_vtxDec_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_vtxDec_key
Definition: TVAAugmentationTool.h:32
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
TVAAugmentationTool.h
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
AthAlgTool
Definition: AthAlgTool.h:26
TrackParticleContainer.h
DerivationFramework::TVAAugmentationTool::m_trackName
std::string m_trackName
Definition: TVAAugmentationTool.h:27