Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
LorentzVectorB.cc
이 파일의 문서화 페이지로 가기
1 // -*- C++ -*-
2 // $Id:$
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 #ifdef GNUPRAGMA
14 #pragma implementation
15 #endif
16 
18 
19 namespace CLHEP {
20 
21 //-*********
22 // rotationOf()
23 //-*********
24 
25 // Each of these is a shell over a rotate method.
26 
27 HepLorentzVector rotationXOf
28  (const HepLorentzVector & vec, double phi){
29  HepLorentzVector vv (vec);
30  return vv.rotateX (phi);
31 }
32 
33 HepLorentzVector rotationYOf
34  (const HepLorentzVector & vec, double phi){
35  HepLorentzVector vv (vec);
36  return vv.rotateY (phi);
37 }
38 
39 HepLorentzVector rotationZOf
40  (const HepLorentzVector & vec, double phi){
41  HepLorentzVector vv (vec);
42  return vv.rotateZ (phi);
43 }
44 
45 //-********
46 // boost
47 //-********
48 
49 HepLorentzVector & HepLorentzVector::boost
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  std::cerr << "HepLorentzVector::boost() - "
57  << "A zero vector used as axis defining a boost -- no boost done"
58  << std::endl;
59  return *this;
60  }
61  double b2 = bbeta*bbeta;
62  if (b2 >= 1) {
63  std::cerr << "HepLorentzVector::boost() - "
64  << "LorentzVector boosted with beta >= 1 (speed of light) -- \n"
65  << "no boost done" << std::endl;
66  } else {
67  Hep3Vector u = aaxis.unit();
68  double ggamma = std::sqrt(1./(1.-b2));
69  double betaDotV = u.dot(pp)*bbeta;
70  double tt = ee;
71 
72  ee = ggamma * (tt + betaDotV);
73  pp += ( ((ggamma-1)/b2)*betaDotV*bbeta + ggamma*bbeta*tt ) * u;
74  // Note: I have verified the behavior of this even when beta is very
75  // small -- (gamma-1)/b2 becomes inaccurate by O(1), but it is then
76  // multiplied by O(beta**2) and added to an O(beta) term, so the
77  // inaccuracy does not affect the final result.
78  }
79  return *this;
80 } /* boost (axis, beta) */
81 
82 } // namespace CLHEP
HepLorentzVector & rotateX(double)
double dot(const Hep3Vector &) const
HepLorentzVector rotationXOf(const HepLorentzVector &vec, double delta)
HepLorentzVector rotationYOf(const HepLorentzVector &vec, double delta)
HepLorentzVector & rotateY(double)
double mag2() const
HepLorentzVector rotationZOf(const HepLorentzVector &vec, double delta)
Hep3Vector unit() const
HepLorentzVector & rotateZ(double)
HepLorentzVector & boost(double, double, double)