CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
LorentzVectorB.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: LorentzVectorB.cc,v 1.2 2003/08/13 20:00:14 garren Exp $
3// ---------------------------------------------------------------------------
4//
5// This file is a part of the CLHEP - a Class Library for High Energy Physics.
6//
7// This is the implementation of the HepLorentzVector class:
8// Those methods originating in ZOOM dealing with simple boosts and rotations.
9// Use of one of these methods will not force loading of the HepRotation or
10// HepLorentzRotation class.
11//
12
13#include "CLHEP/Vector/defs.h"
14#include "CLHEP/Vector/LorentzVector.h"
15#include "CLHEP/Vector/ZMxpv.h"
16
17#include <cmath>
18#include <iostream>
19namespace CLHEP {
20
21//-*********
22// rotationOf()
23//-*********
24
25// Each of these is a shell over a rotate method.
26
28 (const HepLorentzVector & vec, double phi){
29 HepLorentzVector vv (vec);
30 return vv.rotateX (phi);
31}
32
34 (const HepLorentzVector & vec, double phi){
35 HepLorentzVector vv (vec);
36 return vv.rotateY (phi);
37}
38
40 (const HepLorentzVector & vec, double phi){
41 HepLorentzVector vv (vec);
42 return vv.rotateZ (phi);
43}
44
45//-********
46// boost
47//-********
48
50 ( const Hep3Vector & aaxis, double bbeta ) {
51 if (bbeta==0) {
52 return *this; // do nothing for a 0 boost
53 }
54 double r2 = aaxis.mag2();
55 if ( r2 == 0 ) {
56 ZMthrowA (ZMxpvZeroVector(
57 "A zero vector used as axis defining a boost -- no boost done"));
58 return *this;
59 }
60 double b2 = bbeta*bbeta;
61 if (b2 >= 1) {
62 ZMthrowA (ZMxpvTachyonic(
63 "LorentzVector boosted with beta >= 1 (speed of light) -- \n"
64 "no boost done"));
65 } else {
66 Hep3Vector u = aaxis.unit();
67 double ggamma = std::sqrt(1./(1.-b2));
68 double betaDotV = u.dot(pp)*bbeta;
69 double tt = ee;
70
71 ee = ggamma * (tt + betaDotV);
72 pp += ( ((ggamma-1)/b2)*betaDotV*bbeta + ggamma*bbeta*tt ) * u;
73 // Note: I have verified the behavior of this even when beta is very
74 // small -- (gamma-1)/b2 becomes inaccurate by O(1), but it is then
75 // multiplied by O(beta**2) and added to an O(beta) term, so the
76 // inaccuracy does not affect the final result.
77 }
78 return *this;
79} /* boost (axis, beta) */
80
81} // namespace CLHEP
#define ZMthrowA(A)
Definition: ZMxpv.h:128
Hep3Vector unit() const
double mag2() const
double dot(const Hep3Vector &) const
HepLorentzVector & boost(double, double, double)
HepLorentzVector & rotateZ(double)
HepLorentzVector & rotateX(double)
HepLorentzVector & rotateY(double)
HepLorentzVector rotationZOf(const HepLorentzVector &vec, double phi)
HepLorentzVector rotationYOf(const HepLorentzVector &vec, double phi)
HepLorentzVector rotationXOf(const HepLorentzVector &vec, double phi)