ATLAS Offline Software
Classes | Typedefs | Enumerations | Functions
Amg Namespace Reference

Definition of ATLAS Math & Geometry primitives (Amg) More...

Classes

struct  Vector3DComparer
 comparison of two Vector3D, needed for the definition of a std::set<Amg::Vector3D> More...
 
struct  VectorVector3DComparer
 

Typedefs

using Rotation3D = Eigen::Quaternion< double >
 
using Translation3D = Eigen::Translation< double, 3 >
 
using AngleAxis3D = Eigen::AngleAxisd
 
using Transform3D = Eigen::Affine3d
 
using Vector3D = Eigen::Matrix< double, 3, 1 >
 
using Vector2D = Eigen::Matrix< double, 2, 1 >
 
using RotationMatrix3D = Eigen::Matrix< double, 3, 3 >
 
using SetVector3D = std::set< Amg::Vector3D, Vector3DComparer >
 
using SetVectorVector3D = std::set< std::vector< Amg::Vector3D >, VectorVector3DComparer >
 
using MatrixX = Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >
 Dynamic Matrix - dynamic allocation. More...
 
using SymMatrixX = Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >
 
using VectorX = Eigen::Matrix< double, Eigen::Dynamic, 1 >
 Dynamic Vector - dynamic allocation. More...
 
template<int MaxRows, int MaxCols>
using MatrixMaxX = Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxRows, MaxCols >
 Fixed capacity dynamic size types. More...
 
template<int MaxDim>
using SymMatrixMaxX = Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxDim, MaxDim >
 
template<int MaxRows>
using VectorMaxX = Eigen::Matrix< double, Eigen::Dynamic, 1, 0, MaxRows, 1 >
 

Enumerations

enum  AxisDefs {
  x = 0, y = 1, z = 2, px = 0,
  py = 1, pz = 2
}
 element for code readability More...
 

Functions

template<class T >
std::string AsString (const T &m)
 write an Amg Eigen object to std::string More...
 
Amg::Transform3D CLHEPTransformToEigen (const HepGeom::Transform3D &CLHEPtransf)
 Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D. More...
 
RotationMatrix3D CLHEPRotationToEigen (const CLHEP::HepRotation &CLHEProtation)
 Converts a CLHEP::HepRotation into an Eigen-based Amg::RotationMatrix3D. More...
 
Amg::Translation3D CLHEPTranslationToEigen (const CLHEP::Hep3Vector &CLHEPtranslation)
 Converts a CLHEP::Hep3Vector into an Eigen-based Amg::Translation3D. More...
 
Amg::Transform3D CLHEPTranslate3DToEigen (const HepGeom::Translate3D &CLHEPtranslate3D)
 Converts a CLHEP-based HepGeom::Translate3 into an Eigen-based Amg::Transform3D. More...
 
HepGeom::Transform3D EigenTransformToCLHEP (const Amg::Transform3D &eigenTransf)
 Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D. More...
 
Amg::Vector3D Hep3VectorToEigen (const CLHEP::Hep3Vector &CLHEPvector)
 Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D. More...
 
CLHEP::Hep3Vector EigenToHep3Vector (const Amg::Vector3D &eigenvector)
 Converts an Eigen-based Amg::Vector3D into a CLHEP-based CLHEP::Hep3Vector. More...
 
Amg::Vector3D convert_CLHEPPhiThetaPsi_to_EigenEulerAngles (Amg::Vector3D clhep_angles, int convention=0)
 Convert CLEHP Phi,Theta,Psi angles to Eigen euler angles using Z-X-Z convention. More...
 
Amg::Vector3D convert_EigenEulerAngles_to_CLHEPPhiThetaPsi (Amg::Vector3D eigen_angles, int convention=0)
 Convert Eigen euler angles to CLEHP Phi,Theta,Psi angles. More...
 
Amg::Vector3D getPhiThetaPsi (Amg::RotationMatrix3D mat, int convention=0)
 Get the equivalents to CLHEP Phi, Theta, Psi Euler angles. More...
 
Amg::RotationMatrix3D setPhi (Amg::RotationMatrix3D mat, double angle, int convention=0)
 
double angle (const Amg::Vector3D &v1, const Amg::Vector3D &v2)
 calculates the opening angle between two vectors More...
 
float distance2 (const Amg::Vector3D &p1, const Amg::Vector3D &p2)
 calculates the squared distance between two point in 3D space More...
 
float distance (const Amg::Vector3D &p1, const Amg::Vector3D &p2)
 calculates the distance between two point in 3D space More...
 
void setPhi (Amg::Vector3D &v, double phi)
 sets the phi angle of a vector without changing theta nor the magnitude More...
 
void setThetaPhi (Amg::Vector3D &v, double theta, double phi)
 sets the theta and phi angle of a vector without changing the magnitude More...
 
void setRThetaPhi (Amg::Vector3D &v, double r, double theta, double phi)
 sets radius, the theta and phi angle of a vector. More...
 
void setTheta (Amg::Vector3D &v, double theta)
 sets the theta of a vector without changing phi nor the magnitude More...
 
void setPerp (Amg::Vector3D &v, double perp)
 scales the vector in the xy plane without changing the z coordinate nor the angles More...
 
void setMag (Amg::Vector3D &v, double mag)
 scales the vector length without changing the angles More...
 
double deltaPhi (const Amg::Vector3D &v1, const Amg::Vector3D &v2)
 
double deltaR (const Amg::Vector3D &v1, const Amg::Vector3D &v2)
 
void setVector3DCartesian (Amg::Vector3D &v1, double x1, double y1, double z1)
 Sets components in cartesian coordinate system. More...
 
double mag2Vector3D (const Amg::Vector3D &v1)
 Gets magnitude squared of the vector. More...
 
double magVector3D (const Amg::Vector3D &v1)
 Gets magnitude of the vector. More...
 
double rVector3D (const Amg::Vector3D &v1)
 Gets r-component in spherical coordinate system. More...
 
Amg::Vector3D transform (Amg::Vector3D &v, Amg::Transform3D &tr)
 Transform a point from a Trasformation3D. More...
 
Amg::Transform3D getTransformFromRotTransl (Amg::RotationMatrix3D rot, Amg::Vector3D transl_vec)
 
void getAngleAxisFromRotation (Amg::RotationMatrix3D &rotation, double &rotationAngle, Amg::Vector3D &rotationAxis)
 
Amg::Vector3D getTranslationVectorFromTransform (const Amg::Transform3D &tr)
 Get the Translation vector out of a Transformation. More...
 
Amg::Rotation3D getRotation3DfromAngleAxis (double angle, Amg::Vector3D &axis)
 get a AngleAxis from an angle and an axis. More...
 
Amg::Transform3D getRotateX3D (double angle)
 get a rotation transformation around X-axis More...
 
Amg::Transform3D getRotateY3D (double angle)
 get a rotation transformation around Y-axis More...
 
Amg::Transform3D getRotateZ3D (double angle)
 get a rotation transformation around Z-axis More...
 
Amg::Transform3D getTranslateX3D (const double X)
 : Returns a shift transformation along the x-axis More...
 
Amg::Transform3D getTranslateY3D (const double Y)
 : Returns a shift transformation along the y-axis More...
 
Amg::Transform3D getTranslateZ3D (const double Z)
 : Returns a shift transformation along the z-axis More...
 
Amg::Transform3D getTranslate3D (const double X, const double Y, const double Z)
 : Returns a shift transformation along an arbitrary axis More...
 
Amg::Transform3D getTranslate3D (const Amg::Vector3D &v)
 : Returns a shift transformation along an arbitrary axis More...
 
