23  Vec(
double x_, 
double y_, 
double z_) : 
x(x_), 
y(y_), 
z(z_) {}
 
  109  Vec& 
set(
double xx, 
double yy, 
double zz) { 
x=xx; 
y=yy; 
z=zz; 
return *
this;}
 
  131  double phi()
   const { 
return atan2( 
y,
x ); }
 
  145  double len()
   const { 
double l = 
dot(*
this); 
return (l > 0)? sqrt(l) : 0; }
 
  152  double lenxy()
 const { 
const double r2 = 
x*
x + 
y*
y; 
return (r2>0) ? sqrt(r2) :0; }
 
  166  void print( std::ostream& out = std::cout )
 const 
  168        out << 
"Vec:" << 
x << 
" " << 
y << 
" " << 
z;
 
 
  178    static std::string buffer;
 
  180    std::ostringstream s; 
 
  186    return buffer.c_str();
 
 
  238    x = o.
x *cos(ang) - o.
y * sin(ang);
 
  239    y = o.
x *sin(ang) + o.
y * cos(ang);
 
 
  254    y = o.
y *cos(ang) + o.
z * -sin(ang);
 
  255    z = o.
y *sin(ang) + o.
z * cos(ang);
 
 
  268    x = o.
x *cos(ang) + o.
z * sin(ang);
 
  270    z = -o.
x *sin(ang) + o.
z * cos(ang);
 
 
 
  286  out << v.
x << 
" " << v.
y << 
" " << v.
z << 
" ";
 
 
  299  in >> v.
x >> v.
y >> v.
z ; 
return in;
 
 
  311  const double n = a.len() * b.
len();
 
 
  325  if ( c < -1 ) 
return M_PI;
 
  326  if ( c > 1  ) 
return 0;
 
 
#define ClassDefNV(name, version)
 
Vec operator-(const Vec &a, const Vec &b)
Subtract two vectors.
 
std::istream & operator>>(std::istream &in, Vec &v)
Read vector from input stream.
 
Vec operator*(double a, const Vec &v)
Multiply vector.
 
Vec operator+(const Vec &a, const Vec &b)
Add two vectors.
 
double cos_angle_between(const Vec &a, const Vec &b)
Get cosine of space angle between two vectors.
 
Vec operator/(const Vec &v, double a)
Divide vector.
 
std::ostream & operator<<(std::ostream &out, const Vec &v)
Write vector to output stream.
 
double angle_between(const Vec &a, const Vec &b)
Get space angle between two vectors.
 
The Vec class is a straightforward 3-d vector, which also works in pyroot.
 
Vec & normalize()
Normalise this vector.
 
double len() const
Get length.
 
Vec cross(const Vec r) const
Get cross product.
 
double dot(const Vec &v) const
Get dot product.
 
Vec & set_angles(double theta, double phi)
Set vector according given zenith and azimuth angles.
 
Vec & operator-=(const Vec &v)
Subtract vector.
 
bool operator!=(const Vec &v) const
Check in-equality with given vector.
 
Vec & set(double xx, double yy, double zz)
Set vector.
 
Vec & rotate_z(double ang)
Rotate around z-axis with given angle.
 
const char * __repr__() const
Get string representation of this vector.
 
Vec __div__(double d) const
Divide vector.
 
double theta() const
Get zenith angle.
 
Vec & rotate_x(double ang)
Rotate around x-axis with given angle.
 
Vec operator-() const
Negate vector.
 
Vec __sub__(const Vec &v) const
Subtract vector.
 
Vec __mul__(double d) const
Multiply vector.
 
Vec __rmul__(double d) const
Multiply vector.
 
Vec & operator*=(double d)
Multiply vector.
 
Vec & operator+=(const Vec &v)
Add vector.
 
Vec(double x_, double y_, double z_)
Constructor.
 
bool operator==(const Vec &v) const
Check equality with given vector.
 
Vec __add__(const Vec &v) const
Add vector.
 
void print(std::ostream &out=std::cout) const
Print vector.
 
double lenxy() const
Get length of (x,y) component.
 
double phi() const
Get azimuth angle.
 
Vec()
Default constructor.
 
Vec & rotate_y(double ang)
Rotate around y-axis with given angle.
 
Vec & operator/=(double d)
Divide vector.