CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
Vector
src
BoostZ.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// ---------------------------------------------------------------------------
3
//
4
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
5
//
6
// This is the implementation of the HepBoostZ class.
7
//
8
9
#ifdef GNUPRAGMA
10
#pragma implementation
11
#endif
12
13
#include "CLHEP/Vector/defs.h"
14
#include "CLHEP/Vector/BoostZ.h"
15
#include "CLHEP/Vector/Boost.h"
16
#include "CLHEP/Vector/Rotation.h"
17
#include "CLHEP/Vector/LorentzRotation.h"
18
#include "CLHEP/Vector/ZMxpv.h"
19
20
namespace
CLHEP {
21
22
// ---------- Constructors and Assignment:
23
24
HepBoostZ
&
HepBoostZ::set
(
double
bbeta) {
25
double
b2 = bbeta*bbeta;
26
if
(b2 >= 1) {
27
ZMthrowA
(ZMxpvTachyonic(
28
"Beta supplied to set HepBoostZ represents speed >= c."
));
29
beta_
= 1.0 - 1.0E-8;
// NaN-proofing
30
gamma_
= 1.0 / std::sqrt(1.0 - b2);
31
return
*
this
;
32
}
33
beta_
= bbeta;
34
gamma_
= 1.0 / std::sqrt(1.0 - b2);
35
return
*
this
;
36
}
37
38
// ---------- Accessors:
39
40
HepRep4x4
HepBoostZ::rep4x4
()
const
{
41
double
bg =
beta_
*
gamma_
;
42
return
HepRep4x4
( 1, 0, 0, 0,
43
0, 1, 0, 0,
44
0, 0, gamma_, bg,
45
0, 0, bg, gamma_ );
46
}
47
48
HepRep4x4Symmetric
HepBoostZ::rep4x4Symmetric
()
const
{
49
double
bg =
beta_
*
gamma_
;
50
return
HepRep4x4Symmetric
( 1, 0, 0, 0,
51
1, 0, 0,
52
gamma_, bg,
53
gamma_ );
54
}
55
56
// ---------- Decomposition:
57
58
void
HepBoostZ::decompose
(
HepRotation
& rotation,
HepBoost
& boost)
const
{
59
HepAxisAngle
vdelta =
HepAxisAngle
();
60
rotation =
HepRotation
(vdelta);
61
Hep3Vector
bbeta =
boostVector
();
62
boost =
HepBoost
(bbeta);
63
}
64
65
void
HepBoostZ::decompose
(
HepAxisAngle
& rotation,
Hep3Vector
& boost)
const
{
66
rotation =
HepAxisAngle
();
67
boost =
boostVector
();
68
}
69
70
void
HepBoostZ::decompose
(
HepBoost
& boost,
HepRotation
& rotation)
const
{
71
HepAxisAngle
vdelta =
HepAxisAngle
();
72
rotation =
HepRotation
(vdelta);
73
Hep3Vector
bbeta =
boostVector
();
74
boost =
HepBoost
(bbeta);
75
}
76
77
void
HepBoostZ::decompose
(
Hep3Vector
& boost,
HepAxisAngle
& rotation)
const
{
78
rotation =
HepAxisAngle
();
79
boost =
boostVector
();
80
}
81
82
// ---------- Comparisons:
83
84
double
HepBoostZ::distance2
(
const
HepBoost
&
b
)
const
{
85
return
b.
distance2
(*
this
);
86
}
87
88
double
HepBoostZ::distance2
(
const
HepRotation
& r )
const
{
89
double
db2 =
norm2
();
90
double
dr2 = r.
norm2
();
91
return
(db2 + dr2);
92
}
93
94
double
HepBoostZ::distance2
(
const
HepLorentzRotation
& lt )
const
{
95
HepBoost
b1;
96
HepRotation
r1;
97
lt.
decompose
(b1,r1);
98
double
db2 =
distance2
(b1);
99
double
dr2 = r1.
norm2
();
100
return
(db2 + dr2);
101
}
102
103
bool
HepBoostZ::isNear
(
const
HepRotation
& r,
double
epsilon)
const
{
104
double
db2 =
norm2
();
105
if
(db2 > epsilon*epsilon)
return
false
;
106
double
dr2 = r.
norm2
();
107
return
(db2+dr2 <= epsilon*epsilon);
108
}
109
110
bool
HepBoostZ::isNear
(
const
HepLorentzRotation
& lt,
111
double
epsilon )
const
{
112
HepBoost
b1;
113
HepRotation
r1;
114
double
db2 =
distance2
(b1);
115
lt.
decompose
(b1,r1);
116
if
(db2 > epsilon*epsilon)
return
false
;
117
double
dr2 = r1.
norm2
();
118
return
(db2 + dr2);
119
}
120
121
// ---------- Properties:
122
123
void
HepBoostZ::rectify
() {
124
// Assuming the representation of this is close to a true pure boost,
125
// but may have drifted due to round-off error from many operations,
126
// this forms an "exact" pure BoostZ matrix for again.
127
128
double
b2 =
beta_
*
beta_
;
129
if
(b2 >= 1) {
130
beta_ = 1.0 - 1.0e-8;
// NaN-proofing
131
b2 = beta_*
beta_
;
132
}
133
gamma_
= 1.0 / std::sqrt(1.0 - b2);
134
}
135
136
// ---------- Application:
137
138
// ---------- Operations in the group of 4-Rotations
139
140
HepBoostZ
HepBoostZ::operator *
(
const
HepBoostZ
&
b
)
const
{
141
return
HepBoostZ
( (
beta
()+b.
beta
()) / (1+
beta
()*b.
beta
()) );
142
}
143
HepLorentzRotation
HepBoostZ::operator *
(
const
HepBoost
&
b
)
const
{
144
HepLorentzRotation
me (*
this
);
145
return
me*
b
;
146
}
147
HepLorentzRotation
HepBoostZ::operator *
(
const
HepRotation
& r)
const
{
148
HepLorentzRotation
me (*
this
);
149
return
me*r;
150
}
151
HepLorentzRotation
HepBoostZ::operator *
(
const
HepLorentzRotation
& lt)
const
{
152
HepLorentzRotation
me (*
this
);
153
return
me*lt;
154
}
155
156
// ---------- I/O
157
158
std::ostream &
HepBoostZ::print
( std::ostream & os )
const
{
159
os <<
"Boost in Z direction (beta = "
<<
beta_
160
<<
", gamma = "
<<
gamma_
<<
") "
;
161
return
os;
162
}
163
164
}
// namespace CLHEP
Generated on Sun Jun 17 2012 08:08:26 for CLHEP by
1.8.1.1