template<int N>
double lineDistance (const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
 Calculates the shortest distance between two lines posA: offset point of line A dirA: orientation of line A (unit length) posB: offset point of line B dirB: orientation of line B (unit length) More...
 
template<int N>
std::optional< double > intersect (const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
 Calculates the point of closest approach of two lines. More...
 
template<int N>
std::optional< double > intersect (const AmgVector(N)&pos, const AmgVector(N)&dir, const AmgVector(N)&planeNorm, const double offset)
 Intersects a line parametrized as A + lambda * B with the (N-1) dimensional hyperplane that's given in the Hesse normal form <P, N> - C = 0
More...
 
bool doesNotDeform (const Amg::Transform3D &trans)
 Checks whether the linear part of the transformation rotates or stetches any of the basis vectors. More...
 
bool isIdentity (const Amg::Transform3D &trans)
 Checks whether the transformation is the Identity transformation. More...
 
std::string toString (const Translation3D &translation, int precision=4)
 GeoPrimitvesToStringConverter. More...
 
std::string toString (const Transform3D &transform, int precision=4, const std::string &rotOffSet="")
 
std::string toString (const CLHEP::HepRotation &rot, int precision=4, const std::string &offset="")
 
std::string toString (const CLHEP::Hep3Vector &translation, int precision=4)
 
std::string toString (const CLHEP::Hep2Vector &translation, int precision=4)
 
std::string toString (const HepGeom::Transform3D &transf, int precision=4, const std::string &offset="")
 
bool saneCovarianceElement (double ele)
 A covariance matrix formally needs to be positive semi definite. More...
 
template<int N>
bool hasPositiveOrZeroDiagElems (const AmgSymMatrix(N) &mat)
 Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above definition. More...
 
bool hasPositiveOrZeroDiagElems (const Amg::MatrixX &mat)
 
template<int N>
bool hasPositiveDiagElems (const AmgSymMatrix(N) &mat)
 Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above definition. More...
 
bool hasPositiveDiagElems (const Amg::MatrixX &mat)
 
template<int N>
bool isPositiveSemiDefinite (const AmgSymMatrix(N) &mat)
 Check if is positive semidefinit using that fact that is needed for Cholesky decomposition. More...
 
bool isPositiveSemiDefinite (const Amg::MatrixX &mat)
 
template<int N>
bool isPositiveDefinite (const AmgSymMatrix(N) &mat)
 Check if is positive semidefinit using that fact that is needed for Cholesky decomposition. More...
 
bool isPositiveDefinite (const Amg::MatrixX &mat)
 
template<int N>
bool isPositiveSemiDefiniteSlow (const AmgSymMatrix(N) &mat)
 These are the slow test following the definition. More...
 
bool isPositiveSemiDefiniteSlow (const Amg::MatrixX &mat)
 
template<int N>
bool isPositiveDefiniteSlow (const AmgSymMatrix(N) &mat)
 
bool isPositiveDefiniteSlow (const Amg::MatrixX &mat)
 
template<typename T , typename U >
double chi2 (const T &precision, const U &residual, const int sign=1)
 
template<int N>
bool saneVector (const AmgVector(N) &vec)
 
double error (const Amg::MatrixX &mat, int index)
 return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in range More...
 
template<int N>
double error (const AmgSymMatrix(N) &mat, int index)
 
constexpr int CalculateCompressedSize (int n)
 
template<int N>
void compress (const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
 
void compress (const MatrixX &covMatrix, std::vector< float > &vec)
 
template<int N>
void expand (std::vector< float >::const_iterator it, std::vector< float >::const_iterator, AmgSymMatrix(N) &covMatrix)
 
void expand (std::vector< float >::const_iterator it, std::vector< float >::const_iterator it_end, MatrixX &covMatrix)
 
template<int N>
std::pair< int, int > compare (const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
 compare two matrices, returns the indices of the first element that fails the condition, returns <-1,-1> if all is ok Users can provide the required precision and whether the difference should be evaluate relative to the values or absolutely More...
 
template<int N>
int compare (const AmgVector(N) &m1, const AmgVector(N) &m2, double precision=1e-9, bool relative=false)
 compare two vectors, returns the indices of the first element that fails the condition, returns <-1,-1> if all is ok Users can provide the required precision and whether the difference should be evaluate relative to the values or absolutely More...
 
double roundWithPrecision (double val, int precision)
 EventPrimitvesToStringConverter. More...
 
std::string toString (const MatrixX &matrix, int precision=4, const std::string &offset="")
 

Detailed Description

Definition of ATLAS Math & Geometry primitives (Amg)

Event primitives helper functions.

Event Primitives Covariance Helper Functions.

Geometry primitives helper functions.

This is based on the Eigen geometry module: http://eigen.tuxfamily.org/dox/group__Geometry__Module.html

Author
Robert Johannes Langenberg rober.nosp@m.t.la.nosp@m.ngenb.nosp@m.erg@.nosp@m.cern..nosp@m.ch
Andreas Salzburger Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch
Riccardo Maria BIANCHI ricca.nosp@m.rdo..nosp@m.maria.nosp@m..bia.nosp@m.nchi@.nosp@m.cern.nosp@m..ch
Niels van Eldik
Robert Johannes Langenberg rober.nosp@m.t.la.nosp@m.ngenb.nosp@m.erg@.nosp@m.cern..nosp@m.ch
Andreas Salzburger Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch
Christos Anastopoulos
Johannes Junggeburth
Niels van Eldik
Robert Johannes Langenberg
Andreas Salzburger
Johannes Junggeburth

Typedef Documentation

◆ AngleAxis3D

using Amg::AngleAxis3D = typedef Eigen::AngleAxisd

Definition at line 45 of file GeoPrimitives.h.

◆ MatrixMaxX

template<int MaxRows, int MaxCols>
using Amg::MatrixMaxX = typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxRows, MaxCols>

Fixed capacity dynamic size types.

Avoid dynamic allocations. Helpfull if we do not know the exact but a max size. But we potentially waste some space

Definition at line 36 of file EventPrimitives.h.

◆ MatrixX

using Amg::MatrixX = typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>

Dynamic Matrix - dynamic allocation.

Definition at line 27 of file EventPrimitives.h.

◆ Rotation3D

using Amg::Rotation3D = typedef Eigen::Quaternion<double>

Definition at line 43 of file GeoPrimitives.h.

◆ RotationMatrix3D

using Amg::RotationMatrix3D = typedef Eigen::Matrix<double, 3, 3>

Definition at line 49 of file GeoPrimitives.h.

◆ SetVector3D

using Amg::SetVector3D = typedef std::set<Amg::Vector3D, Vector3DComparer>

Definition at line 35 of file GeoPrimitivesHelpers.h.

◆ SetVectorVector3D

using Amg::SetVectorVector3D = typedef std::set< std::vector< Amg::Vector3D>, VectorVector3DComparer>

Definition at line 36 of file GeoPrimitivesHelpers.h.

◆ SymMatrixMaxX

template<int MaxDim>
using Amg::SymMatrixMaxX = typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, MaxDim, MaxDim>

Definition at line 40 of file EventPrimitives.h.

◆ SymMatrixX

using Amg::SymMatrixX = typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>

Definition at line 28 of file EventPrimitives.h.

◆ Transform3D

using Amg::Transform3D = typedef Eigen::Affine3d

Definition at line 46 of file GeoPrimitives.h.

◆ Translation3D

using Amg::Translation3D = typedef Eigen::Translation<double, 3>

Definition at line 44 of file GeoPrimitives.h.

◆ Vector2D

using Amg::Vector2D = typedef Eigen::Matrix<double, 2, 1>

Definition at line 48 of file GeoPrimitives.h.

◆ Vector3D

using Amg::Vector3D = typedef Eigen::Matrix<double, 3, 1>

Definition at line 47 of file GeoPrimitives.h.

◆ VectorMaxX

template<int MaxRows>
using Amg::VectorMaxX = typedef Eigen::Matrix<double, Eigen::Dynamic, 1, 0, MaxRows, 1>

Definition at line 44 of file EventPrimitives.h.

◆ VectorX

using Amg::VectorX = typedef Eigen::Matrix<double, Eigen::Dynamic, 1>

Dynamic Vector - dynamic allocation.

Definition at line 30 of file EventPrimitives.h.

Enumeration Type Documentation

◆ AxisDefs

element for code readability

  • please use these for access to the member variables if needed, e.g. double z = position[Amg::z]; double px = momentum[Amg::px];
Enumerator
px 
py 
pz 

Definition at line 32 of file GeoPrimitives.h.

32  {
33  // position access
34  x = 0,
35  y = 1,
36  z = 2,
37  // momentum access
38  px = 0,
39  py = 1,
40  pz = 2
41  };

Function Documentation

◆ angle()

double Amg::angle ( const Amg::Vector3D v1,
const Amg::Vector3D v2 
)
inline

calculates the opening angle between two vectors

Definition at line 41 of file GeoPrimitivesHelpers.h.

41  {
42  const double dp = std::clamp(v1.dot(v2) / (v1.mag() * v2.mag()), -1. ,1.);
43  return std::acos(dp);
44 }

◆ AsString()

template<class T >
std::string Amg::AsString ( const T &  m)

write an Amg Eigen object to std::string

Definition at line 26 of file AmgStringHelpers.h.

26  {
27  std::stringstream tmp;
28  tmp << m; // we just use eigen classes capability to write to std::ostream
29  return tmp.str();
30 }

◆ CalculateCompressedSize()

constexpr int Amg::CalculateCompressedSize ( int  n)
inlineconstexpr

Definition at line 51 of file EventPrimitivesHelpers.h.

51  {
52  return (n * (n + 1)) / 2;
53 }

◆ chi2()

template<typename T , typename U >
double Amg::chi2 ( const T &  precision,
const U &  residual,
const int  sign = 1 
)
inline

Definition at line 221 of file EventPrimitivesCovarianceHelpers.h.

221  {
222  return sign * residual.transpose() * precision * residual;
223 }

◆ CLHEPRotationToEigen()

RotationMatrix3D Amg::CLHEPRotationToEigen ( const CLHEP::HepRotation &  CLHEProtation)
inline

Converts a CLHEP::HepRotation into an Eigen-based Amg::RotationMatrix3D.

Parameters
CLHEProtationA CLHEP::HepRotation.
Returns
An Eigen-based Amg::RotationMatrix3D.

Definition at line 63 of file CLHEPtoEigenConverter.h.

64  {
66 
67  t(0, 0) = CLHEProtation(0, 0);
68  t(0, 1) = CLHEProtation(0, 1);
69  t(0, 2) = CLHEProtation(0, 2);
70  t(1, 0) = CLHEProtation(1, 0);
71  t(1, 1) = CLHEProtation(1, 1);
72  t(1, 2) = CLHEProtation(1, 2);
73  t(2, 0) = CLHEProtation(2, 0);
74  t(2, 1) = CLHEProtation(2, 1);
75  t(2, 2) = CLHEProtation(2, 2);
76  return t;
77  }

◆ CLHEPTransformToEigen()

Amg::Transform3D Amg::CLHEPTransformToEigen ( const HepGeom::Transform3D &  CLHEPtransf)
inline

Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.

Parameters
CLHEPtransfA CLHEP-based HepGeom::Transform3D.
Returns
An Eigen-based Amg::Transform3D.

Definition at line 38 of file CLHEPtoEigenConverter.h.

39  {
41  //loop unrolled for performance
42  t(0, 0) = CLHEPtransf(0, 0);
43  t(0, 1) = CLHEPtransf(0, 1);
44  t(0, 2) = CLHEPtransf(0, 2);
45  t(1, 0) = CLHEPtransf(1, 0);
46  t(1, 1) = CLHEPtransf(1, 1);
47  t(1, 2) = CLHEPtransf(1, 2);
48  t(2, 0) = CLHEPtransf(2, 0);
49  t(2, 1) = CLHEPtransf(2, 1);
50  t(2, 2) = CLHEPtransf(2, 2);
51  t(0, 3) = CLHEPtransf(0, 3);
52  t(1, 3) = CLHEPtransf(1, 3);
53  t(2, 3) = CLHEPtransf(2, 3);
54  return t;
55  }

◆ CLHEPTranslate3DToEigen()

Amg::Transform3D Amg::CLHEPTranslate3DToEigen ( const HepGeom::Translate3D &  CLHEPtranslate3D)
inline

Converts a CLHEP-based HepGeom::Translate3 into an Eigen-based Amg::Transform3D.

Parameters
CLHEPtranslate3DA CLHEP-based HepGeom::Translate3.
Returns
An Eigen-based Amg::Transform3D.

Definition at line 99 of file CLHEPtoEigenConverter.h.

101  {
102  // from: http://proj-clhep.web.cern.ch/proj-clhep/doc/CLHEP_2_0_4_7/doxygen/html/classHepGeom_1_1Translate3D.html#f2df65781931c7df9cc2858de2c89151
103  //Amg::Transform3D(1, 0, 0, CLHEPtranslate3D[0],
104  // 0, 1, 0, CLHEPtranslate3D[1],
105  // 0, 0, 1, CLHEPtranslate3D[2]);
107  t.setIdentity();
108  t(0, 3) = CLHEPtranslate3D(0, 3);
109  t(1, 3) = CLHEPtranslate3D(1, 3);
110  t(2, 3) = CLHEPtranslate3D(2, 3);
111  return t;
112  }

◆ CLHEPTranslationToEigen()

Amg::Translation3D Amg::CLHEPTranslationToEigen ( const CLHEP::Hep3Vector &  CLHEPtranslation)
inline

Converts a CLHEP::Hep3Vector into an Eigen-based Amg::Translation3D.

Parameters
CLHEPtranslationA CLHEP::Hep3Vector.
Returns
An Eigen-based Amg::Translation3D.

Definition at line 85 of file CLHEPtoEigenConverter.h.

86  {
87  return Amg::Translation3D(
88  Vector3D(CLHEPtranslation[0], CLHEPtranslation[1],
89  CLHEPtranslation[2]));
90  }

◆ compare() [1/2]

template<int N>
std::pair<int, int> Amg::compare ( const AmgSymMatrix(N) &  m1,
const AmgSymMatrix(N) &  m2,
double  precision = 1e-9,
bool  relative = false 
)

compare two matrices, returns the indices of the first element that fails the condition, returns <-1,-1> if all is ok Users can provide the required precision and whether the difference should be evaluate relative to the values or absolutely

Definition at line 109 of file EventPrimitivesHelpers.h.

111  {
112  for (int i = 0; i < N; ++i) {
113  for (int j = 0; j < N; ++j) {
114  if (relative) {
115  if (0.5 * std::abs(m1(i, j) - m2(i, j)) / (m1(i, j) + m2(i, j)) >
116  precision) {
117  return std::make_pair(i, j);
118  }
119  } else {
120  if (std::abs(m1(i, j) - m2(i, j)) > precision) {
121  return std::make_pair(i, j);
122  }
123  }
124  }
125  }
126  return std::make_pair(-1, -1);
127 }

◆ compare() [2/2]

template<int N>
int Amg::compare ( const AmgVector(N) &  m1,
const AmgVector(N) &  m2,
double  precision = 1e-9,
bool  relative = false 
)

compare two vectors, returns the indices of the first element that fails the condition, returns <-1,-1> if all is ok Users can provide the required precision and whether the difference should be evaluate relative to the values or absolutely

Definition at line 135 of file EventPrimitivesHelpers.h.

136  {
137  for (int i = 0; i < N; ++i) {
138  if (relative) {
139  if (0.5 * std::abs(m1(i) - m2(i)) / (m1(i) + m2(i)) > precision)
140  return i;
141  } else {
142  if (std::abs(m1(i) - m2(i)) > precision)
143  return i;
144  }
145  }
146  return -1;
147 }

◆ compress() [1/2]

template<int N>
void Amg::compress ( const AmgSymMatrix(N) &  covMatrix,
std::vector< float > &  vec 
)
inline

Definition at line 56 of file EventPrimitivesHelpers.h.

57  {
58  vec.reserve(CalculateCompressedSize(N));
59  for (unsigned int i = 0; i < N; ++i)
60  for (unsigned int j = 0; j <= i; ++j)
61  vec.emplace_back(covMatrix(i, j));
62 }

◆ compress() [2/2]

void Amg::compress ( const MatrixX covMatrix,
std::vector< float > &  vec 
)
inline

Definition at line 64 of file EventPrimitivesHelpers.h.

64  {
65  int rows = covMatrix.rows();
67  for (int i = 0; i < rows; ++i) {
68  for (int j = 0; j <= i; ++j) {
69  vec.emplace_back(covMatrix(i, j));
70  }
71  }
72 }

◆ convert_CLHEPPhiThetaPsi_to_EigenEulerAngles()

Amg::Vector3D Amg::convert_CLHEPPhiThetaPsi_to_EigenEulerAngles ( Amg::Vector3D  clhep_angles,
int  convention = 0 
)
inline

Convert CLEHP Phi,Theta,Psi angles to Eigen euler angles using Z-X-Z convention.

N.B. if "convention = 0" --> "Z-X-Z" convention ==> DEFAULT!! if "convention = 1" --> "Z-Y-Z"

Definition at line 34 of file CLHEPtoEigenEulerAnglesConverters.h.

35 {
36  Amg::Vector3D eigen_angles;
37 
38  // using Z-X-Z convention (CLHEP): (2,0,2) == "Z,X,Z". // DEFAULT
39  if (convention == 0) {
40  eigen_angles(2) = -clhep_angles(0); // Phi-->Z
41  eigen_angles(1) = -clhep_angles(1); // Theta-->X
42  eigen_angles(0) = -clhep_angles(2); // Psi-->Z
43  }
44  // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
45  else {
46  eigen_angles(0) = -0.5 * clhep_angles(0); // Phi-->Z
47  eigen_angles(1) = clhep_angles(1); // Theta-->Y
48  eigen_angles(2) = clhep_angles(2); // Psi-->Z
49  }
50 
51  return eigen_angles;
52 }

◆ convert_EigenEulerAngles_to_CLHEPPhiThetaPsi()

Amg::Vector3D Amg::convert_EigenEulerAngles_to_CLHEPPhiThetaPsi ( Amg::Vector3D  eigen_angles,
int  convention = 0 
)
inline

Convert Eigen euler angles to CLEHP Phi,Theta,Psi angles.

N.B. if "convention = 0" --> "Z-X-Z" convention ==> DEFAULT!! if "convention = 1" --> "Z-Y-Z" convention

Note: as explained in: eigen / Eigen / src / Geometry / EulerAngles.h the returned angles are in the ranges [0:pi]x[-pi:pi]x[-pi:pi]

(source here: https://bitbucket.org/eigen/eigen/src/42e011583bceb055a43fa688622e828fbbabf818/Eigen/src/Geometry/EulerAngles.h)

N.B.!! CLHEP's Phi, Theta, Psi correspond to eulerAngles[2], [1] and [0] respectively, with the sign inverted.

Definition at line 62 of file CLHEPtoEigenEulerAnglesConverters.h.

63 {
64  Amg::Vector3D clhep_angles;
65 
66  double phi;
67  double theta;
68  double psi;
69 
84  // using Z-X-Z convention: (2,0,2) == "Z,X,Z". // DEFAULT
85  if (convention == 0) {
86  phi = -eigen_angles(2); // Z-->Phi
87  theta = -eigen_angles(1); // X-->Theta
88  psi = -eigen_angles(0); // Z-->Psi
89  }
90  // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
91  else {
92  phi = -2 * eigen_angles(0); // Z-->Phi
93  theta = eigen_angles(1); // Y-->Theta
94  psi = eigen_angles(2); // Z-->Psi
95  }
96 
97  clhep_angles(0) = phi;
98  clhep_angles(1) = theta;
99  clhep_angles(2) = psi;
100 
101  return clhep_angles;
102 
103 }

◆ deltaPhi()

double Amg::deltaPhi ( const Amg::Vector3D v1,
const Amg::Vector3D v2 
)
inline

Definition at line 113 of file GeoPrimitivesHelpers.h.

113  {
114  double dphi = v2.phi() - v1.phi();
115  if (dphi > M_PI) {
116  dphi -= M_PI*2;
117  } else if (dphi <= -M_PI) {
118  dphi += M_PI*2;
119  }
120  return dphi;
121 }

◆ deltaR()

double Amg::deltaR ( const Amg::Vector3D v1,
const Amg::Vector3D v2 
)
inline

Definition at line 122 of file GeoPrimitivesHelpers.h.

122  {
123  double a = v1.eta() - v2.eta();
124  double b = deltaPhi(v1,v2);
125  return sqrt(a*a + b*b);
126 }

◆ distance()

float Amg::distance ( const Amg::Vector3D p1,
const Amg::Vector3D p2 
)
inline

calculates the distance between two point in 3D space

Definition at line 54 of file GeoPrimitivesHelpers.h.

54  {
55  return std::sqrt( distance2(p1, p2) );
56 }

◆ distance2()

float Amg::distance2 ( const Amg::Vector3D p1,
const Amg::Vector3D p2 
)
inline

calculates the squared distance between two point in 3D space

Definition at line 48 of file GeoPrimitivesHelpers.h.

48  {
49  float dx = p2.x()-p1.x(), dy = p2.y()-p1.y(), dz = p2.z()-p1.z();
50  return dx*dx + dy*dy + dz*dz;
51 }

◆ doesNotDeform()

bool Amg::doesNotDeform ( const Amg::Transform3D trans)
inline

Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.

Definition at line 361 of file GeoPrimitivesHelpers.h.

361  {
362  for (unsigned int d = 0; d < 3 ; ++d) {
363  const double defLength = Amg::Vector3D::Unit(d).dot(trans.linear() * Amg::Vector3D::Unit(d));
364  if (std::abs(defLength - 1.) > std::numeric_limits<float>::epsilon()) {
365  return false;
366  }
367  }
368  return true;
369 }

◆ EigenToHep3Vector()

CLHEP::Hep3Vector Amg::EigenToHep3Vector ( const Amg::Vector3D eigenvector)
inline

Converts an Eigen-based Amg::Vector3D into a CLHEP-based CLHEP::Hep3Vector.

Parameters
eigenvectorAn Eigen-based Amg::Vector3D.
Returns
A CLHEP-based CLHEP::Hep3Vector.

Definition at line 147 of file CLHEPtoEigenConverter.h.

147  {
148  return CLHEP::Hep3Vector(eigenvector[0], eigenvector[1], eigenvector[2]);
149  }

◆ EigenTransformToCLHEP()

HepGeom::Transform3D Amg::EigenTransformToCLHEP ( const Amg::Transform3D eigenTransf)
inline

Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.

Parameters
eigenTransfAn Eigen-based Amg::Transform3D.
Returns
A CLHEP-based HepGeom::Transform3D.

Definition at line 120 of file CLHEPtoEigenConverter.h.

121  {
122  CLHEP::HepRotation rotation(
123  CLHEP::Hep3Vector(eigenTransf(0, 0), eigenTransf(1, 0), eigenTransf(2, 0)),
124  CLHEP::Hep3Vector(eigenTransf(0, 1), eigenTransf(1, 1), eigenTransf(2, 1)),
125  CLHEP::Hep3Vector(eigenTransf(0, 2), eigenTransf(1, 2), eigenTransf(2, 2)));
126  CLHEP::Hep3Vector translation(eigenTransf(0, 3), eigenTransf(1, 3), eigenTransf(2, 3));
127  HepGeom::Transform3D t(rotation, translation);
128  return t;
129  }

◆ error() [1/2]

double Amg::error ( const Amg::MatrixX mat,
int  index 
)
inline

return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in range

Definition at line 40 of file EventPrimitivesHelpers.h.

40  {
41  return std::sqrt(mat(index, index));
42 }

◆ error() [2/2]

template<int N>
double Amg::error ( const AmgSymMatrix(N) &  mat,
int  index 
)
inline

Definition at line 44 of file EventPrimitivesHelpers.h.

44  {
45  assert(index < N);
46  return std::sqrt(mat(index, index));
47 }

◆ expand() [1/2]

void Amg::expand ( std::vector< float >::const_iterator  it,
std::vector< float >::const_iterator  it_end,
MatrixX covMatrix 
)
inline

Definition at line 86 of file EventPrimitivesHelpers.h.

88  {
89  unsigned int dist = std::distance(it, it_end);
90  unsigned int n;
91  for (n = 1; dist > n; ++n) {
92  dist = dist - n;
93  }
94  covMatrix = MatrixX(n, n);
95  for (unsigned int i = 0; i < n; ++i) {
96  for (unsigned int j = 0; j <= i; ++j) {
97  covMatrix.fillSymmetric(i, j, *it);
98  ++it;
99  }
100  }
101 }

◆ expand() [2/2]

template<int N>
void Amg::expand ( std::vector< float >::const_iterator  it,
std::vector< float >::const_iterator  ,
AmgSymMatrix(N) &  covMatrix 
)
inline

Definition at line 75 of file EventPrimitivesHelpers.h.

77  {
78  for (unsigned int i = 0; i < N; ++i) {
79  for (unsigned int j = 0; j <= i; ++j) {
80  covMatrix.fillSymmetric(i, j, *it);
81  ++it;
82  }
83  }
84 }

◆ getAngleAxisFromRotation()

void Amg::getAngleAxisFromRotation ( Amg::RotationMatrix3D rotation,
double &  rotationAngle,
Amg::Vector3D rotationAxis 
)
inline

Definition at line 192 of file GeoPrimitivesHelpers.h.

193 {
194  rotationAngle = 0.;
195 
196  double xx = rotation(0,0);
197  double yy = rotation(1,1);
198  double zz = rotation(2,2);
199 
200  double cosa = 0.5 * (xx + yy + zz - 1);
201  double cosa1 = 1 - cosa;
202 
203  if (cosa1 <= 0) {
204  rotationAngle = 0;
205  rotationAxis = Amg::Vector3D(0,0,1);
206  }
207  else{
208  double x=0, y=0, z=0;
209  if (xx > cosa) x = std::sqrt((xx-cosa)/cosa1);
210  if (yy > cosa) y = std::sqrt((yy-cosa)/cosa1);
211  if (zz > cosa) z = std::sqrt((zz-cosa)/cosa1);
212  if (rotation(2,1) < rotation(1,2)) x = -x;
213  if (rotation(0,2) < rotation(2,0)) y = -y;
214  if (rotation(1,0) < rotation(0,1)) z = -z;
215  rotationAngle = (cosa < -1.) ? std::acos(-1.) : std::acos(cosa);
216  rotationAxis = Amg::Vector3D(x,y,z);
217  }
218 
219  return;
220 }

◆ getPhiThetaPsi()

Amg::Vector3D Amg::getPhiThetaPsi ( Amg::RotationMatrix3D  mat,
int  convention = 0 
)
inline

Get the equivalents to CLHEP Phi, Theta, Psi Euler angles.

phi = vector[0] theta = vector[1] psi = vector[2]

N.B. if "convention = 0" --> "Z-X-Z" convention ==> DEFAULT!! if "convention = 1" --> "Z-Y-Z" convention

N.B.!! for normal usage, use the default notation (simply leave it empty, or use convention=0), or, alternatively, be sure to use the same convention in both setPhi() and getPhiThetaPsi().

we extract the Euler Angles from the Eigen matrix,

Definition at line 41 of file EulerAnglesHelpers.h.

42 {
43  double phi;
44  double theta;
45  double psi;
46 
47  Amg::Vector3D ea; // euler angles vector
48 
54  // using Z-X-Z convention: (2,0,2) == "Z,X,Z"
55  if (convention == 0) {
56  ea = mat.eulerAngles(2, 0, 2); // (using Z-X-Z convention) // DEFAULT
57  }
58  // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
59  else {
60  ea = mat.eulerAngles(2, 1, 2); // (using Z-Y-Z convention)
61  }
62 
63  // convert the values from Eigen convention to CLHEP convention
64  ea = convert_EigenEulerAngles_to_CLHEPPhiThetaPsi( ea, convention );
65 
66  phi = ea[0];
67  theta = ea[1];
68  psi = ea[2];
69 
70  Amg::Vector3D phiThetaPsi_angles;
71  phiThetaPsi_angles(0) = phi;
72  phiThetaPsi_angles(1) = theta;
73  phiThetaPsi_angles(2) = psi;
74 
75  return phiThetaPsi_angles;
76 
77 } // end of getPhiThetaPsi()

◆ getRotateX3D()

Amg::Transform3D Amg::getRotateX3D ( double  angle)
inline

get a rotation transformation around X-axis

Definition at line 252 of file GeoPrimitivesHelpers.h.

252  {
253  Amg::Transform3D transf;
254  Amg::AngleAxis3D angleaxis(angle, Amg::Vector3D::UnitX());
255  transf = angleaxis;
256  return transf;
257 }

◆ getRotateY3D()

Amg::Transform3D Amg::getRotateY3D ( double  angle)
inline

get a rotation transformation around Y-axis

Definition at line 261 of file GeoPrimitivesHelpers.h.

261  {
262  Amg::Transform3D transf;
263  Amg::AngleAxis3D angleaxis(angle, Amg::Vector3D::UnitY());
264  transf = angleaxis;
265  return transf;
266 }

◆ getRotateZ3D()

Amg::Transform3D Amg::getRotateZ3D ( double  angle)
inline

get a rotation transformation around Z-axis

Definition at line 270 of file GeoPrimitivesHelpers.h.

270  {
271  Amg::Transform3D transf;
272  Amg::AngleAxis3D angleaxis(angle, Amg::Vector3D::UnitZ());
273  transf = angleaxis;
274  return transf;
275 }

◆ getRotation3DfromAngleAxis()

Amg::Rotation3D Amg::getRotation3DfromAngleAxis ( double  angle,
Amg::Vector3D axis 
)
inline

get a AngleAxis from an angle and an axis.

to replace the CLHEP constructor: CLHEP::Rotate3D::Rotate3D(double a, cconst Vector3D< double > & v)

Definition at line 237 of file GeoPrimitivesHelpers.h.

238 {
239  AngleAxis3D t;
240  t = Eigen::AngleAxis<double>(angle,axis);
241 
242  Amg::Rotation3D rot;
243  rot = t;
244 
245  return rot;
246 }

◆ getTransformFromRotTransl()

Amg::Transform3D Amg::getTransformFromRotTransl ( Amg::RotationMatrix3D  rot,
Amg::Vector3D  transl_vec 
)
inline

Definition at line 172 of file GeoPrimitivesHelpers.h.

173 {
174  Amg::Transform3D trans = Amg::Transform3D::Identity();
175  trans = trans * rot;
176  trans.translation() = transl_vec;
177  return trans;
178 }

◆ getTranslate3D() [1/2]

Amg::Transform3D Amg::getTranslate3D ( const Amg::Vector3D v)
inline

: Returns a shift transformation along an arbitrary axis

Definition at line 293 of file GeoPrimitivesHelpers.h.

293  {
295 }

◆ getTranslate3D() [2/2]

Amg::Transform3D Amg::getTranslate3D ( const double  X,
const double  Y,
const double  Z 
)
inline

: Returns a shift transformation along an arbitrary axis

Definition at line 289 of file GeoPrimitivesHelpers.h.

289  {
291 }

◆ getTranslateX3D()

Amg::Transform3D Amg::getTranslateX3D ( const double  X)
inline

: Returns a shift transformation along the x-axis

Definition at line 277 of file GeoPrimitivesHelpers.h.

277  {
278  return Amg::Transform3D{Amg::Translation3D{X * Amg::Vector3D::UnitX()}};
279 }

◆ getTranslateY3D()

Amg::Transform3D Amg::getTranslateY3D ( const double  Y)
inline

: Returns a shift transformation along the y-axis

Definition at line 281 of file GeoPrimitivesHelpers.h.

281  {
282  return Amg::Transform3D{Amg::Translation3D{Y * Amg::Vector3D::UnitY()}};
283 }

◆ getTranslateZ3D()

Amg::Transform3D Amg::getTranslateZ3D ( const double  Z)
inline

: Returns a shift transformation along the z-axis

Definition at line 285 of file GeoPrimitivesHelpers.h.

285  {
286  return Amg::Transform3D{Amg::Translation3D{Z * Amg::Vector3D::UnitZ()}};
287 }

◆ getTranslationVectorFromTransform()

Amg::Vector3D Amg::getTranslationVectorFromTransform ( const Amg::Transform3D tr)
inline

Get the Translation vector out of a Transformation.

Definition at line 225 of file GeoPrimitivesHelpers.h.

225  {
226  return Amg::Vector3D(tr(0,3),tr(1,3),tr(2,3));
227 } // TODO: check! it's perhaps useless, you acn use the transform.translation() method

◆ hasPositiveDiagElems() [1/2]

bool Amg::hasPositiveDiagElems ( const Amg::MatrixX mat)
inline

Definition at line 105 of file EventPrimitivesCovarianceHelpers.h.

105  {
106  constexpr double MIN_COV_EPSILON = std::numeric_limits<float>::min();
107  int dim = mat.rows();
108  for (int i = 0; i < dim; ++i) {
109  if (mat(i, i) < MIN_COV_EPSILON || !saneCovarianceElement(mat(i, i)))
110  return false;
111  }
112  return true;
113 }

◆ hasPositiveDiagElems() [2/2]

template<int N>
bool Amg::hasPositiveDiagElems ( const AmgSymMatrix(N) &  mat)
inline

Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above definition.

And positive. Instead of just positive we check that we are above the float epsilon

Definition at line 96 of file EventPrimitivesCovarianceHelpers.h.

96  {
97  constexpr double MIN_COV_EPSILON = std::numeric_limits<float>::min();
98  constexpr int dim = N;
99  for (int i = 0; i < dim; ++i) {
100  if (mat(i, i) < MIN_COV_EPSILON || !saneCovarianceElement(mat(i, i)))
101  return false;
102  }
103  return true;
104 }

◆ hasPositiveOrZeroDiagElems() [1/2]

bool Amg::hasPositiveOrZeroDiagElems ( const Amg::MatrixX mat)
inline

Definition at line 82 of file EventPrimitivesCovarianceHelpers.h.

82  {
83  int dim = mat.rows();
84  for (int i = 0; i < dim; ++i) {
85  if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i)))
86  return false;
87  }
88  return true;
89 }

◆ hasPositiveOrZeroDiagElems() [2/2]

template<int N>
bool Amg::hasPositiveOrZeroDiagElems ( const AmgSymMatrix(N) &  mat)
inline

Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above definition.

And equal or greater than 0.

Definition at line 73 of file EventPrimitivesCovarianceHelpers.h.

73  {
74  constexpr int dim = N;
75  for (int i = 0; i < dim; ++i) {
76  if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i)))
77  return false;
78  }
79  return true;
80 }

