Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RotationY.h
Go to the documentation of this file.
1// -*- C++ -*-
2// CLASSDOC OFF
3// ---------------------------------------------------------------------------
4// CLASSDOC ON
5//
6// This file is a part of the CLHEP - a Class Library for High Energy Physics.
7//
8// This is the definition of the HepRotationY class for performing rotations
9// around the X axis on objects of the Hep3Vector (and HepLorentzVector) class.
10//
11// HepRotationY is a concrete implementation of Hep3RotationInterface.
12//
13// .SS See Also
14// RotationInterfaces.h
15// ThreeVector.h, LorentzVector.h, LorentzRotation.h
16//
17// .SS Author
18// Mark Fischler
19
20#ifndef HEP_ROTATIONY_H
21#define HEP_ROTATIONY_H
22
24
25namespace CLHEP {
26
27class HepRotationY;
28class HepRotation;
29class HepBoost;
30
32// Returns the inverse of a RotationY.
33
34/**
35 * @author
36 * @ingroup vector
37 */
39
40public:
41
42 // ---------- Constructors and Assignment:
43
44 inline HepRotationY();
45 // Default constructor. Gives an identity rotation.
46
47 HepRotationY(double delta);
48 // supply angle of rotation
49
50 inline HepRotationY(const HepRotationY & orig);
51 inline HepRotationY(HepRotationY && orig) = default;
52 // Copy and move constructors.
53
55 inline HepRotationY & operator = (HepRotationY && r) = default;
56 // Copy and move assignments from a Rotation, which must be RotationY
57
58 HepRotationY & set ( double delta );
59 // set angle of rotation
60
61 inline ~HepRotationY();
62 // Trivial destructor.
63
64 // ---------- Accessors:
65
66 inline Hep3Vector colX() const;
67 inline Hep3Vector colY() const;
68 inline Hep3Vector colZ() const;
69 // orthogonal unit-length column vectors
70
71 inline Hep3Vector rowX() const;
72 inline Hep3Vector rowY() const;
73 inline Hep3Vector rowZ() const;
74 // orthogonal unit-length row vectors
75
76 inline double xx() const;
77 inline double xy() const;
78 inline double xz() const;
79 inline double yx() const;
80 inline double yy() const;
81 inline double yz() const;
82 inline double zx() const;
83 inline double zy() const;
84 inline double zz() const;
85 // Elements of the rotation matrix (Geant4).
86
87 inline HepRep3x3 rep3x3() const;
88 // 3x3 representation:
89
90 // ------------ Euler angles:
91 inline double getPhi () const;
92 inline double getTheta() const;
93 inline double getPsi () const;
94 double phi () const;
95 double theta() const;
96 double psi () const;
98
99 // ------------ axis & angle of rotation:
100 inline double getDelta() const;
101 inline Hep3Vector getAxis () const;
102 inline double delta() const;
103 inline Hep3Vector axis () const;
104 inline HepAxisAngle axisAngle() const;
105 inline void getAngleAxis(double & delta, Hep3Vector & axis) const;
106 // Returns the rotation angle and rotation axis (Geant4).
107
108 // ------------- Angles of rotated axes
109 double phiX() const;
110 double phiY() const;
111 double phiZ() const;
112 double thetaX() const;
113 double thetaY() const;
114 double thetaZ() const;
115 // Return angles (RADS) made by rotated axes against original axes (Geant4).
116
117 // ---------- Other accessors treating pure rotation as a 4-rotation
118
119 inline HepLorentzVector col1() const;
120 inline HepLorentzVector col2() const;
121 inline HepLorentzVector col3() const;
122 // orthosymplectic 4-vector columns - T component will be zero
123
124 inline HepLorentzVector col4() const;
125 // Will be (0,0,0,1) for this pure Rotation.
126
127 inline HepLorentzVector row1() const;
128 inline HepLorentzVector row2() const;
129 inline HepLorentzVector row3() const;
130 // orthosymplectic 4-vector rows - T component will be zero
131
132 inline HepLorentzVector row4() const;
133 // Will be (0,0,0,1) for this pure Rotation.
134
135 inline double xt() const;
136 inline double yt() const;
137 inline double zt() const;
138 inline double tx() const;
139 inline double ty() const;
140 inline double tz() const;
141 // Will be zero for this pure Rotation
142
143 inline double tt() const;
144 // Will be one for this pure Rotation
145
146 inline HepRep4x4 rep4x4() const;
147 // 4x4 representation.
148
149 // --------- Mutators
150
151 void setDelta (double delta);
152 // change angle of rotation, leaving rotation axis unchanged.
153
154 // ---------- Decomposition:
155
156 void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
157 void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
158 void decompose (HepRotation & rotation, HepBoost & boost) const;
159 void decompose (HepBoost & boost, HepRotation & rotation) const;
160 // These are trivial, as the boost vector is 0.
161
162 // ---------- Comparisons:
163
164 inline bool isIdentity() const;
165 // Returns true if the identity matrix (Geant4).
166
167 inline int compare( const HepRotationY & r ) const;
168 // Dictionary-order comparison, in order of delta
169 // Used in operator<, >, <=, >=
170
171 inline bool operator== ( const HepRotationY & r ) const;
172 inline bool operator!= ( const HepRotationY & r ) const;
173 inline bool operator< ( const HepRotationY & r ) const;
174 inline bool operator> ( const HepRotationY & r ) const;
175 inline bool operator<= ( const HepRotationY & r ) const;
176 inline bool operator>= ( const HepRotationY & r ) const;
177
178 double distance2( const HepRotationY & r ) const;
179 // 3 - Tr ( this/r )
180
181 double distance2( const HepRotation & r ) const;
182 // 3 - Tr ( this/r ) -- This works with RotationY or Z also
183
184 double howNear( const HepRotationY & r ) const;
185 double howNear( const HepRotation & r ) const;
186 bool isNear( const HepRotationY & r,
188 bool isNear( const HepRotation & r,
190
191 double distance2( const HepBoost & lt ) const;
192 // 3 - Tr ( this ) + |b|^2 / (1-|b|^2)
193 double distance2( const HepLorentzRotation & lt ) const;
194 // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt
195
196 double howNear( const HepBoost & lt ) const;
197 double howNear( const HepLorentzRotation & lt ) const;
198 bool isNear( const HepBoost & lt,
200 bool isNear( const HepLorentzRotation & lt,
202
203 // ---------- Properties:
204
205 double norm2() const;
206 // distance2 (IDENTITY), which is 3 - Tr ( *this )
207
208 inline void rectify();
209 // non-const but logically moot correction for accumulated roundoff errors
210
211 // ---------- Application:
212
213 inline Hep3Vector operator() (const Hep3Vector & p) const;
214 // Rotate a Hep3Vector.
215
216 inline Hep3Vector operator * (const Hep3Vector & p) const;
217 // Multiplication with a Hep3Vector.
218
220 // Rotate (the space part of) a HepLorentzVector.
221
223 // Multiplication with a HepLorentzVector.
224
225 // ---------- Operations in the group of Rotations
226
227 inline HepRotationY operator * (const HepRotationY & ry) const;
228 // Product of two Y rotations (this) * ry is known to be RotationY.
229
231 inline HepRotationY & transform (const HepRotationY & r);
232 // Matrix multiplication.
233 // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
234 // However, in this special case, they commute: Both just add deltas.
235
236 inline HepRotationY inverse() const;
237 // Returns the inverse.
238
240 // Returns the inverse of a RotationY.
241
243 // Inverts the Rotation matrix (be negating delta).
244
245 // ---------- I/O:
246
247 std::ostream & print( std::ostream & os ) const;
248 // Output, identifying type of rotation and delta.
249
250 // ---------- Tolerance
251
252 static inline double getTolerance();
253 static inline double setTolerance(double tol);
254
255protected:
256
257 double its_d;
258 // The angle of rotation.
259
260 double its_s;
261 double its_c;
262 // Cache the trig functions, for rapid operations.
263
264 inline HepRotationY ( double dd, double ss, double cc );
265 // Unchecked load-the-data-members
266
267 static inline double proper (double delta);
268 // Put an angle into the range of (-PI, PI]. Useful helper method.
269
270}; // HepRotationY
271
272// ---------- Free-function operations in the group of Rotations
273
274inline
275std::ostream & operator <<
276 ( std::ostream & os, const HepRotationY & r ) {return r.print(os);}
277
278} // namespace CLHEP
279
280#include "CLHEP/Vector/RotationY.icc"
281
282#endif /* HEP_ROTATIONY_H */
283
G4double epsilon(G4double density, G4double temperature)
static DLL_API double tolerance
double getPhi() const
void setDelta(double delta)
Definition: RotationY.cc:103
HepRotationY & operator*=(const HepRotationY &r)
bool operator>(const HepRotationY &r) const
static double proper(double delta)
double phiZ() const
Definition: RotationY.cc:84
Hep3Vector rowY() const
HepRotationY(const HepRotationY &orig)
HepLorentzVector col4() const
double delta() const
HepLorentzVector row4() const
double zz() const
bool operator==(const HepRotationY &r) const
double yz() const
double theta() const
Definition: RotationY.cc:48
double yx() const
double yt() const
HepRotationY & operator=(const HepRotationY &r)
bool isNear(const HepRotationY &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationY.cc:170
int compare(const HepRotationY &r) const
static double setTolerance(double tol)
Hep3Vector colX() const
double howNear(const HepRotationY &r) const
Definition: RotationY.cc:158
Hep3Vector operator()(const Hep3Vector &p) const
bool isIdentity() const
double zy() const
Hep3Vector rowX() const
double zx() const
double xx() const
double phi() const
Definition: RotationY.cc:38
HepLorentzVector col2() const
double xt() const
Hep3Vector colZ() const
double zt() const
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
Definition: RotationY.cc:108
HepRotationY & set(double delta)
Definition: RotationY.cc:31
double xz() const
Hep3Vector getAxis() const
HepAxisAngle axisAngle() const
double thetaY() const
Definition: RotationY.cc:93
double tz() const
double distance2(const HepRotationY &r) const
Definition: RotationY.cc:131
HepLorentzVector row3() const
HepLorentzVector row2() const
bool operator!=(const HepRotationY &r) const
double tt() const
std::ostream & print(std::ostream &os) const
Definition: RotationY.cc:188
double yy() const
double phiY() const
Definition: RotationY.cc:79
double psi() const
Definition: RotationY.cc:52
HepRep3x3 rep3x3() const
bool operator>=(const HepRotationY &r) const
HepLorentzVector col1() const
double xy() const
HepLorentzVector operator()(const HepLorentzVector &w) const
double getPsi() const
Hep3Vector axis() const
HepLorentzVector col3() const
Hep3Vector operator*(const Hep3Vector &p) const
Hep3Vector colY() const
double getDelta() const
HepLorentzVector row1() const
double thetaX() const
Definition: RotationY.cc:89
void getAngleAxis(double &delta, Hep3Vector &axis) const
bool operator<=(const HepRotationY &r) const
static double getTolerance()
bool operator<(const HepRotationY &r) const
HepRotationY inverse() const
HepRotationY(double dd, double ss, double cc)
HepRep4x4 rep4x4() const
double thetaZ() const
Definition: RotationY.cc:98
friend HepRotationY inverseOf(const HepRotationY &r)
HepRotationY & invert()
double phiX() const
Definition: RotationY.cc:74
double ty() const
Hep3Vector rowZ() const
double norm2() const
Definition: RotationY.cc:184
HepRotationY & transform(const HepRotationY &r)
double tx() const
HepRotationY(HepRotationY &&orig)=default
HepEulerAngles eulerAngles() const
Definition: RotationY.cc:62
double getTheta() const
Definition: DoubConv.h:17
HepBoost inverseOf(const HepBoost &lt)