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#include "Math/Vector3D.h"
23
24//--- globals
25const Double_t kNullVector[3] = {0.0, 0.0, 0.0};
26
27const Double_t kIdentityMatrix[3 * 3] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
28
29const Double_t kUnitScale[3] = {1.0, 1.0, 1.0};
30
31class TGeoHMatrix;
32
33////////////////////////////////////////////////////////////////////////////
34// //
35// TGeoMatrix - base class for geometrical transformations. //
36// //
37////////////////////////////////////////////////////////////////////////////
38
39class TGeoMatrix : public TNamed {
40public:
55
56protected:
58
59public:
60 TGeoMatrix();
61 TGeoMatrix(const char *name);
62 ~TGeoMatrix() override;
63
64 Bool_t IsIdentity() const { return !TestBit(kGeoGenTrans); }
68 Bool_t IsScale() const { return TestBit(kGeoScale); }
69 Bool_t IsShared() const { return TestBit(kGeoShared); }
74 Bool_t IsRotAboutZ() const;
76 const char *GetPointerName() const;
78 virtual Int_t GetByteCount() const;
79 virtual const Double_t *GetTranslation() const = 0;
80 virtual const Double_t *GetRotationMatrix() const = 0;
81 virtual const Double_t *GetScale() const = 0;
82 virtual TGeoHMatrix Inverse() const = 0;
83 virtual void LocalToMaster(const Double_t *local, Double_t *master) const;
84 virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const;
85 virtual void LocalToMasterBomb(const Double_t *local, Double_t *master) const;
86 virtual TGeoMatrix *MakeClone() const = 0;
87 virtual void MasterToLocal(const Double_t *master, Double_t *local) const;
88 virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const;
89 virtual void MasterToLocalBomb(const Double_t *master, Double_t *local) const;
90 static void Normalize(Double_t *vect);
91 void Print(Option_t *option = "") const override; // *MENU*
92 virtual void RotateX(Double_t) {}
93 virtual void RotateY(Double_t) {}
94 virtual void RotateZ(Double_t) {}
98 virtual void RegisterYourself();
99 void SetDefaultName();
100 virtual void SetDx(Double_t) {}
101 virtual void SetDy(Double_t) {}
102 virtual void SetDz(Double_t) {}
104
105 ClassDefOverride(TGeoMatrix, 1) // base geometrical transformation class
106};
107
108////////////////////////////////////////////////////////////////////////////
109// //
110// TGeoTranslation - class describing translations. A translation is //
111// basically an array of 3 doubles matching the positions 12, 13 //
112// and 14 in the homogenous matrix description. //
113// //
114// //
115////////////////////////////////////////////////////////////////////////////
116
118protected:
119 Double_t fTranslation[3]; // translation vector
120public:
126 ~TGeoTranslation() override {}
127
131 TGeoTranslation operator*(const TGeoTranslation &right) const;
132 TGeoHMatrix operator*(const TGeoMatrix &right) const;
134
135 void Add(const TGeoTranslation *other);
136 TGeoHMatrix Inverse() const override;
137 void LocalToMaster(const Double_t *local, Double_t *master) const override;
138 void LocalToMasterVect(const Double_t *local, Double_t *master) const override;
139 void LocalToMasterBomb(const Double_t *local, Double_t *master) const override;
140 TGeoMatrix *MakeClone() const override;
141 void MasterToLocal(const Double_t *master, Double_t *local) const override;
142 void MasterToLocalVect(const Double_t *master, Double_t *local) const override;
143 void MasterToLocalBomb(const Double_t *master, Double_t *local) const override;
144 void RotateX(Double_t angle) override;
145 void RotateY(Double_t angle) override;
146 void RotateZ(Double_t angle) override;
147 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
148 void Subtract(const TGeoTranslation *other);
150 void SetTranslation(const TGeoMatrix &other);
154
155 const Double_t *GetTranslation() const override { return &fTranslation[0]; }
156 const Double_t *GetRotationMatrix() const override { return &kIdentityMatrix[0]; }
157 const Double_t *GetScale() const override { return &kUnitScale[0]; }
158
159 ClassDefOverride(TGeoTranslation, 1) // translation class
160};
161
162////////////////////////////////////////////////////////////////////////////
163// //
164// TGeoRotation - class describing rotations. A rotation is a 3*3 array //
165// Column vectors has to be orthogonal unit vectors. //
166// //
167////////////////////////////////////////////////////////////////////////////
168
169class TGeoRotation : public TGeoMatrix {
170protected:
171 Double_t fRotationMatrix[3 * 3]; // rotation matrix
172
173 void CheckMatrix();
174
175public:
176 TGeoRotation();
179 TGeoRotation(const char *name);
180 // TGeoRotation(const char *name, Double_t *matrix) ;
181 TGeoRotation(const char *name, Double_t phi, Double_t theta, Double_t psi);
183 Double_t phi3);
184 ~TGeoRotation() override {}
185
190 TGeoHMatrix operator*(const TGeoMatrix &right) const;
191 Bool_t operator==(const TGeoRotation &other) const;
192
193 Bool_t IsValid() const;
194 TGeoHMatrix Inverse() const override;
195 void Clear(Option_t *option = "") override;
196 Double_t Determinant() const;
197 void FastRotZ(const Double_t *sincos);
199 Double_t &phi3) const;
200 void GetAngles(Double_t &phi, Double_t &theta, Double_t &psi) const;
202 void LocalToMaster(const Double_t *local, Double_t *master) const override;
203 void LocalToMasterVect(const Double_t *local, Double_t *master) const override
204 {
206 }
207 void LocalToMasterBomb(const Double_t *local, Double_t *master) const override
208 {
210 }
211 TGeoMatrix *MakeClone() const override;
212 void MasterToLocal(const Double_t *master, Double_t *local) const override;
213 void MasterToLocalVect(const Double_t *master, Double_t *local) const override
214 {
216 }
217 void MasterToLocalBomb(const Double_t *master, Double_t *local) const override
218 {
220 }
222 void RotateX(Double_t angle) override;
223 void RotateY(Double_t angle) override;
224 void RotateZ(Double_t angle) override;
225 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
226 void ReflectX(Bool_t leftside, Bool_t rotonly = kFALSE) override;
227 void ReflectY(Bool_t leftside, Bool_t rotonly = kFALSE) override;
228 void ReflectZ(Bool_t leftside, Bool_t rotonly = kFALSE) override;
229 void SetAngles(Double_t phi, Double_t theta, Double_t psi);
231 void SetMatrix(const Double_t *rot)
232 {
233 memcpy(&fRotationMatrix[0], rot, 9 * sizeof(Double_t));
234 CheckMatrix();
235 }
236 void SetRotation(const TGeoMatrix &other);
237 void GetInverse(Double_t *invmat) const;
238
239 const Double_t *GetTranslation() const override { return &kNullVector[0]; }
240 const Double_t *GetRotationMatrix() const override { return &fRotationMatrix[0]; }
241 const Double_t *GetScale() const override { return &kUnitScale[0]; }
242
243 ClassDefOverride(TGeoRotation, 1) // rotation class
244};
245
246////////////////////////////////////////////////////////////////////////////
247// //
248// TGeoScale - class describing scale transformations. A scale is an //
249// array of 3 doubles (sx, sy, sz) multiplying elements 0, 5 and 10 //
250// of the homogenous matrix. A scale is normalized : sx*sy*sz = 1 //
251// //
252////////////////////////////////////////////////////////////////////////////
253
254class TGeoScale : public TGeoMatrix {
255protected:
256 Double_t fScale[3]; // scale (x, y, z)
257public:
258 TGeoScale();
259 TGeoScale(const TGeoScale &other);
260 TGeoScale(const TGeoMatrix &other);
262 TGeoScale(const char *name, Double_t sx, Double_t sy, Double_t sz);
263 ~TGeoScale() override;
264
268 TGeoScale operator*(const TGeoScale &other) const;
269 TGeoHMatrix operator*(const TGeoMatrix &right) const;
270 Bool_t operator==(const TGeoScale &other) const;
271
272 TGeoHMatrix Inverse() const override;
274 void SetScale(const TGeoMatrix &other);
275 void LocalToMaster(const Double_t *local, Double_t *master) const override;
276 Double_t LocalToMaster(Double_t dist, const Double_t *dir = nullptr) const;
277 void LocalToMasterVect(const Double_t *local, Double_t *master) const override
278 {
280 }
281 TGeoMatrix *MakeClone() const override;
282 void MasterToLocal(const Double_t *master, Double_t *local) const override;
283 Double_t MasterToLocal(Double_t dist, const Double_t *dir = nullptr) const;
284 void MasterToLocalVect(const Double_t *master, Double_t *local) const override
285 {
287 }
288 void ReflectX(Bool_t, Bool_t) override
289 {
290 fScale[0] = -fScale[0];
292 }
293 void ReflectY(Bool_t, Bool_t) override
294 {
295 fScale[1] = -fScale[1];
297 }
298 void ReflectZ(Bool_t, Bool_t) override
299 {
300 fScale[2] = -fScale[2];
302 }
303
304 const Double_t *GetTranslation() const override { return &kNullVector[0]; }
305 const Double_t *GetRotationMatrix() const override { return &kIdentityMatrix[0]; }
306 const Double_t *GetScale() const override { return &fScale[0]; }
307
308 ClassDefOverride(TGeoScale, 1) // scaling class
309};
310
311////////////////////////////////////////////////////////////////////////////
312// //
313// TGeoCombiTrans - class describing rotation + translation. Most //
314// frequently used in the description of TGeoNode 's //
315// //
316////////////////////////////////////////////////////////////////////////////
317
319protected:
320 Double_t fTranslation[3]; // translation vector
321 TGeoRotation *fRotation; // rotation matrix
322public:
327 TGeoCombiTrans(const char *name);
330
335 Bool_t operator==(const TGeoMatrix &other) const;
336
337 ~TGeoCombiTrans() override;
338
339 void Clear(Option_t *option = "") override;
340 TGeoHMatrix Inverse() const override;
341 TGeoMatrix *MakeClone() const override;
342 void Multiply(const TGeoMatrix *right);
343 void RegisterYourself() override;
344 void RotateX(Double_t angle) override;
345 void RotateY(Double_t angle) override;
346 void RotateZ(Double_t angle) override;
347 void ReflectX(Bool_t leftside, Bool_t rotonly = kFALSE) override;
348 void ReflectY(Bool_t leftside, Bool_t rotonly = kFALSE) override;
349 void ReflectZ(Bool_t leftside, Bool_t rotonly = kFALSE) override;
350 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
354 void SetTranslation(const TGeoTranslation &tr);
357 void SetRotation(const TGeoRotation &other);
358 void SetRotation(const TGeoRotation *rot);
359
360 TGeoRotation *GetRotation() const { return fRotation; }
361
362 const Double_t *GetTranslation() const override { return &fTranslation[0]; }
363 const Double_t *GetRotationMatrix() const override;
364 const Double_t *GetScale() const override { return &kUnitScale[0]; }
365
366 ClassDefOverride(TGeoCombiTrans, 1) // rotation + translation
367};
368
369////////////////////////////////////////////////////////////////////////////
370// //
371// TGeoGenTrans - most general transformation, holding a translation, //
372// a rotation and a scale //
373// //
374////////////////////////////////////////////////////////////////////////////
375
377protected:
378 Double_t fScale[3]; // scale (x, y, z)
379public:
380 TGeoGenTrans();
381 TGeoGenTrans(const char *name);
385 ~TGeoGenTrans() override;
386
387 void Clear(Option_t *option = "") override;
388 TGeoHMatrix Inverse() const override;
390 void SetScale(Double_t *scale) { memcpy(&fScale[0], scale, 3 * sizeof(Double_t)); }
391 TGeoMatrix *MakeClone() const override { return nullptr; }
393
394 const Double_t *GetScale() const override { return &fScale[0]; }
395
396 ClassDefOverride(TGeoGenTrans, 1) // rotation + translation + scale
397};
398
399////////////////////////////////////////////////////////////////////////////
400// //
401// TGeoIdentity - an identity transformation. It holds no data member //
402// and returns pointers to static null translation and identity //
403// transformations for rotation and scale //
404// //
405////////////////////////////////////////////////////////////////////////////
406
407class TGeoIdentity : public TGeoMatrix {
408private:
409 // no data members
410public:
411 TGeoIdentity();
412 TGeoIdentity(const char *name);
413 ~TGeoIdentity() override {}
414
415 TGeoHMatrix Inverse() const override;
416 void LocalToMaster(const Double_t *local, Double_t *master) const override
417 {
418 memcpy(master, local, 3 * sizeof(Double_t));
419 }
420 void LocalToMasterVect(const Double_t *local, Double_t *master) const override
421 {
422 memcpy(master, local, 3 * sizeof(Double_t));
423 }
424 void LocalToMasterBomb(const Double_t *local, Double_t *master) const override
425 {
427 }
428 TGeoMatrix *MakeClone() const override { return nullptr; }
429 void MasterToLocal(const Double_t *master, Double_t *local) const override
430 {
431 memcpy(local, master, 3 * sizeof(Double_t));
432 }
433 void MasterToLocalVect(const Double_t *master, Double_t *local) const override
434 {
435 memcpy(local, master, 3 * sizeof(Double_t));
436 }
437 void MasterToLocalBomb(const Double_t *master, Double_t *local) const override
438 {
440 }
441
442 const Double_t *GetTranslation() const override { return &kNullVector[0]; }
443 const Double_t *GetRotationMatrix() const override { return &kIdentityMatrix[0]; }
444 const Double_t *GetScale() const override { return &kUnitScale[0]; }
445 void SavePrimitive(std::ostream &, Option_t * = "") override {}
446
447 ClassDefOverride(TGeoIdentity, 1) // identity transformation class
448};
449
450////////////////////////////////////////////////////////////////////////////
451// //
452// TGeoHMatrix - Matrix class used for computing global transformations //
453// Should NOT be used for node definition. An instance of this class //
454// is generally used to pile-up local transformations starting from //
455// the top level physical node, down to the current node. //
456// //
457////////////////////////////////////////////////////////////////////////////
458
459class TGeoHMatrix : public TGeoMatrix {
460private:
461 Double_t fTranslation[3]; // translation component
462 Double_t fRotationMatrix[9]; // rotation matrix
463 Double_t fScale[3]; // scale component
464
465public:
466 TGeoHMatrix();
469 TGeoHMatrix(const char *name);
470 ~TGeoHMatrix() override;
471
477 Bool_t operator==(const TGeoMatrix &other) const;
478
479 void Clear(Option_t *option = "") override;
480 void CopyFrom(const TGeoMatrix *other);
481 Double_t Determinant() const;
482 void FastRotZ(const Double_t *sincos);
483 TGeoHMatrix Inverse() const override;
484 TGeoMatrix *MakeClone() const override;
485 void Multiply(const TGeoMatrix *right);
486 void Multiply(const TGeoMatrix &right) { Multiply(&right); }
487 void MultiplyLeft(const TGeoMatrix *left);
488 void MultiplyLeft(const TGeoMatrix &left) { MultiplyLeft(&left); }
489
490 void RotateX(Double_t angle) override;
491 void RotateY(Double_t angle) override;
492 void RotateZ(Double_t angle) override;
493 void ReflectX(Bool_t leftside, Bool_t rotonly = kFALSE) override;
494 void ReflectY(Bool_t leftside, Bool_t rotonly = kFALSE) override;
495 void ReflectZ(Bool_t leftside, Bool_t rotonly = kFALSE) override;
496 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
497 void SetDx(Double_t dx) override
498 {
499 fTranslation[0] = dx;
501 }
502 void SetDy(Double_t dy) override
503 {
504 fTranslation[1] = dy;
506 }
507 void SetDz(Double_t dz) override
508 {
509 fTranslation[2] = dz;
511 }
513 {
515 memcpy(&fTranslation[0], vect, 3 * sizeof(Double_t));
516 }
518 {
520 memcpy(&fRotationMatrix[0], matrix, 9 * sizeof(Double_t));
521 }
523 {
525 memcpy(&fScale[0], scale, 3 * sizeof(Double_t));
526 }
527
528 const Double_t *GetTranslation() const override { return &fTranslation[0]; }
529 const Double_t *GetRotationMatrix() const override { return &fRotationMatrix[0]; }
530 const Double_t *GetScale() const override { return &fScale[0]; }
531
532 virtual Double_t *GetTranslation() { return &fTranslation[0]; }
533 virtual Double_t *GetRotationMatrix() { return &fRotationMatrix[0]; }
534 virtual Double_t *GetScale() { return &fScale[0]; }
535 ClassDefOverride(TGeoHMatrix, 1) // global matrix class
536};
537
539
540#endif
#define R__EXTERN
Definition DllImport.h:26
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
Option_t Option_t TPoint TPoint angle
char name[80]
Definition TGX11.cxx:110
const Double_t kUnitScale[3]
Definition TGeoMatrix.h:29
const Double_t kIdentityMatrix[3 *3]
Definition TGeoMatrix.h:27
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:538
const Double_t kNullVector[3]
Definition TGeoMatrix.h:25
Class describing rotation + translation.
Definition TGeoMatrix.h:318
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
TGeoCombiTrans & operator*=(const TGeoMatrix &other)
Composition.
void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to YZ.
Bool_t operator==(const TGeoMatrix &other) const
Is-equal operator.
TGeoCombiTrans()
dummy ctor
void SetDz(Double_t dz) override
Definition TGeoMatrix.h:353
void RegisterYourself() override
Register the matrix in the current manager, which will become the owner.
const Double_t * GetTranslation() const override
Definition TGeoMatrix.h:362
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoMatrix * MakeClone() const override
Make a clone of this matrix.
TGeoHMatrix Inverse() const override
Return a temporary inverse of this.
void RotateY(Double_t angle) override
Rotate about Y axis with angle expressed in degrees.
void SetDy(Double_t dy) override
Definition TGeoMatrix.h:352
Double_t fTranslation[3]
Definition TGeoMatrix.h:320
void SetDx(Double_t dx) override
Definition TGeoMatrix.h:351
TGeoRotation * fRotation
Definition TGeoMatrix.h:321
void RotateX(Double_t angle) override
Rotate about X axis with angle expressed in degrees.
TGeoRotation * GetRotation() const
Definition TGeoMatrix.h:360
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:324
void Clear(Option_t *option="") override
Reset translation/rotation to identity.
TGeoCombiTrans & operator=(const TGeoCombiTrans &other)
Definition TGeoMatrix.h:331
void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to ZX.
~TGeoCombiTrans() override
destructor
TGeoCombiTrans operator*(const TGeoMatrix &other) const
void RotateZ(Double_t angle) override
Rotate about Z axis with angle expressed in degrees.
const Double_t * GetRotationMatrix() const override
get the rotation array
const Double_t * GetScale() const override
Definition TGeoMatrix.h:364
void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to XY.
Most general transformation, holding a translation, a rotation and a scale.
Definition TGeoMatrix.h:376
const Double_t * GetScale() const override
Definition TGeoMatrix.h:394
void Clear(Option_t *option="") override
clear the fields of this transformation
Double_t fScale[3]
Definition TGeoMatrix.h:378
~TGeoGenTrans() override
destructor
TGeoMatrix * MakeClone() const override
Make a clone of this matrix.
Definition TGeoMatrix.h:391
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 override
Return a temporary inverse of this.
void SetScale(Double_t *scale)
Definition TGeoMatrix.h:390
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:459
TGeoHMatrix & operator*=(const TGeoMatrix &other)
Composition.
TGeoHMatrix()
dummy ctor
virtual Double_t * GetRotationMatrix()
Definition TGeoMatrix.h:533
void RotateX(Double_t angle) override
Rotate about X axis with angle expressed in degrees.
const Double_t * GetScale() const override
Definition TGeoMatrix.h:530
void SetRotation(const Double_t *matrix)
Definition TGeoMatrix.h:517
const Double_t * GetRotationMatrix() const override
Definition TGeoMatrix.h:529
void SetScale(const Double_t *scale)
Definition TGeoMatrix.h:522
void MultiplyLeft(const TGeoMatrix *left)
multiply to the left with an other transformation if right is identity matrix, just return
Double_t Determinant() const
computes determinant of the rotation matrix
TGeoMatrix * MakeClone() const override
Make a clone of this matrix.
TGeoHMatrix Inverse() const override
Return a temporary inverse of this.
void RotateZ(Double_t angle) override
Rotate about Z axis with angle expressed in degrees.
void SetDz(Double_t dz) override
Definition TGeoMatrix.h:507
void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to YZ.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void CopyFrom(const TGeoMatrix *other)
Fast copy method.
void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to ZX.
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:461
Bool_t operator==(const TGeoMatrix &other) const
Is-equal operator.
void SetDy(Double_t dy) override
Definition TGeoMatrix.h:502
void MultiplyLeft(const TGeoMatrix &left)
Definition TGeoMatrix.h:488
Double_t fRotationMatrix[9]
Definition TGeoMatrix.h:462
~TGeoHMatrix() override
destructor
void RotateY(Double_t angle) override
Rotate about Y axis with angle expressed in degrees.
void Clear(Option_t *option="") override
clear the data for this matrix
const Double_t * GetTranslation() const override
Definition TGeoMatrix.h:528
TGeoHMatrix & operator=(const TGeoHMatrix &other)
Definition TGeoMatrix.h:472
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
void SetDx(Double_t dx) override
Definition TGeoMatrix.h:497
virtual Double_t * GetTranslation()
Definition TGeoMatrix.h:532
void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to XY.
TGeoHMatrix operator*(const TGeoMatrix &other) const
virtual Double_t * GetScale()
Definition TGeoMatrix.h:534
void Multiply(const TGeoMatrix &right)
Definition TGeoMatrix.h:486
void SetTranslation(const Double_t *vect)
Definition TGeoMatrix.h:512
Double_t fScale[3]
Definition TGeoMatrix.h:463
An identity transformation.
Definition TGeoMatrix.h:407
const Double_t * GetTranslation() const override
Definition TGeoMatrix.h:442
TGeoHMatrix Inverse() const override
Return a temporary inverse of this.
void MasterToLocalVect(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition TGeoMatrix.h:433
void MasterToLocal(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition TGeoMatrix.h:429
void LocalToMaster(const Double_t *local, Double_t *master) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition TGeoMatrix.h:416
void LocalToMasterVect(const Double_t *local, Double_t *master) const override
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition TGeoMatrix.h:420
TGeoIdentity()
dummy ctor
const Double_t * GetRotationMatrix() const override
Definition TGeoMatrix.h:443
void SavePrimitive(std::ostream &, Option_t *="") override
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGeoMatrix.h:445
void LocalToMasterBomb(const Double_t *local, Double_t *master) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition TGeoMatrix.h:424
TGeoMatrix * MakeClone() const override
Definition TGeoMatrix.h:428
const Double_t * GetScale() const override
Definition TGeoMatrix.h:444
void MasterToLocalBomb(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition TGeoMatrix.h:437
~TGeoIdentity() override
Definition TGeoMatrix.h:413
Geometrical transformation package.
Definition TGeoMatrix.h:39
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:68
void SetDefaultName()
If no name was supplied in the ctor, the type of transformation is checked.
void Print(Option_t *option="") const override
print the matrix in 4x4 format
Bool_t IsGeneral() const
Definition TGeoMatrix.h:72
virtual void RotateZ(Double_t)
Definition TGeoMatrix.h:94
@ kGeoSavePrimitive
Definition TGeoMatrix.h:49
@ kGeoTranslation
Definition TGeoMatrix.h:44
@ kGeoMatrixOwned
Definition TGeoMatrix.h:50
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:102
Bool_t IsTranslation() const
Definition TGeoMatrix.h:65
virtual void SetDy(Double_t)
Definition TGeoMatrix.h:101
Bool_t IsReflection() const
Definition TGeoMatrix.h:67
Bool_t IsRotation() const
Definition TGeoMatrix.h:66
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:93
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:92
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:70
virtual const Double_t * GetScale() const =0
static void Normalize(Double_t *vect)
Normalize a vector.
Bool_t IsIdentity() const
Definition TGeoMatrix.h:64
const char * GetPointerName() const
Provide a pointer name containing uid.
Bool_t IsCombi() const
Definition TGeoMatrix.h:71
void SetShared(Bool_t flag=kTRUE)
Definition TGeoMatrix.h:103
virtual void SetDx(Double_t)
Definition TGeoMatrix.h:100
Bool_t IsRegistered() const
Definition TGeoMatrix.h:73
Bool_t IsShared() const
Definition TGeoMatrix.h:69
virtual const Double_t * GetRotationMatrix() const =0
virtual Int_t GetByteCount() const
Get total size in bytes of this.
virtual TGeoHMatrix Inverse() const =0
void GetWorldAxes(ROOT::Math::XYZVector &ax, ROOT::Math::XYZVector &ay, ROOT::Math::XYZVector &az) const
Extract world-space axes of a placed TGeoBBox.
~TGeoMatrix() override
Destructor.
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.
Class describing rotations.
Definition TGeoMatrix.h:169
void LocalToMasterBomb(const Double_t *local, Double_t *master) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition TGeoMatrix.h:207
void RotateX(Double_t angle) override
Rotate about X axis of the master frame with angle expressed in degrees.
const Double_t * GetScale() const override
Definition TGeoMatrix.h:241
void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to XY.
TGeoRotation()
Default constructor.
void MasterToLocalVect(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition TGeoMatrix.h:213
void Clear(Option_t *option="") override
reset data members
const Double_t * GetRotationMatrix() const override
Definition TGeoMatrix.h:240
void SetAngles(Double_t phi, Double_t theta, Double_t psi)
Set matrix elements according to Euler angles.
~TGeoRotation() override
Definition TGeoMatrix.h:184
void MasterToLocalBomb(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition TGeoMatrix.h:217
void MultiplyBy(const TGeoRotation *rot, Bool_t after=kTRUE)
Multiply this rotation with the one specified by ROT.
void RotateY(Double_t angle) override
Rotate about Y axis of the master frame with angle expressed in degrees.
Bool_t operator==(const TGeoRotation &other) const
Is-equal operator.
void SetMatrix(const Double_t *rot)
Definition TGeoMatrix.h:231
void RotateZ(Double_t angle) override
Rotate about Z axis of the master frame with angle expressed in degrees.
void LocalToMaster(const Double_t *local, Double_t *master) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
TGeoRotation & operator*=(const TGeoRotation &other)
Composition.
void CheckMatrix()
performes an orthogonality check and finds if the matrix is a reflection Warning("CheckMatrix",...
void ReflectY(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to ZX.
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.
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.
Bool_t IsValid() const
Perform orthogonality test for rotation.
void MasterToLocal(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
TGeoMatrix * MakeClone() const override
Make a clone of this matrix.
TGeoRotation operator*(const TGeoRotation &other) const
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
const Double_t * GetTranslation() const override
Definition TGeoMatrix.h:239
void ReflectX(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to YZ.
Double_t fRotationMatrix[3 *3]
Definition TGeoMatrix.h:171
void SetRotation(const TGeoMatrix &other)
Copy rotation elements from other rotation matrix.
void LocalToMasterVect(const Double_t *local, Double_t *master) const override
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition TGeoMatrix.h:203
TGeoRotation & operator=(const TGeoRotation &other)
Definition TGeoMatrix.h:186
TGeoHMatrix Inverse() const override
Return a temporary inverse of this.
Class describing scale transformations.
Definition TGeoMatrix.h:254
TGeoScale()
default constructor
const Double_t * GetScale() const override
Definition TGeoMatrix.h:306
void LocalToMasterVect(const Double_t *local, Double_t *master) const override
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition TGeoMatrix.h:277
TGeoScale & operator=(const TGeoScale &other)
Definition TGeoMatrix.h:265
TGeoMatrix * MakeClone() const override
Make a clone of this matrix.
Bool_t operator==(const TGeoScale &other) const
Is-equal operator.
~TGeoScale() override
destructor
void SetScale(Double_t sx, Double_t sy, Double_t sz)
scale setter
void ReflectY(Bool_t, Bool_t) override
Multiply by a reflection respect to ZX.
Definition TGeoMatrix.h:293
void MasterToLocalVect(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
Definition TGeoMatrix.h:284
void ReflectZ(Bool_t, Bool_t) override
Multiply by a reflection respect to XY.
Definition TGeoMatrix.h:298
void LocalToMaster(const Double_t *local, Double_t *master) const override
Convert a local point to the master frame.
const Double_t * GetRotationMatrix() const override
Definition TGeoMatrix.h:305
TGeoHMatrix Inverse() const override
Return a temporary inverse of this.
Double_t fScale[3]
Definition TGeoMatrix.h:256
TGeoScale operator*(const TGeoScale &other) const
void ReflectX(Bool_t, Bool_t) override
Multiply by a reflection respect to YZ.
Definition TGeoMatrix.h:288
TGeoScale & operator*=(const TGeoScale &other)
Scale composition.
const Double_t * GetTranslation() const override
Definition TGeoMatrix.h:304
void MasterToLocal(const Double_t *master, Double_t *local) const override
Convert a global point to local frame.
Class describing translations.
Definition TGeoMatrix.h:117
void RotateX(Double_t angle) override
Rotate about X axis of the master frame with angle expressed in degrees.
void RotateY(Double_t angle) override
Rotate about Y axis of the master frame with angle expressed in degrees.
Bool_t operator==(const TGeoTranslation &other) const
Is-equal operator.
TGeoTranslation & operator*=(const TGeoTranslation &other)
Translation composition.
const Double_t * GetScale() const override
Definition TGeoMatrix.h:157
TGeoTranslation operator*(const TGeoTranslation &right) const
void Add(const TGeoTranslation *other)
Adding a translation to this one.
void RotateZ(Double_t angle) override
Rotate about Z axis of the master frame with angle expressed in degrees.
~TGeoTranslation() override
Definition TGeoMatrix.h:126
void LocalToMasterVect(const Double_t *local, Double_t *master) const override
convert a vector to MARS
void LocalToMaster(const Double_t *local, Double_t *master) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
void MasterToLocalBomb(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
void SetTranslation(Double_t dx, Double_t dy, Double_t dz)
Set translation components.
TGeoTranslation & operator=(const TGeoTranslation &other)
Definition TGeoMatrix.h:128
Double_t fTranslation[3]
Definition TGeoMatrix.h:119
void SetDy(Double_t dy) override
Definition TGeoMatrix.h:152
const Double_t * GetRotationMatrix() const override
Definition TGeoMatrix.h:156
const Double_t * GetTranslation() const override
Definition TGeoMatrix.h:155
void MasterToLocal(const Double_t *master, Double_t *local) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix
void LocalToMasterBomb(const Double_t *local, Double_t *master) const override
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoTranslation()
Default constructor.
void Subtract(const TGeoTranslation *other)
Subtracting a translation from this one.
TGeoMatrix * MakeClone() const override
Make a clone of this matrix.
void MasterToLocalVect(const Double_t *master, Double_t *local) const override
convert a vector from MARS to local
void SetDz(Double_t dz) override
Definition TGeoMatrix.h:153
TGeoHMatrix Inverse() const override
Return a temporary inverse of this.
void SetDx(Double_t dx) override
Definition TGeoMatrix.h:151
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:202
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:881