12#include "CLHEP/Vector/defs.h"
13#include "CLHEP/Vector/LorentzVector.h"
14#include "CLHEP/Vector/ZMxpv.h"
30 std::cerr <<
"HepLorentzVector subscripting: bad index (" << i <<
")"
47 <<
"HepLorentzVector subscripting: bad index (" << i <<
")"
54 (
double bx,
double by,
double bz){
55 double b2 = bx*bx + by*by + bz*bz;
56 double ggamma = 1.0 / std::sqrt(1.0 - b2);
57 double bp = bx*
x() + by*
y() + bz*
z();
58 double gamma2 = b2 > 0 ? (ggamma - 1.0)/b2 : 0.0;
60 setX(
x() + gamma2*bp*bx + ggamma*bx*
t());
61 setY(
y() + gamma2*bp*by + ggamma*by*
t());
62 setZ(
z() + gamma2*bp*bz + ggamma*bz*
t());
63 setT(ggamma*(
t() + bp));
87 return os <<
"(" << v1.
x() <<
"," << v1.
y() <<
"," << v1.
z()
88 <<
";" << v1.
t() <<
")";
104 if (is.fail() || c !=
'(' ) {
105 std::cerr <<
"Could not find required opening parenthesis "
106 <<
"in input of a HepLorentzVector" << std::endl;
110 is >> x >> std::ws >> c;
111 if (is.fail() || c !=
',' ) {
112 std::cerr <<
"Could not find x value and required trailing comma "
113 <<
"in input of a HepLorentzVector" << std::endl;
117 is >> y >> std::ws >> c;
118 if (is.fail() || c !=
',' ) {
119 std::cerr <<
"Could not find y value and required trailing comma "
120 <<
"in input of a HepLorentzVector" << std::endl;
124 is >> z >> std::ws >> c;
125 if (is.fail() || c !=
';' ) {
126 std::cerr <<
"Could not find z value and required trailing semicolon "
127 <<
"in input of a HepLorentzVector" << std::endl;
131 is >> t >> std::ws >> c;
132 if (is.fail() || c !=
')' ) {
133 std::cerr <<
"Could not find t value and required close parenthesis "
134 <<
"in input of a HepLorentzVector" << std::endl;
150 "Attempt to do LorentzVector /= 0 -- \n"
151 "division by zero would produce infinite or NAN components"));
153 double oneOverC = 1.0/c;
162 "Attempt to do LorentzVector / 0 -- \n"
163 "division by zero would produce infinite or NAN components"));
165 double oneOverC = 1.0/c;
167 w.
getT() * oneOverC);
172 if (pp.
mag2() == 0) {
176 "boostVector computed for LorentzVector with t=0 -- infinite result"));
182 "boostVector computed for a non-timelike LorentzVector "));
190 double b2 = bbeta*bbeta;
193 "boost along X with beta >= 1 (speed of light) -- no boost done"));
195 double ggamma = std::sqrt(1./(1-b2));
197 ee = ggamma*(ee + bbeta*pp.
getX());
198 pp.
setX(ggamma*(pp.
getX() + bbeta*tt));
204 double b2 = bbeta*bbeta;
207 "boost along Y with beta >= 1 (speed of light) -- \nno boost done"));
209 double ggamma = std::sqrt(1./(1-b2));
211 ee = ggamma*(ee + bbeta*pp.
getY());
212 pp.
setY(ggamma*(pp.
getY() + bbeta*tt));
218 double b2 = bbeta*bbeta;
221 "boost along Z with beta >= 1 (speed of light) -- \nno boost done"));
223 double ggamma = std::sqrt(1./(1-b2));
225 ee = ggamma*(ee + bbeta*pp.
getZ());
226 pp.
setZ(ggamma*(pp.
getZ() + bbeta*tt));
233 double oldTolerance (tolerance);
243double HepLorentzVector::tolerance =
245double HepLorentzVector::metric = 1.0;
Hep3Vector & rotateY(double)
Hep3Vector & rotateX(double)
Hep3Vector & rotateZ(double)
static const int ToleranceTicks
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::istream & operator>>(std::istream &is, HepRandom &dist)
std::ostream & operator<<(std::ostream &s, const HepDiagMatrix &q)
HepDiagMatrix operator/(const HepDiagMatrix &hm1, double t)