ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkVertexFitter
TrkVertexFitters
src
DummyVertexSmoother.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/*********************************************************************
6
DummyVertexSmoother.cxx - Description in header file
7
*********************************************************************/
8
9
#include "
TrkVertexFitters/DummyVertexSmoother.h
"
10
#include "
TrkExInterfaces/IExtrapolator.h
"
11
#include "
VxVertex/LinearizedTrack.h
"
12
#include "
TrkSurfaces/PerigeeSurface.h
"
13
#include "
VxVertex/VxTrackAtVertex.h
"
14
15
namespace
Trk
16
{
17
18
DummyVertexSmoother::DummyVertexSmoother
(
const
std::string& t,
const
std::string& n,
const
IInterface* p) :
19
AthAlgTool
(t,n,p),
m_extrapolator
(nullptr),
m_extrapolatorName
(
"Trk::Extrapolator"
),
m_extrapolatorInstance
(
"InDetExtrapolator"
)
20
{
21
declareProperty
(
"ExtrapolatorName"
,
m_extrapolatorName
);
22
declareProperty
(
"ExtrapolatorInstance"
,
m_extrapolatorInstance
);
23
declareInterface<IVertexSmoother>(
this
);
24
}
25
26
DummyVertexSmoother::~DummyVertexSmoother
() =
default
;
27
28
StatusCode
DummyVertexSmoother::initialize
()
29
{
30
StatusCode
sc
= AlgTool::initialize();
31
sc
= toolSvc()->retrieveTool(
m_extrapolatorName
,
m_extrapolatorInstance
,
m_extrapolator
);
32
if
(
sc
.isFailure())
33
{
34
msg
(MSG::FATAL)<<
"Could not find extrapolator tool."
<<
endmsg
;
35
return
sc
;
36
}
37
msg
(MSG::INFO) <<
"Initialize successful"
<<
endmsg
;
38
return
StatusCode::SUCCESS;
39
}
40
41
StatusCode
DummyVertexSmoother::finalize
()
42
{
43
msg
(MSG::INFO) <<
"Initialize successful"
<<
endmsg
;
44
return
StatusCode::SUCCESS;
45
}
46
47
// Had to make the vtx non-const because xAOD::Vertex stores
48
// Trk::VxTrackAtVertex and not Trk::VxTrackAtVertex*
49
void
DummyVertexSmoother::smooth
(
xAOD::Vertex
& vtx)
const
50
{
51
52
//vector of associated tracks at vertex:
53
if
( vtx.
vxTrackAtVertexAvailable
() )
//TODO: is this the right thing to check?
54
{
55
std::vector<Trk::VxTrackAtVertex> & tracks = vtx.
vxTrackAtVertex
();
56
57
if
(!tracks.empty())
58
{
59
//iteratively updating private members of VxTrackAtVertex
60
std::vector<Trk::VxTrackAtVertex>::iterator t_it = tracks.begin();
61
std::vector<Trk::VxTrackAtVertex>::iterator te = tracks.end();
62
for
( ;t_it != te;++t_it)
63
{
64
65
//TODO: There were previously null pointer checks on both the contents and vector itself
66
// of std::vector<Trk::VxTrackAtVertex*>* in VxCandidate
67
// but now in xAOD::Vertex, there is only a std::vector<Trk::VxTrackAtVertex> so
68
// pointer checks are not possible
69
//
70
// -David S.
71
72
//now the extrapolation will happen anyway, creating the surface
73
PerigeeSurface
perigeeSurface(vtx.
position
());
74
const
Trk::TrackParameters
* initPar = (*t_it).initialPerigee();
75
76
if
(initPar !=
nullptr
)
77
{
78
//Either we should return non-const parameters from the extrapolator
79
//as the owner here has to delete them
80
//Or we need to clone
81
auto
extrapolatedPerigee =
82
std::unique_ptr<const Trk::TrackParameters>(
m_extrapolator
->extrapolate(Gaudi::Hive::currentContext(),
83
*initPar,
84
perigeeSurface));
85
if
(extrapolatedPerigee !=
nullptr
) {
86
(*t_it).setPerigeeAtVertex(extrapolatedPerigee->clone());
87
}
else
{
88
msg
(MSG::ERROR) <<
" Extrapolation failed; VxTrackAtertex will not be updated"
<<
endmsg
;
89
}
// end of successfull extrapolation check
90
}
else
{
91
msg
(MSG::WARNING) <<
" The VxTrackAtVertex passed has no initial Parameters? This track will not be refitted"
<<
endmsg
;
92
}
//end of initial parameters protection check
93
94
}
//end of loop over all fitted tracks
95
}
else
{
96
msg
(MSG::ERROR) <<
"xAOD::Vertex with empty vector of tracks is passed to the Vertex Smoother"
<<
endmsg
;
97
msg
(MSG::ERROR) <<
"No action taken; Input xAOD::Vertex stays unchanged "
<<
endmsg
;
98
}
//end of empty vector check
99
100
}
else
{
101
msg
(MSG::ERROR) <<
"Vertex to be smoothed has no vxTrackAtVertices available!"
<<
endmsg
;
102
msg
(MSG::ERROR) <<
"No action taken; Initial xAOD::Vertex returned."
<<
endmsg
;
103
}
//end of protection check whether vxTrackAtVertices are attached to the object
104
}
//end of smooth method
105
106
}
//end of namespace definitions
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
DummyVertexSmoother.h
IExtrapolator.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LinearizedTrack.h
PerigeeSurface.h
VxTrackAtVertex.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
Trk::DummyVertexSmoother::initialize
StatusCode initialize()
Athena default methods.
Definition
DummyVertexSmoother.cxx:28
Trk::DummyVertexSmoother::m_extrapolatorName
std::string m_extrapolatorName
Definition
DummyVertexSmoother.h:67
Trk::DummyVertexSmoother::m_extrapolatorInstance
std::string m_extrapolatorInstance
Definition
DummyVertexSmoother.h:68
Trk::DummyVertexSmoother::~DummyVertexSmoother
~DummyVertexSmoother()
Trk::DummyVertexSmoother::smooth
void smooth(xAOD::Vertex &vtx) const
Actual smooth method.
Definition
DummyVertexSmoother.cxx:49
Trk::DummyVertexSmoother::finalize
StatusCode finalize()
Definition
DummyVertexSmoother.cxx:41
Trk::DummyVertexSmoother::m_extrapolator
Trk::IExtrapolator * m_extrapolator
Definition
DummyVertexSmoother.h:66
Trk::DummyVertexSmoother::DummyVertexSmoother
DummyVertexSmoother(const std::string &t, const std::string &n, const IInterface *p)
Constructor and destructor.
Definition
DummyVertexSmoother.cxx:18
Trk::PerigeeSurface
Class describing the Line to which the Perigee refers to.
Definition
PerigeeSurface.h:43
xAOD::Vertex_v1::vxTrackAtVertexAvailable
bool vxTrackAtVertexAvailable() const
Check if VxTrackAtVertices are attached to the object.
Definition
Vertex_v1.cxx:231
xAOD::Vertex_v1::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Definition
Vertex_v1.cxx:203
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
Definition
Vertex_v1.cxx:106
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::TrackParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:27
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0