CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Private Attributes

ROOT::Math::Transform3DPJ Class Reference

#include <Transform3DPJ.h>

List of all members.

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
Plane3D operator() (const Plane3D &plane) const
template<class CoordSystem >
LorentzVector< CoordSystem > operator() (const LorentzVector< CoordSystem > &q) 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 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 (double xx, double xy, double xz, double dx, double yx, double yy, double yz, double dy, double zx, double zy, double zz, double dz)
 Transform3DPJ (const RotationX &r)
 Transform3DPJ (const EulerAngles &r)
template<class IT >
 Transform3DPJ (IT begin, IT end)
 Transform3DPJ (const Point &fr0, const Point &fr1, const Point &fr2, const Point &to0, const Point &to1, const Point &to2)
 Transform3DPJ (const Quaternion &r)
 Transform3DPJ (const RotationY &r)
 Transform3DPJ (const Rotation3D &r, const Vector &v)
 Transform3DPJ (const AxisAngle &r)
 Transform3DPJ ()
template<class ForeignMatrix >
 Transform3DPJ (const ForeignMatrix &m)
 Transform3DPJ (const RotationZ &r)
template<class ARotation , class CoordSystem , class Tag >
 Transform3DPJ (const DisplacementVector3D< CoordSystem, Tag > &v, const ARotation &r)
template<class ARotation , class CoordSystem , class Tag >
 Transform3DPJ (const ARotation &r, const DisplacementVector3D< CoordSystem, Tag > &v)
template<class CoordSystem , class Tag >
 Transform3DPJ (const DisplacementVector3D< CoordSystem, Tag > &v)
 Transform3DPJ (const Rotation3D &r)
 Transform3DPJ (const Vector &v)
 Transform3DPJ (const Vector &v, const Rotation3D &r)

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

Enumerator:
kXX 
kXY 
kXZ 
kDX 
kYX 
kYY 
kYZ 
kDY 
kZX 
kZY 
kZZ 
kDZ 

Definition at line 69 of file Transform3DPJ.h.

                                 {
      kXX = 0, kXY = 1, kXZ = 2, kDX = 3, 
      kYX = 4, kYY = 5, kYZ = 6, kDY = 7,
      kZX = 8, kZY = 9, kZZ =10, kDZ = 11
    };

Constructor & Destructor Documentation

ROOT::Math::Transform3DPJ::Transform3DPJ ( ) [inline]

Default constructor (identy rotation) + zero translation

Definition at line 80 of file Transform3DPJ.h.

References SetIdentity().

    {
      SetIdentity();
    }
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().

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().

    {
      AssignFrom( r, 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 csvReporter::r.

    {
      // is equivalent from having first the rotation and then the translation vector rotated
      AssignFrom( r, r(v) ); 
    }
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Rotation3D &  r) [inline, explicit]

Construct from a 3D Rotation only with zero translation

Definition at line 114 of file Transform3DPJ.h.

References AssignFrom().

                                                  { 
      AssignFrom(r);
    } 
ROOT::Math::Transform3DPJ::Transform3DPJ ( const AxisAngle &  r) [inline, explicit]

Definition at line 118 of file Transform3DPJ.h.

References AssignFrom().

                                                 { 
      AssignFrom(Rotation3D(r));
    } 
ROOT::Math::Transform3DPJ::Transform3DPJ ( const EulerAngles &  r) [inline, explicit]

Definition at line 121 of file Transform3DPJ.h.

References AssignFrom().

                                                   { 
      AssignFrom(Rotation3D(r));
    } 
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Quaternion &  r) [inline, explicit]

Definition at line 124 of file Transform3DPJ.h.

References AssignFrom().

                                                  { 
      AssignFrom(Rotation3D(r));
    } 
ROOT::Math::Transform3DPJ::Transform3DPJ ( const RotationX &  r) [inline, explicit]

Definition at line 128 of file Transform3DPJ.h.

References AssignFrom().

                                                 { 
      AssignFrom(Rotation3D(r));
    } 
ROOT::Math::Transform3DPJ::Transform3DPJ ( const RotationY &  r) [inline, explicit]

Definition at line 131 of file Transform3DPJ.h.

References AssignFrom().

                                                 { 
      AssignFrom(Rotation3D(r));
    } 
ROOT::Math::Transform3DPJ::Transform3DPJ ( const RotationZ &  r) [inline, explicit]

