Geant4 Cross Reference |
1 // -*- C++ -*- 1 // -*- C++ -*- 2 // CLASSDOC OFF 2 // CLASSDOC OFF >> 3 // $Id:$ 3 // ------------------------------------------- 4 // --------------------------------------------------------------------------- 4 // CLASSDOC ON 5 // CLASSDOC ON 5 // 6 // 6 // This file is a part of the CLHEP - a Class 7 // This file is a part of the CLHEP - a Class Library for High Energy Physics. 7 // 8 // 8 // Hep3Vector is a general 3-vector class defi 9 // Hep3Vector is a general 3-vector class defining vectors in three 9 // dimension using double components. Rotation 10 // dimension using double components. Rotations of these vectors are 10 // performed by multiplying with an object of 11 // performed by multiplying with an object of the HepRotation class. 11 // 12 // 12 // .SS See Also 13 // .SS See Also 13 // LorentzVector.h, Rotation.h, LorentzRotatio 14 // LorentzVector.h, Rotation.h, LorentzRotation.h 14 // 15 // 15 // .SS Authors 16 // .SS Authors 16 // Leif Lonnblad and Anders Nilsson; Modified 17 // Leif Lonnblad and Anders Nilsson; Modified by Evgueni Tcherniaev; 17 // ZOOM additions by Mark Fischler 18 // ZOOM additions by Mark Fischler 18 // 19 // 19 20 20 #ifndef HEP_THREEVECTOR_H 21 #ifndef HEP_THREEVECTOR_H 21 #define HEP_THREEVECTOR_H 22 #define HEP_THREEVECTOR_H 22 23 >> 24 #ifdef GNUPRAGMA >> 25 #pragma interface >> 26 #endif >> 27 23 #include <iostream> 28 #include <iostream> 24 #include "CLHEP/Utility/defs.h" 29 #include "CLHEP/Utility/defs.h" 25 30 26 namespace CLHEP { 31 namespace CLHEP { 27 32 28 class HepRotation; 33 class HepRotation; 29 class HepEulerAngles; 34 class HepEulerAngles; 30 class HepAxisAngle; 35 class HepAxisAngle; 31 36 32 /** 37 /** 33 * @author 38 * @author 34 * @ingroup vector 39 * @ingroup vector 35 */ 40 */ 36 class Hep3Vector { 41 class Hep3Vector { 37 42 38 public: 43 public: 39 44 40 // Basic properties and operations on 3-vector 45 // Basic properties and operations on 3-vectors: 41 46 42 enum { X=0, Y=1, Z=2, NUM_COORDINATES=3, SIZ 47 enum { X=0, Y=1, Z=2, NUM_COORDINATES=3, SIZE=NUM_COORDINATES }; 43 // Safe indexing of the coordinates when usi 48 // Safe indexing of the coordinates when using with matrices, arrays, etc. 44 // (BaBar) 49 // (BaBar) 45 50 46 Hep3Vector(); 51 Hep3Vector(); 47 explicit Hep3Vector(double x); 52 explicit Hep3Vector(double x); 48 Hep3Vector(double x, double y); 53 Hep3Vector(double x, double y); 49 Hep3Vector(double x, double y, double z); 54 Hep3Vector(double x, double y, double z); 50 // The constructor. 55 // The constructor. 51 56 52 inline Hep3Vector(const Hep3Vector &); 57 inline Hep3Vector(const Hep3Vector &); 53 inline Hep3Vector(Hep3Vector &&) = default; << 58 // The copy constructor. 54 // The copy and move constructors. << 55 59 56 inline ~Hep3Vector(); 60 inline ~Hep3Vector(); 57 // The destructor. Not virtual - inheritanc 61 // The destructor. Not virtual - inheritance from this class is dangerous. 58 62 59 inline double operator () (int) const; << 63 double operator () (int) const; 60 // Get components by index -- 0-based (Geant 64 // Get components by index -- 0-based (Geant4) 61 65 62 inline double operator [] (int) const; 66 inline double operator [] (int) const; 63 // Get components by index -- 0-based (Geant 67 // Get components by index -- 0-based (Geant4) 64 68 65 inline double & operator () (int); << 69 double & operator () (int); 66 // Set components by index. 0-based. 70 // Set components by index. 0-based. 67 71 68 inline double & operator [] (int); 72 inline double & operator [] (int); 69 // Set components by index. 0-based. 73 // Set components by index. 0-based. 70 74 71 inline double x() const; 75 inline double x() const; 72 inline double y() const; 76 inline double y() const; 73 inline double z() const; 77 inline double z() const; 74 // The components in cartesian coordinate sy 78 // The components in cartesian coordinate system. Same as getX() etc. 75 79 76 inline void setX(double); 80 inline void setX(double); 77 inline void setY(double); 81 inline void setY(double); 78 inline void setZ(double); 82 inline void setZ(double); 79 // Set the components in cartesian coordinat 83 // Set the components in cartesian coordinate system. 80 84 81 inline void set( double x, double y, double 85 inline void set( double x, double y, double z); 82 // Set all three components in cartesian coo 86 // Set all three components in cartesian coordinate system. 83 87 84 inline double phi() const; 88 inline double phi() const; 85 // The azimuth angle. 89 // The azimuth angle. 86 90 87 inline double theta() const; 91 inline double theta() const; 88 // The polar angle. 92 // The polar angle. 89 93 90 inline double cosTheta() const; 94 inline double cosTheta() const; 91 // Cosine of the polar angle. 95 // Cosine of the polar angle. 92 96 93 inline double cos2Theta() const; 97 inline double cos2Theta() const; 94 // Cosine squared of the polar angle - faste 98 // Cosine squared of the polar angle - faster than cosTheta(). (ZOOM) 95 99 96 inline double mag2() const; 100 inline double mag2() const; 97 // The magnitude squared (r^2 in spherical c 101 // The magnitude squared (r^2 in spherical coordinate system). 98 102 99 inline double mag() const; 103 inline double mag() const; 100 // The magnitude (r in spherical coordinate 104 // The magnitude (r in spherical coordinate system). 101 105 102 inline void setPhi(double); 106 inline void setPhi(double); 103 // Set phi keeping mag and theta constant (B 107 // Set phi keeping mag and theta constant (BaBar). 104 108 105 inline void setTheta(double); 109 inline void setTheta(double); 106 // Set theta keeping mag and phi constant (B 110 // Set theta keeping mag and phi constant (BaBar). 107 111 108 void setMag(double); 112 void setMag(double); 109 // Set magnitude keeping theta and phi const 113 // Set magnitude keeping theta and phi constant (BaBar). 110 114 111 inline double perp2() const; 115 inline double perp2() const; 112 // The transverse component squared (rho^2 i 116 // The transverse component squared (rho^2 in cylindrical coordinate system). 113 117 114 inline double perp() const; 118 inline double perp() const; 115 // The transverse component (rho in cylindri 119 // The transverse component (rho in cylindrical coordinate system). 116 120 117 inline void setPerp(double); 121 inline void setPerp(double); 118 // Set the transverse component keeping phi 122 // Set the transverse component keeping phi and z constant. 119 123 120 void setCylTheta(double); 124 void setCylTheta(double); 121 // Set theta while keeping transvers compone 125 // Set theta while keeping transvers component and phi fixed 122 126 123 inline double perp2(const Hep3Vector &) cons 127 inline double perp2(const Hep3Vector &) const; 124 // The transverse component w.r.t. given axi 128 // The transverse component w.r.t. given axis squared. 125 129 126 inline double perp(const Hep3Vector &) const 130 inline double perp(const Hep3Vector &) const; 127 // The transverse component w.r.t. given axi 131 // The transverse component w.r.t. given axis. 128 132 129 inline Hep3Vector & operator = (const Hep3Ve 133 inline Hep3Vector & operator = (const Hep3Vector &); 130 inline Hep3Vector & operator = (Hep3Vector & << 134 // Assignment. 131 // The copy and move assignment operators. << 132 135 133 inline bool operator == (const Hep3Vector &) 136 inline bool operator == (const Hep3Vector &) const; 134 inline bool operator != (const Hep3Vector &) 137 inline bool operator != (const Hep3Vector &) const; 135 // Comparisons (Geant4). 138 // Comparisons (Geant4). 136 139 137 bool isNear (const Hep3Vector &, double epsi 140 bool isNear (const Hep3Vector &, double epsilon=tolerance) const; 138 // Check for equality within RELATIVE tolera 141 // Check for equality within RELATIVE tolerance (default 2.2E-14). (ZOOM) 139 // |v1 - v2|**2 <= epsilon**2 * |v1.dot(v2)| 142 // |v1 - v2|**2 <= epsilon**2 * |v1.dot(v2)| 140 143 141 double howNear(const Hep3Vector & v ) const; 144 double howNear(const Hep3Vector & v ) const; 142 // sqrt ( |v1-v2|**2 / v1.dot(v2) ) with a m 145 // sqrt ( |v1-v2|**2 / v1.dot(v2) ) with a maximum of 1. 143 // If v1.dot(v2) is negative, will return 1. 146 // If v1.dot(v2) is negative, will return 1. 144 147 145 double deltaR(const Hep3Vector & v) const; 148 double deltaR(const Hep3Vector & v) const; 146 // sqrt( pseudorapity_difference**2 + deltaP 149 // sqrt( pseudorapity_difference**2 + deltaPhi **2 ) 147 150 148 inline Hep3Vector & operator += (const Hep3V 151 inline Hep3Vector & operator += (const Hep3Vector &); 149 // Addition. 152 // Addition. 150 153 151 inline Hep3Vector & operator -= (const Hep3V 154 inline Hep3Vector & operator -= (const Hep3Vector &); 152 // Subtraction. 155 // Subtraction. 153 156 154 inline Hep3Vector operator - () const; 157 inline Hep3Vector operator - () const; 155 // Unary minus. 158 // Unary minus. 156 159 157 inline Hep3Vector & operator *= (double); 160 inline Hep3Vector & operator *= (double); 158 // Scaling with real numbers. 161 // Scaling with real numbers. 159 162 160 Hep3Vector & operator /= (double); 163 Hep3Vector & operator /= (double); 161 // Division by (non-zero) real number. 164 // Division by (non-zero) real number. 162 165 163 inline Hep3Vector unit() const; 166 inline Hep3Vector unit() const; 164 // Vector parallel to this, but of length 1. 167 // Vector parallel to this, but of length 1. 165 168 166 inline Hep3Vector orthogonal() const; 169 inline Hep3Vector orthogonal() const; 167 // Vector orthogonal to this (Geant4). 170 // Vector orthogonal to this (Geant4). 168 171 169 inline double dot(const Hep3Vector &) const; 172 inline double dot(const Hep3Vector &) const; 170 // double product. 173 // double product. 171 174 172 inline Hep3Vector cross(const Hep3Vector &) 175 inline Hep3Vector cross(const Hep3Vector &) const; 173 // Cross product. 176 // Cross product. 174 177 175 double angle(const Hep3Vector &) const; 178 double angle(const Hep3Vector &) const; 176 // The angle w.r.t. another 3-vector. 179 // The angle w.r.t. another 3-vector. 177 180 178 double pseudoRapidity() const; 181 double pseudoRapidity() const; 179 // Returns the pseudo-rapidity, i.e. -ln(tan 182 // Returns the pseudo-rapidity, i.e. -ln(tan(theta/2)) 180 183 181 void setEta ( double p ); 184 void setEta ( double p ); 182 // Set pseudo-rapidity, keeping magnitude an 185 // Set pseudo-rapidity, keeping magnitude and phi fixed. (ZOOM) 183 186 184 void setCylEta ( double p ); 187 void setCylEta ( double p ); 185 // Set pseudo-rapidity, keeping transverse c 188 // Set pseudo-rapidity, keeping transverse component and phi fixed. (ZOOM) 186 189 187 Hep3Vector & rotateX(double); 190 Hep3Vector & rotateX(double); 188 // Rotates the Hep3Vector around the x-axis. 191 // Rotates the Hep3Vector around the x-axis. 189 192 190 Hep3Vector & rotateY(double); 193 Hep3Vector & rotateY(double); 191 // Rotates the Hep3Vector around the y-axis. 194 // Rotates the Hep3Vector around the y-axis. 192 195 193 Hep3Vector & rotateZ(double); 196 Hep3Vector & rotateZ(double); 194 // Rotates the Hep3Vector around the z-axis. 197 // Rotates the Hep3Vector around the z-axis. 195 198 196 Hep3Vector & rotateUz(const Hep3Vector&); 199 Hep3Vector & rotateUz(const Hep3Vector&); 197 // Rotates reference frame from Uz to newUz 200 // Rotates reference frame from Uz to newUz (unit vector) (Geant4). 198 201 199 Hep3Vector & rotate(double, const Hep3Vect 202 Hep3Vector & rotate(double, const Hep3Vector &); 200 // Rotates around the axis specified by anot 203 // Rotates around the axis specified by another Hep3Vector. 201 // (Uses methods of HepRotation, forcing lin 204 // (Uses methods of HepRotation, forcing linking in of Rotation.cc.) 202 205 203 Hep3Vector & operator *= (const HepRotation 206 Hep3Vector & operator *= (const HepRotation &); 204 Hep3Vector & transform(const HepRotation &); 207 Hep3Vector & transform(const HepRotation &); 205 // Transformation with a Rotation matrix. 208 // Transformation with a Rotation matrix. 206 209 207 // = = = = = = = = = = = = = = = = = = = = = = 210 // = = = = = = = = = = = = = = = = = = = = = = = = 208 // 211 // 209 // Esoteric properties and operations on 3-vec 212 // Esoteric properties and operations on 3-vectors: 210 // 213 // 211 // 1 - Set vectors in various coordinate syste 214 // 1 - Set vectors in various coordinate systems 212 // 2 - Synonyms for accessing coordinates and 215 // 2 - Synonyms for accessing coordinates and properties 213 // 3 - Comparisions (dictionary, near-ness, an 216 // 3 - Comparisions (dictionary, near-ness, and geometric) 214 // 4 - Intrinsic properties 217 // 4 - Intrinsic properties 215 // 5 - Properties releative to z axis and arbi 218 // 5 - Properties releative to z axis and arbitrary directions 216 // 6 - Polar and azimuthal angle decomposition 219 // 6 - Polar and azimuthal angle decomposition and deltaPhi 217 // 7 - Rotations 220 // 7 - Rotations 218 // 221 // 219 // = = = = = = = = = = = = = = = = = = = = = = 222 // = = = = = = = = = = = = = = = = = = = = = = = = 220 223 221 // 1 - Set vectors in various coordinate syste 224 // 1 - Set vectors in various coordinate systems 222 225 223 inline void setRThetaPhi (double r, double 226 inline void setRThetaPhi (double r, double theta, double phi); 224 // Set in spherical coordinates: Angles are 227 // Set in spherical coordinates: Angles are measured in RADIANS 225 228 226 inline void setREtaPhi ( double r, double e 229 inline void setREtaPhi ( double r, double eta, double phi ); 227 // Set in spherical coordinates, but specify 230 // Set in spherical coordinates, but specify peudorapidiy to determine theta. 228 231 229 inline void setRhoPhiZ (double rho, double 232 inline void setRhoPhiZ (double rho, double phi, double z); 230 // Set in cylindrical coordinates: Phi angl 233 // Set in cylindrical coordinates: Phi angle is measured in RADIANS 231 234 232 void setRhoPhiTheta ( double rho, double phi 235 void setRhoPhiTheta ( double rho, double phi, double theta); 233 // Set in cylindrical coordinates, but speci 236 // Set in cylindrical coordinates, but specify theta to determine z. 234 237 235 void setRhoPhiEta ( double rho, double phi, 238 void setRhoPhiEta ( double rho, double phi, double eta); 236 // Set in cylindrical coordinates, but speci 239 // Set in cylindrical coordinates, but specify pseudorapidity to determine z. 237 240 238 // 2 - Synonyms for accessing coordinates and 241 // 2 - Synonyms for accessing coordinates and properties 239 242 240 inline double getX() const; 243 inline double getX() const; 241 inline double getY() const; 244 inline double getY() const; 242 inline double getZ() const; 245 inline double getZ() const; 243 // x(), y(), and z() 246 // x(), y(), and z() 244 247 245 inline double getR () const; 248 inline double getR () const; 246 inline double getTheta() const; 249 inline double getTheta() const; 247 inline double getPhi () const; 250 inline double getPhi () const; 248 // mag(), theta(), and phi() 251 // mag(), theta(), and phi() 249 252 250 inline double r () const; 253 inline double r () const; 251 // mag() 254 // mag() 252 255 253 inline double rho () const; 256 inline double rho () const; 254 inline double getRho () const; 257 inline double getRho () const; 255 // perp() 258 // perp() 256 259 257 double eta () const; 260 double eta () const; 258 double getEta () const; 261 double getEta () const; 259 // pseudoRapidity() 262 // pseudoRapidity() 260 263 261 inline void setR ( double s ); 264 inline void setR ( double s ); 262 // setMag() 265 // setMag() 263 266 264 inline void setRho ( double s ); 267 inline void setRho ( double s ); 265 // setPerp() 268 // setPerp() 266 269 267 // 3 - Comparisions (dictionary, near-ness, an 270 // 3 - Comparisions (dictionary, near-ness, and geometric) 268 271 269 int compare (const Hep3Vector & v) const; 272 int compare (const Hep3Vector & v) const; 270 bool operator > (const Hep3Vector & v) const 273 bool operator > (const Hep3Vector & v) const; 271 bool operator < (const Hep3Vector & v) const 274 bool operator < (const Hep3Vector & v) const; 272 bool operator>= (const Hep3Vector & v) const 275 bool operator>= (const Hep3Vector & v) const; 273 bool operator<= (const Hep3Vector & v) const 276 bool operator<= (const Hep3Vector & v) const; 274 // dictionary ordering according to z, then 277 // dictionary ordering according to z, then y, then x component 275 278 276 inline double diff2 (const Hep3Vector & v) c 279 inline double diff2 (const Hep3Vector & v) const; 277 // |v1-v2|**2 280 // |v1-v2|**2 278 281 279 static double setTolerance (double tol); 282 static double setTolerance (double tol); 280 static inline double getTolerance (); 283 static inline double getTolerance (); 281 // Set the tolerance used in isNear() for He 284 // Set the tolerance used in isNear() for Hep3Vectors 282 285 283 bool isParallel (const Hep3Vector & v, doubl 286 bool isParallel (const Hep3Vector & v, double epsilon=tolerance) const; 284 // Are the vectors parallel, within the give 287 // Are the vectors parallel, within the given tolerance? 285 288 286 bool isOrthogonal (const Hep3Vector & v, dou 289 bool isOrthogonal (const Hep3Vector & v, double epsilon=tolerance) const; 287 // Are the vectors orthogonal, within the gi 290 // Are the vectors orthogonal, within the given tolerance? 288 291 289 double howParallel (const Hep3Vector & v) 292 double howParallel (const Hep3Vector & v) const; 290 // | v1.cross(v2) / v1.dot(v2) |, to a maxim 293 // | v1.cross(v2) / v1.dot(v2) |, to a maximum of 1. 291 294 292 double howOrthogonal (const Hep3Vector & v) 295 double howOrthogonal (const Hep3Vector & v) const; 293 // | v1.dot(v2) / v1.cross(v2) |, to a maxim 296 // | v1.dot(v2) / v1.cross(v2) |, to a maximum of 1. 294 297 295 static const int ToleranceTicks = 100; << 298 enum { ToleranceTicks = 100 }; 296 299 297 // 4 - Intrinsic properties 300 // 4 - Intrinsic properties 298 301 299 double beta () const; 302 double beta () const; 300 // relativistic beta (considering v as a vel 303 // relativistic beta (considering v as a velocity vector with c=1) 301 // Same as mag() but will object if >= 1 304 // Same as mag() but will object if >= 1 302 305 303 double gamma() const; 306 double gamma() const; 304 // relativistic gamma (considering v as a ve 307 // relativistic gamma (considering v as a velocity vector with c=1) 305 308 306 double coLinearRapidity() const; 309 double coLinearRapidity() const; 307 // inverse tanh (beta) 310 // inverse tanh (beta) 308 311 309 // 5 - Properties relative to Z axis and to an 312 // 5 - Properties relative to Z axis and to an arbitrary direction 310 313 311 // Note that the non-esoteric CLHEP provid 314 // Note that the non-esoteric CLHEP provides 312 // theta(), cosTheta(), cos2Theta, and ang 315 // theta(), cosTheta(), cos2Theta, and angle(const Hep3Vector&) 313 316 314 inline double angle() const; 317 inline double angle() const; 315 // angle against the Z axis -- synonym for t 318 // angle against the Z axis -- synonym for theta() 316 319 317 inline double theta(const Hep3Vector & v2) c 320 inline double theta(const Hep3Vector & v2) const; 318 // synonym for angle(v2) 321 // synonym for angle(v2) 319 322 320 double cosTheta (const Hep3Vector & v2) cons 323 double cosTheta (const Hep3Vector & v2) const; 321 double cos2Theta(const Hep3Vector & v2) cons 324 double cos2Theta(const Hep3Vector & v2) const; 322 // cos and cos^2 of the angle between two ve 325 // cos and cos^2 of the angle between two vectors 323 326 324 inline Hep3Vector project () const; 327 inline Hep3Vector project () const; 325 Hep3Vector project (const Hep3Vector 328 Hep3Vector project (const Hep3Vector & v2) const; 326 // projection of a vector along a direction. 329 // projection of a vector along a direction. 327 330 328 inline Hep3Vector perpPart() const; 331 inline Hep3Vector perpPart() const; 329 inline Hep3Vector perpPart (const Hep3Vector 332 inline Hep3Vector perpPart (const Hep3Vector & v2) const; 330 // vector minus its projection along a direc 333 // vector minus its projection along a direction. 331 334 332 double rapidity () const; 335 double rapidity () const; 333 // inverse tanh(v.z()) 336 // inverse tanh(v.z()) 334 337 335 double rapidity (const Hep3Vector & v2) cons 338 double rapidity (const Hep3Vector & v2) const; 336 // rapidity with respect to specified direct 339 // rapidity with respect to specified direction: 337 // inverse tanh (v.dot(u)) where u is a unit 340 // inverse tanh (v.dot(u)) where u is a unit in the direction of v2 338 341 339 double eta(const Hep3Vector & v2) const; 342 double eta(const Hep3Vector & v2) const; 340 // - ln tan of the angle beween the vector a 343 // - ln tan of the angle beween the vector and the ref direction. 341 344 342 // 6 - Polar and azimuthal angle decomposition 345 // 6 - Polar and azimuthal angle decomposition and deltaPhi 343 346 344 // Decomposition of an angle within referenc 347 // Decomposition of an angle within reference defined by a direction: 345 348 346 double polarAngle (const Hep3Vector & v2) co 349 double polarAngle (const Hep3Vector & v2) const; 347 // The reference direction is Z: the polarAn 350 // The reference direction is Z: the polarAngle is abs(v.theta()-v2.theta()). 348 351 349 double deltaPhi (const Hep3Vector & v2) cons 352 double deltaPhi (const Hep3Vector & v2) const; 350 // v.phi()-v2.phi(), brought into the range 353 // v.phi()-v2.phi(), brought into the range (-PI,PI] 351 354 352 double azimAngle (const Hep3Vector & v2) co 355 double azimAngle (const Hep3Vector & v2) const; 353 // The reference direction is Z: the azimAng 356 // The reference direction is Z: the azimAngle is the same as deltaPhi 354 357 355 double polarAngle (const Hep3Vector & v2, 358 double polarAngle (const Hep3Vector & v2, 356 const Hep3Vector & ref) const; 359 const Hep3Vector & ref) const; 357 // For arbitrary reference direction, 360 // For arbitrary reference direction, 358 // polarAngle is abs(v.angle(ref) - v2.angl 361 // polarAngle is abs(v.angle(ref) - v2.angle(ref)). 359 362 360 double azimAngle (const Hep3Vector & v2, 363 double azimAngle (const Hep3Vector & v2, 361 const Hep3Vector & ref) const; 364 const Hep3Vector & ref) const; 362 // To compute azimangle, project v and v2 in 365 // To compute azimangle, project v and v2 into the plane normal to 363 // the reference direction. Then in that pl 366 // the reference direction. Then in that plane take the angle going 364 // clockwise around the direction from proje 367 // clockwise around the direction from projection of v to that of v2. 365 368 366 // 7 - Rotations 369 // 7 - Rotations 367 370 368 // These mehtods **DO NOT** use anything in th 371 // These mehtods **DO NOT** use anything in the HepRotation class. 369 // Thus, use of v.rotate(axis,delta) does not 372 // Thus, use of v.rotate(axis,delta) does not force linking in Rotation.cc. 370 373 371 Hep3Vector & rotate (const Hep3Vector & axi 374 Hep3Vector & rotate (const Hep3Vector & axis, double delta); 372 // Synonym for rotate (delta, axis) 375 // Synonym for rotate (delta, axis) 373 376 374 Hep3Vector & rotate (const HepAxisAngle & a 377 Hep3Vector & rotate (const HepAxisAngle & ax); 375 // HepAxisAngle is a struct holding an axis 378 // HepAxisAngle is a struct holding an axis direction and an angle. 376 379 377 Hep3Vector & rotate (const HepEulerAngles & 380 Hep3Vector & rotate (const HepEulerAngles & e); 378 Hep3Vector & rotate (double phi, 381 Hep3Vector & rotate (double phi, 379 double theta, 382 double theta, 380 double psi); 383 double psi); 381 // Rotate via Euler Angles. Our Euler Angles 384 // Rotate via Euler Angles. Our Euler Angles conventions are 382 // those of Goldstein Classical Mechanics pa 385 // those of Goldstein Classical Mechanics page 107. 383 386 384 protected: 387 protected: 385 void setSpherical (double r, double theta, d 388 void setSpherical (double r, double theta, double phi); 386 void setCylindrical (double r, double phi, d 389 void setCylindrical (double r, double phi, double z); 387 double negativeInfinity() const; 390 double negativeInfinity() const; 388 391 389 protected: 392 protected: 390 393 391 double data[3]; << 394 double dx; >> 395 double dy; >> 396 double dz; 392 // The components. 397 // The components. 393 398 394 DLL_API static double tolerance; 399 DLL_API static double tolerance; 395 // default tolerance criterion for isNear() 400 // default tolerance criterion for isNear() to return true. 396 }; // Hep3Vector 401 }; // Hep3Vector 397 402 398 // Global Methods 403 // Global Methods 399 404 400 Hep3Vector rotationXOf (const Hep3Vector & vec 405 Hep3Vector rotationXOf (const Hep3Vector & vec, double delta); 401 Hep3Vector rotationYOf (const Hep3Vector & vec 406 Hep3Vector rotationYOf (const Hep3Vector & vec, double delta); 402 Hep3Vector rotationZOf (const Hep3Vector & vec 407 Hep3Vector rotationZOf (const Hep3Vector & vec, double delta); 403 408 404 Hep3Vector rotationOf (const Hep3Vector & vec, 409 Hep3Vector rotationOf (const Hep3Vector & vec, 405 const Hep3Vector & axis, double delta) 410 const Hep3Vector & axis, double delta); 406 Hep3Vector rotationOf (const Hep3Vector & vec, 411 Hep3Vector rotationOf (const Hep3Vector & vec, const HepAxisAngle & ax); 407 412 408 Hep3Vector rotationOf (const Hep3Vector & vec, 413 Hep3Vector rotationOf (const Hep3Vector & vec, 409 double phi, double theta, double psi); 414 double phi, double theta, double psi); 410 Hep3Vector rotationOf (const Hep3Vector & vec, 415 Hep3Vector rotationOf (const Hep3Vector & vec, const HepEulerAngles & e); 411 // Return a new vector based on a rotation of 416 // Return a new vector based on a rotation of the supplied vector 412 417 413 std::ostream & operator << (std::ostream &, co 418 std::ostream & operator << (std::ostream &, const Hep3Vector &); 414 // Output to a stream. 419 // Output to a stream. 415 420 416 std::istream & operator >> (std::istream &, He 421 std::istream & operator >> (std::istream &, Hep3Vector &); 417 // Input from a stream. 422 // Input from a stream. 418 423 419 extern DLL_API const Hep3Vector HepXHat, HepYH 424 extern DLL_API const Hep3Vector HepXHat, HepYHat, HepZHat; 420 425 421 typedef Hep3Vector HepThreeVectorD; 426 typedef Hep3Vector HepThreeVectorD; 422 typedef Hep3Vector HepThreeVectorF; 427 typedef Hep3Vector HepThreeVectorF; 423 428 424 Hep3Vector operator / (const Hep3Vector &, dou 429 Hep3Vector operator / (const Hep3Vector &, double a); 425 // Division of 3-vectors by non-zero real numb 430 // Division of 3-vectors by non-zero real number 426 431 427 inline Hep3Vector operator + (const Hep3Vector 432 inline Hep3Vector operator + (const Hep3Vector &, const Hep3Vector &); 428 // Addition of 3-vectors. 433 // Addition of 3-vectors. 429 434 430 inline Hep3Vector operator - (const Hep3Vector 435 inline Hep3Vector operator - (const Hep3Vector &, const Hep3Vector &); 431 // Subtraction of 3-vectors. 436 // Subtraction of 3-vectors. 432 437 433 inline double operator * (const Hep3Vector &, 438 inline double operator * (const Hep3Vector &, const Hep3Vector &); 434 // double product of 3-vectors. 439 // double product of 3-vectors. 435 440 436 inline Hep3Vector operator * (const Hep3Vector 441 inline Hep3Vector operator * (const Hep3Vector &, double a); 437 inline Hep3Vector operator * (double a, const 442 inline Hep3Vector operator * (double a, const Hep3Vector &); 438 // Scaling of 3-vectors with a real number 443 // Scaling of 3-vectors with a real number 439 444 440 } // namespace CLHEP 445 } // namespace CLHEP 441 446 442 #include "CLHEP/Vector/ThreeVector.icc" 447 #include "CLHEP/Vector/ThreeVector.icc" 443 448 444 #endif /* HEP_THREEVECTOR_H */ 449 #endif /* HEP_THREEVECTOR_H */ 445 450