◆ Hep3VectorToEigen()

Amg::Vector3D Amg::Hep3VectorToEigen ( const CLHEP::Hep3Vector &  CLHEPvector)
inline

Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.

Parameters
CLHEPvectorA CLHEP-based CLHEP::Hep3Vector.
Returns
An Eigen-based Amg::Vector3D.

Definition at line 137 of file CLHEPtoEigenConverter.h.

137  {
138  return Amg::Vector3D(CLHEPvector[0], CLHEPvector[1], CLHEPvector[2]);
139  }

◆ intersect() [1/2]

template<int N>
std::optional<double> Amg::intersect ( const AmgVector(N)&  pos,
const AmgVector(N)&  dir,
const AmgVector(N)&  planeNorm,
const double  offset 
)

Intersects a line parametrized as A + lambda * B with the (N-1) dimensional hyperplane that's given in the Hesse normal form <P, N> - C = 0

<P, N> - C = 0 --> <A + lambda *B , N> - C = 0 --> lambda = (C - <A,N> ) / <N, B>

Definition at line 347 of file GeoPrimitivesHelpers.h.

350  {
354  const double normDot = planeNorm.dot(dir);
355  if (std::abs(normDot) < std::numeric_limits<double>::epsilon()) return std::nullopt;
356  return (offset - pos.dot(planeNorm)) / normDot;
357 }

