ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Trk::AlignVertex Class Reference

#include <AlignVertex.h>

Collaboration diagram for Trk::AlignVertex:

Public Types

enum  AlignVertexType {
  Unknown = 0, Primary = 1, Refitted = 2, Accumulated = 3,
  NVertexTypes
}
 

Public Member Functions

 AlignVertex ()
 default constructor
More...
 
 AlignVertex (const xAOD::Vertex *originalVertex)
 constructor takes the original vertex candidate More...
 
 AlignVertex (const AlignVertex &rhs)
 copy constructor More...
 
AlignVertexoperator= (const AlignVertex &rhs)
 assignment More...
 
 ~AlignVertex ()
 destructor More...
 
const AlignTrackCollectionalignTrackCollection () const
 returns collection of alignTracks More...
 
AlignTrackCollection::const_iterator firstATrack () const
 retrieve iterator pointer to first element in collection More...
 
AlignTrackCollection::const_iterator lastATrack () const
 returns iterator pointer to last element in collection More...
 
const xAOD::VertexoriginalVertex () const
 retrieve pointer to original vertex and its position More...
 
const Amg::Vector3DoriginalPosition () const
 
void setOriginalVertex (const xAOD::Vertex *vertex)
 set pointer to original vertex More...
 
AlignVertexType type () const
 get and set the refit type More...
 
void setType (AlignVertexType type)
 
const Amg::Vector3Dposition () const
 get the vertex position and covariance More...
 
const AmgSymMatrix (3) *covariance() const
 
const std::vector< AlignModuleVertexDerivatives > * derivatives () const
 The Amg::VectorX is a vector of first-derivatives of the alignTSOS on the alignTrack w.r.t. More...
 
void setDerivatives (std::vector< AlignModuleVertexDerivatives > *vec)
 
void addDerivatives (std::vector< AlignModuleVertexDerivatives > *vec)
 
void dump (MsgStream &msg)
 dump align vertex information More...
 
void incrementVector (const Amg::Vector3D &vtxV)
 increment algebra objects for this verterx: More...
 
void incrementMatrix (const AmgSymMatrix(3) vtxM)
 
void fitVertex ()
 fit the vertex internally More...
 
int Ntracks () const
 get the number of contributing tracks More...
 
void setConstraint (AmgSymMatrix(3) *, Amg::Vector3D *)
 set and get the constraint on VTX position More...
 
const AmgSymMatrix (3) *Qmatrix() const
 
const Amg::Vector3DVvector () const
 
void setUnconstrained ()
 
bool Constrained () const
 

Private Member Functions

 AmgSymMatrix (3) *m_matrix
 
 AmgSymMatrix (3) *m_covariance
 
 AmgSymMatrix (3) *m_qMatrix
 

Private Attributes

int m_nTracks
 
Amg::Vector3Dm_vector
 
const xAOD::Vertexm_original
 
Amg::Vector3Dm_originalPosition
 
AlignTrackCollection m_alignTracks
 
Amg::Vector3Dm_position
 
std::vector< AlignModuleVertexDerivatives > * m_derivatives
 
Amg::Vector3Dm_vVector
 
bool m_constrained
 
AlignVertexType m_type
 

Detailed Description

Definition at line 39 of file AlignVertex.h.

Member Enumeration Documentation

◆ AlignVertexType

Enumerator
Unknown 

default type

Primary 

not refitted, just copy constructed from original Track

Refitted 

normally refitted, without adding any pseudo-measurement

Accumulated 

accumulated by the GX algorithm.


NVertexTypes 

total number of track types

Definition at line 43 of file AlignVertex.h.

43  {
44  Unknown = 0,
45  Primary = 1,
46  Refitted = 2,
47  Accumulated = 3,
48 
50  };

Constructor & Destructor Documentation

◆ AlignVertex() [1/3]

AlignVertex::AlignVertex ( )

default constructor

Definition at line 11 of file AlignVertex.cxx.

