ATLAS Offline Software
Loading...
Searching...
No Matches
LocalParameters.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// LocalParameters.cxx, (c) ATLAS Detector software
8
9
10// Trk
13//Gaudi
14#include "GaudiKernel/MsgStream.h"
15#include <typeinfo>
16#include <sstream>
17#include <iostream>
18
19namespace {
20const Trk::ProjectionMatricesSet s_projectionMatrices(5);
21}
22
24 : Amg::VectorX(1), m_parameterkey(0) {
25 Amg::VectorX::operator[](0) = par1.first;
26 m_parameterkey |= 1 << int(par1.second);
27}
28
30 : Amg::VectorX(2), m_parameterkey(3) {
31 Amg::VectorX::operator[](0) = lp[Trk::locX];
32 Amg::VectorX::operator[](1) = lp[Trk::locY];
33}
34
36 const Trk::DefinedParameter& par2)
37 : Amg::VectorX(2), m_parameterkey(0) {
38 Amg::VectorX::operator[](0) = par1.first;
39 m_parameterkey |= 1 << int(par1.second);
40
41 Amg::VectorX::operator[](1) = par2.first;
42 m_parameterkey |= 1 << int(par2.second);
43}
44
46 double tloc2,
47 double tphi,
48 double ttheta,
49 double tqOverP)
50 : Amg::VectorX(5), m_parameterkey(31) {
51 Amg::VectorX::operator[](0) = tloc1;
52 Amg::VectorX::operator[](1) = tloc2;
53 Amg::VectorX::operator[](2) = tphi;
54 Amg::VectorX::operator[](3) = ttheta;
55 Amg::VectorX::operator[](4) = tqOverP;
56}
57
58Trk::LocalParameters::LocalParameters(const std::vector<Trk::DefinedParameter>& parms)
59 : Amg::VectorX(parms.size()),
61 const size_t parSize = parms.size();
62 assert(parSize > 0 && parSize <= 5);
63 // fill the Amg::VectorX
64 std::vector<Trk::DefinedParameter>::const_iterator parIter = parms.begin();
65 for (size_t idx = 0; idx < parSize; ++idx) {
66 Amg::VectorX::operator[](idx) = parIter->first;
67 m_parameterkey |= 1 << int(parIter->second);
68 ++parIter;
69 }
70}
71
73 return s_projectionMatrices.reductionMatrix(m_parameterkey);
74}
75
77 return s_projectionMatrices.expansionMatrix(m_parameterkey);
78}
79
81{
82 if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) {
83 return Amg::VectorX::operator[](par);
84 }
85 return Amg::VectorX::operator[](
86 s_projectionMatrices.accessor(m_parameterkey, par));
87}
88
90{
91 if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) {
92 return Amg::VectorX::operator[](par);
93 }
94 return Amg::VectorX::operator[](
95 s_projectionMatrices.accessor(m_parameterkey, par));
96}
97
98namespace Trk {
99
101MsgStream& operator << ( MsgStream& sl, const Trk::LocalParameters& lp)
102{
103 std::ostringstream os;
104 os << lp;
105 sl << os.str();
106 return sl;
107}
108
109std::ostream& operator << ( std::ostream& sl, const Trk::LocalParameters& lp)
110{
111 std::streamsize ss = sl.precision();
112 sl << std::setiosflags(std::ios::fixed)<< std::setprecision(3);
113 sl << "Trk::LocalParameters " <<": (";
114 for (int ipar=0; ipar<lp.dimension(); ++ipar)
115 { sl << lp(ipar);
116 if (ipar+1 < lp.dimension()) { sl << ", ";
117 } else { sl << ") - key: "<< lp.m_parameterkey << "(";}
118 }
119
120 for (int itag = 0, ipos=1; itag<5; ++itag, ipos*=2)
121 { bool bit = (lp.m_parameterkey & ipos);
122 if (bit) { sl << "1";
123 } else { sl << "0";
124 }
125 }
126 sl << ")";
127 sl.precision (ss); sl<<std::resetiosflags(std::ios::fixed);
128
129
130 return sl;
131}
132
133
134} // namespace Trk
135
136
static Double_t ss
const Amg::MatrixX & reductionMatrix() const
Reduction matrix from 5x5 to the [dimension()]x[dimension()].
LocalParameters()=default
Default constructor used for POOL.
const Amg::MatrixX & expansionMatrix() const
Expansion matrix from 5x5 to the [dimension()]x[dimension()].
int dimension() const
Dimension of this localParameters() vector.
const double & operator[](ParamDefs par) const
Read from data members.
the matrices to access the variably-dimensioned local parameters and map them to the defined five tra...
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
Ensure that the ATLAS eigen extensions are properly loaded.
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
ParamDefs
This file defines the parameter enums in the Trk namespace.
Definition ParamDefs.h:32
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...