Definition at line 134 of file Transform3DPJ.h.

References AssignFrom().

                                                 { 
      AssignFrom(Rotation3D(r));
    } 
template<class CoordSystem , class Tag >
ROOT::Math::Transform3DPJ::Transform3DPJ ( const DisplacementVector3D< CoordSystem, Tag > &  v) [inline, explicit]

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

Definition at line 143 of file Transform3DPJ.h.

References AssignFrom().

                                                                             { 
      AssignFrom(Vector(v.X(),v.Y(),v.Z()));
    }
ROOT::Math::Transform3DPJ::Transform3DPJ ( const Vector v) [inline, explicit]

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().

                                              { 
      AssignFrom(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().

    {
      AssignFrom( Rotation3D(r), Vector (v.X(),v.Y(),v.Z()) ); 
    }
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().

    {
      // is equivalent from having first the rotation and then the translation vector rotated
      Rotation3D r3d(r);
      AssignFrom( r3d, r3d( Vector(v.X(),v.Y(),v.Z()) ) ); 
    }
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 benchmark_cfg::cerr, SetComponents(), and SetIdentity().

{
   // takes impl. from CLHEP ( E.Chernyaev). To be checked
   
   XYZVector x1,y1,z1, x2,y2,z2;
   x1 = (fr1 - fr0).Unit();
   y1 = (fr2 - fr0).Unit();
   x2 = (to1 - to0).Unit();
   y2 = (to2 - to0).Unit();
   
   //   C H E C K   A N G L E S
   
   double cos1, cos2;
   cos1 = x1.Dot(y1);
   cos2 = x2.Dot(y2);
   
   if (std::fabs(1.0-cos1) <= 0.000001 || std::fabs(1.0-cos2) <= 0.000001) {
      std::cerr << "Transform3DPJ: Error : zero angle between axes" << std::endl;
      SetIdentity();
   } else {
      if (std::fabs(cos1-cos2) > 0.000001) {
         std::cerr << "Transform3DPJ: Warning: angles between axes are not equal"
         << std::endl;
      }
      
      //   F I N D   R O T A T I O N   M A T R I X
      
      z1 = (x1.Cross(y1)).Unit();
      y1  = z1.Cross(x1);
      
      z2 = (x2.Cross(y2)).Unit();
      y2  = z2.Cross(x2);

      double x1x = x1.X(), x1y = x1.Y(), x1z = x1.Z();
      double y1x = y1.X(), y1y = y1.Y(), y1z = y1.Z();
      double z1x = z1.X(), z1y = z1.Y(), z1z = z1.Z();
      
      double detxx =  (y1y*z1z - z1y*y1z);
      double detxy = -(y1x*z1z - z1x*y1z);
      double detxz =  (y1x*z1y - z1x*y1y);
      double detyx = -(x1y*z1z - z1y*x1z);
      double detyy =  (x1x*z1z - z1x*x1z);
      double detyz = -(x1x*z1y - z1x*x1y);
      double detzx =  (x1y*y1z - y1y*x1z);
      double detzy = -(x1x*y1z - y1x*x1z);
      double detzz =  (x1x*y1y - y1x*x1y);

      double x2x = x2.X(), x2y = x2.Y(), x2z = x2.Z();
      double y2x = y2.X(), y2y = y2.Y(), y2z = y2.Z();
      double z2x = z2.X(), z2y = z2.Y(), z2z = z2.Z();

      double txx = x2x*detxx + y2x*detyx + z2x*detzx;
      double txy = x2x*detxy + y2x*detyy + z2x*detzy;
      double txz = x2x*detxz + y2x*detyz + z2x*detzz;
      double tyx = x2y*detxx + y2y*detyx + z2y*detzx;
      double tyy = x2y*detxy + y2y*detyy + z2y*detzy;
      double tyz = x2y*detxz + y2y*detyz + z2y*detzz;
      double tzx = x2z*detxx + y2z*detyx + z2z*detzx;
      double tzy = x2z*detxy + y2z*detyy + z2z*detzy;
      double tzz = x2z*detxz + y2z*detyz + z2z*detzz;
      
      //   S E T    T R A N S F O R M A T I O N
      
      double dx1 = fr0.X(), dy1 = fr0.Y(), dz1 = fr0.Z();
      double dx2 = to0.X(), dy2 = to0.Y(), dz2 = to0.Z();
      
      SetComponents(txx, txy, txz, dx2-txx*dx1-txy*dy1-txz*dz1,
                    tyx, tyy, tyz, dy2-tyx*dx1-tyy*dy1-tyz*dz1,
                    tzx, tzy, tzz, dz2-tzx*dx1-tzy*dy1-tzz*dz1);
   }
}
template<class ForeignMatrix >
ROOT::Math::Transform3DPJ::Transform3DPJ ( const ForeignMatrix &  m) [inline, explicit]

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().

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().

    {
      SetComponents (xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
    }

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().

{
   // assignment  from rotation + translation
   
   double rotData[9];
   r.GetComponents(rotData, rotData +9);
   // first raw
   for (int i = 0; i < 3; ++i)
      fM[i] = rotData[i];
   // second raw
   for (int i = 0; i < 3; ++i)
      fM[kYX+i] = rotData[3+i];
   // third raw
   for (int i = 0; i < 3; ++i)
      fM[kZX+i] = rotData[6+i];
   
   // translation data
   double vecData[3];
   v.GetCoordinates(vecData, vecData+3);
   fM[kDX] = vecData[0];
   fM[kDY] = vecData[1];
   fM[kDZ] = vecData[2];
}
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.

{
   // assign from only a rotation  (null translation)
   double rotData[9];
   r.GetComponents(rotData, rotData +9);
   for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j)
         fM[4*i + j] = rotData[3*i+j];
      // empty vector data
      fM[4*i + 3] = 0;
   }
}
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.

{
   // assign from a translation only (identity rotations)
   fM[kXX] = 1.0;  fM[kXY] = 0.0; fM[kXZ] = 0.0; fM[kDX] = v.X();
   fM[kYX] = 0.0;  fM[kYY] = 1.0; fM[kYZ] = 0.0; fM[kDY] = v.Y();
   fM[kZX] = 0.0;  fM[kZY] = 0.0; fM[kZZ] = 1.0; fM[kDZ] = v.Z();
}
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.

                                       {
      std::copy ( fM, fM+12, begin );
    }
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]