12  : m_matrix(nullptr)
13  , m_vector(nullptr)
14  , m_original(nullptr)
15  , m_originalPosition(nullptr)
16  , m_position(nullptr)
17  , m_covariance(nullptr)
18  , m_derivatives(nullptr)
19  , m_qMatrix(nullptr)
20  , m_vVector(nullptr)
21  , m_constrained(false)
22  , m_type(Unknown)
23  {
24  m_vector=new Amg::Vector3D(0.,0.,0.);
25  m_matrix=new AmgSymMatrix(3);
26  m_derivatives=new std::vector<AlignModuleVertexDerivatives >(0);
27  m_qMatrix= new AmgSymMatrix(3);
28  m_vVector=new Amg::Vector3D(0.,0.,0.);
29  m_nTracks=0;
30  }

◆ AlignVertex() [2/3]

AlignVertex::AlignVertex ( const xAOD::Vertex originalVertex)

constructor takes the original vertex candidate

Definition at line 73 of file AlignVertex.cxx.

74  : m_matrix(nullptr)
75  , m_vector(nullptr)
77  , m_originalPosition(nullptr)
78  , m_position(nullptr)
79  , m_covariance(nullptr)
80  , m_derivatives(nullptr)
81  , m_qMatrix(nullptr)
82  , m_vVector(nullptr)
83  , m_constrained(false)
84  , m_type(Unknown)
85  {
86  m_vector=new Amg::Vector3D(0.,0.,0.);
87  m_matrix=new AmgSymMatrix(3);
89  m_originalPosition = new Amg::Vector3D( vertex->position() );
90  m_derivatives=new std::vector<AlignModuleVertexDerivatives >(0);
91  m_qMatrix=new AmgSymMatrix(3);
92  m_vVector=new Amg::Vector3D(0.,0.,0.);
93  m_nTracks=0;
94  }

◆ AlignVertex() [3/3]

AlignVertex::AlignVertex ( const AlignVertex rhs)

copy constructor

Definition at line 33 of file AlignVertex.cxx.

34  : m_nTracks(rhs.m_nTracks)
35  , m_matrix(new AmgSymMatrix(3)(*(rhs.m_matrix)))
36  , m_vector(new Amg::Vector3D(*(rhs.m_vector)))
37  , m_original(new xAOD::Vertex(*(rhs.m_original)))
38  , m_originalPosition(new Amg::Vector3D( *(rhs.m_originalPosition )))
39  , m_position(new Amg::Vector3D(*(rhs.m_position)))
40  , m_covariance(new AmgSymMatrix(3) (*(rhs.m_covariance)) )
41  , m_derivatives(new auto(*(rhs.m_derivatives)))
42  , m_qMatrix(new AmgSymMatrix(3) (*(rhs.m_qMatrix)) )
43  , m_vVector(new Amg::Vector3D(*(rhs.m_vVector)))
44  , m_constrained(rhs.m_constrained)
45  , m_type(rhs.m_type)
46  {
47 
48  }

◆ ~AlignVertex()

AlignVertex::~AlignVertex ( )

destructor

Definition at line 98 of file AlignVertex.cxx.

99  {
100  if( m_matrix ) delete m_matrix;
101  if( m_vector ) delete m_vector;
102 
104 
105  if( m_position ) delete m_position;
106  if( m_covariance ) delete m_covariance;
107  if( m_derivatives ) delete m_derivatives;
108 
109  if( m_qMatrix ) delete m_qMatrix;
110  if( m_vVector ) delete m_vVector;
111  }

Member Function Documentation

◆ addDerivatives()

void AlignVertex::addDerivatives ( std::vector< AlignModuleVertexDerivatives > *  vec)

Definition at line 132 of file AlignVertex.cxx.

133  {
136 
137  for ( ; derivIt!=derivIt_end ; ++derivIt) {
138  m_derivatives->push_back(*derivIt);
139  }
140 
141  }

◆ alignTrackCollection()

const AlignTrackCollection* Trk::AlignVertex::alignTrackCollection ( ) const

returns collection of alignTracks

◆ AmgSymMatrix() [1/5]

const Trk::AlignVertex::AmgSymMatrix ( ) const
inline

Definition at line 90 of file AlignVertex.h.

90 {return m_covariance;}

◆ AmgSymMatrix() [2/5]

Trk::AlignVertex::AmgSymMatrix ( )
private

