Logo ROOT   master
Reference Guide
TGeoMatrix.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 25/10/01
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGeoMatrix
13 #define ROOT_TGeoMatrix
14 
15 /*************************************************************************
16  * Geometrical transformations. TGeoMatrix - base class, TGeoTranslation *
17  * TGeoRotation, TGeoScale, TGeoCombiTrans, TGeoGenTrans . *
18  * *
19  *************************************************************************/
20 
21 #include "TNamed.h"
22 
23 //--- globals
24 const Double_t kNullVector[3] = {0.0, 0.0, 0.0};
25 
26 const Double_t kIdentityMatrix[3*3] = {1.0, 0.0, 0.0,
27  0.0, 1.0, 0.0,
28  0.0, 0.0, 1.0};
29 
30 const Double_t kUnitScale[3] = {1.0, 1.0, 1.0};
31 
32 class TGeoHMatrix;
33 
34 ////////////////////////////////////////////////////////////////////////////
35 // //
36 // TGeoMatrix - base class for geometrical transformations. //
37 // //
38 ////////////////////////////////////////////////////////////////////////////
39 
40 class TGeoMatrix : public TNamed
41 {
42 public:
45  kGeoShared = BIT(14),
48  kGeoScale = BIT(19),
56 };
57 
58 protected:
59  TGeoMatrix(const TGeoMatrix &other);
60 
61 public :
62  TGeoMatrix();
63  TGeoMatrix(const char *name);
64  virtual ~TGeoMatrix();
65 
66  Bool_t IsIdentity() const {return !TestBit(kGeoGenTrans);}
70  Bool_t IsScale() const {return TestBit(kGeoScale);}
71  Bool_t IsShared() const {return TestBit(kGeoShared);}
74  && TestBit(kGeoRotation));}
78  Bool_t IsRotAboutZ() const;
79  void GetHomogenousMatrix(Double_t *hmat) const;
80  char *GetPointerName() const;
81 
82  virtual Int_t GetByteCount() const;
83  virtual const Double_t *GetTranslation() const = 0;
84  virtual const Double_t *GetRotationMatrix() const = 0;
85  virtual const Double_t *GetScale() const = 0;
86  virtual TGeoHMatrix Inverse() const = 0;
87  virtual void LocalToMaster(const Double_t *local, Double_t *master) const;
88  virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const;
89  virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const;
90  virtual TGeoMatrix *MakeClone() const = 0;
91  virtual void MasterToLocal(const Double_t *master, Double_t *local) const;
92  virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const;
93  virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const;
94  static void Normalize(Double_t *vect);
95  void Print(Option_t *option="") const; // *MENU*
96  virtual void RotateX(Double_t) {}
97  virtual void RotateY(Double_t) {}
98  virtual void RotateZ(Double_t) {}
99  virtual void ReflectX(Bool_t leftside,Bool_t rotonly=kFALSE);
100  virtual void ReflectY(Bool_t leftside,Bool_t rotonly=kFALSE);
101  virtual void ReflectZ(Bool_t leftside,Bool_t rotonly=kFALSE);
102  virtual void RegisterYourself();
103  void SetDefaultName();
104  virtual void SetDx(Double_t) {}
105  virtual void SetDy(Double_t) {}
106  virtual void SetDz(Double_t) {}
107  void SetShared(Bool_t flag=kTRUE) {SetBit(kGeoShared, flag);}
108 
109  ClassDef(TGeoMatrix, 1) // base geometrical transformation class
110 };
111 
112 ////////////////////////////////////////////////////////////////////////////
113 // //
114 // TGeoTranslation - class describing translations. A translation is //
115 // basically an array of 3 doubles matching the positions 12, 13 //
116 // and 14 in the homogenous matrix description. //
117 // //
118 // //
119 ////////////////////////////////////////////////////////////////////////////
120 
122 {
123 protected:
124  Double_t fTranslation[3]; // translation vector
125 public :
126  TGeoTranslation();
127  TGeoTranslation(const TGeoTranslation &other);
128  TGeoTranslation(const TGeoMatrix &other);
130  TGeoTranslation(const char *name, Double_t dx, Double_t dy, Double_t dz);
131  virtual ~TGeoTranslation() {}
132 
134  TGeoTranslation &operator =(const TGeoMatrix &matrix);
136  TGeoTranslation operator *(const TGeoTranslation &right) const;
137  TGeoHMatrix operator *(const TGeoMatrix &right) const;
138  Bool_t operator ==(const TGeoTranslation &other) const;
139 
140  void Add(const TGeoTranslation *other);
141  TGeoHMatrix Inverse() const;
142  virtual void LocalToMaster(const Double_t *local, Double_t *master) const;
143  virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const;
144  virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const;
145  virtual TGeoMatrix *MakeClone() const;
146  virtual void MasterToLocal(const Double_t *master, Double_t *local) const;
147  virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const;
148  virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const;
149  virtual void RotateX(Double_t angle);
150  virtual void RotateY(Double_t angle);
151  virtual void RotateZ(Double_t angle);
152  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
153  void Subtract(const TGeoTranslation *other);
154  void SetTranslation(Double_t dx, Double_t dy, Double_t dz);
155  void SetTranslation(const TGeoMatrix &other);
156  virtual void SetDx(Double_t dx) {SetTranslation(dx, fTranslation[1], fTranslation[2]);}
157  virtual void SetDy(Double_t dy) {SetTranslation(fTranslation[0], dy, fTranslation[2]);}
158  virtual void SetDz(Double_t dz) {SetTranslation(fTranslation[0], fTranslation[1], dz);}
159 
160  virtual const Double_t *GetTranslation() const {return &fTranslation[0];}
161  virtual const Double_t *GetRotationMatrix() const {return &kIdentityMatrix[0];}
162  virtual const Double_t *GetScale() const {return &kUnitScale[0];}
163 
164  ClassDef(TGeoTranslation, 1) // translation class
165 };
166 
167 ////////////////////////////////////////////////////////////////////////////
168 // //
169 // TGeoRotation - class describing rotations. A rotation is a 3*3 array //
170 // Column vectors has to be orthogonal unit vectors. //
171 // //
172 ////////////////////////////////////////////////////////////////////////////
173 
174 class TGeoRotation : public TGeoMatrix
175 {
176 protected:
177  Double_t fRotationMatrix[3*3]; // rotation matrix
178 
179  void CheckMatrix();
180 public :
181  TGeoRotation();
182  TGeoRotation(const TGeoRotation &other);
183  TGeoRotation(const TGeoMatrix &other);
184  TGeoRotation(const char *name);
185 // TGeoRotation(const char *name, Double_t *matrix) ;
186  TGeoRotation(const char *name, Double_t phi, Double_t theta, Double_t psi);
187  TGeoRotation(const char *name, Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2,
188  Double_t theta3, Double_t phi3);
189  virtual ~TGeoRotation() {}
190 
192  TGeoRotation &operator =(const TGeoMatrix &other);
193  TGeoRotation &operator *=(const TGeoRotation &other);
194  TGeoRotation operator *(const TGeoRotation &other) const;
195  TGeoHMatrix operator *(const TGeoMatrix &right) const;
196  Bool_t operator ==(const TGeoRotation &other) const;
197 
198  Bool_t IsValid() const;
199  TGeoHMatrix Inverse() const;
200  void Clear(Option_t *option ="");
201  Double_t Determinant() const;
202  void FastRotZ(const Double_t *sincos);
203  void GetAngles(Double_t &theta1, Double_t &phi1, Double_t &theta2, Double_t &phi2,
204  Double_t &theta3, Double_t &phi3) const;
205  void GetAngles(Double_t &phi, Double_t &theta, Double_t &psi) const;
206  Double_t GetPhiRotation(Bool_t fixX=kFALSE) const;
207  virtual void LocalToMaster(const Double_t *local, Double_t *master) const;
208  virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const {TGeoRotation::LocalToMaster(local, master);}
209  virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const {TGeoRotation::LocalToMaster(local, master);}
210  virtual TGeoMatrix *MakeClone() const;
211  virtual void MasterToLocal(const Double_t *master, Double_t *local) const;
212  virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const {TGeoRotation::MasterToLocal(master, local);}
213  virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const {TGeoRotation::MasterToLocal(master, local);}
214  void MultiplyBy(const TGeoRotation *rot, Bool_t after=kTRUE);
215  virtual void RotateX(Double_t angle);
216  virtual void RotateY(Double_t angle);
217  virtual void RotateZ(Double_t angle);
218  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
219  virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE);
220  virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE);
221  virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE);
222  void SetAngles(Double_t phi, Double_t theta, Double_t psi);
223  void SetAngles(Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2,
224  Double_t theta3, Double_t phi3);
225  void SetMatrix(const Double_t *rot) {memcpy(&fRotationMatrix[0], rot, 9*sizeof(Double_t));CheckMatrix();}
226  void SetRotation(const TGeoMatrix &other);
227  void GetInverse(Double_t *invmat) const;
228 
229  virtual const Double_t *GetTranslation() const {return &kNullVector[0];}
230  virtual const Double_t *GetRotationMatrix() const {return &fRotationMatrix[0];}
231  virtual const Double_t *GetScale() const {return &kUnitScale[0];}
232 
233  ClassDef(TGeoRotation, 1) // rotation class
234 };
235 
236 ////////////////////////////////////////////////////////////////////////////
237 // //
238 // TGeoScale - class describing scale transformations. A scale is an //
239 // array of 3 doubles (sx, sy, sz) multiplying elements 0, 5 and 10 //
240 // of the homogenous matrix. A scale is normalized : sx*sy*sz = 1 //
241 // //
242 ////////////////////////////////////////////////////////////////////////////
243 
244 class TGeoScale : public TGeoMatrix
245 {
246 protected:
247  Double_t fScale[3]; // scale (x, y, z)
248 public :
249  TGeoScale();
250  TGeoScale(const TGeoScale &other);
251  TGeoScale(const TGeoMatrix &other);
252  TGeoScale(Double_t sx, Double_t sy, Double_t sz);
253  TGeoScale(const char *name, Double_t sx, Double_t sy, Double_t sz);
254  virtual ~TGeoScale();
255 
257  TGeoScale &operator =(const TGeoMatrix &other);
258  TGeoScale &operator *=(const TGeoScale &other);
259  TGeoScale operator *(const TGeoScale &other) const;
260  TGeoHMatrix operator *(const TGeoMatrix &right) const;
261  Bool_t operator ==(const TGeoScale &other) const;
262 
263  TGeoHMatrix Inverse() const;
264  void SetScale(Double_t sx, Double_t sy, Double_t sz);
265  void SetScale(const TGeoMatrix &other);
266  virtual void LocalToMaster(const Double_t *local, Double_t *master) const;
267  Double_t LocalToMaster(Double_t dist, const Double_t *dir=0) const;
268  virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const {TGeoScale::LocalToMaster(local, master);}
269  virtual TGeoMatrix *MakeClone() const;
270  virtual void MasterToLocal(const Double_t *master, Double_t *local) const;
271  Double_t MasterToLocal(Double_t dist, const Double_t *dir=0) const;
272  virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const {TGeoScale::MasterToLocal(master, local);}
276 
277  virtual const Double_t *GetTranslation() const {return &kNullVector[0];}
278  virtual const Double_t *GetRotationMatrix() const {return &kIdentityMatrix[0];}
279  virtual const Double_t *GetScale() const {return &fScale[0];}
280 
281  ClassDef(TGeoScale, 1) // scaling class
282 };
283 
284 ////////////////////////////////////////////////////////////////////////////
285 // //
286 // TGeoCombiTrans - class describing rotation + translation. Most //
287 // frequently used in the description of TGeoNode 's //
288 // //
289 ////////////////////////////////////////////////////////////////////////////
290 
292 {
293 protected:
294  Double_t fTranslation[3]; // translation vector
295  TGeoRotation *fRotation; // rotation matrix
296 public :
297  TGeoCombiTrans();
299  TGeoCombiTrans(const TGeoMatrix &other);
300  TGeoCombiTrans(const TGeoTranslation &tr, const TGeoRotation &rot);
301  TGeoCombiTrans(const char *name);
303  TGeoCombiTrans(const char *name, Double_t dx, Double_t dy, Double_t dz, TGeoRotation *rot);
304 
306  TGeoCombiTrans& operator =(const TGeoMatrix &matrix);
307  TGeoCombiTrans &operator *=(const TGeoMatrix &other);
308  TGeoCombiTrans operator *(const TGeoMatrix &other) const;
309  Bool_t operator ==(const TGeoMatrix &other) const;
310 
311  virtual ~TGeoCombiTrans();
312 
313  void Clear(Option_t *option ="");
314  TGeoHMatrix Inverse() const;
315  virtual TGeoMatrix *MakeClone() const;
316  void Multiply(const TGeoMatrix *right);
317  virtual void RegisterYourself();
318  virtual void RotateX(Double_t angle);
319  virtual void RotateY(Double_t angle);
320  virtual void RotateZ(Double_t angle);
321  virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE);
322  virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE);
323  virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE);
324  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
325  virtual void SetDx(Double_t dx) {SetTranslation(dx, fTranslation[1], fTranslation[2]);}
326  virtual void SetDy(Double_t dy) {SetTranslation(fTranslation[0], dy, fTranslation[2]);}
327  virtual void SetDz(Double_t dz) {SetTranslation(fTranslation[0], fTranslation[1], dz);}
328  void SetTranslation(const TGeoTranslation &tr);
329  void SetTranslation(Double_t dx, Double_t dy, Double_t dz);
330  void SetTranslation(Double_t *vect);
331  void SetRotation(const TGeoRotation &other);
332  void SetRotation(const TGeoRotation *rot);
333 
334  TGeoRotation *GetRotation() const {return fRotation;}
335 
336  virtual const Double_t *GetTranslation() const {return &fTranslation[0];}
337  virtual const Double_t *GetRotationMatrix() const;
338  virtual const Double_t *GetScale() const {return &kUnitScale[0];}
339 
340  ClassDef(TGeoCombiTrans, 1) // rotation + translation
341 };
342 
343 ////////////////////////////////////////////////////////////////////////////
344 // //
345 // TGeoGenTrans - most general transformation, holding a translation, //
346 // a rotation and a scale //
347 // //
348 ////////////////////////////////////////////////////////////////////////////
349 
351 {
352 protected:
353  Double_t fScale[3]; // scale (x, y, z)
354 public :
355  TGeoGenTrans();
356  TGeoGenTrans(const char *name);
358  Double_t sx, Double_t sy, Double_t sz, TGeoRotation *rot);
359  TGeoGenTrans(const char *name, Double_t dx, Double_t dy, Double_t dz,
360  Double_t sx, Double_t sy, Double_t sz, TGeoRotation *rot);
361  virtual ~TGeoGenTrans();
362 
363  void Clear(Option_t *option ="");
364  TGeoHMatrix Inverse() const;
365  void SetScale(Double_t sx, Double_t sy, Double_t sz);
366  void SetScale(Double_t *scale) {memcpy(&fScale[0], scale, 3*sizeof(Double_t));}
367  virtual TGeoMatrix *MakeClone() const {return NULL;}
368  Bool_t Normalize();
369 
370  virtual const Double_t *GetScale() const {return &fScale[0];}
371 
372  ClassDef(TGeoGenTrans, 1) // rotation + translation + scale
373 };
374 
375 ////////////////////////////////////////////////////////////////////////////
376 // //
377 // TGeoIdentity - an identity transformation. It holds no data member //
378 // and returns pointers to static null translation and identity //
379 // transformations for rotation and scale //
380 // //
381 ////////////////////////////////////////////////////////////////////////////
382 
383 class TGeoIdentity : public TGeoMatrix
384 {
385 private:
386  // no data members
387 public :
388  TGeoIdentity();
389  TGeoIdentity(const char *name);
390  virtual ~TGeoIdentity() {}
391 
392  TGeoHMatrix Inverse() const;
393  virtual void LocalToMaster(const Double_t *local, Double_t *master) const {memcpy(master, local, 3*sizeof(Double_t));}
394  virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const {memcpy(master, local, 3*sizeof(Double_t));}
395  virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const {TGeoIdentity::LocalToMaster(local, master);}
396  virtual TGeoMatrix *MakeClone() const {return NULL;}
397  virtual void MasterToLocal(const Double_t *master, Double_t *local) const {memcpy(local, master, 3*sizeof(Double_t));}
398  virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const {memcpy(local, master, 3*sizeof(Double_t));}
399  virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const {TGeoIdentity::MasterToLocal(master, local);}
400 
401  virtual const Double_t *GetTranslation() const {return &kNullVector[0];}
402  virtual const Double_t *GetRotationMatrix() const {return &kIdentityMatrix[0];}
403  virtual const Double_t *GetScale() const {return &kUnitScale[0];}
404  virtual void SavePrimitive(std::ostream &, Option_t * = "") {;}
405 
406  ClassDef(TGeoIdentity, 1) // identity transformation class
407 };
408 
409 
410 
411 ////////////////////////////////////////////////////////////////////////////
412 // //
413 // TGeoHMatrix - Matrix class used for computing global transformations //
414 // Should NOT be used for node definition. An instance of this class //
415 // is generally used to pile-up local transformations starting from //
416 // the top level physical node, down to the current node. //
417 // //
418 ////////////////////////////////////////////////////////////////////////////
419 
420 class TGeoHMatrix : public TGeoMatrix
421 {
422 private:
423  Double_t fTranslation[3]; // translation component
424  Double_t fRotationMatrix[9]; // rotation matrix
425  Double_t fScale[3]; // scale component
426 
427 public :
428  TGeoHMatrix();
429  TGeoHMatrix(const TGeoHMatrix &other) : TGeoHMatrix((TGeoMatrix&)other) {}
430  TGeoHMatrix(const TGeoMatrix &matrix);
431  TGeoHMatrix(const char *name);
432  virtual ~TGeoHMatrix();
433 
435  TGeoHMatrix& operator =(const TGeoMatrix *other);
436  TGeoHMatrix& operator =(const TGeoMatrix &other);
437  TGeoHMatrix& operator *=(const TGeoMatrix &other);
438  TGeoHMatrix operator *(const TGeoMatrix &other) const;
439  Bool_t operator ==(const TGeoMatrix &other) const;
440 
441  void Clear(Option_t *option ="");
442  void CopyFrom(const TGeoMatrix *other);
443  Double_t Determinant() const;
444  void FastRotZ(const Double_t *sincos);
445  TGeoHMatrix Inverse() const;
446  virtual TGeoMatrix *MakeClone() const;
447  void Multiply(const TGeoMatrix *right);
448  void Multiply(const TGeoMatrix &right) {Multiply(&right);}
449  void MultiplyLeft(const TGeoMatrix *left);
450  void MultiplyLeft(const TGeoMatrix &left) {MultiplyLeft(&left);}
451 
452  virtual void RotateX(Double_t angle);
453  virtual void RotateY(Double_t angle);
454  virtual void RotateZ(Double_t angle);
455  virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE);
456  virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE);
457  virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE);
458  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
459  virtual void SetDx(Double_t dx) {fTranslation[0] = dx; SetBit(kGeoTranslation);}
460  virtual void SetDy(Double_t dy) {fTranslation[1] = dy; SetBit(kGeoTranslation);}
461  virtual void SetDz(Double_t dz) {fTranslation[2] = dz; SetBit(kGeoTranslation);}
462  void SetTranslation(const Double_t *vect) {SetBit(kGeoTranslation); memcpy(&fTranslation[0], vect, 3*sizeof(Double_t));}
463  void SetRotation(const Double_t *matrix) {SetBit(kGeoRotation); memcpy(&fRotationMatrix[0], matrix, 9*sizeof(Double_t));}
464  void SetScale(const Double_t *scale) {SetBit(kGeoScale); memcpy(&fScale[0], scale, 3*sizeof(Double_t));}
465 
466 
467  virtual const Double_t *GetTranslation() const {return &fTranslation[0];}
468  virtual const Double_t *GetRotationMatrix() const {return &fRotationMatrix[0];}
469  virtual const Double_t *GetScale() const {return &fScale[0];}
470 
471  virtual Double_t *GetTranslation() {return &fTranslation[0];}
472  virtual Double_t *GetRotationMatrix() {return &fRotationMatrix[0];}
473  virtual Double_t *GetScale() {return &fScale[0];}
474  ClassDef(TGeoHMatrix, 1) // global matrix class
475 };
476 
477 
479 
480 #endif
481 
void SetShared(Bool_t flag=kTRUE)
Definition: TGeoMatrix.h:107
void Subtract(const TGeoTranslation *other)
Subtracting a translation from this one.
Definition: TGeoMatrix.cxx:740
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
const Double_t kIdentityMatrix[3 *3]
Definition: TGeoMatrix.h:26
void SetRotation(const TGeoRotation &other)
Copy the rotation from another one.
void Print(Option_t *option="") const
print the matrix in 4x4 format
Definition: TGeoMatrix.cxx:486
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Double_t fRotationMatrix[9]
Definition: TGeoMatrix.h:424
TGeoMatrix()
dummy constructor
Definition: TGeoMatrix.cxx:231
Bool_t IsGeneral() const
Definition: TGeoMatrix.h:75
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.cxx:431
virtual void SetDy(Double_t dy)
Definition: TGeoMatrix.h:157
void MultiplyLeft(const TGeoMatrix &left)
Definition: TGeoMatrix.h:450
void FastRotZ(const Double_t *sincos)
Perform a rotation about Z having the sine/cosine of the rotation angle.
TGeoHMatrix operator*(const TGeoMatrix &other) const
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.h:272
TGeoScale & operator*=(const TGeoScale &other)
Scale composition.
void FastRotZ(const Double_t *sincos)
Perform a rotation about Z having the sine/cosine of the rotation angle.
void MultiplyLeft(const TGeoMatrix *left)
multiply to the left with an other transformation if right is identity matrix, just return ...
virtual ~TGeoScale()
destructor
const char Option_t
Definition: RtypesCore.h:64
Geometrical transformation package.
Definition: TGeoMatrix.h:40
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:370
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.h:393
Bool_t operator==(const TGeoRotation &other) const
Is-equal operator.
Definition: TGeoMatrix.cxx:963
Bool_t operator==(const TGeoMatrix &other) const
Is-equal operator.
virtual const Double_t * GetRotationMatrix() const
Definition: TGeoMatrix.h:468
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:467
virtual void SetDy(Double_t dy)
Definition: TGeoMatrix.h:326
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
virtual const Double_t * GetRotationMatrix() const =0
const Double_t kNullVector[3]
Definition: TGeoMatrix.h:24
TGeoHMatrix(const TGeoHMatrix &other)
Definition: TGeoMatrix.h:429
#define BIT(n)
Definition: Rtypes.h:83
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
Convert a global point to local frame.
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
An identity transformation.
Definition: TGeoMatrix.h:383
TGeoCombiTrans operator*(const TGeoMatrix &other) const
virtual void RotateX(Double_t angle)
Rotate about X axis of the master frame with angle expressed in degrees.
Most general transformation, holding a translation, a rotation and a scale.
Definition: TGeoMatrix.h:350
TGeoCombiTrans()
dummy ctor
void SetTranslation(const Double_t *vect)
Definition: TGeoMatrix.h:462
virtual void SetDx(Double_t dx)
Definition: TGeoMatrix.h:325
virtual void SetDz(Double_t)
Definition: TGeoMatrix.h:106
TGeoRotation()
Default constructor.
Definition: TGeoMatrix.cxx:854
TGeoTranslation operator*(const TGeoTranslation &right) const
Definition: TGeoMatrix.cxx:652
Double_t fScale[3]
Definition: TGeoMatrix.h:425
Class describing translations.
Definition: TGeoMatrix.h:121
Bool_t operator==(const TGeoScale &other) const
Is-equal operator.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual Double_t * GetTranslation()
Definition: TGeoMatrix.h:471
Double_t fTranslation[3]
Definition: TGeoMatrix.h:423
virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.cxx:448
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:469
virtual void RotateZ(Double_t)
Definition: TGeoMatrix.h:98
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:420
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return ...
virtual void SetDx(Double_t)
Definition: TGeoMatrix.h:104
virtual void SetDx(Double_t dx)
Definition: TGeoMatrix.h:459
int Int_t
Definition: RtypesCore.h:43
bool Bool_t
Definition: RtypesCore.h:61
virtual void SetDz(Double_t dz)
Definition: TGeoMatrix.h:158
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.h:268
void GetInverse(Double_t *invmat) const
Get the inverse rotation matrix (which is simply the transpose)
void Add(const TGeoTranslation *other)
Adding a translation to this one.
Definition: TGeoMatrix.cxx:697
const Double_t kUnitScale[3]
Definition: TGeoMatrix.h:30
virtual void RotateY(Double_t angle)
Rotate about Y axis with angle expressed in degrees.
void SetTranslation(const TGeoTranslation &tr)
copy the translation component
virtual ~TGeoCombiTrans()
destructor
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:279
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:277
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
Definition: TGeoMatrix.cxx:976
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void RotateY(Double_t angle)
Rotate about Y axis with angle expressed in degrees.
TGeoRotation & operator=(const TGeoRotation &other)
Definition: TGeoMatrix.h:191
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:231
virtual void RotateX(Double_t angle)
Rotate about X axis with angle expressed in degrees.
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:229
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
Double_t fTranslation[3]
Definition: TGeoMatrix.h:294
TGeoScale operator*(const TGeoScale &other) const
virtual void RotateX(Double_t angle)
Rotate about X axis with angle expressed in degrees.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoMatrix.cxx:832
virtual void RotateZ(Double_t angle)
Rotate about Z axis with angle expressed in degrees.
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
virtual ~TGeoHMatrix()
destructor
virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.h:213
virtual TGeoMatrix * MakeClone() const =0
#define ClassDef(name, id)
Definition: Rtypes.h:322
virtual void RotateY(Double_t)
Definition: TGeoMatrix.h:97
Bool_t Normalize()
A scale transformation should be normalized by sx*sy*sz factor.
Double_t GetPhiRotation(Bool_t fixX=kFALSE) const
Returns rotation angle about Z axis in degrees.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.h:398
Double_t Determinant() const
computes determinant of the rotation matrix
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
virtual void SetDz(Double_t dz)
Definition: TGeoMatrix.h:327
virtual ~TGeoGenTrans()
destructor
Bool_t IsShared() const
Definition: TGeoMatrix.h:71
Bool_t IsIdentity() const
Definition: TGeoMatrix.h:66
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return ...
TGeoHMatrix()
dummy ctor
Bool_t IsOwned() const
Definition: TGeoMatrix.h:72
TGeoRotation operator*(const TGeoRotation &other) const
Definition: TGeoMatrix.cxx:946
void CopyFrom(const TGeoMatrix *other)
Fast copy method.
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.cxx:363
virtual void RotateY(Double_t angle)
Rotate about Y axis of the master frame with angle expressed in degrees.
char * GetPointerName() const
Provide a pointer name containing uid.
Definition: TGeoMatrix.cxx:294
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.h:397
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:160
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
TGeoTranslation & operator*=(const TGeoTranslation &other)
Translation composition.
Definition: TGeoMatrix.cxx:642
virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.h:209
TGeoHMatrix & operator*=(const TGeoMatrix &other)
Composition.
virtual Double_t * GetScale()
Definition: TGeoMatrix.h:473
virtual void SetDx(Double_t dx)
Definition: TGeoMatrix.h:156
virtual const Double_t * GetRotationMatrix() const
Definition: TGeoMatrix.h:230
virtual void ReflectY(Bool_t, Bool_t)
Multiply by a reflection respect to ZX.
Definition: TGeoMatrix.h:274
virtual const Double_t * GetRotationMatrix() const
Definition: TGeoMatrix.h:402
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
Definition: TGeoMatrix.h:367
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
Convert a local point to the master frame.
Double_t fScale[3]
Definition: TGeoMatrix.h:247
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
void Multiply(const TGeoMatrix &right)
Definition: TGeoMatrix.h:448
Bool_t operator==(const TGeoMatrix &other) const
Is-equal operator.
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
void Clear(Option_t *option="")
clear the data for this matrix
TGeoCombiTrans(const TGeoCombiTrans &other)
Definition: TGeoMatrix.h:298
Class describing rotation + translation.
Definition: TGeoMatrix.h:291
void Clear(Option_t *option="")
clear the fields of this transformation
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.cxx:802
virtual Double_t * GetRotationMatrix()
Definition: TGeoMatrix.h:472
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector to MARS
Definition: TGeoMatrix.cxx:782
virtual const Double_t * GetRotationMatrix() const
get the rotation array
void Clear(Option_t *option="")
reset data members
void SetDefaultName()
If no name was supplied in the ctor, the type of transformation is checked.
Definition: TGeoMatrix.cxx:549
void CheckMatrix()
performes an orthogonality check and finds if the matrix is a reflection Warning("CheckMatrix", "orthogonality check not performed yet");
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.h:208
Bool_t IsRegistered() const
Definition: TGeoMatrix.h:77
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.cxx:772
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
Definition: TGeoMatrix.cxx:707
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Definition: TGeoMatrix.cxx:526
TGeoTranslation & operator=(const TGeoTranslation &other)
Definition: TGeoMatrix.h:133
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
Definition: TGeoMatrix.cxx:512
static void Normalize(Double_t *vect)
Normalize a vector.
Definition: TGeoMatrix.cxx:473
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:336
TGeoRotation * GetRotation() const
Definition: TGeoMatrix.h:334
void Clear(Option_t *option="")
Reset translation/rotation to identity.
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
virtual Int_t GetByteCount() const
Get total size in bytes of this.
Definition: TGeoMatrix.cxx:282
void GetHomogenousMatrix(Double_t *hmat) const
The homogenous matrix associated with the transformation is used for piling up's and visualization...
Definition: TGeoMatrix.cxx:314
TGeoGenTrans()
dummy ctor
virtual const Double_t * GetRotationMatrix() const
Definition: TGeoMatrix.h:278
virtual void RotateZ(Double_t angle)
Rotate about Z axis of the master frame with angle expressed in degrees.
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.cxx:339
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:338
Class describing rotations.
Definition: TGeoMatrix.h:174
virtual void RotateZ(Double_t angle)
Rotate about Z axis of the master frame with angle expressed in degrees.
Definition: TGeoMatrix.cxx:732
virtual void SetDy(Double_t dy)
Definition: TGeoMatrix.h:460
Double_t fRotationMatrix[3 *3]
Definition: TGeoMatrix.h:177
const Bool_t kFALSE
Definition: RtypesCore.h:90
Bool_t IsValid() const
Perform orthogonality test for rotation.
Definition: TGeoMatrix.cxx:997
Bool_t IsRotation() const
Definition: TGeoMatrix.h:68
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
void SetScale(Double_t *scale)
Definition: TGeoMatrix.h:366
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
Definition: TGeoMatrix.cxx:519
Class describing scale transformations.
Definition: TGeoMatrix.h:244
TGeoIdentity()
dummy ctor
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
void GetAngles(Double_t &theta1, Double_t &phi1, Double_t &theta2, Double_t &phi2, Double_t &theta3, Double_t &phi3) const
Retrieve rotation angles.
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.cxx:406
TGeoTranslation()
Default constructor.
Definition: TGeoMatrix.cxx:579
double Double_t
Definition: RtypesCore.h:57
Bool_t IsCombi() const
Definition: TGeoMatrix.h:73
TGeoScale & operator=(const TGeoScale &other)
Definition: TGeoMatrix.h:256
virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.h:395
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
Definition: TGeoMatrix.cxx:682
TGeoScale()
default constructor
Bool_t IsScale() const
Definition: TGeoMatrix.h:70
virtual void ReflectZ(Bool_t, Bool_t)
Multiply by a reflection respect to XY.
Definition: TGeoMatrix.h:275
void SetRotation(const TGeoMatrix &other)
Copy rotation elements from other rotation matrix.
virtual void ReflectX(Bool_t, Bool_t)
Multiply by a reflection respect to YZ.
Definition: TGeoMatrix.h:273
Double_t Determinant() const
computes determinant of the rotation matrix
TGeoCombiTrans & operator=(const TGeoCombiTrans &other)
Definition: TGeoMatrix.h:305
TGeoCombiTrans & operator*=(const TGeoMatrix &other)
Composition.
virtual void RotateX(Double_t)
Definition: TGeoMatrix.h:96
Bool_t IsReflection() const
Definition: TGeoMatrix.h:69
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.h:212
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
void MultiplyBy(const TGeoRotation *rot, Bool_t after=kTRUE)
Multiply this rotation with the one specified by ROT.
void SetScale(const Double_t *scale)
Definition: TGeoMatrix.h:464
void SetMatrix(const Double_t *rot)
Definition: TGeoMatrix.h:225
TGeoHMatrix & operator=(const TGeoHMatrix &other)
Definition: TGeoMatrix.h:434
virtual void SavePrimitive(std::ostream &, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoMatrix.h:404
virtual ~TGeoRotation()
Definition: TGeoMatrix.h:189
virtual TGeoHMatrix Inverse() const =0
#define R__EXTERN
Definition: DllImport.h:27
Bool_t operator==(const TGeoTranslation &other) const
Is-equal operator.
Definition: TGeoMatrix.cxx:669
R__EXTERN TGeoIdentity * gGeoIdentity
Definition: TGeoMatrix.h:478
virtual void SetDy(Double_t)
Definition: TGeoMatrix.h:105
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:403
TGeoRotation & operator*=(const TGeoRotation &other)
Composition.
Definition: TGeoMatrix.cxx:939
virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.h:399
void SetRotation(const Double_t *matrix)
Definition: TGeoMatrix.h:463
virtual ~TGeoMatrix()
Destructor.
Definition: TGeoMatrix.cxx:256
virtual ~TGeoIdentity()
Definition: TGeoMatrix.h:390
TGeoRotation * fRotation
Definition: TGeoMatrix.h:295
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual const Double_t * GetTranslation() const
Definition: TGeoMatrix.h:401
Bool_t IsTranslation() const
Definition: TGeoMatrix.h:67
virtual const Double_t * GetRotationMatrix() const
Definition: TGeoMatrix.h:161
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
Definition: TGeoMatrix.cxx:505
void SetScale(Double_t sx, Double_t sy, Double_t sz)
scale setter
virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition: TGeoMatrix.cxx:820
virtual TGeoMatrix * MakeClone() const
Definition: TGeoMatrix.h:396
virtual void RotateX(Double_t angle)
Rotate about X axis of the master frame with angle expressed in degrees.
Definition: TGeoMatrix.cxx:716
virtual void RotateY(Double_t angle)
Rotate about Y axis of the master frame with angle expressed in degrees.
Definition: TGeoMatrix.cxx:724
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
Set matrix elements according to Euler angles.
virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.cxx:380
virtual const Double_t * GetScale() const
Definition: TGeoMatrix.h:162
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a vector from MARS to local
Definition: TGeoMatrix.cxx:812
virtual void RotateZ(Double_t angle)
Rotate about Z axis with angle expressed in degrees.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
const Bool_t kTRUE
Definition: RtypesCore.h:89
virtual const Double_t * GetTranslation() const =0
virtual void SetDz(Double_t dz)
Definition: TGeoMatrix.h:461
Bool_t IsRotAboutZ() const
Returns true if no rotation or the rotation is about Z axis.
Definition: TGeoMatrix.cxx:269
virtual const Double_t * GetScale() const =0
void SetTranslation(Double_t dx, Double_t dy, Double_t dz)
Set translation components.
Definition: TGeoMatrix.cxx:750
char name[80]
Definition: TGX11.cxx:109
virtual ~TGeoTranslation()
Definition: TGeoMatrix.h:131
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Double_t fTranslation[3]
Definition: TGeoMatrix.h:124
virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.cxx:790
void SetScale(Double_t sx, Double_t sy, Double_t sz)
set the scale
Double_t fScale[3]
Definition: TGeoMatrix.h:353
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.h:394