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.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/RotationX.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Vector/RotationX.h (Version 10.6.p2)


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