Project
Loading...
Searching...
No Matches
FairGeoRotation.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3 * *
4 * This software is distributed under the terms of the *
5 * GNU Lesser General Public Licence (LGPL) version 3, *
6 * copied verbatim in the file "LICENSE" *
7 ********************************************************************************/
8//*-- AUTHOR : Ilse Koenig
9//*-- Modified : 16/06/99
10
12// FairGeoRotation
13//
14// This class defines a 3x3 rotation matrix.
15// The data are stored in a linear array with 9 Double_t
16// components.
17//
18// Inline functions:
19//
20// Constructors:
21// FairGeoRotation()
22// FairGeoRotation(const FairGeoRotation& r)
23// FairGeoRotation(const Double_t* a)
24//
25// Access to components:
26// Double_t operator () (Int_t) const
27// void setElement(const Double_t,const Int_t)
28//
29// Check for equality/inequality
30// Bool_t operator == (const FairGeoRotation&)
31// Bool_t operator != (const FairGeoRotation&)
32//
33// FairGeoRotation& operator = (const FairGeoRotation&);
34// assignment
35//
36// void setUnitMatrix()
37// sets identity matrix
38//
39// void setZero()
40// sets all components to 0.0
41//
42// Bool_t isUnitMatrix()
43// checks unity
44//
45// FairGeoRotation& invert()
46// inverts the matrix
47//
48// FairGeoRotation inverse()
49// copies the matrix and returns the inverse of the copy
50//
51// Double_t determinant() const;
52// returns determinate
53//
54// FairGeoRotation& operator *= (const FairGeoRotation&);
55// multiplies with the given rotation matrix from the right
56//
57// FairGeoRotation& transform(const FairGeoRotation&);
58// multiplies with the given rotation matrix from the left
59//
60// FairGeoVector operator * (const FairGeoVector&) const;
61// rotates a vector
62//
63// FairGeoRotation operator * (const FairGeoRotation&) const;
64// rotates the given rotation
65//
66// void print()
67// shows the matrix
68//
69//
70// Euler Angles:
71// 1. angle: rotation around z-axis --> x1, y1, z1=z
72// 2. angle: rotation around y1-axis --> x2, y2=y1, z2
73// 3. angle: rotation around z2-axis --> x3, y3, z3=z2
75#include "FairGeoRotation.h"
76
77#include <TMath.h> // for Cos, Sin
78#include <TRotMatrix.h> // for TRotMatrix
79
81
82FairGeoRotation::FairGeoRotation(const Double_t a, const Double_t b, const Double_t c)
83 : TObject()
84{
85 // constructor taking three Euler angles
87}
88
89void FairGeoRotation::setEulerAngles(const Double_t a, const Double_t b, const Double_t c)
90{
91 // sets the matrix calculating the values from the given Euler angles
92 const double deg2rad = 0.01745329252;
93 Double_t s0 = TMath::Sin(a * deg2rad);
94 Double_t c0 = TMath::Cos(a * deg2rad);
95 Double_t s1 = TMath::Sin(b * deg2rad);
96 Double_t c1 = TMath::Cos(b * deg2rad);
97 Double_t s2 = TMath::Sin(c * deg2rad);
98 Double_t c2 = TMath::Cos(c * deg2rad);
99 rot[0] = c0 * c1 * c2 - s0 * s2;
100 rot[1] = -c0 * c1 * s2 - s0 * c2;
101 rot[2] = c0 * s1;
102 rot[3] = s0 * c1 * c2 + c0 * s2;
103 rot[4] = c0 * c2 - s0 * c1 * s2;
104 rot[5] = s0 * s1;
105 rot[6] = -s1 * c2;
106 rot[7] = s1 * s2;
107 rot[8] = c1;
108}
109
111{
112 // calculates the square of the difference between 2 matrices
113 Double_t s = 0;
114 for (Int_t i = 0; i < 9; i++) {
115 Double_t d = rot[i] - r(i);
116 s += d * d;
117 }
118 return s;
119}
120
121TRotMatrix* FairGeoRotation::createTRotMatrix(const Text_t* name, const Text_t* title)
122{
123 // creates a TRotMatrix
124 // (uses a new() operator and the user has to take care to free the memory)
125 TRotMatrix* t = 0;
126 if (isUnitMatrix() == kTRUE) {
127 return t;
128 }
129 Double_t a[9];
130 for (Int_t i = 0; i < 3; i++) {
131 for (Int_t j = 0; j < 3; j++) {
132 a[j + 3 * i] = rot[i + 3 * j];
133 }
134 }
135 t = new TRotMatrix(name, title, a);
136 return t;
137}
ClassImp(FairGeoRotation)
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
void setEulerAngles(const Double_t, const Double_t, const Double_t)
TRotMatrix * createTRotMatrix(const Text_t *name="", const Text_t *title="")
Double_t diff2(const FairGeoRotation &) const
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition glcorearb.h:5034
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s0
Definition glcorearb.h:5034
constexpr double deg2rad