14 #pragma implementation
17 #include "CLHEP/Vector/ThreeVector.h"
30 double Hep3Vector::beta()
const {
31 double b = std::sqrt(mag2());
39 double Hep3Vector::gamma()
const {
40 double bbeta = std::sqrt(mag2());
51 return 1/std::sqrt(1-bbeta*bbeta);
54 double Hep3Vector::rapidity()
const {
66 return (.5 * std::log((1+dz)/(1-dz)) );
69 double Hep3Vector::coLinearRapidity()
const {
82 return (.5 * std::log((1+b)/(1-b)) );
89 Hep3Vector Hep3Vector::project (
const Hep3Vector & v2)
const {
90 double mag2v2 = v2.mag2();
92 std::cerr <<
"Hep3Vector::project() - "
93 <<
"Attempt to take projection of vector against zero reference vector"
97 return ( v2 * (dot(v2)/mag2v2) );
100 double Hep3Vector::rapidity(
const Hep3Vector & v2)
const {
101 double vmag = v2.mag();
103 std::cerr <<
"Hep3Vector::rapidity() - "
104 <<
"Rapidity taken with respect to zero vector" << std::endl;
107 double z1 = dot(v2)/vmag;
114 return (.5 * std::log((1+z1)/(1-z1)) );
117 double Hep3Vector::eta(
const Hep3Vector & v2)
const {
124 double v2r = v2.mag();
125 if ( (r1 == 0) || (v2r == 0) ) {
126 std::cerr <<
"Hep3Vector::eta() - "
127 <<
"Cannot find pseudorapidity of a zero vector relative to a vector"
131 double c = dot(v2)/(r1*v2r);
134 std::cerr <<
"Hep3Vector::eta() - "
135 <<
"Pseudorapidity of vector relative to parallel vector -- \n"
136 <<
"will give infinite result" << std::endl;
142 std::cerr <<
"Hep3Vector::eta() - "
143 <<
"Pseudorapidity of vector relative to anti-parallel vector -- \n"
144 <<
"will give negative infinite result"<< std::endl;
146 return ( negativeInfinity() );
153 double tangent = std::sqrt (1-c*c) / ( 1 + c );
154 return (- std::log (tangent));