◆ intersect() [2/2]

template<int N>
std::optional<double> Amg::intersect ( const AmgVector(N)&  posA,
const AmgVector(N)&  dirA,
const AmgVector(N)&  posB,
const AmgVector(N)&  dirB 
)

Calculates the point of closest approach of two lines.

posA: offset point of line A dirA: orientation of line A (unit length) posB: offset point of line B dirB: orientation of line B (unit length) Returns the length to be travelled along line B

Use the formula A + lambda dirA = B + mu dirB (A-B) + lambda dirA = mu dirB <A-B, dirB> + lambda <dirA,dirB> = mu A + lambda dirA = B + (<A-B, dirB> + lambda <dirA,dirB>)dirB <A-B,dirA> + lambda <dirA, dirA> = <A-B, dirB><dirA,dirB> + lamda<dirA,dirB><dirA,dirB> -> lambda = -(<A-B, dirA> - <A-B, dirB> * <dirA, dirB>) / (1- <dirA,dirB>^2) --> mu = (<A-B, dirB> - <A-B, dirA> * <dirA, dirB>) / (1- <dirA,dirB>^2)

If the two directions are parallel to each other there's no way of intersection

Definition at line 325 of file GeoPrimitivesHelpers.h.

328  {
337  const double dirDots = dirA.dot(dirB);
338  const double divisor = (1. - dirDots * dirDots);
340  if (std::abs(divisor) < std::numeric_limits<double>::epsilon()) return std::nullopt;
341  const AmgVector(N) AminusB = posA - posB;
342  return (AminusB.dot(dirB) - AminusB.dot(dirA) * dirDots) / divisor;
343 }

