14 #pragma implementation
17 #include "CLHEP/Vector/defs.h"
18 #include "CLHEP/Vector/ThreeVector.h"
19 #include "CLHEP/Vector/ZMxpv.h"
33 double b = std::sqrt(
mag2());
36 "Beta taken for Hep3Vector of at least unit length"));
42 double bbeta = std::sqrt(
mag2());
45 "Gamma taken for Hep3Vector of unit magnitude -- infinite result"));
49 "Gamma taken for Hep3Vector of more than unit magnitude -- "
50 "the sqrt function would return NAN" ));
52 return 1/std::sqrt(1-bbeta*bbeta);
56 if (std::fabs(
dz) == 1) {
58 "Rapidity in Z direction taken for Hep3Vector with |Z| = 1 -- \n"
59 "the log should return infinity"));
61 if (std::fabs(
dz) > 1) {
63 "Rapidity in Z direction taken for Hep3Vector with |Z| > 1 -- \n"
64 "the log would return a NAN" ));
67 return (.5 * std::log((1+
dz)/(1-
dz)) );
74 "Co-linear Rapidity taken for Hep3Vector of unit length -- "
75 "the log should return infinity"));
79 "Co-linear Rapidity taken for Hep3Vector of more than unit length -- "
80 "the log would return a NAN" ));
83 return (.5 * std::log((1+b)/(1-b)) );
91 double mag2v2 = v2.
mag2();
94 "Attempt to take projection of vector against zero reference vector "));
97 return ( v2 * (
dot(v2)/mag2v2) );
101 double vmag = v2.
mag();
104 "Rapidity taken with respect to zero vector" ));
107 double z1 =
dot(v2)/vmag;
108 if (std::fabs(z1) >= 1) {
110 "Rapidity taken for too large a Hep3Vector "
111 "-- would return infinity or NAN"));
114 return (.5 * std::log((1+z1)/(1-z1)) );
124 double v2r = v2.
mag();
125 if ( (r1 == 0) || (v2r == 0) ) {
127 "Cannot find pseudorapidity of a zero vector relative to a vector"));
130 double c =
dot(v2)/(r1*v2r);
134 "Pseudorapidity of vector relative to parallel vector -- "
135 "will give infinite result"));
142 "Pseudorapidity of vector relative to anti-parallel vector -- "
143 "will give negative infinite result"));
152 double tangent = std::sqrt (1-c*c) / ( 1 + c );
153 return (- std::log (tangent));