ROOT logo
ROOT » GEOM » GEOM » TGeoGenTrans

class TGeoGenTrans: public TGeoCombiTrans

 Geometrical transformation package.

   All geometrical transformations handled by the modeller are provided as a
 built-in package. This was designed to minimize memory requirements and
 optimize performance of point/vector master-to-local and local-to-master
 computation. We need to have in mind that a transformation in TGeo has 2
 major use-cases. The first one is for defining the placement of a volume
 with respect to its container reference frame. This frame will be called
 'master' and the frame of the positioned volume - 'local'. If T is a
 transformation used for positioning volume daughters, then:

          MASTER = T * LOCAL

   Therefore a local-to-master conversion will be performed by using T, while
 a master-to-local by using its inverse. The second use case is the computation
 of the global transformation of a given object in the geometry. Since the
 geometry is built as 'volumes-inside-volumes', this global transformation
 represent the pile-up of all local transformations in the corresponding
 branch. The conversion from the global reference frame and the given object
 is also called master-to-local, but it is handled by the manager class.
   A general homogenous transformation is defined as a 4x4 matrix embeeding
 a rotation, a translation and a scale. The advantage of this description
 is that each basic transformation can be represented as a homogenous matrix,
 composition being performed as simple matrix multiplication.
   Rotation:                      Inverse rotation:
         r11  r12  r13   0              r11  r21  r31   0
         r21  r22  r23   0              r12  r22  r32   0
         r31  r32  r33   0              r13  r23  r33   0
          0    0    0    1               0    0    0    1

   Translation:                   Inverse translation:
          1    0    0    tx               1    0    0   -tx
          0    1    0    ty               0    1    0   -ty
          0    0    1    tz               0    0    1   -tz
          0    0    0    1                0    0    0   1

   Scale:                         Inverse scale:
          sx   0    0    0              1/sx  0    0    0
          0    sy   0    0               0   1/sy  0    0
          0    0    sz   0               0    0   1/sz  0
          0    0    0    1               0    0    0    1

  where: rij are the 3x3 rotation matrix components,
         tx, ty, tz are the translation components
         sx, sy, sz are arbitrary scale constants on the eacks axis,

   The disadvantage in using this approach is that computation for 4x4 matrices
 is expensive. Even combining two translation would become a multiplication
 of their corresponding matrices, which is quite an undesired effect. On the
 other hand, it is not a good idea to store a translation as a block of 16
 numbers. We have therefore chosen to implement each basic transformation type
 as a class deriving from the same basic abstract class and handling its specific
 data and point/vector transformation algorithms.


