Type definition for direction.  
 More...
#include <JAAnetTestkit.hh>
 | 
| double  | dot (const Vec &v) const | 
|   | Get dot product.  
  | 
|   | 
| Vec  | cross (const Vec r) const | 
|   | Get cross product.  
  | 
|   | 
| Vec &  | operator+= (const Vec &v) | 
|   | Add vector.  
  | 
|   | 
| Vec &  | operator-= (const Vec &v) | 
|   | Subtract vector.  
  | 
|   | 
| Vec &  | operator*= (double d) | 
|   | Multiply vector.  
  | 
|   | 
| Vec &  | operator/= (double d) | 
|   | Divide vector.  
  | 
|   | 
| Vec  | operator- () const | 
|   | Negate vector.  
  | 
|   | 
| bool  | operator== (const Vec &v) const | 
|   | Check equality with given vector.  
  | 
|   | 
| bool  | operator!= (const Vec &v) const | 
|   | Check in-equality with given vector.  
  | 
|   | 
| Vec &  | set (double xx, double yy, double zz) | 
|   | Set vector.  
  | 
|   | 
| Vec &  | set_angles (double theta, double phi) | 
|   | Set vector according given zenith and azimuth angles.  
  | 
|   | 
| double  | phi () const | 
|   | Get azimuth angle.  
  | 
|   | 
| double  | theta () const | 
|   | Get zenith angle.  
  | 
|   | 
| double  | len () const | 
|   | Get length.  
  | 
|   | 
| double  | lenxy () const | 
|   | Get length of (x,y) component.  
  | 
|   | 
| Vec &  | normalize () | 
|   | Normalise this vector.  
  | 
|   | 
| void  | print (std::ostream &out=std::cout) const | 
|   | Print vector.  
  | 
|   | 
| const char *  | __repr__ () const | 
|   | Get string representation of this vector.  
  | 
|   | 
| Vec  | __add__ (const Vec &v) const | 
|   | Add vector.  
  | 
|   | 
| Vec  | __sub__ (const Vec &v) const | 
|   | Subtract vector.  
  | 
|   | 
| Vec  | __mul__ (double d) const | 
|   | Multiply vector.  
  | 
|   | 
| Vec  | __rmul__ (double d) const | 
|   | Multiply vector.  
  | 
|   | 
| Vec  | __div__ (double d) const | 
|   | Divide vector.  
  | 
|   | 
| Vec &  | rotate_z (double ang) | 
|   | Rotate around z-axis with given angle.  
  | 
|   | 
| Vec &  | rotate_x (double ang) | 
|   | Rotate around x-axis with given angle.  
  | 
|   | 
| Vec &  | rotate_y (double ang) | 
|   | Rotate around y-axis with given angle.  
  | 
|   | 
 | 
| double  | x | 
|   | 
| double  | y | 
|   | 
| double  | z | 
|   | 
Type definition for direction. 
Definition at line 60 of file JAAnetTestkit.hh.
 
