ATLAS Offline Software
Loading...
Searching...
No Matches
TrackParticlePerigeeAtPVAssociationTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
10
12
17
18namespace D3PD {
19
27 (const std::string& type,
28 const std::string& name,
29 const IInterface* parent)
30 : Base (type, name, parent),
31 m_resolver ("TrackParticlePerigeeAtPVAssociationTool",
32 evtStore(),
34{
35 declareProperty ("SGKey", m_vxCandidate = "PrimaryVertices,VxPrimaryCandidate");
36}
37
39
40 CHECK( Base::initialize() );
41 CHECK( m_trackToVertexTool.retrieve() );
42
43 return StatusCode::SUCCESS;
44}
45
46
55{
56 m_resolver.initialize<xAOD::VertexContainer>().ignore();
57 const xAOD::VertexContainer* vxContainer = 0;
58 StatusCode sc = evtStore()->retrieve(vxContainer, m_resolver.key());
59 if (sc.isFailure() || !vxContainer) {
60 REPORT_MESSAGE (MSG::WARNING) << "Could not retrieve primary vertex container: " << m_vxCandidate;
61 return 0;
62 }
63
64 if(vxContainer->size()<1){
65 REPORT_MESSAGE (MSG::WARNING) << "No primary vertices reconstructed";
66 return 0;
67 }
68
69 for (const xAOD::Vertex* vx : *vxContainer) {
70 if (vx->vertexType() == xAOD::VxType::PriVtx)
71 return m_trackToVertexTool->perigeeAtVertex(Gaudi::Hive::currentContext(), track, vx->position()).release();
72 }
73
74 REPORT_MESSAGE (MSG::WARNING) << "No primary vertices reconstructed";
75 return 0;
76}
77
78
92
93} // namespace D3PD
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t sc
Associate from a TrackParticle to its perigee at PV.
virtual void releaseObject(const Trk::TrackParameters *p) override
Release an object retrieved from the association.
SingleAssociationTool< Types< xAOD::TrackParticle >, Trk::TrackParameters > Base
TrackParticlePerigeeAtPVAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
virtual const Trk::TrackParameters * get(const xAOD::TrackParticle &p) override
Return the target object.
size_type size() const noexcept
Returns the number of elements in the collection.
Block filler tool for noisy FEB information.
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ PriVtx
Primary vertex.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.