Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 
23 #ifdef GNUPRAGMA
24 #pragma interface
25 #endif
26 
28 
29 namespace CLHEP {
30 
31 class HepRotationY;
32 class HepRotation;
33 class HepBoost;
34 
35 inline HepRotationY inverseOf(const HepRotationY & r);
36 // Returns the inverse of a RotationY.
37 
42 class HepRotationY {
43 
44 public:
45 
46  // ---------- Constructors and Assignment:
47 
48  inline HepRotationY();
49  // Default constructor. Gives an identity rotation.
50 
51  HepRotationY(double delta);
52  // supply angle of rotation
53 
54  inline HepRotationY(const HepRotationY & orig);
55  // Copy constructor.
56 
57  inline HepRotationY & operator = (const HepRotationY & r);
58  // Assignment from a Rotation, which must be RotationY
59 
60  HepRotationY & set ( double delta );
61  // set angle of rotation
62 
63  inline ~HepRotationY();
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 HepRotationY & r ) const;
170  // Dictionary-order comparison, in order of delta
171  // Used in operator<, >, <=, >=
172 
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  inline bool operator<= ( const HepRotationY & r ) const;
178  inline bool operator>= ( const HepRotationY & r ) const;
179 
180  double distance2( const HepRotationY & 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 HepRotationY & r ) const;
187  double howNear( const HepRotation & r ) const;
188  bool isNear( const HepRotationY & r,
190  bool isNear( const HepRotation & r,
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,
202  bool isNear( const HepLorentzRotation & lt,
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 
221  inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
222  // Rotate (the space part of) a HepLorentzVector.
223 
224  inline HepLorentzVector operator* ( const HepLorentzVector & w ) const;
225  // Multiplication with a HepLorentzVector.
226 
227  // ---------- Operations in the group of Rotations
228 
229  inline HepRotationY operator * (const HepRotationY & ry) const;
230  // Product of two Y rotations (this) * ry is known to be RotationY.
231 
232  inline HepRotationY & operator *= (const HepRotationY & r);
233  inline HepRotationY & transform (const HepRotationY & 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 HepRotationY inverse() const;
239  // Returns the inverse.
240 
241  friend HepRotationY inverseOf(const HepRotationY & r);
242  // Returns the inverse of a RotationY.
243 
244  inline HepRotationY & invert();
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 
257 protected:
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 HepRotationY ( 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 }; // HepRotationY
273 
274 // ---------- Free-function operations in the group of Rotations
275 
276 inline
277 std::ostream & operator <<
278  ( std::ostream & os, const HepRotationY & r ) {return r.print(os);}
279 
280 } // namespace CLHEP
281 
282 #include "CLHEP/Vector/RotationY.icc"
283 
284 #endif /* HEP_ROTATIONY_H */
285 
double phi() const
Definition: RotationY.cc:42
bool operator<(const HepRotationY &r) const
HepLorentzVector row3() const
HepLorentzVector col1() const
bool operator>(const HepRotationY &r) const
HepRotationY & operator=(const HepRotationY &r)
double phiX() const
Definition: RotationY.cc:78
double howNear(const HepRotationY &r) const
Definition: RotationY.cc:162
Hep3Vector operator*(const Hep3Vector &p) const
Hep3Vector colZ() const
const char * p
Definition: xmltok.h:285
static DLL_API double tolerance
double tt() const
int compare(const HepRotationY &r) const
double xy() const
void getAngleAxis(double &delta, Hep3Vector &axis) const
double xx() const
double yy() const
Hep3Vector rowY() const
double phiY() const
Definition: RotationY.cc:83
double yt() const
double psi() const
Definition: RotationY.cc:56
double thetaX() const
Definition: RotationY.cc:93
double ty() const
HepLorentzVector row1() const
double norm2() const
Definition: RotationY.cc:188
bool operator<=(const HepRotationY &r) const
friend HepRotationY inverseOf(const HepRotationY &r)
HepRep3x3 rep3x3() const
double distance2(const HepRotationY &r) const
Definition: RotationY.cc:135
HepBoost inverseOf(const HepBoost &lt)
HepRotationY & transform(const HepRotationY &r)
double getPsi() const
HepRep4x4 rep4x4() const
bool isIdentity() const
double zt() const
HepLorentzVector row4() const
Hep3Vector rowZ() const
HepLorentzVector row2() const
bool operator!=(const HepRotationY &r) const
Hep3Vector colY() const
HepLorentzVector col2() const
double xz() const
double getPhi() const
double yx() const
std::ostream & print(std::ostream &os) const
Definition: RotationY.cc:192
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
Definition: RotationY.cc:112
static double proper(double delta)
double phiZ() const
Definition: RotationY.cc:88
double theta() const
Definition: RotationY.cc:52
HepLorentzVector col4() const
double tz() const
double delta() const
HepRotationY inverse() const
double zy() const
Hep3Vector colX() const
void setDelta(double delta)
Definition: RotationY.cc:107
Hep3Vector rowX() const
static double getTolerance()
HepRotationY & set(double delta)
Definition: RotationY.cc:35
static double setTolerance(double tol)
HepRotationY & operator*=(const HepRotationY &r)
Hep3Vector operator()(const Hep3Vector &p) const
bool operator==(const HepRotationY &r) const
HepRotationY & invert()
double zx() const
double thetaY() const
Definition: RotationY.cc:97
double getTheta() const
Hep3Vector axis() const
double getDelta() const
bool operator>=(const HepRotationY &r) const
double tx() const
bool isNear(const HepRotationY &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationY.cc:174
double xt() const
HepEulerAngles eulerAngles() const
Definition: RotationY.cc:66
HepAxisAngle axisAngle() const
double epsilon(double density, double temperature)
Hep3Vector getAxis() const
double yz() const
HepLorentzVector col3() const
double zz() const
double thetaZ() const
Definition: RotationY.cc:102