Commit 46b33607 authored by Lynn Garren's avatar Lynn Garren
Browse files

inline Hep3Vector::operator () (int i), which returns x, y, or z

parent f3cc7aeb
......@@ -39,6 +39,31 @@ inline void Hep3Vector::set(double x1, double y1, double z1) {
dz = z1;
}
inline double Hep3Vector::operator () (int i) const {
switch(i) {
case X:
return x();
case Y:
return y();
case Z:
return z();
}
return 0.;
}
inline double & Hep3Vector::operator () (int i) {
static double dummy;
switch(i) {
case X:
return dx;
case Y:
return dy;
case Z:
return dz;
}
return dummy;
}
// --------------
// Global methods
// --------------
......
......@@ -37,38 +37,6 @@ void Hep3Vector::setMag(double ma) {
}
}
double Hep3Vector::operator () (int i) const {
switch(i) {
case X:
return x();
case Y:
return y();
case Z:
return z();
default:
std::cerr << "Hep3Vector subscripting: bad index (" << i << ")"
<< std::endl;
}
return 0.;
}
double & Hep3Vector::operator () (int i) {
static double dummy;
switch(i) {
case X:
return dx;
case Y:
return dy;
case Z:
return dz;
default:
std::cerr
<< "Hep3Vector subscripting: bad index (" << i << ")"
<< std::endl;
return dummy;
}
}
Hep3Vector & Hep3Vector::rotateUz(const Hep3Vector& NewUzVector) {
// NewUzVector must be normalized !
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment