ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
TrackD3PDMaker
src
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
11
#include "
TrackParticlePerigeeAtPVAssociationTool.h
"
12
13
#include "
TrkParameters/TrackParameters.h
"
14
#include "
xAODTracking/VertexContainer.h
"
15
#include "
AthenaKernel/errorcheck.h
"
16
#include "
VxVertex/PrimaryVertexSelector.h
"
17
18
namespace
D3PD
{
19
26
TrackParticlePerigeeAtPVAssociationTool::TrackParticlePerigeeAtPVAssociationTool
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(),
33
m_vxCandidate
)
34
{
35
declareProperty (
"SGKey"
,
m_vxCandidate
=
"PrimaryVertices,VxPrimaryCandidate"
);
36
}
37
38
StatusCode
TrackParticlePerigeeAtPVAssociationTool::initialize
(){
39
40
CHECK
( Base::initialize() );
41
CHECK
(
m_trackToVertexTool
.retrieve() );
42
43
return
StatusCode::SUCCESS;
44
}
45
46
53
const
Trk::TrackParameters
*
54
TrackParticlePerigeeAtPVAssociationTool::get
(
const
xAOD::TrackParticle
& track)
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
88
void
TrackParticlePerigeeAtPVAssociationTool::releaseObject
(
const
Trk::TrackParameters
* p)
89
{
90
if
(p)
delete
p;
91
}
92
93
}
// namespace D3PD
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:365
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
PrimaryVertexSelector.h
TrackParticlePerigeeAtPVAssociationTool.h
Associate from a TrackParticle to its perigee at PV.
TrackParameters.h
VertexContainer.h
D3PD::TrackParticlePerigeeAtPVAssociationTool::releaseObject
virtual void releaseObject(const Trk::TrackParameters *p) override
Release an object retrieved from the association.
Definition
TrackParticlePerigeeAtPVAssociationTool.cxx:88
D3PD::TrackParticlePerigeeAtPVAssociationTool::m_vxCandidate
std::string m_vxCandidate
Definition
TrackParticlePerigeeAtPVAssociationTool.h:64
D3PD::TrackParticlePerigeeAtPVAssociationTool::Base
SingleAssociationTool< Types< xAOD::TrackParticle >, Trk::TrackParameters > Base
Definition
TrackParticlePerigeeAtPVAssociationTool.h:35
D3PD::TrackParticlePerigeeAtPVAssociationTool::initialize
virtual StatusCode initialize() override
Definition
TrackParticlePerigeeAtPVAssociationTool.cxx:38
D3PD::TrackParticlePerigeeAtPVAssociationTool::m_resolver
SGKeyResolver m_resolver
Definition
TrackParticlePerigeeAtPVAssociationTool.h:71
D3PD::TrackParticlePerigeeAtPVAssociationTool::TrackParticlePerigeeAtPVAssociationTool
TrackParticlePerigeeAtPVAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition
TrackParticlePerigeeAtPVAssociationTool.cxx:27
D3PD::TrackParticlePerigeeAtPVAssociationTool::m_trackToVertexTool
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
Definition
TrackParticlePerigeeAtPVAssociationTool.h:68
D3PD::TrackParticlePerigeeAtPVAssociationTool::get
virtual const Trk::TrackParameters * get(const xAOD::TrackParticle &p) override
Return the target object.
Definition
TrackParticlePerigeeAtPVAssociationTool.cxx:54
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
D3PD
Block filler tool for noisy FEB information.
Definition
CaloCellDetailsFillerTool.cxx:29
Trk::TrackParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:27
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::VertexContainer
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Definition
VertexContainer.h:14
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
type
Generated on
for ATLAS Offline Software by
1.17.0