Get the nine components into 12 scalars

Definition at line 320 of file Transform3DPJ.h.

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

                                                                         {
      xx=fM[kXX];  xy=fM[kXY];  xz=fM[kXZ];  dx=fM[kDX];
      yx=fM[kYX];  yy=fM[kYY];  yz=fM[kYZ];  dy=fM[kDY];
      zx=fM[kZX];  zy=fM[kZY];  zz=fM[kZZ];  dz=fM[kDZ];
    }
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<<().

                                               {
       for (int i = 0; i <12; ++i) { 
          *begin = fM[i];
          ++begin;  
       }
       assert (end==begin);
    }
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()().

{
   // decompose a trasfomation in a 3D rotation and in a 3D vector (cartesian coordinates) 
   r.SetComponents( fM[kXX], fM[kXY], fM[kXZ],
                    fM[kYX], fM[kYY], fM[kYZ],
                    fM[kZX], fM[kZY], fM[kZZ] );
   
   v.SetCoordinates( fM[kDX], fM[kDY], fM[kDZ] );
}
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.

                                                 {
      m(0,0)=fM[kXX];  m(0,1)=fM[kXY];  m(0,2)=fM[kXZ];  m(0,3)=fM[kDX];
      m(1,0)=fM[kYX];  m(1,1)=fM[kYY];  m(1,2)=fM[kYZ];  m(1,3)=fM[kDY];
      m(2,0)=fM[kZX];  m(2,1)=fM[kZY];  m(2,2)=fM[kZZ];  m(2,3)=fM[kDZ];
    }
Transform3DPJ ROOT::Math::Transform3DPJ::Inverse ( ) const [inline]

Return the inverse of the transformation.

Definition at line 441 of file Transform3DPJ.h.

References Invert(), and matplotRender::t.

                                  { 
      Transform3DPJ t(*this);
      t.Invert();
      return t;
    }
void ROOT::Math::Transform3DPJ::Invert ( )

Invert the transformation in place

Definition at line 115 of file Transform3DPJ.cc.

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

Referenced by Inverse().

