16#include "CLHEP/Vector/defs.h"
17#include "CLHEP/Vector/LorentzVector.h"
18#include "CLHEP/Vector/ZMxpv.h"
33 std::cerr <<
"HepLorentzVector subscripting: bad index (" << i <<
")"
50 <<
"HepLorentzVector subscripting: bad index (" << i <<
")"
57 (
double bx,
double by,
double bz){
58 double b2 = bx*bx + by*by + bz*bz;
59 register double ggamma = 1.0 / std::sqrt(1.0 - b2);
60 register double bp = bx*
x() + by*
y() + bz*
z();
61 register double gamma2 = b2 > 0 ? (ggamma - 1.0)/b2 : 0.0;
63 setX(
x() + gamma2*bp*bx + ggamma*bx*
t());
64 setY(
y() + gamma2*bp*by + ggamma*by*
t());
65 setZ(
z() + gamma2*bp*bz + ggamma*bz*
t());
66 setT(ggamma*(
t() + bp));
90 return os <<
"(" << v1.
x() <<
"," << v1.
y() <<
"," << v1.
z()
91 <<
";" << v1.
t() <<
")";
107 if (is.fail() || c !=
'(' ) {
108 std::cerr <<
"Could not find required opening parenthesis "
109 <<
"in input of a HepLorentzVector" << std::endl;
113 is >> x >> std::ws >> c;
114 if (is.fail() || c !=
',' ) {
115 std::cerr <<
"Could not find x value and required trailing comma "
116 <<
"in input of a HepLorentzVector" << std::endl;
120 is >> y >> std::ws >> c;
121 if (is.fail() || c !=
',' ) {
122 std::cerr <<
"Could not find y value and required trailing comma "
123 <<
"in input of a HepLorentzVector" << std::endl;
127 is >> z >> std::ws >> c;
128 if (is.fail() || c !=
';' ) {
129 std::cerr <<
"Could not find z value and required trailing semicolon "
130 <<
"in input of a HepLorentzVector" << std::endl;
134 is >> t >> std::ws >> c;
135 if (is.fail() || c !=
')' ) {
136 std::cerr <<
"Could not find t value and required close parenthesis "
137 <<
"in input of a HepLorentzVector" << std::endl;
153 "Attempt to do LorentzVector /= 0 -- \n"
154 "division by zero would produce infinite or NAN components"));
156 double oneOverC = 1.0/c;
165 "Attempt to do LorentzVector / 0 -- \n"
166 "division by zero would produce infinite or NAN components"));
168 double oneOverC = 1.0/c;
170 w.
getT() * oneOverC);
175 if (pp.
mag2() == 0) {
179 "boostVector computed for LorentzVector with t=0 -- infinite result"));
185 "boostVector computed for a non-timelike LorentzVector "));
193 register double b2 = bbeta*bbeta;
196 "boost along X with beta >= 1 (speed of light) -- no boost done"));
198 register double ggamma = std::sqrt(1./(1-b2));
199 register double tt = ee;
200 ee = ggamma*(ee + bbeta*pp.
getX());
201 pp.
setX(ggamma*(pp.
getX() + bbeta*tt));
207 register double b2 = bbeta*bbeta;
210 "boost along Y with beta >= 1 (speed of light) -- \nno boost done"));
212 register double ggamma = std::sqrt(1./(1-b2));
213 register double tt = ee;
214 ee = ggamma*(ee + bbeta*pp.
getY());
215 pp.
setY(ggamma*(pp.
getY() + bbeta*tt));
221 register double b2 = bbeta*bbeta;
224 "boost along Z with beta >= 1 (speed of light) -- \nno boost done"));
226 register double ggamma = std::sqrt(1./(1-b2));
227 register double tt = ee;
228 ee = ggamma*(ee + bbeta*pp.
getZ());
229 pp.
setZ(ggamma*(pp.
getZ() + bbeta*tt));
236 double oldTolerance (tolerance);
246double HepLorentzVector::tolerance =
248double HepLorentzVector::metric = 1.0;
Hep3Vector & rotateY(double)
Hep3Vector & rotateX(double)
Hep3Vector & rotateZ(double)
Hep3Vector & rotateUz(const Hep3Vector &)
Hep3Vector boostVector() const
HepLorentzVector & boost(double, double, double)
HepLorentzVector & boostZ(double beta)
static double setTolerance(double tol)
HepLorentzVector & boostX(double beta)
HepLorentzVector & rotateZ(double)
HepLorentzVector & boostY(double beta)
HepLorentzVector & rotateX(double)
HepLorentzVector & operator/=(double)
HepLorentzVector & rotateUz(const Hep3Vector &)
static double getTolerance()
HepLorentzVector & rotateY(double)
double operator()(int) const
std::ostream & operator<<(std::ostream &os, const HepAxisAngle &aa)
std::istream & operator>>(std::istream &is, HepAxisAngle &aa)
HepLorentzVector operator/(const HepLorentzVector &, double a)