CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
ROOT::Math::Transform3DPJ Class Reference

#include <Transform3DPJ.h>

Public Types

enum  ETransform3DMatrixIndex {
  kXX = 0, kXY = 1, kXZ = 2, kDX = 3,
  kYX = 4, kYY = 5, kYZ = 6, kDY = 7,
  kZX = 8, kZY = 9, kZZ =10, kDZ = 11
}
 
typedef PositionVector3D
< Cartesian3D< double >
, DefaultCoordinateSystemTag > 
Point
 
typedef DisplacementVector3D
< Cartesian3D< double >
, DefaultCoordinateSystemTag > 
Vector
 

Public Member Functions

template<class IT >
void GetComponents (IT begin, IT end) const
 
template<class IT >
void GetComponents (IT begin) const
 
void GetComponents (double &xx, double &xy, double &xz, double &dx, double &yx, double &yy, double &yz, double &dy, double &zx, double &zy, double &zz, double &dz) const
 
void GetDecomposition (Rotation3D &r, Vector &v) const
 
template<class ForeignMatrix >
void GetTransformMatrix (ForeignMatrix &m) const
 
Transform3DPJ Inverse () const
 
void Invert ()
 
bool operator!= (const Transform3DPJ &rhs) const
 
Point operator() (const Point &p) const
 
Vector operator() (const Vector &v) const
 
template<class CoordSystem >
PositionVector3D< CoordSystem > operator() (const PositionVector3D< CoordSystem > &p) const
 
template<class CoordSystem >
DisplacementVector3D< CoordSystem > operator() (const DisplacementVector3D< CoordSystem > &v) const
 
template<class CoordSystem >
LorentzVector< CoordSystem > operator() (const LorentzVector< CoordSystem > &q) const
 
Plane3D operator() (const Plane3D &plane) const
 
template<class AVector >
AVector operator* (const AVector &v) const
 
Transform3DPJ operator* (const Transform3DPJ &t) const
 
Transform3DPJoperator*= (const Transform3DPJ &t)
 
template<class ForeignMatrix >
Transform3DPJoperator= (const ForeignMatrix &m)
 
bool operator== (const Transform3DPJ &rhs) const
 
template<class IT >
void SetComponents (IT begin, IT end)
 
void SetComponents (double xx, double xy, double xz, double dx, double yx, double yy, double yz, double dy, double zx, double zy, double zz, double dz)
 
template<class ForeignMatrix >
void SetTransformMatrix (const ForeignMatrix &m)
 
template<class CoordSystem , class Tag1 , class Tag2 >
void Transform (const PositionVector3D< CoordSystem, Tag1 > &p1, PositionVector3D< CoordSystem, Tag2 > &p2) const
 
template<class CoordSystem , class Tag1 , class Tag2 >
void Transform (const DisplacementVector3D< CoordSystem, Tag1 > &v1, DisplacementVector3D< CoordSystem, Tag2 > &v2) const
 
 Transform3DPJ ()
 
template<class IT >
 Transform3DPJ (IT begin, IT end)
 
 Transform3DPJ (const Rotation3D &r, const Vector &v)
 
 Transform3DPJ (const Vector &v, const Rotation3D &r)
 
 Transform3DPJ (const Rotation3D &r)
 
 Transform3DPJ (const AxisAngle &r)
 
 Transform3DPJ (const EulerAngles &r)
 
 Transform3DPJ (const Quaternion &r)
 
 Transform3DPJ (const RotationX &r)
 
 Transform3DPJ (const RotationY &r)
 
 Transform3DPJ (const RotationZ &r)
 
template<class CoordSystem , class Tag >
 Transform3DPJ (const DisplacementVector3D< CoordSystem, Tag > &v)
 
 Transform3DPJ (const Vector &v)
 
template<class ARotation , class CoordSystem , class Tag >
 Transform3DPJ (const ARotation &r, const DisplacementVector3D< CoordSystem, Tag > &v)
 
template<class ARotation , class CoordSystem , class Tag >
 Transform3DPJ (const DisplacementVector3D< CoordSystem, Tag > &v, const ARotation &r)
 
 Transform3DPJ (const Point &fr0, const Point &fr1, const Point &fr2, const Point &to0, const Point &to1, const Point &to2)
 
template<class ForeignMatrix >
 Transform3DPJ (const ForeignMatrix &m)
 
 Transform3DPJ (double xx, double xy, double xz, double dx, double yx, double yy, double yz, double dy, double zx, double zy, double zz, double dz)
 

