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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/clhep/include/CLHEP/Vector/RotationZ.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Vector/RotationZ.h (Version 10.6.p3)


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