◆ AmgSymMatrix() [3/5]

Trk::AlignVertex::AmgSymMatrix ( )
private

◆ AmgSymMatrix() [4/5]

Trk::AlignVertex::AmgSymMatrix ( )
private

◆ AmgSymMatrix() [5/5]

const Trk::AlignVertex::AmgSymMatrix ( ) const
inline

Definition at line 117 of file AlignVertex.h.

117 { return m_qMatrix; }

◆ Constrained()

bool Trk::AlignVertex::Constrained ( ) const
inline

Definition at line 123 of file AlignVertex.h.

123 { return m_constrained; }

◆ derivatives()

const std::vector<AlignModuleVertexDerivatives>* Trk::AlignVertex::derivatives ( ) const
inline

The Amg::VectorX is a vector of first-derivatives of the alignTSOS on the alignTrack w.r.t.

a particular alignment parameter times W*F. There is one Amg::VectorX in the vector for each alignment parameter of each align module. Set by accumulateVTX.

Definition at line 95 of file AlignVertex.h.

95 { return m_derivatives; }

◆ dump()

void AlignVertex::dump ( MsgStream &  msg)

dump align vertex information

Definition at line 218 of file AlignVertex.cxx.

219  {
220  msg<<"dumping AlignVertex: "<<endmsg;
221 
222  msg<<" vertex Position: "<< (*m_position) << endmsg;
223  msg<<" vertex Covariance: "<< (*m_covariance) << endmsg;
224  msg<< endmsg;
225 
226  }

◆ firstATrack()

AlignTrackCollection::const_iterator Trk::AlignVertex::firstATrack ( ) const

retrieve iterator pointer to first element in collection

◆ fitVertex()

void AlignVertex::fitVertex ( )

fit the vertex internally

Definition at line 144 of file AlignVertex.cxx.

145  {
146 
147  m_type = Unknown;
148 
149  if( Ntracks() < 2 ) return; // this is not a good vertex!
150 
151 
152  if( !m_matrix ) {
153  std::cout <<"NULL pointer to the matrix! Bailing out..."<< std::endl;
154  return;
155  }
156 
157  Amg::Vector3D vec = (*m_vector);
158  AmgSymMatrix(3) cov = (*m_matrix);
159  AmgSymMatrix(3) covcons = (*m_matrix);
160 
161  AmgSymMatrix(3) Qinv;
162  if( m_constrained && m_qMatrix->determinant() > 1.0e-24 ) { // just my guess sigma>0.1 micron ???
163 
164  bool invertible;
165  m_qMatrix->computeInverseWithCheck(Qinv,invertible);
166 
167  if(!invertible) {
168  std::cout <<"fitVertex: Q inversion failed. " << std::endl;
169  return;
170  }
171 
172 
173  Amg::Vector3D vtemp(3, 0);
174 
175  vtemp = *m_originalPosition;
176  vtemp -= *m_vVector;
177 
178  covcons += 2.0*Qinv;
179  vec += 2.0*Qinv*vtemp;
180  }
181 
182  // invert the constrained covariance:
183  AmgSymMatrix(3) invcovcons;
184 
185  bool invertible;
186  covcons.computeInverseWithCheck(invcovcons,invertible);
187 
188  if(!invertible) {
189  std::cout <<"fitVertex: covcons inversion failed. " << std::endl;
190  return;
191  }
192 
193  // invert the covariance matrix:
194  AmgSymMatrix(3) invcov;
195  cov.computeInverseWithCheck(invcov,invertible);
196 
197  if(!invertible) {
198  std::cout <<"fitVertex: cov inversion failed. " << std::endl;
199  return;
200  }
201 
202 
203 
204  // calculate corrections (mind the sign!)
205  Amg::Vector3D delta(invcovcons * vec);
206 
207  if ( !m_position ) m_position=new Amg::Vector3D(0.,0.,0.);
209  *m_position -= delta;
210 
211 
212  if ( !m_covariance ) m_covariance= new AmgSymMatrix(3);
213  (*m_covariance)=invcov; // this one is unconstrained!
214 
215  m_type = Refitted;
216  }

◆ incrementMatrix()

