ATLAS Offline Software
Public Member Functions | Protected Attributes | Friends | List of all members
Trk::LocalParameters Class Reference

#include <LocalParameters.h>

Inheritance diagram for Trk::LocalParameters:
Collaboration diagram for Trk::LocalParameters:

Public Member Functions

 LocalParameters ()=default
 Default constructor used for POOL. More...
 
 LocalParameters (const LocalParameters &)=default
 
 LocalParameters (LocalParameters &&)=default
 
LocalParametersoperator= (const LocalParameters &)=default
 
LocalParametersoperator= (LocalParameters &&)=default
 
 ~LocalParameters ()=default
 
 LocalParameters (const DefinedParameter &one)
 Explicit constructor for 1-dimensional vector. More...
 
 LocalParameters (const DefinedParameter &one, const DefinedParameter &two)
 Explicit constructor for 2-dimensional vector. More...
 
 LocalParameters (const Amg::Vector2D &lp)
 Explicit constructor from LocalPosition. More...
 
 LocalParameters (double locone, double loctwo, double tphi, double ttheta, double tqOverp)
 Explicit constructor for full 5 parameter vector - respect the order. More...
 
template<size_t N>
 LocalParameters (const std::array< DefinedParameter, N > &parms)
 constructor for N Dim size known at compile time More...
 
 LocalParameters (const std::vector< DefinedParameter > &parms)
 constructor for N Dim size not known at compile time
More...
 
LocalParametersclone () const
 Pseudo-constructor. More...
 
const Amg::MatrixXreductionMatrix () const
 Reduction matrix from 5x5 to the [dimension()]x[dimension()]. More...
 
const Amg::MatrixXexpansionMatrix () const
 Expansion matrix from 5x5 to the [dimension()]x[dimension()]. More...
 
const Amg::VectorXasVector () const
 Amg Vector representation. More...
 
int dimension () const
 Dimension of this localParameters() vector. More...
 
int parameterKey () const
 Identifier key for matrix expansion/reduction. More...
 
bool contains (ParamDefs par) const
 The simple check for the clients whether the parameter is contained. More...
 
const double & operator[] (ParamDefs par) const
 Read from data members. More...
 
double & operator[] (ParamDefs par)
 Write data members. More...
 
double get (ParamDefs par) const
 Retrieve specified parameter (const version). More...
 
double get (ParamDefs par)
 Retrieve specified parameter. More...
 

Protected Attributes

int m_parameterkey = 0
 

Friends

class ::LocalParametersCnv_p1
 
MsgStream & operator<< (MsgStream &sl, const LocalParameters &lp)
 Overload of << operator for both, MsgStream and std::ostream for debug output. More...
 
std::ostream & operator<< (std::ostream &sl, const LocalParameters &lp)
 

Detailed Description

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Class inheriting from Amg::VectorX for 1-5 dimensional parameter vectors. It uses a static const projection matrices set for expanding the actual dimension to 5 dimension, respectively reducing a 5 dimensional object to the actual dimension of this object.

The identification is done by a parameter key (integer) that represents a binary number. For technical reasons this binary number has to be read from back to the front to associate it with the five parameters.

For the binary number, the following identification is chosen:

Examples:

loc1 loc2 \( \phi \) \( \theta \) \( \frac{q}{p} \) binary number (mirrored) Parameter - Key Comments
1 1 1 1 1 11111 31 The 'old' track parameters vector
1 0 0 0 0 00001 1 'local position'(measurement) with only one dimension (TRT, MDT)
1 1 0 0 0 00011 3 'local position'(measurement) with only one dimension
1 1 0 1 0 01011 11 hypothetical track segment having 2 local coordinated and \( \theta \) information

The accessors are optimized for full track parameters, 1 dim and 2 dim local parameters.

Definition at line 98 of file LocalParameters.h.

Constructor & Destructor Documentation

◆ LocalParameters() [1/9]

Trk::LocalParameters::LocalParameters ( )
default

Default constructor used for POOL.

◆ LocalParameters() [2/9]

Trk::LocalParameters::LocalParameters ( const LocalParameters )
default

◆ LocalParameters() [3/9]

Trk::LocalParameters::LocalParameters ( LocalParameters &&  )
default

◆ ~LocalParameters()

Trk::LocalParameters::~LocalParameters ( )
default

◆ LocalParameters() [4/9]

Trk::LocalParameters::LocalParameters ( const DefinedParameter one)