/* */

 The base class TGeoMatrix defines abstract metods for:

 - translation, rotation and scale getters. Every derived class stores only
   its specific data, e.g. a translation stores an array of 3 doubles and a
   rotation an array of 9. However, asking which is the rotation array of a
   TGeoTranslation through the base TGeoMatrix interface is a legal operation.
   The answer in this case is a pointer to a global constant array representing
   an identity rotation.
      Double_t *TGeoMatrix::GetTranslation()
      Double_t *TGeoMatrix::GetRotation()
      Double_t *TGeoMatrix::GetScale()

 - MasterToLocal() and LocalToMaster() point and vector transformations :
      void      TGeoMatrix::MasterToLocal(const Double_t *master, Double_t *local)
      void      TGeoMatrix::LocalToMaster(const Double_t *local, Double_t *master)
      void      TGeoMatrix::MasterToLocalVect(const Double_t *master, Double_t *local)
      void      TGeoMatrix::LocalToMasterVect(const Double_t *local, Double_t *master)
   These allow correct conversion also for reflections.
 - Transformation type getters :
      Bool_t    TGeoMatrix::IsIdentity()
      Bool_t    TGeoMatrix::IsTranslation()
      Bool_t    TGeoMatrix::IsRotation()
      Bool_t    TGeoMatrix::IsScale()
      Bool_t    TGeoMatrix::IsCombi() (translation + rotation)
      Bool_t    TGeoMatrix::IsGeneral() (translation + rotation + scale)

   Combinations of basic transformations are represented by specific classes
 deriving from TGeoMatrix. In order to define a matrix as a combination of several
 others, a special class TGeoHMatrix is provided. Here is an example of matrix
 creation :

 Matrix creation example:

   root[0] TGeoRotation r1,r2;
           r1.SetAngles(90,0,30);        // rotation defined by Euler angles
           r2.SetAngles(90,90,90,180,0,0); // rotation defined by GEANT3 angles
           TGeoTranslation t1(-10,10,0);
           TGeoTranslation t2(10,-10,5);
           TGeoCombiTrans c1(t1,r1);
           TGeoCombiTrans c2(t2,r2);
           TGeoHMatrix h = c1 * c2; // composition is done via TGeoHMatrix class
   root[7] TGeoHMatrix *ph = new TGeoHMatrix(hm); // this is the one we want to
                                                // use for positioning a volume
   root[8] ph->Print();

           pVolume->AddNode(pVolDaughter,id,ph) // now ph is owned by the manager

 Rule for matrix creation:
  - unless explicitly used for positioning nodes (TGeoVolume::AddNode()) all
 matrices deletion have to be managed by users. Matrices passed to geometry
 have to be created by using new() operator and their deletion is done by
 TGeoManager class.

 Available geometrical transformations

   1. TGeoTranslation - represent a (dx,dy,dz) translation. Data members:
 Double_t fTranslation[3]. Translations can be added/subtracted.
         TGeoTranslation t1;
         t1->SetTranslation(-5,10,4);
         TGeoTranslation *t2 = new TGeoTranslation(4,3,10);
         t2->Subtract(&t1);

   2. Rotations - represent a pure rotation. Data members: Double_t fRotationMatrix[3*3].
 Rotations can be defined either by Euler angles, either, by GEANT3 angles :
         TGeoRotation *r1 = new TGeoRotation();
         r1->SetAngles(phi, theta, psi); // all angles in degrees
      This represent the composition of : first a rotation about Z axis with
      angle phi, then a rotation with theta about the rotated X axis, and
      finally a rotation with psi about the new Z axis.

         r1->SetAngles(th1,phi1, th2,phi2, th3,phi3)
      This is a rotation defined in GEANT3 style. Theta and phi are the spherical
      angles of each axis of the rotated coordinate system with respect to the
      initial one. This construction allows definition of malformed rotations,
      e.g. not orthogonal. A check is performed and an error message is issued
      in this case.

      Specific utilities : determinant, inverse.

   3. Scale transformations - represent a scale shrinking/enlargement. Data
      members :Double_t fScale[3]. Not fully implemented yet.

   4. Combined transformations - represent a rotation folowed by a translation.
      Data members: Double_t fTranslation[3], TGeoRotation *fRotation.
         TGeoRotation *rot = new TGeoRotation("rot",10,20,30);
         TGeoTranslation trans;

         TGeoCombiTrans *c1 = new TGeoCombiTrans(trans, rot);
         TGeoCombiTrans *c2 = new TGeoCombiTrans("somename",10,20,30,rot)

   5. TGeoGenTrans - combined transformations including a scale. Not implemented.
   6. TGeoIdentity - a generic singleton matrix representing a identity transformation
       NOTE: identified by the global variable gGeoIdentity.


Function Members (Methods)

