File indexing completed on 2025-01-18 09:54:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef HEP_LORENTZVECTOR_H
0022 #define HEP_LORENTZVECTOR_H
0023
0024 #include <iostream>
0025 #include "CLHEP/Vector/defs.h"
0026 #include "CLHEP/Vector/ThreeVector.h"
0027
0028 namespace CLHEP {
0029
0030
0031 class HepLorentzVector;
0032 class HepLorentzRotation;
0033 class HepRotation;
0034 class HepAxisAngle;
0035 class HepEulerAngles;
0036 class Tcomponent;
0037 HepLorentzVector rotationXOf( const HepLorentzVector & vec, double delta );
0038 HepLorentzVector rotationYOf( const HepLorentzVector & vec, double delta );
0039 HepLorentzVector rotationZOf( const HepLorentzVector & vec, double delta );
0040 HepLorentzVector rotationOf
0041 ( const HepLorentzVector & vec, const Hep3Vector & axis, double delta );
0042 HepLorentzVector rotationOf
0043 ( const HepLorentzVector & vec, const HepAxisAngle & ax );
0044 HepLorentzVector rotationOf
0045 ( const HepLorentzVector & vec, const HepEulerAngles & e1 );
0046 HepLorentzVector rotationOf
0047 ( const HepLorentzVector & vec, double phi,
0048 double theta,
0049 double psi );
0050 inline
0051 HepLorentzVector boostXOf( const HepLorentzVector & vec, double beta );
0052 inline
0053 HepLorentzVector boostYOf( const HepLorentzVector & vec, double beta );
0054 inline
0055 HepLorentzVector boostZOf( const HepLorentzVector & vec, double beta );
0056 inline HepLorentzVector boostOf
0057 ( const HepLorentzVector & vec, const Hep3Vector & betaVector );
0058 inline HepLorentzVector boostOf
0059 ( const HepLorentzVector & vec, const Hep3Vector & axis, double beta );
0060
0061 enum ZMpvMetric_t { TimePositive, TimeNegative };
0062
0063
0064
0065
0066
0067
0068 class HepLorentzVector {
0069
0070 public:
0071
0072 enum { X=0, Y=1, Z=2, T=3, NUM_COORDINATES=4, SIZE=NUM_COORDINATES };
0073
0074
0075
0076 inline HepLorentzVector(double x, double y,
0077 double z, double t);
0078
0079
0080 inline HepLorentzVector(double x, double y, double z);
0081
0082
0083 explicit HepLorentzVector(double t);
0084
0085
0086 inline HepLorentzVector();
0087
0088
0089 inline HepLorentzVector(const Hep3Vector & p, double e);
0090 inline HepLorentzVector(double e, const Hep3Vector & p);
0091
0092
0093 inline HepLorentzVector(const HepLorentzVector &);
0094 inline HepLorentzVector(HepLorentzVector &&) = default;
0095
0096
0097 inline ~HepLorentzVector();
0098
0099
0100 inline operator const Hep3Vector & () const;
0101 inline operator Hep3Vector & ();
0102
0103
0104 inline double x() const;
0105 inline double y() const;
0106 inline double z() const;
0107 inline double t() const;
0108
0109
0110 inline void setX(double);
0111 inline void setY(double);
0112 inline void setZ(double);
0113 inline void setT(double);
0114
0115
0116 inline double px() const;
0117 inline double py() const;
0118 inline double pz() const;
0119 inline double e() const;
0120
0121
0122 inline void setPx(double);
0123 inline void setPy(double);
0124 inline void setPz(double);
0125 inline void setE(double);
0126
0127
0128 inline Hep3Vector vect() const;
0129
0130
0131 inline void setVect(const Hep3Vector &);
0132
0133
0134 inline double theta() const;
0135 inline double cosTheta() const;
0136 inline double phi() const;
0137 inline double rho() const;
0138
0139
0140 inline void setTheta(double);
0141 inline void setPhi(double);
0142 inline void setRho(double);
0143
0144
0145 double operator () (int) const;
0146 inline double operator [] (int) const;
0147
0148
0149 double & operator () (int);
0150 inline double & operator [] (int);
0151
0152
0153 inline HepLorentzVector & operator = (const HepLorentzVector &);
0154 inline HepLorentzVector & operator = (HepLorentzVector &&) = default;
0155
0156
0157 inline HepLorentzVector operator + (const HepLorentzVector &) const;
0158 inline HepLorentzVector & operator += (const HepLorentzVector &);
0159
0160
0161 inline HepLorentzVector operator - (const HepLorentzVector &) const;
0162 inline HepLorentzVector & operator -= (const HepLorentzVector &);
0163
0164
0165 inline HepLorentzVector operator - () const;
0166
0167
0168 inline HepLorentzVector & operator *= (double);
0169 HepLorentzVector & operator /= (double);
0170
0171
0172 inline bool operator == (const HepLorentzVector &) const;
0173 inline bool operator != (const HepLorentzVector &) const;
0174
0175
0176 inline double perp2() const;
0177
0178
0179 inline double perp() const;
0180
0181
0182 inline void setPerp(double);
0183
0184
0185 inline double perp2(const Hep3Vector &) const;
0186
0187
0188 inline double perp(const Hep3Vector &) const;
0189
0190
0191 inline double angle(const Hep3Vector &) const;
0192
0193
0194 inline double mag2() const;
0195
0196
0197
0198 inline double m2() const;
0199
0200
0201 inline double mag() const;
0202 inline double m() const;
0203
0204
0205 inline double mt2() const;
0206
0207
0208 inline double mt() const;
0209
0210
0211 inline double et2() const;
0212
0213
0214 inline double et() const;
0215
0216
0217 inline double dot(const HepLorentzVector &) const;
0218 inline double operator * (const HepLorentzVector &) const;
0219
0220
0221 inline double invariantMass2( const HepLorentzVector & w ) const;
0222
0223
0224 double invariantMass ( const HepLorentzVector & w ) const;
0225
0226
0227 inline void setVectMag(const Hep3Vector & spatial, double magnitude);
0228 inline void setVectM(const Hep3Vector & spatial, double mass);
0229
0230
0231 inline double plus() const;
0232 inline double minus() const;
0233
0234
0235 Hep3Vector boostVector() const;
0236
0237
0238
0239 HepLorentzVector & boost(double, double, double);
0240 inline HepLorentzVector & boost(const Hep3Vector &);
0241
0242
0243 HepLorentzVector & boostX( double beta );
0244 HepLorentzVector & boostY( double beta );
0245 HepLorentzVector & boostZ( double beta );
0246
0247
0248 double rapidity() const;
0249
0250
0251 inline double pseudoRapidity() const;
0252
0253
0254 inline bool isTimelike() const;
0255
0256
0257 inline bool isSpacelike() const;
0258
0259
0260 inline bool isLightlike(double epsilon=tolerance) const;
0261
0262
0263 HepLorentzVector & rotateX(double);
0264
0265
0266 HepLorentzVector & rotateY(double);
0267
0268
0269 HepLorentzVector & rotateZ(double);
0270
0271
0272 HepLorentzVector & rotateUz(const Hep3Vector &);
0273
0274
0275 HepLorentzVector & rotate(double, const Hep3Vector &);
0276
0277
0278 inline HepLorentzVector & operator *= (const HepRotation &);
0279 inline HepLorentzVector & transform(const HepRotation &);
0280
0281
0282 HepLorentzVector & operator *= (const HepLorentzRotation &);
0283 HepLorentzVector & transform(const HepLorentzRotation &);
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305 static ZMpvMetric_t setMetric( ZMpvMetric_t a1 );
0306 static ZMpvMetric_t getMetric();
0307
0308
0309
0310 inline void set (double x, double y, double z, double t);
0311 inline void set (double x, double y, double z, Tcomponent t);
0312 inline HepLorentzVector(double x, double y, double z, Tcomponent t);
0313
0314
0315 inline void set (Tcomponent t, double x, double y, double z);
0316 inline HepLorentzVector(Tcomponent t, double x, double y, double z);
0317
0318
0319 inline void set ( double t );
0320
0321 inline void set ( Tcomponent t );
0322 inline explicit HepLorentzVector( Tcomponent t );
0323
0324
0325 inline void set ( const Hep3Vector & v );
0326 inline explicit HepLorentzVector( const Hep3Vector & v );
0327
0328
0329 inline HepLorentzVector & operator=( const Hep3Vector & v );
0330
0331
0332 inline void set ( const Hep3Vector & v, double t );
0333 inline void set ( double t, const Hep3Vector & v );
0334
0335
0336
0337
0338 inline double getX() const;
0339 inline double getY() const;
0340 inline double getZ() const;
0341 inline double getT() const;
0342
0343
0344 inline Hep3Vector v() const;
0345 inline Hep3Vector getV() const;
0346
0347
0348 inline void setV(const Hep3Vector &);
0349
0350
0351
0352
0353 inline void setV( double x, double y, double z );
0354
0355 inline void setRThetaPhi( double r, double theta, double phi);
0356 inline void setREtaPhi( double r, double eta, double phi);
0357 inline void setRhoPhiZ( double rho, double phi, double z );
0358
0359
0360
0361 int compare( const HepLorentzVector & w ) const;
0362
0363 bool operator >( const HepLorentzVector & w ) const;
0364 bool operator <( const HepLorentzVector & w ) const;
0365 bool operator>=( const HepLorentzVector & w ) const;
0366 bool operator<=( const HepLorentzVector & w ) const;
0367
0368 bool isNear ( const HepLorentzVector & w,
0369 double epsilon=tolerance ) const;
0370 double howNear( const HepLorentzVector & w ) const;
0371
0372
0373 bool isNearCM ( const HepLorentzVector & w,
0374 double epsilon=tolerance ) const;
0375 double howNearCM( const HepLorentzVector & w ) const;
0376
0377
0378
0379
0380
0381
0382
0383 bool isParallel( const HepLorentzVector & w,
0384 double epsilon=tolerance ) const;
0385
0386 double howParallel (const HepLorentzVector & w) const;
0387
0388 static double getTolerance();
0389 static double setTolerance( double tol );
0390
0391
0392
0393 double deltaR(const HepLorentzVector & v) const;
0394
0395
0396
0397
0398 double howLightlike() const;
0399
0400
0401 inline double euclideanNorm2() const;
0402
0403
0404 inline double euclideanNorm() const;
0405
0406
0407
0408
0409
0410
0411
0412 inline double restMass2() const;
0413 inline double invariantMass2() const;
0414
0415
0416 inline double restMass() const;
0417 inline double invariantMass() const;
0418
0419
0420
0421
0422
0423 HepLorentzVector rest4Vector() const;
0424
0425
0426
0427
0428
0429 double beta() const;
0430
0431
0432 double gamma() const;
0433
0434
0435 inline double eta() const;
0436
0437
0438 inline double eta(const Hep3Vector & ref) const;
0439
0440
0441 double rapidity(const Hep3Vector & ref) const;
0442
0443
0444 double coLinearRapidity() const;
0445
0446
0447 Hep3Vector findBoostToCM() const;
0448
0449
0450
0451
0452 Hep3Vector findBoostToCM( const HepLorentzVector & w ) const;
0453
0454
0455
0456
0457 inline double et2(const Hep3Vector &) const;
0458
0459
0460 inline double et(const Hep3Vector &) const;
0461
0462
0463
0464
0465 inline double diff2( const HepLorentzVector & w ) const;
0466
0467
0468 inline double delta2Euclidean ( const HepLorentzVector & w ) const;
0469
0470
0471
0472
0473 double plus( const Hep3Vector & ref ) const;
0474
0475
0476 double minus( const Hep3Vector & ref ) const;
0477
0478
0479
0480
0481 HepLorentzVector & rotate ( const Hep3Vector & axis, double delta );
0482
0483
0484 HepLorentzVector & rotate ( const HepAxisAngle & ax );
0485 HepLorentzVector & rotate ( const HepEulerAngles & e );
0486 HepLorentzVector & rotate ( double phi,
0487 double theta,
0488 double psi );
0489
0490
0491 HepLorentzVector & boost ( const Hep3Vector & axis, double beta );
0492
0493
0494
0495 friend HepLorentzVector rotationXOf
0496 ( const HepLorentzVector & vec, double delta );
0497 friend HepLorentzVector rotationYOf
0498 ( const HepLorentzVector & vec, double delta );
0499 friend HepLorentzVector rotationZOf
0500 ( const HepLorentzVector & vec, double delta );
0501 friend HepLorentzVector rotationOf
0502 ( const HepLorentzVector & vec, const Hep3Vector & axis, double delta );
0503 friend HepLorentzVector rotationOf
0504 ( const HepLorentzVector & vec, const HepAxisAngle & ax );
0505 friend HepLorentzVector rotationOf
0506 ( const HepLorentzVector & vec, const HepEulerAngles & e );
0507 friend HepLorentzVector rotationOf
0508 ( const HepLorentzVector & vec, double phi,
0509 double theta,
0510 double psi );
0511
0512 inline friend HepLorentzVector boostXOf
0513 ( const HepLorentzVector & vec, double beta );
0514 inline friend HepLorentzVector boostYOf
0515 ( const HepLorentzVector & vec, double beta );
0516 inline friend HepLorentzVector boostZOf
0517 ( const HepLorentzVector & vec, double beta );
0518 inline friend HepLorentzVector boostOf
0519 ( const HepLorentzVector & vec, const Hep3Vector & betaVector );
0520 inline friend HepLorentzVector boostOf
0521 ( const HepLorentzVector & vec, const Hep3Vector & axis, double beta );
0522
0523 private:
0524
0525 Hep3Vector pp;
0526 double ee;
0527
0528 static double tolerance;
0529 static double metric;
0530
0531 };
0532
0533
0534
0535 static const HepLorentzVector X_HAT4 = HepLorentzVector( 1, 0, 0, 0 );
0536 static const HepLorentzVector Y_HAT4 = HepLorentzVector( 0, 1, 0, 0 );
0537 static const HepLorentzVector Z_HAT4 = HepLorentzVector( 0, 0, 1, 0 );
0538 static const HepLorentzVector T_HAT4 = HepLorentzVector( 0, 0, 0, 1 );
0539
0540
0541
0542 std::ostream & operator << (std::ostream &, const HepLorentzVector &);
0543
0544
0545 std::istream & operator >> (std::istream &, HepLorentzVector &);
0546
0547
0548 typedef HepLorentzVector HepLorentzVectorD;
0549 typedef HepLorentzVector HepLorentzVectorF;
0550
0551 inline HepLorentzVector operator * (const HepLorentzVector &, double a);
0552 inline HepLorentzVector operator * (double a, const HepLorentzVector &);
0553
0554
0555 HepLorentzVector operator / (const HepLorentzVector &, double a);
0556
0557
0558
0559
0560
0561 class Tcomponent {
0562 private:
0563 double t_;
0564 public:
0565 explicit Tcomponent(double t) : t_(t) {}
0566 operator double() const { return t_; }
0567 };
0568
0569 }
0570
0571 #include "CLHEP/Vector/LorentzVector.icc"
0572
0573 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0574
0575 using namespace CLHEP;
0576 #endif
0577
0578 #endif