Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
24const Double_t kNullVector[3] = {0.0, 0.0, 0.0};
25
26const 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
30const Double_t kUnitScale[3] = {1.0, 1.0, 1.0};
31
32class TGeoHMatrix;
33
34////////////////////////////////////////////////////////////////////////////
35// //
36// TGeoMatrix - base class for geometrical transformations. //
37// //
38////////////////////////////////////////////////////////////////////////////
39
40class TGeoMatrix : public TNamed
41{
42public:
56};
57
58protected:
59 TGeoMatrix(const TGeoMatrix &other);
60
61public :
62 TGeoMatrix();
63 TGeoMatrix(const char *name);
64 virtual ~TGeoMatrix();
65
70 Bool_t IsScale() const {return TestBit(kGeoScale);}
71 Bool_t IsShared() const {return TestBit(kGeoShared);}
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) {}
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{
123protected:
124 Double_t fTranslation[3]; // translation vector
125public :
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
175{
176protected:
177 Double_t fRotationMatrix[3*3]; // rotation matrix
178
179 void CheckMatrix();
180public :
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);
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;
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
244class TGeoScale : public TGeoMatrix
245{
246protected:
247 Double_t fScale[3]; // scale (x, y, z)
248public :
249 TGeoScale();
250 TGeoScale(const TGeoScale &other);
251 TGeoScale(const TGeoMatrix &other);
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{
293protected:
294 Double_t fTranslation[3]; // translation vector
295 TGeoRotation *fRotation; // rotation matrix
296public :
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);
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
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{
352protected:
353 Double_t fScale[3]; // scale (x, y, z)
354public :
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;}
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
384{
385private:
386 // no data members
387public :
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
421{
422private:
423 Double_t fTranslation[3]; // translation component
424 Double_t fRotationMatrix[9]; // rotation matrix
425 Double_t fScale[3]; // scale component
426
427public :
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];}
473 virtual Double_t *GetScale() {return &fScale[0];}
474 ClassDef(TGeoHMatrix, 1) // global matrix class
475};
476
477
479
480#endif
481
#define R__EXTERN
Definition DllImport.h:27
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
char name[80]
Definition TGX11.cxx:110
const Double_t kUnitScale[3]
Definition TGeoMatrix.h:30
const Double_t kIdentityMatrix[3 *3]
Definition TGeoMatrix.h:26
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:478
const Double_t kNullVector[3]
Definition TGeoMatrix.h:24
Class describing rotation + translation.
Definition TGeoMatrix.h:292
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
TGeoCombiTrans & operator*=(const TGeoMatrix &other)
Composition.
Bool_t operator==(const TGeoMatrix &other) const
Is-equal operator.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual const Double_t * GetTranslation() const
Definition TGeoMatrix.h:336
TGeoCombiTrans()
dummy ctor
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual ~TGeoCombiTrans()
destructor
virtual void SetDy(Double_t dy)
Definition TGeoMatrix.h:326
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:338
virtual const Double_t * GetRotationMatrix() const
get the rotation array
virtual void RotateZ(Double_t angle)
Rotate about Z axis with angle expressed in degrees.
Double_t fTranslation[3]
Definition TGeoMatrix.h:294
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
TGeoRotation * fRotation
Definition TGeoMatrix.h:295
virtual void SetDz(Double_t dz)
Definition TGeoMatrix.h:327
TGeoRotation * GetRotation() const
Definition TGeoMatrix.h:334
void SetTranslation(const TGeoTranslation &tr)
copy the translation component
void SetRotation(const TGeoRotation &other)
Copy the rotation from another one.
TGeoCombiTrans(const TGeoCombiTrans &other)
Definition TGeoMatrix.h:298
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
TGeoCombiTrans & operator=(const TGeoCombiTrans &other)
Definition TGeoMatrix.h:305
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
TGeoCombiTrans operator*(const TGeoMatrix &other) const
void Clear(Option_t *option="")
Reset translation/rotation to identity.
virtual void RotateY(Double_t angle)
Rotate about Y axis with angle expressed in degrees.
virtual void SetDx(Double_t dx)
Definition TGeoMatrix.h:325
virtual void RotateX(Double_t angle)
Rotate about X axis with angle expressed in degrees.
Most general transformation, holding a translation, a rotation and a scale.
Definition TGeoMatrix.h:351
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
Definition TGeoMatrix.h:367
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:370
virtual ~TGeoGenTrans()
destructor
Double_t fScale[3]
Definition TGeoMatrix.h:353
void Clear(Option_t *option="")
clear the fields of this transformation
Bool_t Normalize()
A scale transformation should be normalized by sx*sy*sz factor.
TGeoGenTrans()
dummy ctor
void SetScale(Double_t sx, Double_t sy, Double_t sz)
set the scale
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
void SetScale(Double_t *scale)
Definition TGeoMatrix.h:366
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:421
TGeoHMatrix & operator*=(const TGeoMatrix &other)
Composition.
TGeoHMatrix()
dummy ctor
virtual Double_t * GetRotationMatrix()
Definition TGeoMatrix.h:472
virtual void RotateX(Double_t angle)
Rotate about X axis with angle expressed in degrees.
void SetRotation(const Double_t *matrix)
Definition TGeoMatrix.h:463
TGeoHMatrix(const TGeoHMatrix &other)
Definition TGeoMatrix.h:429
virtual void RotateZ(Double_t angle)
Rotate about Z axis with angle expressed in degrees.
void SetScale(const Double_t *scale)
Definition TGeoMatrix.h:464
void MultiplyLeft(const TGeoMatrix *left)
multiply to the left with an other transformation if right is identity matrix, just return
virtual ~TGeoHMatrix()
destructor
Double_t Determinant() const
computes determinant of the rotation matrix
virtual void SetDz(Double_t dz)
Definition TGeoMatrix.h:461
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
void Clear(Option_t *option="")
clear the data for this matrix
void CopyFrom(const TGeoMatrix *other)
Fast copy method.
void FastRotZ(const Double_t *sincos)
Perform a rotation about Z having the sine/cosine of the rotation angle.
Double_t fTranslation[3]
Definition TGeoMatrix.h:423
Bool_t operator==(const TGeoMatrix &other) const
Is-equal operator.
void MultiplyLeft(const TGeoMatrix &left)
Definition TGeoMatrix.h:450
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:469
Double_t fRotationMatrix[9]
Definition TGeoMatrix.h:424
virtual const Double_t * GetTranslation() const
Definition TGeoMatrix.h:467
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual void SetDx(Double_t dx)
Definition TGeoMatrix.h:459
virtual void RotateY(Double_t angle)
Rotate about Y axis with angle expressed in degrees.
TGeoHMatrix & operator=(const TGeoHMatrix &other)
Definition TGeoMatrix.h:434
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Double_t * GetTranslation()
Definition TGeoMatrix.h:471
TGeoHMatrix operator*(const TGeoMatrix &other) const
virtual Double_t * GetScale()
Definition TGeoMatrix.h:473
virtual void SetDy(Double_t dy)
Definition TGeoMatrix.h:460
void Multiply(const TGeoMatrix &right)
Definition TGeoMatrix.h:448
void SetTranslation(const Double_t *vect)
Definition TGeoMatrix.h:462
Double_t fScale[3]
Definition TGeoMatrix.h:425
virtual const Double_t * GetRotationMatrix() const
Definition TGeoMatrix.h:468
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
An identity transformation.
Definition TGeoMatrix.h:384
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
virtual const Double_t * GetTranslation() const
Definition TGeoMatrix.h:401
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 ~TGeoIdentity()
Definition TGeoMatrix.h:390
virtual void SavePrimitive(std::ostream &, Option_t *="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGeoMatrix.h:404
virtual TGeoMatrix * MakeClone() const
Definition TGeoMatrix.h:396
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:403
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
virtual const Double_t * GetRotationMatrix() const
Definition TGeoMatrix.h:402
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
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
TGeoIdentity()
dummy ctor
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
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
Geometrical transformation package.
Definition TGeoMatrix.h:41
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
Bool_t IsScale() const
Definition TGeoMatrix.h:70
void SetDefaultName()
If no name was supplied in the ctor, the type of transformation is checked.
Bool_t IsGeneral() const
Definition TGeoMatrix.h:75
virtual void RotateZ(Double_t)
Definition TGeoMatrix.h:98
@ kGeoSavePrimitive
Definition TGeoMatrix.h:51
@ kGeoTranslation
Definition TGeoMatrix.h:46
@ kGeoMatrixOwned
Definition TGeoMatrix.h:52
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
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
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
virtual const Double_t * GetTranslation() const =0
virtual void SetDz(Double_t)
Definition TGeoMatrix.h:106
Bool_t IsTranslation() const
Definition TGeoMatrix.h:67
virtual void SetDy(Double_t)
Definition TGeoMatrix.h:105
Bool_t IsReflection() const
Definition TGeoMatrix.h:69
Bool_t IsRotation() const
Definition TGeoMatrix.h:68
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
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
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
virtual void RotateY(Double_t)
Definition TGeoMatrix.h:97
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
Bool_t IsRotAboutZ() const
Returns true if no rotation or the rotation is about Z axis.
virtual void RotateX(Double_t)
Definition TGeoMatrix.h:96
void GetHomogenousMatrix(Double_t *hmat) const
The homogenous matrix associated with the transformation is used for piling up's and visualization.
TGeoMatrix()
dummy constructor
virtual TGeoMatrix * MakeClone() const =0
Bool_t IsOwned() const
Definition TGeoMatrix.h:72
virtual const Double_t * GetScale() const =0
static void Normalize(Double_t *vect)
Normalize a vector.
void Print(Option_t *option="") const
print the matrix in 4x4 format
Bool_t IsIdentity() const
Definition TGeoMatrix.h:66
Bool_t IsCombi() const
Definition TGeoMatrix.h:73
void SetShared(Bool_t flag=kTRUE)
Definition TGeoMatrix.h:107
virtual void SetDx(Double_t)
Definition TGeoMatrix.h:104
Bool_t IsRegistered() const
Definition TGeoMatrix.h:77
virtual ~TGeoMatrix()
Destructor.
Bool_t IsShared() const
Definition TGeoMatrix.h:71
virtual const Double_t * GetRotationMatrix() const =0
virtual Int_t GetByteCount() const
Get total size in bytes of this.
virtual TGeoHMatrix Inverse() const =0
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
char * GetPointerName() const
Provide a pointer name containing uid.
Class describing rotations.
Definition TGeoMatrix.h:175
virtual void RotateY(Double_t angle)
Rotate about Y axis of the master frame with angle expressed in degrees.
virtual void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to YZ.
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
TGeoRotation()
Default constructor.
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
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
virtual ~TGeoRotation()
Definition TGeoMatrix.h:189
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
Set matrix elements according to Euler angles.
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
void Clear(Option_t *option="")
reset data members
virtual const Double_t * GetRotationMatrix() const
Definition TGeoMatrix.h:230
void MultiplyBy(const TGeoRotation *rot, Bool_t after=kTRUE)
Multiply this rotation with the one specified by ROT.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Bool_t operator==(const TGeoRotation &other) const
Is-equal operator.
void SetMatrix(const Double_t *rot)
Definition TGeoMatrix.h:225
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
virtual void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to ZX.
TGeoRotation & operator*=(const TGeoRotation &other)
Composition.
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
virtual void RotateX(Double_t angle)
Rotate about X axis of the master frame with angle expressed in degrees.
void CheckMatrix()
performes an orthogonality check and finds if the matrix is a reflection Warning("CheckMatrix",...
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
Double_t GetPhiRotation(Bool_t fixX=kFALSE) const
Returns rotation angle about Z axis in degrees.
void FastRotZ(const Double_t *sincos)
Perform a rotation about Z having the sine/cosine of the rotation angle.
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
void GetInverse(Double_t *invmat) const
Get the inverse rotation matrix (which is simply the transpose)
Double_t Determinant() const
computes determinant of the rotation matrix
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 const Double_t * GetScale() const
Definition TGeoMatrix.h:231
Bool_t IsValid() const
Perform orthogonality test for rotation.
virtual void RotateZ(Double_t angle)
Rotate about Z axis of the master frame with angle expressed in degrees.
TGeoRotation operator*(const TGeoRotation &other) const
Double_t fRotationMatrix[3 *3]
Definition TGeoMatrix.h:177
void SetRotation(const TGeoMatrix &other)
Copy rotation elements from other rotation matrix.
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 const Double_t * GetTranslation() const
Definition TGeoMatrix.h:229
TGeoRotation & operator=(const TGeoRotation &other)
Definition TGeoMatrix.h:191
Class describing scale transformations.
Definition TGeoMatrix.h:245
virtual const Double_t * GetTranslation() const
Definition TGeoMatrix.h:277
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
Convert a global point to local frame.
TGeoScale()
default constructor
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:278
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
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
TGeoScale & operator=(const TGeoScale &other)
Definition TGeoMatrix.h:256
Bool_t operator==(const TGeoScale &other) const
Is-equal operator.
void SetScale(Double_t sx, Double_t sy, Double_t sz)
scale setter
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
virtual ~TGeoScale()
destructor
Double_t fScale[3]
Definition TGeoMatrix.h:247
virtual void ReflectZ(Bool_t, Bool_t)
Multiply by a reflection respect to XY.
Definition TGeoMatrix.h:275
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
Convert a local point to the master frame.
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:279
virtual void ReflectX(Bool_t, Bool_t)
Multiply by a reflection respect to YZ.
Definition TGeoMatrix.h:273
TGeoScale operator*(const TGeoScale &other) const
TGeoScale & operator*=(const TGeoScale &other)
Scale composition.
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
Class describing translations.
Definition TGeoMatrix.h:122
virtual const Double_t * GetTranslation() const
Definition TGeoMatrix.h:160
Bool_t operator==(const TGeoTranslation &other) const
Is-equal operator.
TGeoTranslation & operator*=(const TGeoTranslation &other)
Translation composition.
virtual const Double_t * GetScale() const
Definition TGeoMatrix.h:162
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
virtual void SetDy(Double_t dy)
Definition TGeoMatrix.h:157
virtual void RotateX(Double_t angle)
Rotate about X axis of the master frame with angle expressed in degrees.
TGeoTranslation operator*(const TGeoTranslation &right) const
void Add(const TGeoTranslation *other)
Adding a translation to this one.
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
virtual ~TGeoTranslation()
Definition TGeoMatrix.h:131
virtual void SetDz(Double_t dz)
Definition TGeoMatrix.h:158
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector to MARS
virtual void RotateZ(Double_t angle)
Rotate about Z axis of the master frame with angle expressed in degrees.
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a vector from MARS to local
virtual void RotateY(Double_t angle)
Rotate about Y axis of the master frame 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".
void SetTranslation(Double_t dx, Double_t dy, Double_t dz)
Set translation components.
TGeoTranslation & operator=(const TGeoTranslation &other)
Definition TGeoMatrix.h:133
Double_t fTranslation[3]
Definition TGeoMatrix.h:124
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
TGeoHMatrix Inverse() const
Return a temporary inverse of this.
virtual TGeoMatrix * MakeClone() const
Make a clone of this matrix.
TGeoTranslation()
Default constructor.
void Subtract(const TGeoTranslation *other)
Subtracting a translation from this one.
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
virtual void SetDx(Double_t dx)
Definition TGeoMatrix.h:156
virtual const Double_t * GetRotationMatrix() const
Definition TGeoMatrix.h:161
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:696