ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkVertexFitter
TrkVertexSeedFinderTools
src
TrackDensitySeedFinder.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
TrackDensitySeedFinder.cxx - Description in header file
7
*********************************************************************/
8
9
#include "
TrkVertexSeedFinderTools/TrackDensitySeedFinder.h
"
10
11
#include "
TrkVertexSeedFinderUtils/SeedFinderParamDefs.h
"
12
13
#include "
TrkParameters/TrackParameters.h
"
14
#include "
TrkTrack/Track.h
"
15
#include "
TrkEventPrimitives/ParamDefs.h
"
16
17
//Amg
18
#include "
GeoPrimitives/GeoPrimitives.h
"
19
20
#include <algorithm>
21
22
namespace
Trk
23
{
24
25
TrackDensitySeedFinder::TrackDensitySeedFinder
(
const
std::string& t,
const
std::string& n,
const
IInterface* p) :
26
base_class(t,n,p)
27
{
28
}
29
30
31
TrackDensitySeedFinder::~TrackDensitySeedFinder
()
32
=
default
;
33
34
35
StatusCode
TrackDensitySeedFinder::initialize
()
36
{
37
ATH_CHECK
(
m_densityEstimator
.retrieve() );
38
ATH_MSG_DEBUG
(
"Initialize successful"
);
39
return
StatusCode::SUCCESS;
40
}
41
42
StatusCode
TrackDensitySeedFinder::finalize
()
43
{
44
ATH_MSG_DEBUG
(
"Finalize successful"
);
45
return
StatusCode::SUCCESS;
46
}
47
48
Amg::Vector3D
TrackDensitySeedFinder::findSeed
(
const
std::vector<const Trk::Track*> & VectorTrk,
49
const
xAOD::Vertex
* constraint)
const
50
{
51
52
//create perigees from track list
53
std::vector<const TrackParameters*> perigeeList;
54
55
std::vector<const Trk::Track*>::const_iterator begin=VectorTrk.begin();
56
std::vector<const Trk::Track*>::const_iterator end=VectorTrk.end();
57
58
for
(std::vector<const Trk::Track*>::const_iterator iter=begin;
59
iter!=end;++iter)
60
{
61
perigeeList.push_back((*iter)->perigeeParameters());
62
}
63
64
//create seed from perigee list
65
return
findSeed
(perigeeList,constraint);
66
}
67
68
Amg::Vector3D
TrackDensitySeedFinder::findSeed
(
const
std::vector<const Trk::TrackParameters*> & perigeeList,
69
const
xAOD::Vertex
* constraint)
const
70
{
71
double
zResult {0.};
72
if
( !perigeeList.empty() )
73
{
74
zResult =
m_densityEstimator
->globalMaximum (perigeeList);
75
ATH_MSG_DEBUG
(
"Highest density Z position found: "
<< zResult);
76
}
77
else
78
{
79
ATH_MSG_DEBUG
(
"No tracks with sufficient weight; return z position = 0"
);
80
}
81
82
if
(constraint)
83
{
84
return
Amg::Vector3D
(constraint->
position
().x(), constraint->
position
().y(), zResult + constraint->
position
().z());
85
}
86
else
87
{
88
return
Amg::Vector3D
(0.,0.,zResult);
89
}
90
}
91
92
// testing find seed with width
93
std::pair<Amg::Vector3D,Amg::MatrixX>
TrackDensitySeedFinder::findAnalyticSeed
(
const
std::vector<const Trk::TrackParameters*>& perigeeList,
const
xAOD::Vertex
* constraint )
const
{
94
std::pair<double,double> zResult {0.,0.};
95
if
( !perigeeList.empty() )
96
{
97
zResult =
m_densityEstimator
->globalMaximumWithWidth (perigeeList);
98
ATH_MSG_DEBUG
(
"Highest density Z position found: "
<< zResult.first <<
"with width: "
<< zResult.second);
99
}
100
else
101
{
102
ATH_MSG_DEBUG
(
"No tracks with sufficient weight; return z position = 0"
);
103
}
104
105
if
(constraint)
106
{
107
Amg::Vector3D
positionVector =
Amg::Vector3D
(constraint->
position
().x(), constraint->
position
().y(), zResult.first + constraint->
position
().z());
108
Amg::MatrixX
covarianceMatrix = constraint->covariancePosition() ;
109
110
ATH_MSG_DEBUG
(
"The vertex seed width is "
<< zResult.second);
111
112
// if no seed is found, we get a NaN here.
113
// This should not propagate through the vertex fit.
114
// The upstream code aborts if position[z] == 0, which we need to ensure.
115
// In this case, the cov matrix will not be used.
116
if
(std::isnan(zResult.second)){
117
positionVector[2] = 0.;
118
}
119
else
covarianceMatrix.fillSymmetric(2,2,std::pow(zResult.second,2.));
120
121
return
std::make_pair(positionVector,covarianceMatrix) ;
122
}
123
else
124
{
125
Amg::Vector3D
positionVector =
Amg::Vector3D
(0.,0.,zResult.first);
126
Amg::MatrixX
covarianceMatrix;
127
for
(
const
auto
i : {0,1,2} ){
128
for
(
const
auto
j : {0,1,2}){
129
covarianceMatrix(i,j)=0;
130
}
131
}
132
return
{positionVector,covarianceMatrix};
133
}
134
}
135
136
std::vector<Amg::Vector3D>
TrackDensitySeedFinder::findMultiSeeds
(
const
std::vector<const Trk::Track*>&
/* vectorTrk */
,
137
const
xAOD::Vertex
*
/* constraint */
)
const
138
{
139
//implemented to satisfy inheritance but this algorithm only supports one seed at a time
140
ATH_MSG_WARNING
(
"Multi-seeding requested but seed finder not able to operate in that mode, returning no seeds"
);
141
return
std::vector<Amg::Vector3D>(0);
142
}
143
144
std::vector<Amg::Vector3D>
TrackDensitySeedFinder::findMultiSeeds
(
const
std::vector<const Trk::TrackParameters*>&
/* perigeeList */
,
145
const
xAOD::Vertex
*
/* constraint */
)
const
146
{
147
//implemented to satisfy inheritance but this algorithm only supports one seed at a time
148
ATH_MSG_WARNING
(
"Multi-seeding requested but seed finder not able to operate in that mode, returning no seeds"
);
149
return
std::vector<Amg::Vector3D>(0);
150
}
151
152
153
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GeoPrimitives.h
ParamDefs.h
SeedFinderParamDefs.h
TrackDensitySeedFinder.h
TrackParameters.h
Track.h
Trk::TrackDensitySeedFinder::~TrackDensitySeedFinder
virtual ~TrackDensitySeedFinder()
Trk::TrackDensitySeedFinder::m_densityEstimator
ToolHandle< IVertexTrackDensityEstimator > m_densityEstimator
Definition
TrackDensitySeedFinder.h:92
Trk::TrackDensitySeedFinder::findMultiSeeds
virtual std::vector< Amg::Vector3D > findMultiSeeds(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds full vector of linearization points from a vector of tracks and returns it as an Amg::Vector3D ...
Definition
TrackDensitySeedFinder.cxx:136
Trk::TrackDensitySeedFinder::TrackDensitySeedFinder
TrackDensitySeedFinder(const std::string &t, const std::string &n, const IInterface *p)
Definition
TrackDensitySeedFinder.cxx:25
Trk::TrackDensitySeedFinder::findAnalyticSeed
virtual std::pair< Amg::Vector3D, Amg::MatrixX > findAnalyticSeed(const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint=0) const override final
Definition
TrackDensitySeedFinder.cxx:93
Trk::TrackDensitySeedFinder::initialize
virtual StatusCode initialize() override
Definition
TrackDensitySeedFinder.cxx:35
Trk::TrackDensitySeedFinder::finalize
virtual StatusCode finalize() override
Definition
TrackDensitySeedFinder.cxx:42
Trk::TrackDensitySeedFinder::findSeed
virtual Amg::Vector3D findSeed(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object.
Definition
TrackDensitySeedFinder.cxx:48
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
Definition
Vertex_v1.cxx:106
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition
EventPrimitives.h:27
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
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