◆ isIdentity()

bool Amg::isIdentity ( const Amg::Transform3D trans)
inline

Checks whether the transformation is the Identity transformation.

Definition at line 371 of file GeoPrimitivesHelpers.h.

371  {
372  return doesNotDeform(trans) &&
373  trans.translation().mag() < std::numeric_limits<float>::epsilon();
374 }

◆ isPositiveDefinite() [1/2]

bool Amg::isPositiveDefinite ( const Amg::MatrixX mat)
inline

Definition at line 146 of file EventPrimitivesCovarianceHelpers.h.

146  {
147  if (!hasPositiveDiagElems(mat)) {
148  // fast check for necessary condition
149  return false;
150  }
151  Eigen::LLT<Amg::MatrixX> lltCov(mat);
152  return (lltCov.info() == Eigen::Success);
153 }

◆ isPositiveDefinite() [2/2]

template<int N>
bool Amg::isPositiveDefinite ( const AmgSymMatrix(N) &  mat)
inline

Check if is positive semidefinit using that fact that is needed for Cholesky decomposition.

We use LLT from Eigen

Definition at line 138 of file EventPrimitivesCovarianceHelpers.h.

138  {
139  if (!hasPositiveDiagElems(mat)) {
140  // fast check for necessary condition
141  return false;
142  }
143  Eigen::LLT<AmgSymMatrix(N)> lltCov(mat);
144  return (lltCov.info() == Eigen::Success);
145 }