{
   //
   // Name: Transform3DPJ::inverse                     Date:    24.09.96
   // Author: E.Chernyaev (IHEP/Protvino)            Revised:
   //
   // Function: Find inverse affine transformation.
   
   double detxx = fM[kYY]*fM[kZZ] - fM[kYZ]*fM[kZY];
   double detxy = fM[kYX]*fM[kZZ] - fM[kYZ]*fM[kZX];
   double detxz = fM[kYX]*fM[kZY] - fM[kYY]*fM[kZX];
   double det   = fM[kXX]*detxx - fM[kXY]*detxy + fM[kXZ]*detxz;
   if (det == 0) {
      std::cerr << "Transform3DPJ::inverse error: zero determinant" << std::endl;
      return;
   }
   det = 1./det; detxx *= det; detxy *= det; detxz *= det;
   double detyx = (fM[kXY]*fM[kZZ] - fM[kXZ]*fM[kZY] )*det;
   double detyy = (fM[kXX]*fM[kZZ] - fM[kXZ]*fM[kZX] )*det;
   double detyz = (fM[kXX]*fM[kZY] - fM[kXY]*fM[kZX] )*det;
   double detzx = (fM[kXY]*fM[kYZ] - fM[kXZ]*fM[kYY] )*det;
   double detzy = (fM[kXX]*fM[kYZ] - fM[kXZ]*fM[kYX] )*det;
   double detzz = (fM[kXX]*fM[kYY] - fM[kXY]*fM[kYX] )*det;
   SetComponents
      (detxx, -detyx,  detzx, -detxx*fM[kDX]+detyx*fM[kDY]-detzx*fM[kDZ],
       -detxy,  detyy, -detzy,  detxy*fM[kDX]-detyy*fM[kDY]+detzy*fM[kDZ],
       detxz, -detyz,  detzz, -detxz*fM[kDX]+detyz*fM[kDY]-detzz*fM[kDZ]);
}
bool ROOT::Math::Transform3DPJ::operator!= ( const Transform3DPJ rhs) const [inline]

Definition at line 467 of file Transform3DPJ.h.

References operator==().

                                                       {
      return ! operator==(rhs);
    }
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()().

                                                                                              { 
      Point xyzNew = operator() ( Point(p) );
      return  PositionVector3D<CoordSystem> (xyzNew);
    }
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()().

                                                                                       { 
      Vector xyzNew = operator() ( Vector(q.Vect() ) );
      return  LorentzVector<CoordSystem> (xyzNew.X(), xyzNew.Y(), xyzNew.Z(), q.E() );
    }
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 L1TEmulatorMonitor_cff::p.

{
   // transformations on a 3D plane
   XYZVector n = plane.Normal();
   // take a point on the plane. Use origin projection on the plane
   // ( -ad, -bd, -cd) if (a**2 + b**2 + c**2 ) = 1
   double d = plane.HesseDistance();
   XYZPoint p( - d * n.X() , - d *n.Y(), -d *n.Z() );
   return Plane3D ( operator() (n), operator() (p) );
}
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(), csvReporter::r, and matplotRender::t.

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

{
   // pass through rotation class (could be implemented directly to be faster)
   
   Rotation3D r;
   XYZVector  t;
   GetDecomposition(r, t);
   XYZPoint pnew = r(p);
   pnew += t;
   return pnew;
}
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(), csvReporter::r, and matplotRender::t.

{
   // pass through rotation class ( could be implemented directly to be faster)
   
   Rotation3D r;
   XYZVector  t;
   GetDecomposition(r, t);
   // only rotation
   return r(v);
}
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()().

                                                                                                      { 
      Vector xyzNew = operator() ( Vector(v) );
      return  DisplacementVector3D<CoordSystem> (xyzNew);
    }
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()().

                                                 { 
      return operator() (v);
    }
Transform3DPJ ROOT::Math::Transform3DPJ::operator* ( const Transform3DPJ t) const [inline]

multiply (combine) two transformations

Definition at line 427 of file Transform3DPJ.h.

References matplotRender::t, and tmp.

                                                              { 
      Transform3DPJ tmp(*this);
      tmp*= t;
      return tmp;
    }
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().