◆ dot()
  
  
      
        
          | double Vec::dot  | 
          ( | 
          const Vec & |           v | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get dot product. 
- Parameters
 - 
  
  
 
- Returns
 - dot product 
 
Definition at line 36 of file Vec.hh.
   36{ 
return v.x*
x + 
v.y*
y+ 
v.z*
z;}
 
 
 
 
◆ cross()
  
  
      
        
          | Vec Vec::cross  | 
          ( | 
          const Vec |           r | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get cross product. 
- Parameters
 - 
  
  
 
- Returns
 - cross product 
 
Definition at line 44 of file Vec.hh.
Vec()
Default constructor.
 
 
 
 
◆ operator+=()
  
  
      
        
          | Vec & Vec::operator+=  | 
          ( | 
          const Vec & |           v | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Add vector. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 52 of file Vec.hh.
   52{ 
x+=
v.x; 
y+=
v.y; 
z+=
v.z; 
return *
this;}
 
 
 
 
◆ operator-=()
  
  
      
        
          | Vec & Vec::operator-=  | 
          ( | 
          const Vec & |           v | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Subtract vector. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 60 of file Vec.hh.
   60{ 
x-=
v.x; 
y-=
v.y; 
z-=
v.z; 
return *
this;}
 
 
 
 
◆ operator*=()
  
  
      
        
          | Vec & Vec::operator*=  | 
          ( | 
          double |           d | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Multiply vector. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 68 of file Vec.hh.
   68{ 
x*=d; 
y*=d; 
z*=d; 
return *
this;}
 
 
 
 
◆ operator/=()
  
  
      
        
          | Vec & Vec::operator/=  | 
          ( | 
          double |           d | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Divide vector. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 76 of file Vec.hh.
Vec & operator*=(double d)
Multiply vector.
 
 
 
 
◆ operator-()
  
  
      
        
          | Vec Vec::operator-  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Negate vector. 
- Returns
 - vector 
 
Definition at line 83 of file Vec.hh.
 
 
◆ operator==()
  
  
      
        
          | bool Vec::operator==  | 
          ( | 
          const Vec & |           v | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Check equality with given vector. 
- Parameters
 - 
  
  
 
- Returns
 - true if (x,y,z) positions of two vectors are equal; else false 
 
Definition at line 91 of file Vec.hh.
   91{ 
return x==
v.x && 
y==
v.y && 
z==
v.z ; }
 
 
 
 
◆ operator!=()
  
  
      
        
          | bool Vec::operator!=  | 
          ( | 
          const Vec & |           v | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Check in-equality with given vector. 
- Parameters
 - 
  
  
 
- Returns
 - true if one of (x,y,z) positions of two vectors are not equal; else false 
 
Definition at line 99 of file Vec.hh.
   99{ 
return x!=
v.x || 
y!=
v.y || 
z!=
v.z ; }
 
 
 
 
◆ set()
  
  
      
        
          | Vec & Vec::set  | 
          ( | 
          double |           xx,  | 
         
        
           | 
           | 
          double |           yy,  | 
         
        
           | 
           | 
          double |           zz ) | 
         
       
   | 
  
inlineinherited   | 
  
 
Set vector. 
- Parameters
 - 
  
    | xx | x position  | 
    | yy | y position  | 
    | zz | z position  | 
  
   
- Returns
 - this vector 
 
Definition at line 109 of file Vec.hh.
  109{ 
x=xx; 
y=yy; 
z=zz; 
return *
this;}
 
 
 
 
◆ set_angles()
  
  
      
        
          | Vec & Vec::set_angles  | 
          ( | 
          double |           theta,  | 
         
        
           | 
           | 
          double |           phi ) | 
         
       
   | 
  
inlineinherited   | 
  
 
Set vector according given zenith and azimuth angles. 
- Parameters
 - 
  
    | theta | zenith angle [rad]  | 
    | phi | azimuth angle [rad]  | 
  
   
- Returns
 - this vector 
 
Definition at line 118 of file Vec.hh.
  119  {
  123    return *this;
  124  }
double theta() const
Get zenith angle.
 
double phi() const
Get azimuth angle.
 
 
 
 
◆ phi()
  
  
      
        
          | double Vec::phi  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get azimuth angle. 
- Returns
 - angle [rad] 
 
Definition at line 131 of file Vec.hh.
  131{ 
return atan2( 
y,
x ); }
 
 
 
 
◆ theta()
  
  
      
        
          | double Vec::theta  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get zenith angle. 
- Returns
 - angle [rad] 
 
Definition at line 138 of file Vec.hh.
 
 
◆ len()
  
  
      
        
          | double Vec::len  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get length. 
- Returns
 - length 
 
Definition at line 145 of file Vec.hh.
  145{ 
double l = 
dot(*
this); 
return (l > 0)? sqrt(l) : 0; }
 
double dot(const Vec &v) const
Get dot product.
 
 
 
 
◆ lenxy()
  
  
      
        
          | double Vec::lenxy  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get length of (x,y) component. 
- Returns
 - length 
 
Definition at line 152 of file Vec.hh.
  152{ 
const double r2 = 
x*
x + 
y*
y; 
return (r2>0) ? sqrt(r2) :0; }
 
 
 
 
◆ normalize()
Normalise this vector. 
- Returns
 - this vector 
 
Definition at line 159 of file Vec.hh.
double len() const
Get length.
 
Vec & operator/=(double d)
Divide vector.
 
 
 
 
◆ print()
  
  
      
        
          | void Vec::print  | 
          ( | 
          std::ostream & |           out = std::cout | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Print vector. 
- Parameters
 - 
  
  
 
Definition at line 166 of file Vec.hh.
  167  {
  168        out << 
"Vec:" << 
x << 
" " << 
y << 
" " << 
z;
 
  169  }
 
 
 
◆ __repr__()
  
  
      
        
          | const char * Vec::__repr__  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Get string representation of this vector. 
- Returns
 - string 
 
Definition at line 176 of file Vec.hh.
  177  {
  178    static std::string buffer;
  179 
  180    std::ostringstream s; 
  181  
  183 
  184    buffer = s.str();
  185 
  186    return buffer.c_str();
  187  }
void print(std::ostream &out=std::cout) const
Print vector.
 
 
 
 
◆ __add__()
  
  
      
        
          | Vec Vec::__add__  | 
          ( | 
          const Vec & |           v | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Add vector. 
- Parameters
 - 
  
  
 
- Returns
 - vector 
 
Definition at line 195 of file Vec.hh.
  195{ 
Vec r=*
this; 
return r+=
v; }
 
The Vec class is a straightforward 3-d vector, which also works in pyroot.
 
 
 
 
◆ __sub__()
  
  
      
        
          | Vec Vec::__sub__  | 
          ( | 
          const Vec & |           v | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Subtract vector. 
- Parameters
 - 
  
  
 
- Returns
 - vector 
 
Definition at line 203 of file Vec.hh.
  203{ 
Vec r=*
this; 
return r-=
v; }
 
 
 
 
◆ __mul__()
  
  
      
        
          | Vec Vec::__mul__  | 
          ( | 
          double |           d | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Multiply vector. 
- Parameters
 - 
  
  
 
- Returns
 - vector 
 
Definition at line 211 of file Vec.hh.
  211{ 
Vec r=*
this; 
return r*=d; }
 
 
 
 
◆ __rmul__()
  
  
      
        
          | Vec Vec::__rmul__  | 
          ( | 
          double |           d | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Multiply vector. 
- Parameters
 - 
  
  
 
- Returns
 - vector 
 
Definition at line 219 of file Vec.hh.
Vec __mul__(double d) const
Multiply vector.
 
 
 
 
◆ __div__()
  
  
      
        
          | Vec Vec::__div__  | 
          ( | 
          double |           d | ) | 
           const | 
         
       
   | 
  
inlineinherited   | 
  
 
Divide vector. 
- Parameters
 - 
  
  
 
- Returns
 - vector 
 
Definition at line 227 of file Vec.hh.
  227{ 
Vec r=*
this; 
return r/=d; }
 
 
 
 
◆ rotate_z()
  
  
      
        
          | Vec & Vec::rotate_z  | 
          ( | 
          double |           ang | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Rotate around z-axis with given angle. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 235 of file Vec.hh.
  236  {
  238    x = o.
x *cos(ang) - o.
y * sin(ang);
 
  239    y = o.
x *sin(ang) + o.
y * cos(ang);
 
  241    return *this;
  242  }
 
 
 
◆ rotate_x()
  
  
      
        
          | Vec & Vec::rotate_x  | 
          ( | 
          double |           ang | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Rotate around x-axis with given angle. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 250 of file Vec.hh.
  251  {
  254    y = o.
y *cos(ang) + o.
z * -sin(ang);
 
  255    z = o.
y *sin(ang) + o.
z * cos(ang);
 
  256    return *this;
  257  }
 
 
 
◆ rotate_y()
  
  
      
        
          | Vec & Vec::rotate_y  | 
          ( | 
          double |           ang | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Rotate around y-axis with given angle. 
- Parameters
 - 
  
  
 
- Returns
 - this vector 
 
Definition at line 265 of file Vec.hh.
  266  {
  268    x = o.
x *cos(ang) + o.
z * sin(ang);
 
  270    z = -o.
x *sin(ang) + o.
z * cos(ang);
 
  271    return *this;
  272  }
 
 
 
The documentation for this struct was generated from the following file: