13 #pragma implementation
22 double HepLorentzVector::tolerance =
24 double HepLorentzVector::metric = 1.0;
35 std::cerr <<
"HepLorentzVector subscripting: bad index (" << i <<
")"
52 <<
"HepLorentzVector subscripting: bad index (" << i <<
")"
59 (
double bx,
double by,
double bz){
60 double b2 = bx*bx + by*by + bz*bz;
61 double ggamma = 1.0 / std::sqrt(1.0 - b2);
62 double bp = bx*
x() + by*y() + bz*
z();
63 double gamma2 = b2 > 0 ? (ggamma - 1.0)/b2 : 0.0;
65 setX(
x() + gamma2*bp*bx + ggamma*bx*t());
66 setY(y() + gamma2*bp*by + ggamma*by*t());
67 setZ(
z() + gamma2*bp*bz + ggamma*bz*t());
68 setT(ggamma*(t() + bp));
92 return os <<
"(" << v1.
x() <<
"," << v1.
y() <<
"," << v1.
z()
93 <<
";" << v1.
t() <<
")";
109 if (is.fail() || c !=
'(' ) {
110 std::cerr <<
"Could not find required opening parenthesis "
111 <<
"in input of a HepLorentzVector" << std::endl;
115 is >> x >> std::ws >>
c;
116 if (is.fail() || c !=
',' ) {
117 std::cerr <<
"Could not find x value and required trailing comma "
118 <<
"in input of a HepLorentzVector" << std::endl;
122 is >> y >> std::ws >>
c;
123 if (is.fail() || c !=
',' ) {
124 std::cerr <<
"Could not find y value and required trailing comma "
125 <<
"in input of a HepLorentzVector" << std::endl;
129 is >> z >> std::ws >>
c;
130 if (is.fail() || c !=
';' ) {
131 std::cerr <<
"Could not find z value and required trailing semicolon "
132 <<
"in input of a HepLorentzVector" << std::endl;
136 is >> t >> std::ws >>
c;
137 if (is.fail() || c !=
')' ) {
138 std::cerr <<
"Could not find t value and required close parenthesis "
139 <<
"in input of a HepLorentzVector" << std::endl;
159 double oneOverC = 1.0/
c;
172 double oneOverC = 1.0/
c;
174 w.
getT() * oneOverC);
179 if (pp.
mag2() == 0) {
182 std::cerr <<
"HepLorentzVector::boostVector() - "
183 <<
"boostVector computed for LorentzVector with t=0 -- infinite result"
189 std::cerr <<
"HepLorentzVector::boostVector() - "
190 <<
"boostVector computed for a non-timelike LorentzVector " << std::endl;
198 double b2 = bbeta*bbeta;
200 std::cerr <<
"HepLorentzVector::boostX() - "
201 <<
"boost along X with beta >= 1 (speed of light) -- \n"
202 <<
"no boost done" << std::endl;
204 double ggamma = std::sqrt(1./(1-b2));
206 ee = ggamma*(ee + bbeta*pp.
getX());
207 pp.
setX(ggamma*(pp.
getX() + bbeta*tt));
213 double b2 = bbeta*bbeta;
215 std::cerr <<
"HepLorentzVector::boostY() - "
216 <<
"boost along Y with beta >= 1 (speed of light) -- \n"
217 <<
"no boost done" << std::endl;
219 double ggamma = std::sqrt(1./(1-b2));
221 ee = ggamma*(ee + bbeta*pp.
getY());
222 pp.
setY(ggamma*(pp.
getY() + bbeta*tt));
228 double b2 = bbeta*bbeta;
230 std::cerr <<
"HepLorentzVector::boostZ() - "
231 <<
"boost along Z with beta >= 1 (speed of light) -- \n"
232 <<
"no boost done" << std::endl;
234 double ggamma = std::sqrt(1./(1-b2));
236 ee = ggamma*(ee + bbeta*pp.
getZ());
237 pp.
setZ(ggamma*(pp.
getZ() + bbeta*tt));
244 double oldTolerance (tolerance);
Hep3Vector boostVector() const
HepLorentzVector & rotateX(double)
double operator()(int) const
std::vector< ExP01TrackerHit * > a
static double setTolerance(double tol)
HepLorentzVector & rotateZ(double)
std::ostream & operator<<(std::ostream &os, const HepRandom &dist)
HepLorentzVector & boost(double, double, double)
Hep3Vector & rotateUz(const Hep3Vector &)
Hep3Vector & rotateZ(double)
HepLorentzVector & operator/=(double)
HepLorentzVector & rotateUz(const Hep3Vector &)
HepLorentzVector & boostZ(double beta)
HepLorentzVector operator/(const HepLorentzVector &, double a)
Hep3Vector & rotateY(double)
HepLorentzVector & boostX(double beta)
HepLorentzVector & rotateY(double)
HepLorentzVector & boostY(double beta)
static double getTolerance()
std::istream & operator>>(std::istream &is, HepRandom &dist)
Hep3Vector & rotateX(double)