ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEvent
VxJetVertex
src
RecVertexPositions.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/***************************************************************************
6
RecVertexPositions.cxx - Description
7
-------------------
8
begin : Autumn 2006
9
authors : Giacinto Piacquadio (Freiburg University)
10
email : Giacinto.Piacquadio@physik.uni-freiburg.de
11
comments:
12
changes :
13
14
***************************************************************************/
15
16
#include "
VxJetVertex/RecVertexPositions.h
"
17
#include "GaudiKernel/MsgStream.h"
18
#include <iostream>
19
#include <sstream>
20
#include <cmath>
21
22
namespace
Trk
{
23
24
RecVertexPositions::RecVertexPositions
() :
25
VertexPositions
(),
26
m_positionError
(
Amg
::MatrixX())
27
{
m_positionError
.setZero();}
28
29
30
RecVertexPositions::RecVertexPositions
(
const
VertexPositions
& pos) :
31
VertexPositions
(pos),
32
m_positionError
(
Amg
::MatrixX())
33
{
m_positionError
.setZero();}
34
35
36
RecVertexPositions::RecVertexPositions
(
const
Amg::VectorX
&pos,
const
Amg::MatrixX
&cov,
37
const
double
ndf,
const
double
chi2
,
38
bool
isWeightTimesPosition) :
39
VertexPositions
(pos),
m_positionError
(cov),
m_fitQuality
(
Trk
::
FitQuality
(
chi2
,ndf)) {
40
m_useWeightTimesPosition
=isWeightTimesPosition;
41
}
42
43
44
RecVertexPositions::RecVertexPositions
(
const
Amg::VectorX
&pos,
const
double
ndf,
const
double
chi2
) :
45
VertexPositions
(pos),
46
m_positionError
(
Amg
::MatrixX()),
47
m_fitQuality
(
Trk
::
FitQuality
(
chi2
,ndf)) {
m_positionError
.setZero();}
48
49
50
const
Amg::VectorX
&
RecVertexPositions::weightTimesPosition
() {
51
if
(!
m_useWeightTimesPosition
&&
m_positionError
.determinant()!=0.0) {
52
m_position
=
m_positionError
.inverse()*
m_position
;
53
m_useWeightTimesPosition
=
true
;
54
}
else
{
55
std::cout <<
"Warning in RecVertexPositions: requested finalization but was already finalized..."
<< std::endl;
56
}
57
return
m_position
;
58
}
59
60
// Use storing weight matrix * position instead of position
61
// saves you from inverting the weight matrix at every fit iteration
62
// Then transparently, asking the position for the first time,
63
// the m_position will be restored to the correct value of position
64
// (using the invertion of the weight matrix only once...)
65
void
RecVertexPositions::setWeightTimesPosition
(
const
Amg::VectorX
&
weightTimesPosition
) {
66
m_useWeightTimesPosition
=
true
;
67
m_position
=
weightTimesPosition
;
68
}
69
70
//the finalizePosition() method is used to ask the RecVertexPositions class
71
//to invert the weight matrix and fill the m_position vector with the real
72
//position, in order to finalize the position (and make it available)
73
void
RecVertexPositions::finalizePosition
() {
74
if
(
m_useWeightTimesPosition
) {
75
m_useWeightTimesPosition
=
false
;
76
m_position
=
m_positionError
*
m_position
;
77
}
78
}
79
80
MsgStream&
RecVertexPositions::dump
(MsgStream& sl)
const
{
81
sl <<
"Trk::RecVertexPositions: \n"
;
82
std::ostringstream oss;
83
dump
(oss);
84
sl << oss.str() <<
endmsg
;
85
return
sl;
86
}
87
88
std::ostream&
RecVertexPositions::dump
(std::ostream& sl)
const
{
89
if
(
m_useWeightTimesPosition
) {
90
sl <<
"Trk::VertexPositions weight times position: ("
;
91
}
else
{
92
sl <<
"Trk::VertexPositions position: ("
;
93
}
94
sl <<
"xv "
<<
m_position
(
jet_xv
) <<
"+/-"
<<std::sqrt(this->
covariancePosition
()(
jet_xv
,
jet_xv
)) <<
" , "
95
<<
"yv "
<<
m_position
(
jet_yv
) <<
"+/-"
<<std::sqrt(this->
covariancePosition
()(
jet_yv
,
jet_yv
)) <<
", "
96
<<
"zv "
<<
m_position
(
jet_zv
) <<
"+/-"
<<std::sqrt(this->
covariancePosition
()(
jet_zv
,
jet_zv
)) <<
", "
97
<<
"phi "
<<
m_position
(
jet_phi
) <<
"+/-"
<<std::sqrt(this->
covariancePosition
()(
jet_phi
,
jet_phi
)) <<
", "
98
<<
"theta "
<<
m_position
(
jet_theta
)<<
"+/-"
<<std::sqrt(this->
covariancePosition
()(
jet_theta
,
jet_theta
))
99
<<
"\n"
;
100
if
(!
m_useWeightTimesPosition
) {
101
for
(
int
i=5;i<
m_position
.rows();i++) {
102
sl <<
"dist"
<< i <<
" "
<<
m_position
(i) <<
"+/-"
<< std::sqrt(this->
covariancePosition
()(i,i))<<
" , "
;
103
}
104
}
else
{
105
for
(
int
i=5;i<
m_position
.rows();i++) {
106
sl <<
"dist corrected"
<< i <<
" "
<< (
m_positionError
*
m_position
).eval()(i) <<
"+/-"
<< std::sqrt(
m_positionError
(i,i))<<
" , "
;
107
}
108
}
109
sl <<
"\n"
;
110
111
VertexPositions::dump
(sl);
112
sl <<
m_positionError
<<
"\n"
;
113
sl <<
" ndf: "
<<
m_fitQuality
.doubleNumberDoF() <<
"\t chi2: "
<<
m_fitQuality
.chiSquared() << std::endl;
114
return
sl;
115
}
116
117
RecVertexPositions::~RecVertexPositions
() =
default
;
118
119
const
Trk::FitQuality
&
RecVertexPositions::fitQuality
()
const
120
{
return
m_fitQuality
;}
121
122
123
const
Amg::MatrixX
&
RecVertexPositions::covariancePosition
()
const
124
{
return
m_positionError
; }
125
126
127
void
RecVertexPositions::setCovariancePosition
(
const
Amg::MatrixX
& newerror) {
128
m_positionError
=newerror;
129
}
130
131
void
RecVertexPositions::setFitQuality
(
const
Trk::FitQuality
& newFitQuality) {
132
m_fitQuality
=newFitQuality;
133
}
134
135
136
137
}
// end of namespace
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
RecVertexPositions.h
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition
FitQuality.h:97
Trk::RecVertexPositions::m_fitQuality
Trk::FitQuality m_fitQuality
Definition
RecVertexPositions.h:78
Trk::RecVertexPositions::~RecVertexPositions
virtual ~RecVertexPositions()
default destructor
Trk::RecVertexPositions::RecVertexPositions
RecVertexPositions()
default constructor, if called initializes a RecVertexPositions with all data members set to 0.
Definition
RecVertexPositions.cxx:24
Trk::RecVertexPositions::covariancePosition
Amg::MatrixX const & covariancePosition() const
return the covDeltaV matrix of the vertex fit
Definition
RecVertexPositions.cxx:123
Trk::RecVertexPositions::setWeightTimesPosition
void setWeightTimesPosition(const Amg::VectorX &)
Definition
RecVertexPositions.cxx:65
Trk::RecVertexPositions::weightTimesPosition
const Amg::VectorX & weightTimesPosition()
Definition
RecVertexPositions.cxx:50
Trk::RecVertexPositions::setFitQuality
void setFitQuality(const Trk::FitQuality &)
Definition
RecVertexPositions.cxx:131
Trk::RecVertexPositions::fitQuality
const Trk::FitQuality & fitQuality() const
Fit quality access method.
Definition
RecVertexPositions.cxx:119
Trk::RecVertexPositions::m_positionError
Amg::MatrixX m_positionError
cov matrix on vertex position (primary vtx+jet dir+distance)
Definition
RecVertexPositions.h:77
Trk::RecVertexPositions::setCovariancePosition
void setCovariancePosition(const Amg::MatrixX &)
Definition
RecVertexPositions.cxx:127
Trk::RecVertexPositions::finalizePosition
void finalizePosition()
Definition
RecVertexPositions.cxx:73
Trk::RecVertexPositions::dump
virtual MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
Definition
RecVertexPositions.cxx:80
Trk::VertexPositions::VertexPositions
VertexPositions()
default constructor
Definition
VertexPositions.cxx:20
Trk::VertexPositions::m_position
Amg::VectorX m_position
vertex position
Definition
VertexPositions.h:48
Trk::VertexPositions::dump
virtual MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
Definition
VertexPositions.cxx:36
Trk::VertexPositions::m_useWeightTimesPosition
bool m_useWeightTimesPosition
Definition
VertexPositions.h:49
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition
comparitor.cxx:525
Amg
Definition of ATLAS Math & Geometry primitives (Amg).
Definition
AmgStringHelpers.h:19
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition
EventPrimitives.h:27
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition
EventPrimitives.h:30
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::jet_theta
@ jet_theta
Definition
JetVtxParamDefs.h:28
Trk::jet_phi
@ jet_phi
Definition
JetVtxParamDefs.h:28
Trk::jet_xv
@ jet_xv
Definition
JetVtxParamDefs.h:27
Trk::jet_zv
@ jet_zv
position x,y,z of primary vertex
Definition
JetVtxParamDefs.h:27
Trk::jet_yv
@ jet_yv
Definition
JetVtxParamDefs.h:27
dump
-event-from-file
Generated on
for ATLAS Offline Software by
1.17.0