14 #pragma implementation 
   26   double factor = 
mag();
 
   28     std::cerr << 
"Hep3Vector::setMag() - " 
   29               << 
"zero vector can't be stretched" << std::endl;
 
   47     std::cerr << 
"Hep3Vector::operator () - " 
   48               << 
"Hep3Vector subscripting: bad index (" << i << 
")" 
   65       << 
"Hep3Vector::operator () - " 
   66       << 
"Hep3Vector subscripting: bad index (" << i << 
")" 
   75   double u1 = NewUzVector.
x();
 
   76   double u2 = NewUzVector.
y();
 
   77   double u3 = NewUzVector.
z();
 
   78   double up = u1*u1 + u2*u2;
 
   82       double px = 
dx,  py = 
dy,  pz = 
dz;
 
   83       dx = (u1*u3*px - u2*py)/up + u1*pz;
 
   84       dy = (u2*u3*px + u1*py)/up + u2*pz;
 
   87   else if (u3 < 0.) { 
dx = -
dx; 
dz = -
dz; }      
 
   94   if ( m1==  0   ) 
return  0.0;   
 
   95   if ( m1==  
z() ) 
return  1.0E72;
 
   96   if ( m1== -
z() ) 
return -1.0E72;
 
   97   return 0.5*std::log( (m1+
z())/(m1-
z()) );
 
  101   return os << 
"(" << v.
x() << 
"," << v.
y() << 
"," << v.
z() << 
")";
 
  105                        double & 
x, 
double & 
y, 
double & 
z );
 
  114 const Hep3Vector 
HepXHat(1.0, 0.0, 0.0);
 
  115 const Hep3Vector 
HepYHat(0.0, 1.0, 0.0);
 
  116 const Hep3Vector 
HepZHat(0.0, 0.0, 1.0);
 
  125   double sinphi = std::sin(phi1);
 
  126   double cosphi = std::cos(phi1);
 
  128   ty = 
dy * cosphi - 
dz * sinphi;
 
  129   dz = 
dz * cosphi + 
dy * sinphi;
 
  135   double sinphi = std::sin(phi1);
 
  136   double cosphi = std::cos(phi1);
 
  138   tz = 
dz * cosphi - 
dx * sinphi;
 
  139   dx = 
dx * cosphi + 
dz * sinphi;
 
  145   double sinphi = std::sin(phi1);
 
  146   double cosphi = std::cos(phi1);
 
  148   tx = 
dx * cosphi - 
dy * sinphi;
 
  149   dy = 
dy * cosphi + 
dx * sinphi;
 
  155   double limit = 
dot(v)*epsilon*epsilon;
 
  156   return ( (*
this - v).
mag2() <= limit );
 
  161   double d   = (*
this - 
v).
mag2();
 
  163   if ( (vdv > 0) && (d < vdv)  ) {
 
  164     return std::sqrt (d/vdv);
 
  165   } 
else if ( (vdv == 0) && (d == 0) ) {
 
  174   if ( dphi > CLHEP::pi ) {
 
  175     dphi -= CLHEP::twopi;
 
  176   } 
else if ( dphi <= -CLHEP::pi ) {
 
  177     dphi += CLHEP::twopi;
 
  185   return std::sqrt ( a*a + b*b );
 
  194     arg = 
dot(q)/std::sqrt(ptot2);
 
  195     if(arg >  1.0) arg =  1.0;
 
  196     if(arg < -1.0) arg = -1.0;
 
  203   double ptot2 = 
mag2();
 
  204   double qtot2 = q.
mag2();
 
  205   if ( ptot2 == 0 || qtot2 == 0 )  {
 
  209     arg = (pdq/ptot2) * (pdq/qtot2);
 
  212     if(arg >  1.0) arg =  1.0;
 
  220   if ( (
dx == 0) && (
dy == 0) ) {
 
  222       std::cerr << 
"Hep3Vector::setEta() - " 
  223                 << 
"Attempt to set eta of zero vector -- vector is unchanged" 
  227   std::cerr << 
"Hep3Vector::setEta() - " 
  228             << 
"Attempt to set eta of vector along Z axis -- will use phi = 0" 
  235   double tanHalfTheta = std::exp ( -eta1 );
 
  237         (1 - tanHalfTheta*tanHalfTheta) / (1 + tanHalfTheta*tanHalfTheta);
 
  239   double rho1 = r1*std::sqrt(1 - cosTheta1*cosTheta1);
 
  240   dy = rho1 * std::sin (phi1);
 
  241   dx = rho1 * std::cos (phi1);
 
  249   if ( (
dx == 0) && (
dy == 0) ) {
 
  251       std::cerr << 
"Hep3Vector::setCylTheta() - " 
  252                 << 
"Attempt to set cylTheta of zero vector -- vector is unchanged" 
  260     if (theta1 == CLHEP::pi) {
 
  264     std::cerr << 
"Hep3Vector::setCylTheta() - " 
  265       << 
"Attempt set cylindrical theta of vector along Z axis " 
  266       << 
"to a non-trivial value, while keeping rho fixed -- " 
  267       << 
"will return zero vector" << std::endl;
 
  271   if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) {
 
  272     std::cerr << 
"Hep3Vector::setCylTheta() - " 
  273       << 
"Setting Cyl theta of a vector based on a value not in [0, PI]" 
  279   if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) {
 
  280     std::cerr << 
"Hep3Vector::setCylTheta() - " 
  281       << 
"Attempt to set cylindrical theta to 0 or PI " 
  282       << 
"while keeping rho fixed -- infinite Z will be computed" 
  284       dz = (theta1==0) ? 1.0E72 : -1.0E72;
 
  287   dz = rho1 / std::tan (theta1);
 
  288   dy = rho1 * std::sin (phi1);
 
  289   dx = rho1 * std::cos (phi1);
 
  297   double theta1 = 2 * std::atan ( std::exp (-eta1) );
 
  304   if ( (
dx == 0) && (
dy == 0) ) {
 
  306       std::cerr << 
"Hep3Vector::setCylEta() - " 
  307         << 
"Attempt to set cylEta of zero vector -- vector is unchanged" 
  315     if (theta1 == CLHEP::pi) {
 
  319     std::cerr << 
"Hep3Vector::setCylEta() - " 
  320       << 
"Attempt set cylindrical eta of vector along Z axis " 
  321       << 
"to a non-trivial value, while keeping rho fixed -- " 
  322       << 
"will return zero vector" << std::endl;
 
  328   dz = rho1 / std::tan (theta1);
 
  329   dy = rho1 * std::sin (phi1);
 
  330   dx = rho1 * std::cos (phi1);
 
  341   double   oneOverC = 1.0/
c;
 
  354   double oneOverC = 1.0/
c;