Protected Member Functions

void AssignFrom (const Rotation3D &r, const Vector &v)
 
void AssignFrom (const Rotation3D &r)
 
void AssignFrom (const Vector &v)
 
void SetIdentity ()
 

Private Attributes

double fM [12]
 

Detailed Description

Basic 3D Transformation class describing a rotation and then a translation The internal data are a rotation data and a 3D vector data and they can be represented like a 3x4 matrix The class has a template parameter the coordinate system tag of the reference system to which the transformatioon will be applied. For example for transforming from global to local coordinate systems, the transfrom3D has to be instantiated with the coordinate of the traget system

Definition at line 60 of file Transform3DPJ.h.

Member Typedef Documentation

typedef PositionVector3D<Cartesian3D<double>, DefaultCoordinateSystemTag > ROOT::Math::Transform3DPJ::Point

Definition at line 66 of file Transform3DPJ.h.

typedef DisplacementVector3D<Cartesian3D<double>, DefaultCoordinateSystemTag > ROOT::Math::Transform3DPJ::Vector

Definition at line 65 of file Transform3DPJ.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

ROOT::Math::Transform3DPJ::Transform3DPJ ( )
inline

Default constructor (identy rotation) + zero translation

Definition at line 80 of file Transform3DPJ.h.

References SetIdentity().

81  {
82  SetIdentity();
83  }
template<class IT >
ROOT::Math::Transform3DPJ::Transform3DPJ ( IT  begin,
IT  end 
)
inline

Construct given a pair of pointers or iterators defining the beginning and end of an array of 12 Scalars

Definition at line 90 of file Transform3DPJ.h.

References SetComponents().

91  {
93  }
#define end
Definition: vmac.h:38
void SetComponents(IT begin, IT end)
#define begin
Definition: vmac.h:31
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Rotation3D &  r,
const Vector v 
)
inline

Construct from a rotation and then a translation described by a Vector

Definition at line 98 of file Transform3DPJ.h.

References AssignFrom().

99  {
100  AssignFrom( r, v );
101  }
void AssignFrom(const Rotation3D &r, const Vector &v)
mathSSE::Vec4< T > v
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Vector v,
const Rotation3D &  r 
)
inline

Construct from a translation and then a rotation (inverse assignment)

Definition at line 105 of file Transform3DPJ.h.

References AssignFrom(), and alignCSCRings::r.

106  {
107  // is equivalent from having first the rotation and then the translation vector rotated
108  AssignFrom( r, r(v) );
109  }
void AssignFrom(const Rotation3D &r, const Vector &v)
mathSSE::Vec4< T > v
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Rotation3D &  r)
inlineexplicit

Construct from a 3D Rotation only with zero translation

Definition at line 114 of file Transform3DPJ.h.

References AssignFrom().