public:
TGeoGenTrans()
TGeoGenTrans(const char* name)
TGeoGenTrans(const TGeoGenTrans&)
TGeoGenTrans(Double_t dx, Double_t dy, Double_t dz, Double_t sx, Double_t sy, Double_t sz, TGeoRotation* rot)
TGeoGenTrans(const char* name, Double_t dx, Double_t dy, Double_t dz, Double_t sx, Double_t sy, Double_t sz, TGeoRotation* rot)
virtual~TGeoGenTrans()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
static TClass*TGeoCombiTrans::Class()
static TClass*TGeoMatrix::Class()
static TClass*TNamed::Class()
static TClass*TObject::Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* option = "")
virtual voidTGeoCombiTrans::Clear(Option_t* option = "")
virtual voidTNamed::Clear(Option_t* option = "")
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Int_tTGeoMatrix::GetByteCount() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
voidTGeoMatrix::GetHomogenousMatrix(Double_t* hmat) const
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::GetName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
char*TGeoMatrix::GetPointerName() const
TGeoRotation*TGeoCombiTrans::GetRotation() const
virtual const Double_t*TGeoCombiTrans::GetRotationMatrix() const
virtual const Double_t*TGeoMatrix::GetRotationMatrix() const
virtual const Double_t*GetScale() const
virtual const Double_t*TGeoCombiTrans::GetScale() const
virtual const Double_t*TGeoMatrix::GetScale() const
virtual const char*TNamed::GetTitle() const
virtual const char*TObject::GetTitle() const
virtual const Double_t*TGeoCombiTrans::GetTranslation() const
virtual const Double_t*TGeoMatrix::GetTranslation() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
virtual TGeoMatrix&Inverse() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual TClass*TGeoCombiTrans::IsA() const
virtual TClass*TGeoMatrix::IsA() const
virtual TClass*TNamed::IsA() const
virtual TClass*TObject::IsA() const
Bool_tTGeoMatrix::IsCombi() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTGeoMatrix::IsGeneral() const
Bool_tTGeoMatrix::IsIdentity() const
Bool_tTObject::IsOnHeap() const
Bool_tTGeoMatrix::IsReflection() const
Bool_tTGeoMatrix::IsRegistered() const
Bool_tTGeoMatrix::IsRotAboutZ() const
Bool_tTGeoMatrix::IsRotation() const
Bool_tTGeoMatrix::IsScale() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTGeoMatrix::IsTranslation() const
Bool_tTObject::IsZombie() const
virtual voidTGeoMatrix::LocalToMaster(const Double_t* local, Double_t* master) const
virtual voidTGeoMatrix::LocalToMasterBomb(const Double_t* local, Double_t* master) const
virtual voidTGeoMatrix::LocalToMasterVect(const Double_t* local, Double_t* master) const
virtual voidTNamed::ls(Option_t* option = "") const
virtual voidTObject::ls(Option_t* option = "") const
virtual TGeoMatrix*MakeClone() const
virtual TGeoMatrix*TGeoCombiTrans::MakeClone() const
virtual voidTGeoMatrix::MasterToLocal(const Double_t* master, Double_t* local) const
virtual voidTGeoMatrix::MasterToLocalBomb(const Double_t* master, Double_t* local) const
virtual voidTGeoMatrix::MasterToLocalVect(const Double_t* master, Double_t* local) const
voidTObject::MayNotUse(const char* method) const
Bool_tNormalize()
static voidTGeoMatrix::Normalize(Double_t* vect)
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TGeoMatrix&TGeoMatrix::operator*(const TGeoMatrix& right) const
TGeoGenTrans&operator=(const TGeoGenTrans&)
TGeoCombiTrans&TGeoCombiTrans::operator=(const TGeoMatrix& matrix)
TGeoCombiTrans&TGeoCombiTrans::operator=(const TGeoCombiTrans& other)
TGeoMatrix&TGeoMatrix::operator=(const TGeoMatrix& matrix)
TNamed&TNamed::operator=(const TNamed& rhs)
TObject&TObject::operator=(const TObject& rhs)
Bool_tTGeoMatrix::operator==(const TGeoMatrix& other) const
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTGeoMatrix::Print(Option_t* option = "") constMENU
virtual voidTNamed::Print(Option_t* option = "") const
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTGeoCombiTrans::ReflectX(Bool_t leftside, Bool_t rotonly = kFALSE)
virtual voidTGeoMatrix::ReflectX(Bool_t leftside, Bool_t rotonly = kFALSE)
virtual voidTGeoCombiTrans::ReflectY(Bool_t leftside, Bool_t rotonly = kFALSE)
virtual voidTGeoCombiTrans::ReflectZ(Bool_t leftside, Bool_t rotonly = kFALSE)
virtual voidTGeoMatrix::ReflectZ(Bool_t leftside, Bool_t rotonly = kFALSE)
virtual voidTGeoCombiTrans::RegisterYourself()
virtual voidTGeoMatrix::RegisterYourself()
voidTObject::ResetBit(UInt_t f)
virtual voidTGeoCombiTrans::RotateX(Double_t angle)
virtual voidTGeoMatrix::RotateX(Double_t)
virtual voidTGeoCombiTrans::RotateY(Double_t angle)
virtual voidTGeoMatrix::RotateY(Double_t)
virtual voidTGeoCombiTrans::RotateZ(Double_t angle)
virtual voidTGeoMatrix::RotateZ(Double_t)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTGeoCombiTrans::SavePrimitive(ostream& out, Option_t* option = "")
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTGeoMatrix::SetDefaultName()
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTGeoCombiTrans::SetDx(Double_t dx)
virtual voidTGeoMatrix::SetDx(Double_t)
virtual voidTGeoCombiTrans::SetDy(Double_t dy)
virtual voidTGeoMatrix::SetDy(Double_t)
virtual voidTGeoCombiTrans::SetDz(Double_t dz)
virtual voidTGeoMatrix::SetDz(Double_t)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidTGeoCombiTrans::SetRotation(const TGeoRotation& other)
voidTGeoCombiTrans::SetRotation(const TGeoRotation* rot)
voidSetScale(Double_t* scale)
voidSetScale(Double_t sx, Double_t sy, Double_t sz)
virtual voidTNamed::SetTitle(const char* title = "")MENU
voidTGeoCombiTrans::SetTranslation(const TGeoTranslation& tr)
voidTGeoCombiTrans::SetTranslation(Double_t* vect)
voidTGeoCombiTrans::SetTranslation(Double_t dx, Double_t dy, Double_t dz)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTGeoCombiTrans::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTGeoMatrix::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTNamed::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTObject::ShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
virtual voidTGeoCombiTrans::Streamer(TBuffer& b)
virtual voidTGeoMatrix::Streamer(TBuffer& b)
virtual voidTNamed::Streamer(TBuffer& b)
virtual voidTObject::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTGeoCombiTrans::StreamerNVirtual(TBuffer& b)
voidTGeoMatrix::StreamerNVirtual(TBuffer& b)
voidTNamed::StreamerNVirtual(TBuffer& b)
voidTObject::StreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
TStringTNamed::fNameobject identifier
TGeoRotation*TGeoCombiTrans::fRotationrotation matrix
Double_tfScale[3]scale (x, y, z)
TStringTNamed::fTitleobject title
Double_tTGeoCombiTrans::fTranslation[3]translation vector

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGeoGenTrans()
 dummy ctor
TGeoGenTrans(const char *name)
 constructor
TGeoGenTrans(Double_t dx, Double_t dy, Double_t dz, Double_t sx, Double_t sy, Double_t sz, TGeoRotation* rot)
 constructor
TGeoGenTrans(const char* name, Double_t dx, Double_t dy, Double_t dz, Double_t sx, Double_t sy, Double_t sz, TGeoRotation* rot)
 constructor
~TGeoGenTrans()
 destructor
void Clear(Option_t* option = "")
 clear the fields of this transformation
void SetScale(Double_t sx, Double_t sy, Double_t sz)
 set the scale
TGeoMatrix& Inverse() const
 Return a temporary inverse of this.
Bool_t Normalize()
 A scale transformation should be normalized by sx*sy*sz factor
TGeoMatrix& operator=(const TGeoGenTrans& )
const Double_t * GetScale() const
TGeoMatrix * MakeClone() const
void SetScale(Double_t sx, Double_t sy, Double_t sz)
TGeoGenTrans()