1 #ifndef VEC_HH_INCLUDED
2 #define VEC_HH_INCLUDED
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;}
120 x =
sin ( theta ) * cos( phi );
121 y =
sin ( theta ) *
sin( phi );
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;
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;
bool operator!=(const Vec &v) const
Check in-equality with given vector.
Vec __div__(double d) const
Divide vector.
Vec & set_angles(double theta, double phi)
Set vector according given zenith and azimuth angles.
Vec operator-(const Vec &a, const Vec &b)
Subtract two vectors.
Vec __sub__(const Vec &v) const
Subtract vector.
Vec __add__(const Vec &v) const
Add vector.
double cos_angle_between(const Vec &a, const Vec &b)
Get cosine of space angle between two vectors.
Vec __rmul__(double d) const
Multiply vector.
#define ClassDefNV(name, version)
Vec operator-() const
Negate vector.
double phi() const
Get azimuth angle.
Vec & rotate_z(double ang)
Rotate around z-axis with given angle.
double len() const
Get length.
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
Vec(double x_, double y_, double z_)
Constructor.
double dot(const Vec &v) const
Get dot product.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Vec()
Default constructor.
Vec & operator*=(double d)
Multiply vector.
double lenxy() const
Get length of (x,y) component.
Vec cross(const Vec r) const
Get cross product.
Vec __mul__(double d) const
Multiply vector.
const JCalculator< T, 1 > & operator*(const T &first, const T &second)
Product evaluation of objects.
Vec & normalize()
Normalise this vector.
Vec operator+(const Vec &a, const Vec &b)
Add two vectors.
bool operator==(const Vec &v) const
Check equality with given vector.
Vec & set(double xx, double yy, double zz)
Set vector.
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
Vec & operator/=(double d)
Divide vector.
Vec & rotate_x(double ang)
Rotate around x-axis with given angle.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Vec & operator-=(const Vec &v)
Subtract vector.
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
double angle_between(const Vec &a, const Vec &b)
Get space angle between two vectors.
void print(std::ostream &out=std::cout) const
Print vector.
const char * __repr__() const
Get string representation of this vector.
double theta() const
Get zenith angle.
Vec operator/(const Vec &v, double a)
Divide vector.
Vec & rotate_y(double ang)
Rotate around y-axis with given angle.
Vec & operator+=(const Vec &v)
Add vector.