ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkEvent
TrkEventPrimitives
src
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
11
#include "
TrkEventPrimitives/LocalParameters.h
"
12
#include "
TrkEventPrimitives/DefinedParameter.h
"
13
//Gaudi
14
#include "GaudiKernel/MsgStream.h"
15
#include <typeinfo>
16
#include <sstream>
17
#include <iostream>
18
19
namespace
{
20
const
Trk::ProjectionMatricesSet
s_projectionMatrices(5);
21
}
22
23
Trk::LocalParameters::LocalParameters
(
const
Trk::DefinedParameter
& par1)
24
:
Amg
::VectorX(1),
m_parameterkey
(0) {
25
Amg::VectorX::operator[](0) = par1.first;
26
m_parameterkey
|= 1 << int(par1.second);
27
}
28
29
Trk::LocalParameters::LocalParameters
(
const
Amg::Vector2D
& lp)
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
35
Trk::LocalParameters::LocalParameters
(
const
Trk::DefinedParameter
& par1,
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
45
Trk::LocalParameters::LocalParameters
(
double
tloc1,
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
58
Trk::LocalParameters::LocalParameters
(
const
std::vector<Trk::DefinedParameter>& parms)
59
:
Amg
::VectorX(parms.
size
()),
60
m_parameterkey
(0) {
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
72
const
Amg::MatrixX
&
Trk::LocalParameters::reductionMatrix
()
const
{
73
return
s_projectionMatrices.reductionMatrix(
m_parameterkey
);
74
}
75
76
const
Amg::MatrixX
&
Trk::LocalParameters::expansionMatrix
()
const
{
77
return
s_projectionMatrices.expansionMatrix(
m_parameterkey
);
78
}
79
80
const
double
&
Trk::LocalParameters::operator[]
(
ParamDefs
par)
const
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
89
double
&
Trk::LocalParameters::operator[]
(
ParamDefs
par)
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
98
namespace
Trk
{
99
101
MsgStream&
operator <<
( MsgStream& sl,
const
Trk::LocalParameters
& lp)
102
{
103
std::ostringstream os;
104
os << lp;
105
sl << os.str();
106
return
sl;
107
}
108
109
std::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
DefinedParameter.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
LocalParameters.h
size
size_t size() const
Number of registered mappings.
Trk::LocalParameters
Definition
LocalParameters.h:100
Trk::LocalParameters::reductionMatrix
const Amg::MatrixX & reductionMatrix() const
Reduction matrix from 5x5 to the [dimension()]x[dimension()].
Definition
LocalParameters.cxx:72
Trk::LocalParameters::LocalParameters
LocalParameters()=default
Default constructor used for POOL.
Trk::LocalParameters::m_parameterkey
int m_parameterkey
Definition
LocalParameters.h:181
Trk::LocalParameters::expansionMatrix
const Amg::MatrixX & expansionMatrix() const
Expansion matrix from 5x5 to the [dimension()]x[dimension()].
Definition
LocalParameters.cxx:76
Trk::LocalParameters::dimension
int dimension() const
Dimension of this localParameters() vector.
Trk::LocalParameters::operator[]
const double & operator[](ParamDefs par) const
Read from data members.
Definition
LocalParameters.cxx:80
Trk::ProjectionMatricesSet
the matrices to access the variably-dimensioned local parameters and map them to the defined five tra...
Definition
ProjectionMatricesSet.h:29
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::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition
AlignModule.cxx:204
Trk::ParamDefs
ParamDefs
This file defines the parameter enums in the Trk namespace.
Definition
ParamDefs.h:32
Trk::locY
@ locY
local cartesian
Definition
ParamDefs.h:38
Trk::locX
@ locX
Definition
ParamDefs.h:37
Trk::DefinedParameter
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...
Definition
DefinedParameter.h:27
Generated on
for ATLAS Offline Software by
1.17.0