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