{
   // combination of transformations
   
   SetComponents(fM[kXX]*t.fM[kXX]+fM[kXY]*t.fM[kYX]+fM[kXZ]*t.fM[kZX],
                 fM[kXX]*t.fM[kXY]+fM[kXY]*t.fM[kYY]+fM[kXZ]*t.fM[kZY],
                 fM[kXX]*t.fM[kXZ]+fM[kXY]*t.fM[kYZ]+fM[kXZ]*t.fM[kZZ],
                 fM[kXX]*t.fM[kDX]+fM[kXY]*t.fM[kDY]+fM[kXZ]*t.fM[kDZ]+fM[kDX],
                 
                 fM[kYX]*t.fM[kXX]+fM[kYY]*t.fM[kYX]+fM[kYZ]*t.fM[kZX],
                 fM[kYX]*t.fM[kXY]+fM[kYY]*t.fM[kYY]+fM[kYZ]*t.fM[kZY],
                 fM[kYX]*t.fM[kXZ]+fM[kYY]*t.fM[kYZ]+fM[kYZ]*t.fM[kZZ],
                 fM[kYX]*t.fM[kDX]+fM[kYY]*t.fM[kDY]+fM[kYZ]*t.fM[kDZ]+fM[kDY],
                 
                 fM[kZX]*t.fM[kXX]+fM[kZY]*t.fM[kYX]+fM[kZZ]*t.fM[kZX],
                 fM[kZX]*t.fM[kXY]+fM[kZY]*t.fM[kYY]+fM[kZZ]*t.fM[kZY],
                 fM[kZX]*t.fM[kXZ]+fM[kZY]*t.fM[kYZ]+fM[kZZ]*t.fM[kZZ],
                 fM[kZX]*t.fM[kDX]+fM[kZY]*t.fM[kDY]+fM[kZZ]*t.fM[kDZ]+fM[kDZ]);
   
   return *this;
}
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().

                                                        { 
      SetComponents(m); 
      return *this; 
    }
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!=().

                                                       {
      if( fM[0] != rhs.fM[0] )  return false;
      if( fM[1] != rhs.fM[1] )  return false;
      if( fM[2] != rhs.fM[2] )  return false;
      if( fM[3] != rhs.fM[3] )  return false;
      if( fM[4] != rhs.fM[4] )  return false;
      if( fM[5] != rhs.fM[5] )  return false;
      if( fM[6] != rhs.fM[6] )  return false;
      if( fM[7] != rhs.fM[7] )  return false;
      if( fM[8] != rhs.fM[8] )  return false;
      if( fM[9] != rhs.fM[9] )  return false;
      if( fM[10]!= rhs.fM[10] ) return false;
      if( fM[11]!= rhs.fM[11] ) return false;
      return true;
    }
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().

                                         {
     for (int i = 0; i <12; ++i) { 
        fM[i] = *begin;
        ++begin; 
     }
     assert (end==begin);
    }
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]

Set the components from 12 scalars

Definition at line 308 of file Transform3DPJ.h.

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

                                                                  {
      fM[kXX]=xx;  fM[kXY]=xy;  fM[kXZ]=xz;  fM[kDX]=dx;
      fM[kYX]=yx;  fM[kYY]=yy;  fM[kYZ]=yz;  fM[kDY]=dy;
      fM[kZX]=zx;  fM[kZY]=zy;  fM[kZZ]=zz;  fM[kDZ]=dz;
    }
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().

{
   //set identity ( identity rotation and zero translation)
   fM[kXX] = 1.0;  fM[kXY] = 0.0; fM[kXZ] = 0.0; fM[kDX] = 0.0;
   fM[kYX] = 0.0;  fM[kYY] = 1.0; fM[kYZ] = 0.0; fM[kDY] = 0.0;
   fM[kZX] = 0.0;  fM[kZY] = 0.0; fM[kZZ] = 1.0; fM[kDZ] = 0.0;
}
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.

                                                 {
      fM[kXX]=m(0,0);  fM[kXY]=m(0,1);  fM[kXZ]=m(0,2); fM[kDX]=m(0,3);
      fM[kYX]=m(1,0);  fM[kYY]=m(1,1);  fM[kYZ]=m(1,2); fM[kDY]=m(1,3);
      fM[kZX]=m(2,0);  fM[kZY]=m(2,1);  fM[kZZ]=m(2,2); fM[kDZ]=m(2,3);
    }
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()().

                                                                                                                              { 
      Vector xyzNew = operator() ( Vector(v1.X(), v1.Y(), v1.Z() ) );
      v2.SetXYZ( xyzNew.X(), xyzNew.Y(), xyzNew.Z() ); 
    }
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()().

                                                                                                                      { 
      Point xyzNew = operator() ( Point(p1.X(), p1.Y(), p1.Z()) );
      p2.SetXYZ( xyzNew.X(), xyzNew.Y(), xyzNew.Z() ); 
    }

Member Data Documentation

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