◆ isPositiveDefiniteSlow() [1/2]

bool Amg::isPositiveDefiniteSlow ( const Amg::MatrixX mat)
inline

Definition at line 202 of file EventPrimitivesCovarianceHelpers.h.

202  {
203  if (!hasPositiveDiagElems(mat)) {
204  // fast check for necessary condition
205  return false;
206  }
207  Eigen::SelfAdjointEigenSolver<Amg::MatrixX> eigensolver(mat);
208  auto res = eigensolver.eigenvalues();
209  int dim = mat.rows();
210  for (int i = 0; i < dim; ++i) {
211  if (res[i] <= 0) {
212  return false;
213  }
214  }
215  return true;
216 }

◆ isPositiveDefiniteSlow() [2/2]

template<int N>
bool Amg::isPositiveDefiniteSlow ( const AmgSymMatrix(N) &  mat)
inline

Definition at line 188 of file EventPrimitivesCovarianceHelpers.h.

188  {
189  if (!hasPositiveDiagElems(mat)) {
190  // fast check for necessary condition
191  return false;
192  }
193  Eigen::SelfAdjointEigenSolver<AmgSymMatrix(5)> eigensolver(mat);
194  auto res = eigensolver.eigenvalues();
195  for (size_t i = 0; i < N; ++i) {
196  if (res[i] <= 0) {
197  return false;
198  }
199  }
200  return true;
201 }

◆ isPositiveSemiDefinite() [1/2]

bool Amg::isPositiveSemiDefinite ( const Amg::MatrixX mat)
inline

Definition at line 126 of file EventPrimitivesCovarianceHelpers.h.

126  {
128  // fast check for necessary condition
129  return false;
130  }
131  Eigen::LDLT<Amg::MatrixX> ldltCov(mat);
132  return (ldltCov.info() == Eigen::Success && ldltCov.isPositive());
133 }

◆ isPositiveSemiDefinite() [2/2]

template<int N>
bool Amg::isPositiveSemiDefinite ( const AmgSymMatrix(N) &  mat)
inline

Check if is positive semidefinit using that fact that is needed for Cholesky decomposition.

We have to use LDLT from Eigen

Definition at line 118 of file EventPrimitivesCovarianceHelpers.h.

118  {
120  // fast check for necessary condition
121  return false;
122  }
123  Eigen::LDLT<AmgSymMatrix(N)> ldltCov(mat);
124  return (ldltCov.info() == Eigen::Success && ldltCov.isPositive());
125 }

◆ isPositiveSemiDefiniteSlow() [1/2]

bool Amg::isPositiveSemiDefiniteSlow ( const Amg::MatrixX mat)
inline

Definition at line 172 of file EventPrimitivesCovarianceHelpers.h.

172  {
174  // fast check for necessary condition
175  return false;
176  }
177  Eigen::SelfAdjointEigenSolver<Amg::MatrixX> eigensolver(mat);
178  auto res = eigensolver.eigenvalues();
179  int dim = mat.rows();
180  for (int i = 0; i < dim; ++i) {
181  if (res[i] < 0) {
182  return false;
183  }
184  }
185  return true;
186 }

◆ isPositiveSemiDefiniteSlow() [2/2]

template<int N>
bool Amg::isPositiveSemiDefiniteSlow ( const AmgSymMatrix(N) &  mat)
inline

These are the slow test following the definition.

Indented mainly for testing/

Definition at line 158 of file EventPrimitivesCovarianceHelpers.h.

158  {
160  // fast check for necessary condition
161  return false;
162  }
163  Eigen::SelfAdjointEigenSolver<AmgSymMatrix(5)> eigensolver(mat);
164  auto res = eigensolver.eigenvalues();
165  for (size_t i = 0; i < N; ++i) {
166  if (res[i] < 0) {
167  return false;
168  }
169  }
170  return true;
171 }

◆ lineDistance()

template<int N>
double Amg::lineDistance ( const AmgVector(N)&  posA,
const AmgVector(N)&  dirA,
const AmgVector(N)&  posB,
const AmgVector(N)&  dirB 
)

Calculates the shortest distance between two lines posA: offset point of line A dirA: orientation of line A (unit length) posB: offset point of line B dirB: orientation of line B (unit length)

Definition at line 303 of file GeoPrimitivesHelpers.h.

306  {
307 
308  const double dirDots = dirA.dot(dirB);
309  const double divisor = (1. - dirDots * dirDots);
310  const AmgVector(N) AminusB = posA - posB;
311  if (std::abs(divisor) < std::numeric_limits<double>::epsilon()) {
312  const AmgVector(N) d = posA + dirA.dot(AminusB)*dirA;
313  return std::sqrt(d.dot(d));
314  }
315  const AmgVector(N) lineTravel = AminusB.dot(dirA) * dirA -
316  AminusB.dot(dirB) * dirB;
317  return std::sqrt(std::max(0., AminusB.dot(AminusB) - lineTravel.dot(lineTravel)) / divisor);
318 }

◆ mag2Vector3D()

double Amg::mag2Vector3D ( const Amg::Vector3D v1)
inline

Gets magnitude squared of the vector.

Definition at line 140 of file GeoPrimitivesHelpers.h.

140 { return v1.x()*v1.x() + v1.y()*v1.y() + v1.z()*v1.z(); }

◆ magVector3D()

double Amg::magVector3D ( const Amg::Vector3D v1)
inline

Gets magnitude of the vector.

Definition at line 144 of file GeoPrimitivesHelpers.h.

144 { return std::sqrt(mag2Vector3D(v1)); }

◆ roundWithPrecision()

double Amg::roundWithPrecision ( double  val,
int  precision 
)
inline

EventPrimitvesToStringConverter.

inline methods for conversion of EventPrimitives (Matrix) to std::string.

This is to enhance formatted screen ouput and for ASCII based testing.

The offset can be used to offset the lines (starting from line 2) wrt to the zero position for formatting reasons.

Author
Niels.nosp@m..Van.nosp@m..Eldi.nosp@m.k@ce.nosp@m.rn.ch

Definition at line 35 of file EventPrimitivesToStringConverter.h.

35  {
36  if (val < 0 && std::abs(val) * std::pow(10, precision) < 1.)
37  return -val;
38  return val;
39 }

◆ rVector3D()

double Amg::rVector3D ( const Amg::Vector3D v1)
inline

Gets r-component in spherical coordinate system.

Definition at line 148 of file GeoPrimitivesHelpers.h.

148 { return magVector3D(v1); }

◆ saneCovarianceElement()

bool Amg::saneCovarianceElement ( double  ele)
inline

A covariance matrix formally needs to be positive semi definite.

Not positive definite just positive semi definite.

A symmetric matrix M with real entries is positive-definite if the real number x^T M x is positive for every nonzero real column vector x. Positive-semidefinite means x^T M x non zero for every nonzero real column vector x

A symmetric matrix is positive semidefinite if all its eigenvalues are non negative.

A symmetric matrix is positive definite if all its eigenvalues are positive

Positive Definite and Positive Semi Definit matrices Have a Cholesky decomposition. The Positive (semi) definiteness is a necessary and sufficient condition

A positive (semi)-definite matrix can not have non-positive (negative) diagonal elements. If A_ii < 0 we could choose an x vector with all entries 0 bar x_i and the x^T M x would be negative.

Having positive (positive or 0) diagonal elements is necessary but not sufficient condition. As we could have positive diagonal elements and have a vector x that still could result in x^T M x being negative. Matrix A in the test shows this issue

What follows are methods to check for these

We can

  • Just check for the necessary condition (relatively fast)
  • Check using Cholosky decomposition (still not too slow)
  • Solve for all eigenvalues and check none is zero (slow) Avoid nan, inf, and elements above float max

Definition at line 63 of file EventPrimitivesCovarianceHelpers.h.

