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