Explicit constructor for 1-dimensional vector.

Definition at line 20 of file LocalParameters.cxx.

21  : Amg::VectorX(1), m_parameterkey(0) {
22  Amg::VectorX::operator[](0) = par1.first;
23  m_parameterkey |= 1 << int(par1.second);
24 }

◆ LocalParameters() [5/9]

Trk::LocalParameters::LocalParameters ( const DefinedParameter one,
const DefinedParameter two 
)

Explicit constructor for 2-dimensional vector.

Definition at line 32 of file LocalParameters.cxx.

34  : Amg::VectorX(2), m_parameterkey(0) {
35  Amg::VectorX::operator[](0) = par1.first;
36  m_parameterkey |= 1 << int(par1.second);
37 
38  Amg::VectorX::operator[](1) = par2.first;
39  m_parameterkey |= 1 << int(par2.second);
40 }

◆ LocalParameters() [6/9]

Trk::LocalParameters::LocalParameters ( const Amg::Vector2D lp)

Explicit constructor from LocalPosition.

Definition at line 26 of file LocalParameters.cxx.

27  : Amg::VectorX(2), m_parameterkey(3) {
28  Amg::VectorX::operator[](0) = lp[Trk::locX];
29  Amg::VectorX::operator[](1) = lp[Trk::locY];
30 }

◆ LocalParameters() [7/9]

Trk::LocalParameters::LocalParameters ( double  locone,
double  loctwo,
double  tphi,
double  ttheta,
double  tqOverp 
)

Explicit constructor for full 5 parameter vector - respect the order.

Definition at line 42 of file LocalParameters.cxx.

47  : Amg::VectorX(5), m_parameterkey(31) {
48  Amg::VectorX::operator[](0) = tloc1;
49  Amg::VectorX::operator[](1) = tloc2;
50  Amg::VectorX::operator[](2) = tphi;
51  Amg::VectorX::operator[](3) = ttheta;
52  Amg::VectorX::operator[](4) = tqOverP;
53 }

◆ LocalParameters() [8/9]

template<size_t N>
Trk::LocalParameters::LocalParameters ( const std::array< DefinedParameter, N > &  parms)

constructor for N Dim size known at compile time

◆ LocalParameters() [9/9]

Trk::LocalParameters::LocalParameters ( const std::vector< DefinedParameter > &  parms)

constructor for N Dim size not known at compile time

Definition at line 55 of file LocalParameters.cxx.

56  : Amg::VectorX(parms.size()),
57  m_parameterkey(0) {
58  const size_t parSize = parms.size();
59  assert(parSize > 0 && parSize <= 5);
60  // fill the Amg::VectorX
61  std::vector<Trk::DefinedParameter>::const_iterator parIter = parms.begin();
62  for (size_t idx = 0; idx < parSize; ++idx) {
63  Amg::VectorX::operator[](idx) = parIter->first;
64  m_parameterkey |= 1 << int(parIter->second);
65  ++parIter;
66  }
67 }

Member Function Documentation

◆ asVector()

const Amg::VectorX& Trk::LocalParameters::asVector ( ) const

Amg Vector representation.

◆ clone()

LocalParameters* Trk::LocalParameters::clone ( ) const

Pseudo-constructor.

◆ contains()

bool Trk::LocalParameters::contains ( ParamDefs  par) const

The simple check for the clients whether the parameter is contained.

◆ dimension()

int Trk::LocalParameters::dimension ( ) const

Dimension of this localParameters() vector.

◆ expansionMatrix()

const Amg::MatrixX & Trk::LocalParameters::expansionMatrix ( ) const

Expansion matrix from 5x5 to the [dimension()]x[dimension()].

Definition at line 73 of file LocalParameters.cxx.

73  {
74  return s_projectionMatrices.expansionMatrix(m_parameterkey);
75 }

◆ get() [1/2]

double Trk::LocalParameters::get ( ParamDefs  par)

Retrieve specified parameter.

There is NO check to see if a parameter is contained, so consider using contains(ParamDefs par) to make sure it is actually defined for this object.

Parameters
parParameters requested to be return
Returns
Value of stored parameter (or undefined, if the parameter is not used in this object i.e. be SURE it is!)

◆ get() [2/2]

double Trk::LocalParameters::get ( ParamDefs  par) const

Retrieve specified parameter (const version).