114  {
115  AssignFrom(r);
116  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Transform3DPJ::Transform3DPJ ( const AxisAngle &  r)
inlineexplicit

Definition at line 118 of file Transform3DPJ.h.

References AssignFrom().

118  {
119  AssignFrom(Rotation3D(r));
120  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Transform3DPJ::Transform3DPJ ( const EulerAngles &  r)
inlineexplicit

Definition at line 121 of file Transform3DPJ.h.

References AssignFrom().

121  {
122  AssignFrom(Rotation3D(r));
123  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Quaternion &  r)
inlineexplicit

Definition at line 124 of file Transform3DPJ.h.

References AssignFrom().

124  {
125  AssignFrom(Rotation3D(r));
126  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Transform3DPJ::Transform3DPJ ( const RotationX &  r)
inlineexplicit

Definition at line 128 of file Transform3DPJ.h.

References AssignFrom().

128  {
129  AssignFrom(Rotation3D(r));
130  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Transform3DPJ::Transform3DPJ ( const RotationY &  r)
inlineexplicit

Definition at line 131 of file Transform3DPJ.h.

References AssignFrom().

131  {
132  AssignFrom(Rotation3D(r));
133  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Transform3DPJ::Transform3DPJ ( const RotationZ &  r)
inlineexplicit

Definition at line 134 of file Transform3DPJ.h.

References AssignFrom().

134  {
135  AssignFrom(Rotation3D(r));
136  }
void AssignFrom(const Rotation3D &r, const Vector &v)
template<class CoordSystem , class Tag >
ROOT::Math::Transform3DPJ::Transform3DPJ ( const DisplacementVector3D< CoordSystem, Tag > &  v)
inlineexplicit

Construct from a translation only, represented by any DisplacementVector3D and with an identity rotation

Definition at line 143 of file Transform3DPJ.h.

References AssignFrom().

143  {
144  AssignFrom(Vector(v.X(),v.Y(),v.Z()));
145  }
void AssignFrom(const Rotation3D &r, const Vector &v)
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Vector
Definition: Transform3DPJ.h:65
mathSSE::Vec4< T > v
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Vector v)
inlineexplicit

Construct from a translation only, represented by a Cartesian 3D Vector, and with an identity rotation

Definition at line 150 of file Transform3DPJ.h.

References AssignFrom().

150  {
151  AssignFrom(v);
152  }
void AssignFrom(const Rotation3D &r, const Vector &v)
mathSSE::Vec4< T > v
template<class ARotation , class CoordSystem , class Tag >
ROOT::Math::Transform3DPJ::Transform3DPJ ( const ARotation &  r,
const DisplacementVector3D< CoordSystem, Tag > &  v 
)
inline

Construct from a rotation (any rotation object) and then a translation (represented by any DisplacementVector) The requirements on the rotation and vector objects are that they can be transformed in a Rotation3D class and in a Vector

Definition at line 165 of file Transform3DPJ.h.

References AssignFrom().

166  {
167  AssignFrom( Rotation3D(r), Vector (v.X(),v.Y(),v.Z()) );
168  }
void AssignFrom(const Rotation3D &r, const Vector &v)
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:28
mathSSE::Vec4< T > v
template<class ARotation , class CoordSystem , class Tag >
ROOT::Math::Transform3DPJ::Transform3DPJ ( const DisplacementVector3D< CoordSystem, Tag > &  v,
const ARotation &  r 
)
inline

Construct from a translation (using any type of DisplacementVector ) and then a rotation (any rotation object). Requirement on the rotation and vector objects are that they can be transformed in a Rotation3D class and in a Vector

Definition at line 176 of file Transform3DPJ.h.

References AssignFrom().

177  {
178  // is equivalent from having first the rotation and then the translation vector rotated
179  Rotation3D r3d(r);
180  AssignFrom( r3d, r3d( Vector(v.X(),v.Y(),v.Z()) ) );
181  }
void AssignFrom(const Rotation3D &r, const Vector &v)
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Vector
Definition: Transform3DPJ.h:65
mathSSE::Vec4< T > v
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Point fr0,
const Point fr1,
const Point fr2,
const Point to0,
const Point to1,
const Point to2 
)

Construct transformation from one coordinate system defined by three points (origin + two axis) to a new coordinate system defined by other three points (origin + axis)

Parameters
fr0point defining origin of original reference system
fr1point defining first axis of original reference system
fr2point defining second axis of original reference system
to0point defining origin of transformed reference system
to1point defining first axis transformed reference system
to2point defining second axis transformed reference system

Definition at line 40 of file Transform3DPJ.cc.

References dtNoiseDBValidation_cfg::cerr, SetComponents(), and SetIdentity().

42 {
43  // takes impl. from CLHEP ( E.Chernyaev). To be checked
44 
45  XYZVector x1,y1,z1, x2,y2,z2;
46  x1 = (fr1 - fr0).Unit();
47  y1 = (fr2 - fr0).Unit();
48  x2 = (to1 - to0).Unit();
49  y2 = (to2 - to0).Unit();
50 
51  // C H E C K A N G L E S
52 
53  double cos1, cos2;
54  cos1 = x1.Dot(y1);
55  cos2 = x2.Dot(y2);
56 
57  if (std::fabs(1.0-cos1) <= 0.000001 || std::fabs(1.0-cos2) <= 0.000001) {
58  std::cerr << "Transform3DPJ: Error : zero angle between axes" << std::endl;
59  SetIdentity();
60  } else {
61  if (std::fabs(cos1-cos2) > 0.000001) {
62  std::cerr << "Transform3DPJ: Warning: angles between axes are not equal"
63  << std::endl;
64  }
65 
66  // F I N D R O T A T I O N M A T R I X
67 
68  z1 = (x1.Cross(y1)).Unit();
69  y1 = z1.Cross(x1);
70 
71  z2 = (x2.Cross(y2)).Unit();
72  y2 = z2.Cross(x2);
73 
74  double x1x = x1.X(), x1y = x1.Y(), x1z = x1.Z();
75  double y1x = y1.X(), y1y = y1.Y(), y1z = y1.Z();
76  double z1x = z1.X(), z1y = z1.Y(), z1z = z1.Z();
77 
78  double detxx = (y1y*z1z - z1y*y1z);
79  double detxy = -(y1x*z1z - z1x*y1z);
80  double detxz = (y1x*z1y - z1x*y1y);
81  double detyx = -(x1y*z1z - z1y*x1z);
82  double detyy = (x1x*z1z - z1x*x1z);
83  double detyz = -(x1x*z1y - z1x*x1y);
84  double detzx = (x1y*y1z - y1y*x1z);
85  double detzy = -(x1x*y1z - y1x*x1z);
86  double detzz = (x1x*y1y - y1x*x1y);
87 
88  double x2x = x2.X(), x2y = x2.Y(), x2z = x2.Z();
89  double y2x = y2.X(), y2y = y2.Y(), y2z = y2.Z();
90  double z2x = z2.X(), z2y = z2.Y(), z2z = z2.Z();
91 
92  double txx = x2x*detxx + y2x*detyx + z2x*detzx;
93  double txy = x2x*detxy + y2x*detyy + z2x*detzy;
94  double txz = x2x*detxz + y2x*detyz + z2x*detzz;
95  double tyx = x2y*detxx + y2y*detyx + z2y*detzx;
96  double tyy = x2y*detxy + y2y*detyy + z2y*detzy;
97  double tyz = x2y*detxz + y2y*detyz + z2y*detzz;
98  double tzx = x2z*detxx + y2z*detyx + z2z*detzx;
99  double tzy = x2z*detxy + y2z*detyy + z2z*detzy;
100  double tzz = x2z*detxz + y2z*detyz + z2z*detzz;
101 
102  // S E T T R A N S F O R M A T I O N
103 
104  double dx1 = fr0.X(), dy1 = fr0.Y(), dz1 = fr0.Z();
105  double dx2 = to0.X(), dy2 = to0.Y(), dz2 = to0.Z();
106 
107  SetComponents(txx, txy, txz, dx2-txx*dx1-txy*dy1-txz*dz1,
108  tyx, tyy, tyz, dy2-tyx*dx1-tyy*dy1-tyz*dz1,
109  tzx, tzy, tzz, dz2-tzx*dx1-tzy*dy1-tzz*dz1);
110  }
111 }
math::XYZVector XYZVector
void SetComponents(IT begin, IT end)
template<class ForeignMatrix >
ROOT::Math::Transform3DPJ::Transform3DPJ ( const ForeignMatrix &  m)
inlineexplicit

Construct from a linear algebra matrix of size at least 3x4, which must support operator()(i,j) to obtain elements (0,0) thru (2,3). The 3x3 sub-block is assumed to be the rotation part and the translations vector are described by the 4-th column

Definition at line 211 of file Transform3DPJ.h.

References SetComponents().

211  {
212  SetComponents(m);
213  }
void SetComponents(IT begin, IT end)
ROOT::Math::Transform3DPJ::Transform3DPJ ( double  xx,
double  xy,
double  xz,
double  dx,
double  yx,
double  yy,
double  yz,
double  dy,
double  zx,
double  zy,
double  zz,
double  dz 
)
inline

Raw constructor from 12 Scalar components

Definition at line 218 of file Transform3DPJ.h.

References SetComponents().

221  {
222  SetComponents (xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
223  }
void SetComponents(IT begin, IT end)

Member Function Documentation

void ROOT::Math::Transform3DPJ::AssignFrom ( const Rotation3D &  r,
const Vector v 
)
protected

make transformation from first a rotation then a translation

Definition at line 212 of file Transform3DPJ.cc.

References fM, i, kDX, kDY, kDZ, kYX, and kZX.

Referenced by Transform3DPJ().

213 {
214  // assignment from rotation + translation
215 
216  double rotData[9];
217  r.GetComponents(rotData, rotData +9);
218  // first raw
219  for (int i = 0; i < 3; ++i)
220  fM[i] = rotData[i];
221  // second raw
222  for (int i = 0; i < 3; ++i)
223  fM[kYX+i] = rotData[3+i];
224  // third raw
225  for (int i = 0; i < 3; ++i)
226  fM[kZX+i] = rotData[6+i];
227 
228  // translation data
229  double vecData[3];
230  v.GetCoordinates(vecData, vecData+3);
231  fM[kDX] = vecData[0];
232  fM[kDY] = vecData[1];
233  fM[kDZ] = vecData[2];
234 }
int i
Definition: DBlmapReader.cc:9
mathSSE::Vec4< T > v
void ROOT::Math::Transform3DPJ::AssignFrom ( const Rotation3D &  r)
protected

make transformation from only rotations (zero translation)

Definition at line 237 of file Transform3DPJ.cc.

References fM, i, and j.

238 {
239  // assign from only a rotation (null translation)
240  double rotData[9];
241  r.GetComponents(rotData, rotData +9);
242  for (int i = 0; i < 3; ++i) {
243  for (int j = 0; j < 3; ++j)
244  fM[4*i + j] = rotData[3*i+j];
245  // empty vector data
246  fM[4*i + 3] = 0;
247  }
248 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
void ROOT::Math::Transform3DPJ::AssignFrom ( const Vector v)
protected

make transformation from only translation (identity rotations)

Definition at line 250 of file Transform3DPJ.cc.

References fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, and kZZ.

template<class IT >
void ROOT::Math::Transform3DPJ::GetComponents ( IT  begin,
IT  end 
) const
inline

Get the 12 matrix components into data specified by an iterator begin and another to the end of the desired data (12 past start).

Definition at line 260 of file Transform3DPJ.h.

References begin, fM, and i.

Referenced by ROOT::Math::operator<<().

260  {
261  for (int i = 0; i <12; ++i) {
262  *begin = fM[i];
263  ++begin;
264  }
265  assert (end==begin);
266  }
int i
Definition: DBlmapReader.cc:9
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
template<class IT >
void ROOT::Math::Transform3DPJ::GetComponents ( IT  begin) const
inline

Get the 12 matrix components into data specified by an iterator begin

Definition at line 272 of file Transform3DPJ.h.

References filterCSVwithJSON::copy, and fM.

272  {
273  std::copy ( fM, fM+12, begin );
274  }
#define begin
Definition: vmac.h:31
void ROOT::Math::Transform3DPJ::GetComponents ( double &  xx,
double &  xy,
double &  xz,
double &  dx,
double &  yx,
double &  yy,
double &  yz,
double &  dy,
double &  zx,
double &  zy,
double &  zz,
double &  dz 
) const
inline
void ROOT::Math::Transform3DPJ::GetDecomposition ( Rotation3D &  r,
Vector v 
) const

Get the rotation and translation vector representing the 3D transformation

Definition at line 146 of file Transform3DPJ.cc.

References fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, and kZZ.

Referenced by CrystalPad::CrystalPad(), and operator()().

template<class ForeignMatrix >
void ROOT::Math::Transform3DPJ::GetTransformMatrix ( ForeignMatrix &  m) const
inline

Get components into a linear algebra matrix of size at least 3x4, which must support operator()(i,j) for write access to elements (0,0) thru (2,3).

Definition at line 297 of file Transform3DPJ.h.

References fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, kZZ, and m.

Transform3DPJ ROOT::Math::Transform3DPJ::Inverse ( ) const
inline

Return the inverse of the transformation.

Definition at line 441 of file Transform3DPJ.h.

References Invert(), and lumiQTWidget::t.

441  {
442  Transform3DPJ t(*this);
443  t.Invert();
444  return t;
445  }
void ROOT::Math::Transform3DPJ::Invert ( )

Invert the transformation in place

Definition at line 115 of file Transform3DPJ.cc.

References dtNoiseDBValidation_cfg::cerr, fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, kZZ, and SetComponents().

Referenced by Inverse().

116 {
117  //
118  // Name: Transform3DPJ::inverse Date: 24.09.96
119  // Author: E.Chernyaev (IHEP/Protvino) Revised:
120  //
121  // Function: Find inverse affine transformation.
122 
123  double detxx = fM[kYY]*fM[kZZ] - fM[kYZ]*fM[kZY];
124  double detxy = fM[kYX]*fM[kZZ] - fM[kYZ]*fM[kZX];
125  double detxz = fM[kYX]*fM[kZY] - fM[kYY]*fM[kZX];
126  double det = fM[kXX]*detxx - fM[kXY]*detxy + fM[kXZ]*detxz;
127  if (det == 0) {
128  std::cerr << "Transform3DPJ::inverse error: zero determinant" << std::endl;
129  return;
130  }
131  det = 1./det; detxx *= det; detxy *= det; detxz *= det;
132  double detyx = (fM[kXY]*fM[kZZ] - fM[kXZ]*fM[kZY] )*det;
133  double detyy = (fM[kXX]*fM[kZZ] - fM[kXZ]*fM[kZX] )*det;
134  double detyz = (fM[kXX]*fM[kZY] - fM[kXY]*fM[kZX] )*det;
135  double detzx = (fM[kXY]*fM[kYZ] - fM[kXZ]*fM[kYY] )*det;
136  double detzy = (fM[kXX]*fM[kYZ] - fM[kXZ]*fM[kYX] )*det;
137  double detzz = (fM[kXX]*fM[kYY] - fM[kXY]*fM[kYX] )*det;
139  (detxx, -detyx, detzx, -detxx*fM[kDX]+detyx*fM[kDY]-detzx*fM[kDZ],
140  -detxy, detyy, -detzy, detxy*fM[kDX]-detyy*fM[kDY]+detzy*fM[kDZ],
141  detxz, -detyz, detzz, -detxz*fM[kDX]+detyz*fM[kDY]-detzz*fM[kDZ]);
142 }
void SetComponents(IT begin, IT end)
bool ROOT::Math::Transform3DPJ::operator!= ( const Transform3DPJ rhs) const
inline

Definition at line 467 of file Transform3DPJ.h.

References operator==().

467  {
468  return ! operator==(rhs);
469  }
bool operator==(const Transform3DPJ &rhs) const
XYZPoint ROOT::Math::Transform3DPJ::operator() ( const Point p) const

Transformation operation for Position Vector in Cartesian coordinate

Definition at line 157 of file Transform3DPJ.cc.

References GetDecomposition(), alignCSCRings::r, and lumiQTWidget::t.

Referenced by operator()(), operator*(), and Transform().

158 {
159  // pass through rotation class (could be implemented directly to be faster)
160 
161  Rotation3D r;
162  XYZVector t;
163  GetDecomposition(r, t);
164  XYZPoint pnew = r(p);
165  pnew += t;
166  return pnew;
167 }
math::XYZVector XYZVector
void GetDecomposition(Rotation3D &r, Vector &v) const
math::XYZVector XYZPoint
XYZVector ROOT::Math::Transform3DPJ::operator() ( const Vector v) const

Transformation operation for Displacement Vectors in Cartesian coordinate For the Displacement Vectors only the rotation applies - no translations

Definition at line 170 of file Transform3DPJ.cc.

References GetDecomposition(), alignCSCRings::r, and lumiQTWidget::t.

171 {
172  // pass through rotation class ( could be implemented directly to be faster)
173 
174  Rotation3D r;
175  XYZVector t;
176  GetDecomposition(r, t);
177  // only rotation
178  return r(v);
179 }
math::XYZVector XYZVector
void GetDecomposition(Rotation3D &r, Vector &v) const
mathSSE::Vec4< T > v
template<class CoordSystem >
PositionVector3D<CoordSystem> ROOT::Math::Transform3DPJ::operator() ( const PositionVector3D< CoordSystem > &  p) const
inline

Transformation operation for Position Vector in any coordinate system

Definition at line 356 of file Transform3DPJ.h.

References operator()().

356  {
357  Point xyzNew = operator() ( Point(p) );
358  return PositionVector3D<CoordSystem> (xyzNew);
359  }
PositionVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Point
Definition: Transform3DPJ.h:66
math::XYZPoint Point
Point operator()(const Point &p) const
template<class CoordSystem >
DisplacementVector3D<CoordSystem> ROOT::Math::Transform3DPJ::operator() ( const DisplacementVector3D< CoordSystem > &  v) const
inline

Transformation operation for Displacement Vector in any coordinate system

Definition at line 365 of file Transform3DPJ.h.

References operator()().

365  {
366  Vector xyzNew = operator() ( Vector(v) );
367  return DisplacementVector3D<CoordSystem> (xyzNew);
368  }
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Vector
Definition: Transform3DPJ.h:65
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:28
mathSSE::Vec4< T > v
Point operator()(const Point &p) const
template<class CoordSystem >
LorentzVector<CoordSystem> ROOT::Math::Transform3DPJ::operator() ( const LorentzVector< CoordSystem > &  q) const
inline

Transformation operation for a Lorentz Vector in any coordinate system

Definition at line 393 of file Transform3DPJ.h.

References operator()().

393  {
394  Vector xyzNew = operator() ( Vector(q.Vect() ) );
395  return LorentzVector<CoordSystem> (xyzNew.X(), xyzNew.Y(), xyzNew.Z(), q.E() );
396  }
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Vector
Definition: Transform3DPJ.h:65
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:28
math::XYZTLorentzVector LorentzVector
Point operator()(const Point &p) const
Plane3D ROOT::Math::Transform3DPJ::operator() ( const Plane3D plane) const

Transformation on a 3D plane

Definition at line 258 of file Transform3DPJ.cc.

References n, and AlCaHLTBitMon_ParallelJobs::p.

259 {
260  // transformations on a 3D plane
261  XYZVector n = plane.Normal();
262  // take a point on the plane. Use origin projection on the plane
263  // ( -ad, -bd, -cd) if (a**2 + b**2 + c**2 ) = 1
264  double d = plane.HesseDistance();
265  XYZPoint p( - d * n.X() , - d *n.Y(), -d *n.Z() );
266  return Plane3D ( operator() (n), operator() (p) );
267 }
math::XYZVector XYZVector
math::XYZVector XYZPoint
ROOT::Math::Plane3D Plane3D
template<class AVector >
AVector ROOT::Math::Transform3DPJ::operator* ( const AVector &  v) const
inline

Transformation operation for Vectors. Apply same rules as operator() depending on type of vector. Will work only for DisplacementVector3D, PositionVector3D and LorentzVector

Definition at line 413 of file Transform3DPJ.h.

References operator()().

413  {
414  return operator() (v);
415  }
mathSSE::Vec4< T > v
Point operator()(const Point &p) const
Transform3DPJ ROOT::Math::Transform3DPJ::operator* ( const Transform3DPJ t) const
inline

multiply (combine) two transformations

Definition at line 427 of file Transform3DPJ.h.

References lumiQTWidget::t, and tmp.

427  {
428  Transform3DPJ tmp(*this);
429  tmp*= t;
430  return tmp;
431  }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Transform3DPJ & ROOT::Math::Transform3DPJ::operator*= ( const Transform3DPJ t)

multiply (combine) with another transformation in place

Definition at line 181 of file Transform3DPJ.cc.

References fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, kZZ, and SetComponents().

182 {
183  // combination of transformations
184 
185  SetComponents(fM[kXX]*t.fM[kXX]+fM[kXY]*t.fM[kYX]+fM[kXZ]*t.fM[kZX],
186  fM[kXX]*t.fM[kXY]+fM[kXY]*t.fM[kYY]+fM[kXZ]*t.fM[kZY],
187  fM[kXX]*t.fM[kXZ]+fM[kXY]*t.fM[kYZ]+fM[kXZ]*t.fM[kZZ],
188  fM[kXX]*t.fM[kDX]+fM[kXY]*t.fM[kDY]+fM[kXZ]*t.fM[kDZ]+fM[kDX],
189 
190  fM[kYX]*t.fM[kXX]+fM[kYY]*t.fM[kYX]+fM[kYZ]*t.fM[kZX],
191  fM[kYX]*t.fM[kXY]+fM[kYY]*t.fM[kYY]+fM[kYZ]*t.fM[kZY],
192  fM[kYX]*t.fM[kXZ]+fM[kYY]*t.fM[kYZ]+fM[kYZ]*t.fM[kZZ],
193  fM[kYX]*t.fM[kDX]+fM[kYY]*t.fM[kDY]+fM[kYZ]*t.fM[kDZ]+fM[kDY],
194 
195  fM[kZX]*t.fM[kXX]+fM[kZY]*t.fM[kYX]+fM[kZZ]*t.fM[kZX],
196  fM[kZX]*t.fM[kXY]+fM[kZY]*t.fM[kYY]+fM[kZZ]*t.fM[kZY],
197  fM[kZX]*t.fM[kXZ]+fM[kZY]*t.fM[kYZ]+fM[kZZ]*t.fM[kZZ],
198  fM[kZX]*t.fM[kDX]+fM[kZY]*t.fM[kDY]+fM[kZZ]*t.fM[kDZ]+fM[kDZ]);
199 
200  return *this;
201 }
void SetComponents(IT begin, IT end)
template<class ForeignMatrix >
Transform3DPJ& ROOT::Math::Transform3DPJ::operator= ( const ForeignMatrix &  m)
inline

Construct from a linear algebra matrix of size at least 3x4, which must support operator()(i,j) to obtain elements (0,0) thru (2,3). The 3x3 sub-block is assumed to be the rotation part and the translations vector are described by the 4-th column

Definition at line 233 of file Transform3DPJ.h.

References SetComponents().

233  {
234  SetComponents(m);
235  return *this;
236  }
void SetComponents(IT begin, IT end)
bool ROOT::Math::Transform3DPJ::operator== ( const Transform3DPJ rhs) const
inline

Equality/inequality operators

Definition at line 451 of file Transform3DPJ.h.

References fM.

Referenced by operator!=().

451  {
452  if( fM[0] != rhs.fM[0] ) return false;
453  if( fM[1] != rhs.fM[1] ) return false;
454  if( fM[2] != rhs.fM[2] ) return false;
455  if( fM[3] != rhs.fM[3] ) return false;
456  if( fM[4] != rhs.fM[4] ) return false;
457  if( fM[5] != rhs.fM[5] ) return false;
458  if( fM[6] != rhs.fM[6] ) return false;
459  if( fM[7] != rhs.fM[7] ) return false;
460  if( fM[8] != rhs.fM[8] ) return false;
461  if( fM[9] != rhs.fM[9] ) return false;
462  if( fM[10]!= rhs.fM[10] ) return false;
463  if( fM[11]!= rhs.fM[11] ) return false;
464  return true;
465  }
template<class IT >
void ROOT::Math::Transform3DPJ::SetComponents ( IT  begin,
IT  end 
)
inline

Set the 12 matrix components given an iterator to the start of the desired data, and another to the end (12 past start).

Definition at line 247 of file Transform3DPJ.h.

References begin, fM, and i.

Referenced by Invert(), operator*=(), operator=(), and Transform3DPJ().

247  {
248  for (int i = 0; i <12; ++i) {
249  fM[i] = *begin;
250  ++begin;
251  }
252  assert (end==begin);
253  }
int i
Definition: DBlmapReader.cc:9
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
void ROOT::Math::Transform3DPJ::SetComponents ( double  xx,
double  xy,
double  xz,
double  dx,
double  yx,
double  yy,
double  yz,
double  dy,
double  zx,
double  zy,
double  zz,
double  dz 
)
inline
void ROOT::Math::Transform3DPJ::SetIdentity ( )
protected

Set identity transformation (identity rotation , zero translation)

Definition at line 203 of file Transform3DPJ.cc.

References fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, and kZZ.

Referenced by Transform3DPJ().

template<class ForeignMatrix >
void ROOT::Math::Transform3DPJ::SetTransformMatrix ( const ForeignMatrix &  m)
inline

Set components from a linear algebra matrix of size at least 3x4, which must support operator()(i,j) to obtain elements (0,0) thru (2,3). The 3x3 sub-block is assumed to be the rotation part and the translations vector are described by the 4-th column

Definition at line 284 of file Transform3DPJ.h.

References fM, kDX, kDY, kDZ, kXX, kXY, kXZ, kYX, kYY, kYZ, kZX, kZY, kZZ, and m.

template<class CoordSystem , class Tag1 , class Tag2 >
void ROOT::Math::Transform3DPJ::Transform ( const PositionVector3D< CoordSystem, Tag1 > &  p1,
PositionVector3D< CoordSystem, Tag2 > &  p2 
) const
inline

Transformation operation for points between different coordinate system tags

Definition at line 374 of file Transform3DPJ.h.

References operator()().

374  {
375  Point xyzNew = operator() ( Point(p1.X(), p1.Y(), p1.Z()) );
376  p2.SetXYZ( xyzNew.X(), xyzNew.Y(), xyzNew.Z() );
377  }
PositionVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Point
Definition: Transform3DPJ.h:66
math::XYZPoint Point
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
Point operator()(const Point &p) const
template<class CoordSystem , class Tag1 , class Tag2 >
void ROOT::Math::Transform3DPJ::Transform ( const DisplacementVector3D< CoordSystem, Tag1 > &  v1,
DisplacementVector3D< CoordSystem, Tag2 > &  v2 
) const
inline

Transformation operation for Displacement Vector of different coordinate systems

Definition at line 384 of file Transform3DPJ.h.

References operator()().

384  {
385  Vector xyzNew = operator() ( Vector(v1.X(), v1.Y(), v1.Z() ) );
386  v2.SetXYZ( xyzNew.X(), xyzNew.Y(), xyzNew.Z() );
387  }
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Vector
Definition: Transform3DPJ.h:65
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:28
Point operator()(const Point &p) const

Member Data Documentation

double ROOT::Math::Transform3DPJ::fM[12]
private