CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
RotationX.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 HepRotationX class for performing rotations
9// around the X axis on objects of the Hep3Vector (and HepLorentzVector) class.
10//
11// HepRotationX 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_ROTATIONX_H
21#define HEP_ROTATIONX_H
22
23#include "CLHEP/Vector/defs.h"
24#include "CLHEP/Vector/RotationInterfaces.h"
25
26namespace CLHEP {
27
28class HepRotationX;
29
30class HepRotation;
31class HepBoost;
32
34// Returns the inverse of a RotationX.
35
36/**
37 * @author
38 * @ingroup vector
39 */
41
42public:
43
44 // ---------- Constructors and Assignment:
45
46 inline HepRotationX();
47 // Default constructor. Gives an identity rotation.
48
49 HepRotationX(double delta);
50 // supply angle of rotation
51
52 inline HepRotationX(const HepRotationX & orig);
53 inline HepRotationX(HepRotationX && orig) = default;
54 // Copy and move constructors.
55
57 inline HepRotationX & operator = (HepRotationX && r) = default;
58 // Copy and move assignments from a Rotation, which must be RotationX
59
60 HepRotationX & set ( double delta );
61 // set angle of rotation
62
63 inline ~HepRotationX();
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 HepRotationX & r ) const;
170 // Dictionary-order comparison, in order of delta
171 // Used in operator<, >, <=, >=
172
173 inline bool operator== ( const HepRotationX & r ) const;
174 inline bool operator!= ( const HepRotationX & r ) const;
175 inline bool operator< ( const HepRotationX & r ) const;
176 inline bool operator> ( const HepRotationX & r ) const;
177 inline bool operator<= ( const HepRotationX & r ) const;
178 inline bool operator>= ( const HepRotationX & r ) const;
179
180 double distance2( const HepRotationX & 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 HepRotationX & r ) const;
187 double howNear( const HepRotation & r ) const;
188 bool isNear( const HepRotationX & 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 HepRotationX operator * (const HepRotationX & rx) const;
230 // Product of two X rotations: (this) * rx is known to be RotationX.
231
233 inline HepRotationX & transform (const HepRotationX & r);
234 // Matrix multiplication.
235 // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
236 // However, in this special case, they commute: Both just add deltas.
237
238 inline HepRotationX inverse() const;
239 // Returns the inverse.
240
242 // Returns the inverse of a RotationX.
243
245 // Inverts the Rotation matrix (be negating delta).
246
247 // ---------- I/O:
248
249 std::ostream & print( std::ostream & os ) const;
250 // Output, identifying type of rotation and delta.
251
252 // ---------- Tolerance
253
254 static inline double getTolerance();
255 static inline double setTolerance(double tol);
256
257protected:
258
259 double its_d;
260 // The angle of rotation.
261
262 double its_s;
263 double its_c;
264 // Cache the trig functions, for rapid operations.
265
266 inline HepRotationX ( double dd, double ss, double cc );
267 // Unchecked load-the-data-members
268
269 static inline double proper (double delta);
270 // Put an angle into the range of (-PI, PI]. Useful helper method.
271
272}; // HepRotationX
273// ---------- Free-function operations in the group of Rotations
274
275inline
276std::ostream & operator <<
277 ( std::ostream & os, const HepRotationX & r ) {return r.print(os);}
278
279} // namespace CLHEP
280
281#include "CLHEP/Vector/RotationX.icc"
282
283#ifdef ENABLE_BACKWARDS_COMPATIBILITY
284// backwards compatibility will be enabled ONLY in CLHEP 1.9
285using namespace CLHEP;
286#endif
287
288#endif /* HEP_ROTATIONX_H */
double phiX() const
Definition: RotationX.cc:71
double tt() const
HepRotationX(double dd, double ss, double cc)
HepLorentzVector row4() const
double xy() const
friend HepRotationX inverseOf(const HepRotationX &r)
HepRotationX inverse() const
static double getTolerance()
HepLorentzVector col1() const
HepRotationX(const HepRotationX &orig)
double getPsi() const
double thetaZ() const
Definition: RotationX.cc:95
double xx() const
double phiY() const
Definition: RotationX.cc:76
Hep3Vector rowX() const
double yz() const
HepRotationX & transform(const HepRotationX &r)
HepLorentzVector col3() const
double tx() const
HepRep4x4 rep4x4() const
static double proper(double delta)
HepRotationX(HepRotationX &&orig)=default
bool operator>=(const HepRotationX &r) const
double delta() const
Hep3Vector colZ() const
double zy() const
HepRotationX & set(double delta)
Definition: RotationX.cc:32
HepLorentzVector col2() const
Hep3Vector rowY() const
HepEulerAngles eulerAngles() const
Definition: RotationX.cc:59
int compare(const HepRotationX &r) const
HepRep3x3 rep3x3() const
double getDelta() const
double psi() const
Definition: RotationX.cc:51
double getPhi() const
double howNear(const HepRotationX &r) const
Definition: RotationX.cc:155
bool operator!=(const HepRotationX &r) const
Hep3Vector rowZ() const
void setDelta(double delta)
Definition: RotationX.cc:100
double yy() const
double phi() const
Definition: RotationX.cc:39
double thetaY() const
Definition: RotationX.cc:91
double xz() const
HepRotationX & operator=(const HepRotationX &r)
double phiZ() const
Definition: RotationX.cc:81
void getAngleAxis(double &delta, Hep3Vector &axis) const
double ty() const
double xt() const
double thetaX() const
Definition: RotationX.cc:86
Hep3Vector axis() const
double tz() const
bool operator==(const HepRotationX &r) const
bool operator<=(const HepRotationX &r) const
HepLorentzVector col4() const
HepRotationX & operator*=(const HepRotationX &r)
double yt() const
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
Definition: RotationX.cc:105
HepAxisAngle axisAngle() const
std::ostream & print(std::ostream &os) const
Definition: RotationX.cc:186
bool isNear(const HepRotationX &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationX.cc:167
HepLorentzVector row3() const
HepLorentzVector row2() const
Hep3Vector operator()(const Hep3Vector &p) const
double theta() const
Definition: RotationX.cc:47
double getTheta() const
Hep3Vector colY() const
double zz() const
bool isIdentity() const
HepLorentzVector operator()(const HepLorentzVector &w) const
Hep3Vector getAxis() const
Hep3Vector operator*(const Hep3Vector &p) const
bool operator<(const HepRotationX &r) const
HepLorentzVector row1() const
double distance2(const HepRotationX &r) const
Definition: RotationX.cc:128
Hep3Vector colX() const
double norm2() const
Definition: RotationX.cc:182
double yx() const
HepRotationX & invert()
double zt() const
double zx() const
bool operator>(const HepRotationX &r) const
static double setTolerance(double tol)
HepBoost inverseOf(const HepBoost &lt)