void Trk::AlignVertex::incrementMatrix ( const AmgSymMatrix(3)  vtxM)
inline

Definition at line 105 of file AlignVertex.h.

105 { (*m_matrix)+=vtxM; }

◆ incrementVector()

void Trk::AlignVertex::incrementVector ( const Amg::Vector3D vtxV)
inline

increment algebra objects for this verterx:

Definition at line 104 of file AlignVertex.h.

104 { (*m_vVector)+=vtxV; }

◆ lastATrack()

AlignTrackCollection::const_iterator Trk::AlignVertex::lastATrack ( ) const

returns iterator pointer to last element in collection

◆ Ntracks()

int Trk::AlignVertex::Ntracks ( ) const
inline

get the number of contributing tracks

Definition at line 112 of file AlignVertex.h.

112 { return m_nTracks; }

◆ operator=()

AlignVertex & AlignVertex::operator= ( const AlignVertex rhs)

assignment

Definition at line 51 of file AlignVertex.cxx.

51  {
52  if (&rhs!=this){
53  m_nTracks = rhs.m_nTracks;
54  delete m_matrix; m_matrix = new AmgSymMatrix(3)(*(rhs.m_matrix));
55  delete m_vector; m_vector = new Amg::Vector3D(*(rhs.m_vector));
56  delete m_original; m_original = new xAOD::Vertex(*(rhs.m_original));
57  delete m_originalPosition; m_originalPosition = new Amg::Vector3D( *(rhs.m_originalPosition ));
58  delete m_position; m_position = new Amg::Vector3D(*(rhs.m_position));
59  delete m_covariance; m_covariance = new AmgSymMatrix(3) (*(rhs.m_covariance));
60  delete m_derivatives; m_derivatives = new auto(*(rhs.m_derivatives));
61  delete m_qMatrix; m_qMatrix = new AmgSymMatrix(3) (*(rhs.m_qMatrix));
62  delete m_vVector; m_vVector = new Amg::Vector3D(*(rhs.m_vVector));
63  m_constrained = rhs.m_constrained;
64  m_type = rhs.m_type;
65  }
66  return *this;
67  }

◆ originalPosition()

const Amg::Vector3D* Trk::AlignVertex::originalPosition ( ) const
inline

Definition at line 79 of file AlignVertex.h.

79 {return m_originalPosition;}

◆ originalVertex()

const xAOD::Vertex* Trk::AlignVertex::originalVertex ( ) const
inline

retrieve pointer to original vertex and its position

Definition at line 78 of file AlignVertex.h.

78 { return m_original; }

◆ position()

const Amg::Vector3D* Trk::AlignVertex::position ( ) const
inline

get the vertex position and covariance

Definition at line 89 of file AlignVertex.h.

89 {return m_position;}

◆ setConstraint()

void AlignVertex::setConstraint ( AmgSymMatrix(3) *  Q,
Amg::Vector3D V 
)

set and get the constraint on VTX position

Definition at line 114 of file AlignVertex.cxx.

115  {
116  if( Q->rows()!=3 || V->rows()!=3 ) {
117  std::cout <<"Unexpected size of the constraint:"<< std::endl;
118  std::cout <<" Q size = "<< Q->rows() << ", V size = "<< V->rows() << std::endl;
119  return;
120  }
121  if( Q->determinant() < 1.0e-24 ) {
122  std::cout <<" Suspicious Q determinant: detQ = "<< Q->determinant() << std::endl;
123  return;
124  }
125  (*m_qMatrix) = (*Q);
126  (*m_vVector) = (*V);
127  m_constrained = true;
128  }

◆ setDerivatives()

void Trk::AlignVertex::setDerivatives ( std::vector< AlignModuleVertexDerivatives > *  vec)
inline

Definition at line 96 of file AlignVertex.h.

96 { m_derivatives=vec; }

◆ setOriginalVertex()

void Trk::AlignVertex::setOriginalVertex ( const xAOD::Vertex vertex)
inline

set pointer to original vertex

Definition at line 82 of file AlignVertex.h.

82 { m_original = vertex; }

◆ setType()

void Trk::AlignVertex::setType ( AlignVertexType  type)
inline

