ATLAS Offline Software
Loading...
Searching...
No Matches
RecVertexPositions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 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
17//#include "TrkEventPrimitives/CovarianceMatrix.h" //!< include for the track class
18//#include "CLHEP/Vector/ThreeVector.h" //!< include for CLHEP::Hep3Vector
19//#include "VxJetVertex/VxVertexOnJetAxis.h"
20
21
22namespace Trk {
23
28
29
34
35
37 const double ndf, const double chi2,
38 bool isWeightTimesPosition) :
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()),
48
50
51
53 if (!m_useWeightTimesPosition && m_positionError.determinant()!=0.0) {
56 } else {
57 std::cout << "Warning in RecVertexPositions: requested finalization but was already finalized..." << std::endl;
58 }
59 return m_position;
60 }
61
62 // Use storing weight matrix * position instead of position
63 // saves you from inverting the weight matrix at every fit iteration
64 // Then transparently, asking the position for the first time,
65 // the m_position will be restored to the correct value of position
66 // (using the invertion of the weight matrix only once...)
71
72 //the finalizePosition() method is used to ask the RecVertexPositions class
73 //to invert the weight matrix and fill the m_position vector with the real
74 //position, in order to finalize the position (and make it available)
81
82
83
85 {
86 if (this!=&rhs)
87 {
88 // you need to call the base class assignment operator
92 }
93 return *this;
94 }
95
96 MsgStream& RecVertexPositions::dump(MsgStream& sl) const {
97 sl << "Trk::RecVertexPositions: " << std::endl;
98 //VertexOnJetAxis::dump(sl);
99
101 sl << "Trk::VertexPositions weight times position: (" ;
102 } else {
103 sl << "Trk::VertexPositions position: (" ;
104 }
105 sl << "xv " << m_position(jet_xv) << "+/-" << sqrt(m_positionError(jet_xv,jet_xv)) << " , "
106 << "yv " << m_position(jet_yv) << "+/-" << sqrt(m_positionError(jet_yv,jet_yv)) <<", "
107 << "zv " << m_position(jet_zv) << "+/-" << sqrt(m_positionError(jet_zv,jet_zv)) <<", "
108 << "phi " << m_position(jet_phi) << "+/-" << sqrt(m_positionError(jet_phi,jet_phi)) <<", "
109 << "theta " << m_position(jet_theta) << "+/-" << sqrt(m_positionError(jet_theta,jet_theta)) << endmsg;
111 for (int i=5;i<m_position.rows();i++) {
112 sl << "dist" << i << " " << m_position(i) << "+/-" << sqrt(m_positionError(i,i))<<" , ";
113 }
114 } else {
115 for (int i=5;i<m_position.rows();i++) {
116 sl << "dist corrected" << i << " " << (m_positionError*m_position).eval()(i) << "+/-" << sqrt(m_positionError(i,i))<<" , ";
117 }
118 }
119 sl << endmsg;
120
121 sl << m_positionError << std::endl;
122 sl << " ndf: " << m_fitQuality.doubleNumberDoF() << "\t chi2: " << m_fitQuality.chiSquared() << endmsg;
123 return sl;
124 }
125
126 std::ostream& RecVertexPositions::dump(std::ostream& sl) const {
127 // sl << "Trk::RecVertexPositions: " << std::endl;
129 sl << "Trk::VertexPositions weight times position: (" ;
130 } else {
131 sl << "Trk::VertexPositions position: (" ;
132 }
133 sl << "xv " << m_position(jet_xv) << "+/-" <<sqrt(this->covariancePosition()(jet_xv,jet_xv)) << " , "
134 << "yv " << m_position(jet_yv) << "+/-" <<sqrt(this->covariancePosition()(jet_yv,jet_yv)) <<", "
135 << "zv " << m_position(jet_zv) << "+/-" <<sqrt(this->covariancePosition()(jet_zv,jet_zv)) <<", "
136 << "phi " << m_position(jet_phi) << "+/-"<<sqrt(this->covariancePosition()(jet_phi,jet_phi)) <<", "
137 << "theta " << m_position(jet_theta)<<"+/-"<<sqrt(this->covariancePosition()(jet_theta,jet_theta))
138 << std::endl;
140 for (int i=5;i<m_position.rows();i++) {
141 sl << "dist" << i << " " << m_position(i) << "+/-" << sqrt(this->covariancePosition()(i,i))<<" , ";
142 }
143 } else {
144 for (int i=5;i<m_position.rows();i++) {
145 sl << "dist corrected" << i << " " << (m_positionError*m_position).eval()(i) << "+/-" << sqrt(m_positionError(i,i))<<" , ";
146 }
147 }
148 sl << std::endl;
149
151 sl << m_positionError << std::endl;
152 sl << " ndf: " << m_fitQuality.doubleNumberDoF() << "\t chi2: " << m_fitQuality.chiSquared() << std::endl;
153 return sl;
154 }
155
157
160
161
164
165
167 m_positionError=newerror;
168 }
169
171 m_fitQuality=newFitQuality;
172 }
173
174
175
176} // end of namespace
#define endmsg
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
virtual ~RecVertexPositions()
default destructor
RecVertexPositions()
default constructor, if called initializes a RecVertexPositions with all data members set to 0.
Amg::MatrixX const & covariancePosition() const
return the covDeltaV matrix of the vertex fit
void setWeightTimesPosition(const Amg::VectorX &)
const Amg::VectorX & weightTimesPosition()
void setFitQuality(const Trk::FitQuality &)
const Trk::FitQuality & fitQuality() const
Fit quality access method.
Amg::MatrixX m_positionError
cov matrix on vertex position (primary vtx+jet dir+distance)
void setCovariancePosition(const Amg::MatrixX &)
RecVertexPositions & operator=(const RecVertexPositions &)
Assignement operator.
virtual MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
VertexPositions & operator=(const VertexPositions &)=default
Assignment operator.
VertexPositions()
default constructor
Amg::VectorX m_position
vertex position
virtual MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
double chi2(TH1 *h0, TH1 *h1)
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Ensure that the ATLAS eigen extensions are properly loaded.
@ jet_zv
position x,y,z of primary vertex