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