63  {
64  constexpr double upper_covariance_cutoff = std::numeric_limits<float>::max();
65  return !(std::isnan(ele) || std::isinf(ele) ||
66  std::abs(ele) > upper_covariance_cutoff);
67 }

◆ saneVector()

template<int N>
bool Amg::saneVector ( const AmgVector(N) &  vec)
inline

Definition at line 28 of file EventPrimitivesHelpers.h.

28  {
29  for (int i = 0; i < N; ++i) {
30  if (std::isnan(vec[i]) || std::isinf(vec[i]))
31  return false;
32  }
33  constexpr double max_length2 = 1.e16;
34  return vec.dot(vec) < max_length2;
35 }

◆ setMag()

void Amg::setMag ( Amg::Vector3D v,
double  mag 
)
inline

scales the vector length without changing the angles

Definition at line 104 of file GeoPrimitivesHelpers.h.

104  {
105  double p = v.mag();
106  if (p != 0.0) {
107  double scale = mag / p;
108  v[0] *= scale;
109  v[1] *= scale;
110  v[2] *= scale;
111  }
112 }

◆ setPerp()

void Amg::setPerp ( Amg::Vector3D v,
double  perp 
)
inline

scales the vector in the xy plane without changing the z coordinate nor the angles

Definition at line 94 of file GeoPrimitivesHelpers.h.

94  {
95  double p = v.perp();
96  if (p != 0.0) {
97  double scale = perp / p;
98  v[0] *= scale;
99  v[1] *= scale;
100  }
101 }

◆ setPhi() [1/2]

Amg::RotationMatrix3D Amg::setPhi ( Amg::RotationMatrix3D  mat,
double  angle,
int  convention = 0 
)
inline

Definition at line 102 of file EulerAnglesHelpers.h.

103 {
104 
105 
106  Amg::Vector3D phi_theta_psi;
107 
108 
109  // using Z-X-Z convention: (2,0,2) == "Z,X,Z". ==> DEFAULT!
110  if (convention == 0) {
111  phi_theta_psi = getPhiThetaPsi(mat, 0); // using Z-X-Z ((2,0,2) convention // DEFAULT
112  }
113  else { // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
114  phi_theta_psi = getPhiThetaPsi(mat, 1); // using Z-Y-Z ((2,1,2) convention
115  }
116 
117  double phi = phi_theta_psi(0);
118  double theta = phi_theta_psi(1);
119  double psi = phi_theta_psi(2);
120 
121 
122  /*
123  * set a new Phi angle, from user's settings
124  */
125  phi = angle;
126 
127  /*
128  * get Eigen Euler angles from CLEHP style Phi, Theta, Psi
129  */
130  Amg::Vector3D clhep_phiThetaPsi(phi, theta, psi); // a vector with CLHEP angles
131  Amg::Vector3D eigen_euler_angles;
132  // converting the CLHEP angles to Eigen angles
133  if (convention == 0) { // using Z-X-Z convention: (2,0,2) == "Z,X,Z". ==> DEFAULT!
134  eigen_euler_angles = convert_CLHEPPhiThetaPsi_to_EigenEulerAngles(clhep_phiThetaPsi, 0); // using Z-X-Z ((2,0,2) convention // DEFAULT
135  }
136  else { // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
137  eigen_euler_angles = convert_CLHEPPhiThetaPsi_to_EigenEulerAngles(clhep_phiThetaPsi, 1); // using Z-Y-Z ((2,1,2) convention
138  }
139 
140  /*
141  * create a new rotation matrix from AngleAxis
142  *
143  * N.B.!!
144  * to match CLHEP results,
145  * we have to invert the order of the rotation operations,
146  * compared to the order in CLHEP.
147  * The matrix here below is equal to:
148  * ---
149  * CLHEP::HepRotation localRot;
150  * localRot.rotateZ(angC);
151  * localRot.rotateY(angB);
152  * localRot.rotateZ(angA);
153  * ---
154  *
155  */
156 
157  if (convention == 0) { // using Z-X-Z convention: (2,0,2) == "Z,X,Z". ==> DEFAULT!
158  mat = Amg::AngleAxis3D(eigen_euler_angles(0), Amg::Vector3D::UnitZ())
159  * Amg::AngleAxis3D(eigen_euler_angles(1), Amg::Vector3D::UnitX())
160  * Amg::AngleAxis3D(eigen_euler_angles(2), Amg::Vector3D::UnitZ());
161  }
162  else { // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
163  mat = Amg::AngleAxis3D(eigen_euler_angles(0), Amg::Vector3D::UnitZ())
164  * Amg::AngleAxis3D(eigen_euler_angles(1), Amg::Vector3D::UnitY())
165  * Amg::AngleAxis3D(eigen_euler_angles(2), Amg::Vector3D::UnitZ());
166  }
167 
168  return mat;
169 
170 } // end of SetPhi()

◆ setPhi() [2/2]

void Amg::setPhi ( Amg::Vector3D v,
double  phi 
)
inline

sets the phi angle of a vector without changing theta nor the magnitude

Definition at line 62 of file GeoPrimitivesHelpers.h.

62  {
63  double xy = v.perp();
65  v[0] = xy * sc.cs;
66  v[1] = xy * sc.sn;
67 }

◆ setRThetaPhi()

void Amg::setRThetaPhi ( Amg::Vector3D v,
double  r,
double  theta,
double  phi 
)
inline

sets radius, the theta and phi angle of a vector.

Angles are measured in RADIANS

Definition at line 80 of file GeoPrimitivesHelpers.h.

80  {
83  v[0] = r * sct.sn * sc.cs;
84  v[1] = r * sct.sn * sc.sn;
85  v[2] = r * sct.cs;
86 }

◆ setTheta()

void Amg::setTheta ( Amg::Vector3D v,
double  theta 
)
inline

sets the theta of a vector without changing phi nor the magnitude

Definition at line 89 of file GeoPrimitivesHelpers.h.

89  {
90  setThetaPhi(v, theta, v.phi());
91 }

◆ setThetaPhi()

void Amg::setThetaPhi ( Amg::Vector3D v,
double  theta,
double  phi 
)
inline

sets the theta and phi angle of a vector without changing the magnitude

Definition at line 70 of file GeoPrimitivesHelpers.h.

70  {
71  double mag = v.mag();
74  v[0] = mag * sct.sn * sc.cs;
75  v[1] = mag * sct.sn * sc.sn;
76  v[2] = mag * sct.cs;
77 }

◆ setVector3DCartesian()

void Amg::setVector3DCartesian ( Amg::Vector3D v1,
double  x1,
double  y1,
double  z1 
)
inline

Sets components in cartesian coordinate system.

Definition at line 136 of file GeoPrimitivesHelpers.h.

136 { v1[0] = x1; v1[1] = y1; v1[2] = z1; }

◆ toString() [1/7]

std::string Amg::toString ( const CLHEP::Hep2Vector &  translation,
int  precision = 4 
)
inline

Definition at line 100 of file GeoPrimitivesToStringConverter.h.

100  {
101  std::ostringstream sout;
102  sout << std::setiosflags(std::ios::fixed) << std::setprecision(precision);
103  for( int j=0;j<2;++j ){
104  if( j == 0 ) sout << "(";
105  double val = roundWithPrecision( translation[j],precision);
106  sout << val;
107  if( j == 1 ) sout << ")";
108  else sout << ", ";
109  }
110  return sout.str();
111  }

◆ toString() [2/7]

std::string Amg::toString ( const CLHEP::Hep3Vector &  translation,
int  precision = 4 
)
inline

Definition at line 87 of file GeoPrimitivesToStringConverter.h.

87  {
88  std::ostringstream sout;
89  sout << std::setiosflags(std::ios::fixed) << std::setprecision(precision);
90  for( int j=0;j<3;++j ){
91  if( j == 0 ) sout << "(";
92  double val = roundWithPrecision( translation[j],precision);
93  sout << val;
94  if( j == 2 ) sout << ")";
95  else sout << ", ";
96  }
97  return sout.str();
98  }

◆ toString() [3/7]

std::string Amg::toString ( const CLHEP::HepRotation &  rot,
int  precision = 4,
const std::string &  offset = "" 
)
inline

Definition at line 66 of file GeoPrimitivesToStringConverter.h.

66  {
67  std::ostringstream sout;
68 
69  sout << std::setiosflags(std::ios::fixed) << std::setprecision(precision);
70  for( int i=0;i<3;++i ){
71  for( int j=0;j<3;++j ){
72  if( j == 0 ) sout << "(";
73  double val = roundWithPrecision(rot(i,j),precision);
74  sout << val;
75  if( j == 2 ) sout << ")";
76  else sout << ", ";
77  }
78  if( i != 2 ) {
79  sout << std::endl;
80  sout << offset;
81  }
82  }
83  return sout.str();
84  }

◆ toString() [4/7]

std::string Amg::toString ( const HepGeom::Transform3D &  transf,
int  precision = 4,
const std::string &  offset = "" 
)
inline

Definition at line 113 of file GeoPrimitivesToStringConverter.h.

113  {
114  std::ostringstream sout;
115  sout << "Translation : " << toString( transf.getTranslation(), precision ) << std::endl;
116  std::string rotationOffset = offset + " ";
117  sout << offset << "Rotation : " << toString( transf.getRotation(), precision+2, rotationOffset );
118  return sout.str();
119  }