There is NO check to see if a parameter is contained, so consider using contains(ParamDefs par) to make sure it is actually defined for this object.

Parameters
parParameters requested to be return
Returns
Value of stored parameter (or undefined, if the parameter is not used in this object i.e. be SURE it is!)

◆ operator=() [1/2]

LocalParameters& Trk::LocalParameters::operator= ( const LocalParameters )
default

◆ operator=() [2/2]

LocalParameters& Trk::LocalParameters::operator= ( LocalParameters &&  )
default

◆ operator[]() [1/2]

double & Trk::LocalParameters::operator[] ( ParamDefs  par)

Write data members.

Definition at line 86 of file LocalParameters.cxx.

87 {
88  if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) {
89  return Amg::VectorX::operator[](par);
90  }
91  return Amg::VectorX::operator[](
92  s_projectionMatrices.accessor(m_parameterkey, par));
93 }

◆ operator[]() [2/2]

const double & Trk::LocalParameters::operator[] ( ParamDefs  par) const

Read from data members.

Definition at line 77 of file LocalParameters.cxx.

78 {
79  if (m_parameterkey == 31 || m_parameterkey == 1 || m_parameterkey == 3) {
80  return Amg::VectorX::operator[](par);
81  }
82  return Amg::VectorX::operator[](
83  s_projectionMatrices.accessor(m_parameterkey, par));
84 }

◆ parameterKey()

int Trk::LocalParameters::parameterKey ( ) const

Identifier key for matrix expansion/reduction.

◆ reductionMatrix()

const Amg::MatrixX & Trk::LocalParameters::reductionMatrix ( ) const

Reduction matrix from 5x5 to the [dimension()]x[dimension()].

Definition at line 69 of file LocalParameters.cxx.

69  {
70  return s_projectionMatrices.reductionMatrix(m_parameterkey);
71 }

Friends And Related Function Documentation

◆ ::LocalParametersCnv_p1

friend class ::LocalParametersCnv_p1
friend

Definition at line 178 of file LocalParameters.h.

◆ operator<< [1/2]

MsgStream& operator<< ( MsgStream &  sl,
const LocalParameters lp 
)
friend

Overload of << operator for both, MsgStream and std::ostream for debug output.

Definition at line 98 of file LocalParameters.cxx.

99 {
100  std::streamsize ss = sl.precision();
101  sl << std::setiosflags(std::ios::fixed)<< std::setprecision(3);
102  sl << "Trk::LocalParameters " <<": (";
103  for (int ipar=0; ipar<lp.dimension(); ++ipar)
104  { sl << lp(ipar);
105  if (ipar+1 < lp.dimension()) { sl << ", ";
106  } else { sl << ") - key: "<< lp.m_parameterkey << "(";}
107  }
108 
109  for (int itag = 0, ipos=1; itag<5; ++itag, ipos*=2)
110  { bool bit = (lp.m_parameterkey & ipos);
111  if (bit) { sl << "1";
112  } else { sl << "0";}
113  }
114  sl << ")";
115  sl.precision (ss); sl<<std::resetiosflags(std::ios::fixed);
116 
117  return sl;
118 }

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  sl,
const LocalParameters lp 
)
friend

Definition at line 120 of file LocalParameters.cxx.

121 {
122  std::streamsize ss = sl.precision();
123  sl << std::setiosflags(std::ios::fixed)<< std::setprecision(3);
124  sl << "Trk::LocalParameters " <<": (";
125  for (int ipar=0; ipar<lp.dimension(); ++ipar)
126  { sl << lp(ipar);
127  if (ipar+1 < lp.dimension()) { sl << ", ";
128  } else { sl << ") - key: "<< lp.m_parameterkey << "(";}
129  }
130 
131  for (int itag = 0, ipos=1; itag<5; ++itag, ipos*=2)
132  { bool bit = (lp.m_parameterkey & ipos);
133  if (bit) { sl << "1";
134  } else { sl << "0";
135  }
136  }
137  sl << ")";
138  sl.precision (ss); sl<<std::resetiosflags(std::ios::fixed);
139 
140 
141  return sl;
142 }

Member Data Documentation

◆ m_parameterkey

int Trk::LocalParameters::m_parameterkey = 0
protected

Definition at line 179 of file LocalParameters.h.


The documentation for this class was generated from the following files:
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
Trk::LocalParameters::m_parameterkey
int m_parameterkey
Definition: LocalParameters.h:179
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69