ATLAS Offline Software
Loading...
Searching...
No Matches
VertexOnTrack.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6// VertexOnTrack.cxx, (c) ATLAS Detector software
8
9// Trk
11#include "VxVertex/RecVertex.h"
12
13// Gaudi & AthenaCommon
14#include "GaudiKernel/MsgStream.h"
15#include <string>
16#include <typeinfo>
17
18namespace {
19const double NaN(std::numeric_limits<double>::quiet_NaN());
20const Amg::Vector3D INVALID_VECTOR3D(NaN, NaN, NaN);
21}
22
23// Constructor with parameters:
25 Amg::MatrixX&& locerr,
26 const PerigeeSurface& assocSurf)
27 : Trk::MeasurementBase(std::move(locpars), std::move(locerr))
28 , PerigeeSurfacePtrHolder(assocSurf)
29 , m_globalPosition(std::nullopt)
30{}
31
33 LocalParameters&& locpars,
34 Amg::MatrixX&& locerr,
36 : Trk::MeasurementBase(std::move(locpars), std::move(locerr))
37 , PerigeeSurfacePtrHolder(assocSurf.release())
38 , m_globalPosition(std::nullopt)
39{}
40
41// Constructor with parameters:
43 const Trk::Perigee& perigee)
46 , m_globalPosition(Amg::Vector3D(perigee.position()))
47{
48 if ((rvertex.position() - perigee.associatedSurface().center()).mag() > 10e-5)
49 throw GaudiException(
50 "Inconsistent input data, Perigee not expressed at vertex!",
51 "Trk::VertexOnTrack",
52 StatusCode::RECOVERABLE);
53
54 // the local parameters are by definition at (0,0)
55 Amg::Vector2D localPosition(0, 0);
56 m_localParams = Trk::LocalParameters(localPosition);
57
58 // transform Cartesian (x,y,z) to perigee (d0,z0)
59 Amg::MatrixX jacobian(2, 3);
60 jacobian.setZero();
61 double ptInv = 1. / perigee.momentum().perp();
62 jacobian(0, 0) = -ptInv * perigee.momentum().y();
63 jacobian(0, 1) = ptInv * perigee.momentum().x();
64 jacobian(1, 2) = 1.0;
65 // the covariance on matrix of the vertex
66 const Amg::MatrixX& vtxCov = rvertex.covariancePosition();
67 // the local coordinate
68 m_localCovariance = vtxCov.similarity(jacobian);
69}
70
71const Amg::Vector3D&
73{
74 if (m_globalPosition) {
75 return *m_globalPosition;
76 }
77 return INVALID_VECTOR3D;
78}
79
80MsgStream&
81Trk::VertexOnTrack::dump(MsgStream& sl) const
82{
83 std::string name(typeid(*this).name());
84 sl << "Concrete dump method not implemented - using base class" << std::endl;
85 sl << name << "\t local position = " << this->localParameters() << std::endl;
86 sl << name << "\t global position ( " << this->globalPosition().x() << " , "
87 << this->globalPosition().y() << " , " << this->globalPosition().z()
88 << " ) " << std::endl;
89 sl << name << "\t has Error Matrix: " << std::endl;
90 sl << this->localCovariance() << std::endl;
91 sl << name << "\t has associated surface:" << std::endl;
92 sl << this->associatedSurface() << std::endl;
93 return sl;
94}
95
96std::ostream&
97Trk::VertexOnTrack::dump(std::ostream& sl) const
98{
99 std::string name(typeid(*this).name());
100 sl << "Concrete dump method not implemented - using base class" << std::endl;
101 sl << name << "\t local position = " << this->localParameters() << std::endl;
102 sl << name << "\t global position ( " << this->globalPosition().x() << " , "
103 << this->globalPosition().y() << " , " << this->globalPosition().z()
104 << " ) " << std::endl;
105 sl << name << "\t has Error Matrix: " << std::endl;
106 sl << this->localCovariance() << std::endl;
107 sl << name << "\t has associated surface:" << std::endl;
108 sl << this->associatedSurface() << std::endl;
109 return sl;
110}
111
Eigen::Matrix< double, 3, 1 > Vector3D
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
MeasurementBase()=default
Default constructor - needed for POOL/SEAL.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
LocalParameters m_localParams
Amg::MatrixX m_localCovariance
const Amg::Vector3D & momentum() const
Access method for the momentum.
virtual const S & associatedSurface() const override final
Access to the Surface method.
Class describing the Line to which the Perigee refers to.
Trk::RecVertex inherits from Trk::Vertex.
Definition RecVertex.h:44
const PerigeeSurface * release() noexcept
const Amg::Vector3D & center() const
Returns the center position of the Surface.
virtual const Amg::Vector3D & globalPosition() const override final
Interface method to get the global Position.
virtual MsgStream & dump(MsgStream &out) const override final
returns the some information about this VertexOnTrack.
VertexOnTrack()=default
Default Constructor for POOL.
virtual const PerigeeSurface & associatedSurface() const override final
returns the surface for the local to global transformation
std::optional< Amg::Vector3D > m_globalPosition
Global position of the VoT.
const Amg::Vector3D & position() const
return position of vertex
Definition Vertex.cxx:63
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
SurfacePtrHolderImpl< PerigeeSurface > PerigeeSurfacePtrHolder
std::unique_ptr< S, SurfaceDeleter< S > > SurfaceUniquePtrT
STL namespace.