Definition at line 86 of file AlignVertex.h.

86 {m_type = type;}

◆ setUnconstrained()

void Trk::AlignVertex::setUnconstrained ( )
inline

Definition at line 121 of file AlignVertex.h.

121 { m_constrained=false; }

◆ type()

AlignVertexType Trk::AlignVertex::type ( ) const
inline

get and set the refit type

Definition at line 85 of file AlignVertex.h.

85 {return m_type;}

◆ Vvector()

const Amg::Vector3D* Trk::AlignVertex::Vvector ( ) const
inline

Definition at line 119 of file AlignVertex.h.

119 { return m_vVector; }

Member Data Documentation

◆ m_alignTracks

AlignTrackCollection Trk::AlignVertex::m_alignTracks
private

Definition at line 135 of file AlignVertex.h.

◆ m_constrained

bool Trk::AlignVertex::m_constrained
private

Definition at line 144 of file AlignVertex.h.

◆ m_derivatives

std::vector<AlignModuleVertexDerivatives >* Trk::AlignVertex::m_derivatives
private

Definition at line 140 of file AlignVertex.h.

◆ m_nTracks

int Trk::AlignVertex::m_nTracks
private

Definition at line 127 of file AlignVertex.h.

◆ m_original

const xAOD::Vertex* Trk::AlignVertex::m_original
private

Definition at line 132 of file AlignVertex.h.

◆ m_originalPosition

Amg::Vector3D* Trk::AlignVertex::m_originalPosition
private

Definition at line 133 of file AlignVertex.h.

◆ m_position

Amg::Vector3D* Trk::AlignVertex::m_position
private

Definition at line 137 of file AlignVertex.h.

◆ m_type

AlignVertexType Trk::AlignVertex::m_type
private

Definition at line 147 of file AlignVertex.h.

◆ m_vector

Amg::Vector3D* Trk::AlignVertex::m_vector
private

Definition at line 130 of file AlignVertex.h.

◆ m_vVector

Amg::Vector3D* Trk::AlignVertex::m_vVector
private

Definition at line 143 of file AlignVertex.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::AlignVertex::m_constrained
bool m_constrained
Definition: AlignVertex.h:144
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition: Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Trk::AlignVertex::m_position
Amg::Vector3D * m_position
Definition: AlignVertex.h:137
Trk::AlignVertex::m_original
const xAOD::Vertex * m_original
Definition: AlignVertex.h:132
Trk::AlignVertex::AmgSymMatrix
const AmgSymMatrix(3) *covariance() const
Definition: AlignVertex.h:90
Trk::AlignVertex::Unknown
@ Unknown
default type
Definition: AlignVertex.h:44
Trk::AlignVertex::m_type
AlignVertexType m_type
Definition: AlignVertex.h:147
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
Trk::AlignVertex::m_derivatives
std::vector< AlignModuleVertexDerivatives > * m_derivatives
Definition: AlignVertex.h:140
Trk::AlignVertex::m_vVector
Amg::Vector3D * m_vVector
Definition: AlignVertex.h:143
Trk::AlignVertex::Accumulated
@ Accumulated
accumulated by the GX algorithm.
Definition: AlignVertex.h:47
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
Trk::AlignVertex::Ntracks
int Ntracks() const
get the number of contributing tracks
Definition: AlignVertex.h:112
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::AlignVertex::m_vector
Amg::Vector3D * m_vector
Definition: AlignVertex.h:130
Trk::AlignVertex::m_originalPosition
Amg::Vector3D * m_originalPosition
Definition: AlignVertex.h:133
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Trk::AlignVertex::NVertexTypes
@ NVertexTypes
total number of track types
Definition: AlignVertex.h:49
Trk::AlignVertex::Refitted
@ Refitted
normally refitted, without adding any pseudo-measurement
Definition: AlignVertex.h:46
Trk::AlignVertex::type
AlignVertexType type() const
get and set the refit type
Definition: AlignVertex.h:85
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::AlignVertex::m_nTracks
int m_nTracks
Definition: AlignVertex.h:127
Trk::AlignVertex::Primary
@ Primary
not refitted, just copy constructed from original Track
Definition: AlignVertex.h:45