◆ toString() [5/7]

std::string Amg::toString ( const MatrixX matrix,
int  precision = 4,
const std::string &  offset = "" 
)
inline

Definition at line 41 of file EventPrimitivesToStringConverter.h.

42  {
43  std::ostringstream sout;
44 
45  sout << std::setiosflags(std::ios::fixed) << std::setprecision(precision);
46  if (matrix.cols() == 1) {
47  sout << "(";
48  for (int i = 0; i < matrix.rows(); ++i) {
49  double val = roundWithPrecision(matrix(i, 0), precision);
50  sout << val;
51  if (i != matrix.rows() - 1)
52  sout << ", ";
53  }
54  sout << ")";
55  } else {
56  for (int i = 0; i < matrix.rows(); ++i) {
57  for (int j = 0; j < matrix.cols(); ++j) {
58  if (j == 0)
59  sout << "(";
60  double val = roundWithPrecision(matrix(i, j), precision);
61  sout << val;
62  if (j == matrix.cols() - 1)
63  sout << ")";
64  else
65  sout << ", ";
66  }
67  if (i != matrix.rows() -
68  1) { // make the end line and the offset in the next line
69  sout << std::endl;
70  sout << offset;
71  }
72  }
73  }
74  return sout.str();
75 }

◆ toString() [6/7]

std::string Amg::toString ( const Transform3D transform,
int  precision = 4,
const std::string &  rotOffSet = "" 
)
inline

Definition at line 46 of file GeoPrimitivesToStringConverter.h.

46  {
47  std::stringstream sstr{};
48  bool printed{false};
49  if (transform.translation().mag() > std::numeric_limits<float>::epsilon()) {
50  sstr<<"translation: "<<toString(transform.translation(), precision);
51  printed = true;
52  }
54  if (printed) sstr<<rotOffSet<<", ";
55  sstr<<"rotation: {"<<toString(transform.linear()*Vector3D::UnitX(), precision)<<",";
56  sstr<<toString(transform.linear()*Vector3D::UnitY(), precision)<<",";
57  sstr<<toString(transform.linear()*Vector3D::UnitZ(), precision)<<"}";
58  printed = true;
59  }
60  if (!printed) sstr<<"Identity matrix ";
61  return sstr.str();
62 }

◆ toString() [7/7]

std::string Amg::toString ( const Translation3D translation,
int  precision = 4 
)
inline

GeoPrimitvesToStringConverter.

static methods for conversion of GeoPrimitives and will call the EventPrimitives converter (Matrix) to std::string.

This is to enhance formatted screen ouput and for ASCII based testing.

The offset can be used to offset the lines (starting from line 2) wrt to the zero position for formatting reasons.

Author
Niels.nosp@m..Van.nosp@m..Eldi.nosp@m.k@ce.nosp@m.rn.ch

Definition at line 40 of file GeoPrimitivesToStringConverter.h.

40  {
41  Vector3D trans{translation.x(), translation.y(), translation.z()};
42  return toString( trans, precision );
43  }

◆ transform()

Amg::Vector3D Amg::transform ( Amg::Vector3D v,
Amg::Transform3D tr 
)
inline

Transform a point from a Trasformation3D.

from CLHEP::Point3D::transform: http://proj-clhep.web.cern.ch/proj-clhep/doc/CLHEP_2_0_4_7/doxygen/html/Point3D_8cc-source.html#l00032

Definition at line 156 of file GeoPrimitivesHelpers.h.

156  {
157  Amg::Vector3D vect;
158  double vx = v.x(), vy = v.y(), vz = v.z();
159  setVector3DCartesian( vect,
160  tr(0,0)*vx + tr(0,1)*vy + tr(0,2)*vz + tr(0,3),
161  tr(1,0)*vx + tr(1,1)*vy + tr(1,2)*vz + tr(1,3),
162  tr(2,0)*vx + tr(2,1)*vy + tr(2,2)*vz + tr(2,3));
163  return vect;
164 }
beamspotman.r
def r
Definition: beamspotman.py:676
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
Amg::Rotation3D
Eigen::Quaternion< double > Rotation3D
Definition: GeoPrimitives.h:43
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
max
#define max(a, b)
Definition: cfImp.cxx:41
Amg::convert_CLHEPPhiThetaPsi_to_EigenEulerAngles
Amg::Vector3D convert_CLHEPPhiThetaPsi_to_EigenEulerAngles(Amg::Vector3D clhep_angles, int convention=0)
Convert CLEHP Phi,Theta,Psi angles to Eigen euler angles using Z-X-Z convention.
Definition: CLHEPtoEigenEulerAnglesConverters.h:34
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
perp
Scalar perp() const
perp method - perpenticular length
Definition: AmgMatrixBasePlugin.h:44
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
index
Definition: index.py:1
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Amg::deltaPhi
double deltaPhi(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
Definition: GeoPrimitivesHelpers.h:113
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
Amg::getTranslateZ3D
Amg::Transform3D getTranslateZ3D(const double Z)
: Returns a shift transformation along the z-axis
Definition: GeoPrimitivesHelpers.h:285
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Amg::saneCovarianceElement
bool saneCovarianceElement(double ele)
A covariance matrix formally needs to be positive semi definite.
Definition: EventPrimitivesCovarianceHelpers.h:63
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
Amg::CalculateCompressedSize
constexpr int CalculateCompressedSize(int n)
Definition: EventPrimitivesHelpers.h:51
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
skel.it
it
Definition: skel.GENtoEVGEN.py:396
compute_lumi.divisor
divisor
Definition: compute_lumi.py:60
M_PI
#define M_PI
Definition: ActiveFraction.h:11
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
Amg::getTranslateY3D
Amg::Transform3D getTranslateY3D(const double Y)
: Returns a shift transformation along the y-axis
Definition: GeoPrimitivesHelpers.h:281
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
x
#define x
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Amg::hasPositiveDiagElems
bool hasPositiveDiagElems(const Amg::MatrixX &mat)
Definition: EventPrimitivesCovarianceHelpers.h:105
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
python.changerun.m1
m1
Definition: changerun.py:32
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
beamspotman.n
n
Definition: beamspotman.py:731
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
xAOD::covMatrix
covMatrix
Definition: TrackMeasurement_v1.cxx:19
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::doesNotDeform
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Definition: GeoPrimitivesHelpers.h:361
Amg::px
@ px
Definition: GeoPrimitives.h:38
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Amg::setVector3DCartesian
void setVector3DCartesian(Amg::Vector3D &v1, double x1, double y1, double z1)
Sets components in cartesian coordinate system.
Definition: GeoPrimitivesHelpers.h:136
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
beamspotnt.rows
list rows
Definition: bin/beamspotnt.py:1112
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
beamspotman.dir
string dir
Definition: beamspotman.py:623
min
#define min(a, b)
Definition: cfImp.cxx:40
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Amg::py
@ py
Definition: GeoPrimitives.h:39
Amg::hasPositiveOrZeroDiagElems
bool hasPositiveOrZeroDiagElems(const Amg::MatrixX &mat)
Definition: EventPrimitivesCovarianceHelpers.h:82
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Amg::mag2Vector3D
double mag2Vector3D(const Amg::Vector3D &v1)
Gets magnitude squared of the vector.
Definition: GeoPrimitivesHelpers.h:140
Amg::convert_EigenEulerAngles_to_CLHEPPhiThetaPsi
Amg::Vector3D convert_EigenEulerAngles_to_CLHEPPhiThetaPsi(Amg::Vector3D eigen_angles, int convention=0)
Convert Eigen euler angles to CLEHP Phi,Theta,Psi angles.
Definition: CLHEPtoEigenEulerAnglesConverters.h:62
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
python.PyAthena.v
v
Definition: PyAthena.py:154
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
Amg::toString
std::string toString(const HepGeom::Transform3D &transf, int precision=4, const std::string &offset="")
Definition: GeoPrimitivesToStringConverter.h:113
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition: sincos.h:76
Amg::getPhiThetaPsi
Amg::Vector3D getPhiThetaPsi(Amg::RotationMatrix3D mat, int convention=0)
Get the equivalents to CLHEP Phi, Theta, Psi Euler angles.
Definition: EulerAnglesHelpers.h:41
Amg::AngleAxis3D
Eigen::AngleAxisd AngleAxis3D
Definition: GeoPrimitives.h:45
Amg::roundWithPrecision
double roundWithPrecision(double val, int precision)
EventPrimitvesToStringConverter.
Definition: EventPrimitivesToStringConverter.h:35
Amg::distance2
float distance2(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the squared distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:48
Amg::magVector3D
double magVector3D(const Amg::Vector3D &v1)
Gets magnitude of the vector.
Definition: GeoPrimitivesHelpers.h:144
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
Amg::getTranslateX3D
Amg::Transform3D getTranslateX3D(const double X)
: Returns a shift transformation along the x-axis
Definition: GeoPrimitivesHelpers.h:277
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
Amg::setThetaPhi
void setThetaPhi(Amg::Vector3D &v, double theta, double phi)
sets the theta and phi angle of a vector without changing the magnitude
Definition: GeoPrimitivesHelpers.h:70