Jpp  15.0.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
JAANET::coord_origin Struct Reference

Coordinate origin. More...

#include <JHead.hh>

Inheritance diagram for JAANET::coord_origin:
Vec

Public Member Functions

 coord_origin ()
 Default constructor. More...
 
 coord_origin (const double x, const double y, const double z)
 Constructor. More...
 
bool match (const coord_origin &object) const
 Test match. More...
 
 ClassDefNV (coord_origin, 1)
 
double dot (const Vec &v) const
 Get dot product. More...
 
Vec cross (const Vec r) const
 Get cross product. More...
 
Vecoperator+= (const Vec &v)
 Add vector. More...
 
Vecoperator-= (const Vec &v)
 Subtract vector. More...
 
Vecoperator*= (double d)
 Multiply vector. More...
 
Vecoperator/= (double d)
 Divide vector. More...
 
Vec operator- () const
 Negate vector. More...
 
bool operator== (const Vec &v) const
 Check equality with given vector. More...
 
bool operator!= (const Vec &v) const
 Check in-equality with given vector. More...
 
Vecset (double xx, double yy, double zz)
 Set vector. More...
 
Vecset_angles (double theta, double phi)
 Set vector according given zenith and azimuth angles. More...
 
double phi () const
 Get azimuth angle. More...
 
double theta () const
 Get zenith angle. More...
 
double len () const
 Get length. More...
 
double lenxy () const
 Get length of (x,y) component. More...
 
Vecnormalize ()
 Normalise this vector. More...
 
void print (std::ostream &out=std::cout) const
 Print vector. More...
 
const char * __repr__ () const
 Get string representation of this vector. More...
 
Vec __add__ (const Vec &v) const
 Add vector. More...
 
Vec __sub__ (const Vec &v) const
 Subtract vector. More...
 
Vec __mul__ (double d) const
 Multiply vector. More...
 
Vec __rmul__ (double d) const
 Multiply vector. More...
 
Vec __div__ (double d) const
 Divide vector. More...
 
Vecrotate_z (double ang)
 Rotate around z-axis with given angle. More...
 
Vecrotate_x (double ang)
 Rotate around x-axis with given angle. More...
 
Vecrotate_y (double ang)
 Rotate around y-axis with given angle. More...
 

Public Attributes

double x
 
double y
 
double z
 

Detailed Description

Coordinate origin.

Definition at line 714 of file JHead.hh.

Constructor & Destructor Documentation

JAANET::coord_origin::coord_origin ( )
inline

Default constructor.

Definition at line 720 of file JHead.hh.

720  :
721  Vec()
722  {}
Vec()
Default constructor.
Definition: Vec.hh:28
JAANET::coord_origin::coord_origin ( const double  x,
const double  y,
const double  z 
)
inline

Constructor.

Parameters
xx position
yy position
zz position

Definition at line 731 of file JHead.hh.

733  :
734  Vec(x,y,z)
735  {}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec()
Default constructor.
Definition: Vec.hh:28

Member Function Documentation

bool JAANET::coord_origin::match ( const coord_origin object) const
inline

Test match.

Parameters
objectcoordinate origin
Returns
true if matches; else false

Definition at line 743 of file JHead.hh.

744  {
745  return (x == object.x &&
746  y == object.y &&
747  z == object.z);
748  }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
JAANET::coord_origin::ClassDefNV ( coord_origin  ,
 
)
double Vec::dot ( const Vec v) const
inlineinherited

Get dot product.

Parameters
vvector
Returns
dot product

Definition at line 36 of file Vec.hh.

36 { return v.x*x + v.y*y+ v.z*z;}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec Vec::cross ( const Vec  r) const
inlineinherited

Get cross product.

Parameters
rvector
Returns
cross product

Definition at line 44 of file Vec.hh.

44 { return Vec ( y*r.z-z*r.y, z*r.x-x*r.z, x*r.y-y*r.x);}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec()
Default constructor.
Definition: Vec.hh:28
Vec& Vec::operator+= ( const Vec v)
inlineinherited

Add vector.

Parameters
vvector
Returns
this vector

Definition at line 52 of file Vec.hh.

52 { x+=v.x; y+=v.y; z+=v.z; return *this;}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec& Vec::operator-= ( const Vec v)
inlineinherited

Subtract vector.

Parameters
vvector
Returns
this vector

Definition at line 60 of file Vec.hh.

60 { x-=v.x; y-=v.y; z-=v.z; return *this;}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec& Vec::operator*= ( double  d)
inlineinherited

Multiply vector.

Parameters
dfactor
Returns
this vector

Definition at line 68 of file Vec.hh.

68 { x*=d; y*=d; z*=d; return *this;}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Vec& Vec::operator/= ( double  d)
inlineinherited

Divide vector.

Parameters
dfactor
Returns
this vector

Definition at line 76 of file Vec.hh.

76 { return operator*=( 1.0 / d ); }
Vec & operator*=(double d)
Multiply vector.
Definition: Vec.hh:68
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Vec Vec::operator- ( ) const
inlineinherited

Negate vector.

Returns
vector

Definition at line 83 of file Vec.hh.

83 { return Vec(-x,-y,-z); }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec()
Default constructor.
Definition: Vec.hh:28
bool Vec::operator== ( const Vec v) const
inlineinherited

Check equality with given vector.

Parameters
vvector
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 ; }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
bool Vec::operator!= ( const Vec v) const
inlineinherited

Check in-equality with given vector.

Parameters
vvector
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 ; }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec& Vec::set ( double  xx,
double  yy,
double  zz 
)
inlineinherited

Set vector.

Parameters
xxx position
yyy position
zzz position
Returns
this vector

Definition at line 109 of file Vec.hh.

109 { x=xx; y=yy; z=zz; return *this;}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec& Vec::set_angles ( double  theta,
double  phi 
)
inlineinherited

Set vector according given zenith and azimuth angles.

Parameters
thetazenith angle [rad]
phiazimuth angle [rad]
Returns
this vector

Definition at line 118 of file Vec.hh.

119  {
120  x = sin ( theta ) * cos( phi );
121  y = sin ( theta ) * sin( phi );
122  z = cos ( theta );
123  return *this;
124  }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double phi() const
Get azimuth angle.
Definition: Vec.hh:131
double x
Definition: Vec.hh:14
double theta() const
Get zenith angle.
Definition: Vec.hh:138
double Vec::phi ( ) const
inlineinherited

Get azimuth angle.

Returns
angle [rad]

Definition at line 131 of file Vec.hh.

131 { return atan2( y,x ); }
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
double Vec::theta ( ) const
inlineinherited

Get zenith angle.

Returns
angle [rad]

Definition at line 138 of file Vec.hh.

138 { return acos(z); }
double z
Definition: Vec.hh:14
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.
Definition: Vec.hh:36
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; }
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
Vec& Vec::normalize ( )
inlineinherited

Normalise this vector.

Returns
this vector

Definition at line 159 of file Vec.hh.

159 { return operator/=( len() ); }
double len() const
Get length.
Definition: Vec.hh:145
Vec & operator/=(double d)
Divide vector.
Definition: Vec.hh:76
void Vec::print ( std::ostream &  out = std::cout) const
inlineinherited

Print vector.

Parameters
outoutput stream

Definition at line 166 of file Vec.hh.

167  {
168  out << "Vec:" << x << " " << y << " " << z;
169  }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
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 
182  print(s);
183 
184  buffer = s.str();
185 
186  return buffer.c_str();
187  }
void print(std::ostream &out=std::cout) const
Print vector.
Definition: Vec.hh:166
Vec Vec::__add__ ( const Vec v) const
inlineinherited

Add vector.

Parameters
vvector
Returns
vector

Definition at line 195 of file Vec.hh.

195 { Vec r=*this; return r+=v; }
data_type r[M+1]
Definition: JPolint.hh:742
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
data_type v[N+1][M+1]
Definition: JPolint.hh:740
Vec Vec::__sub__ ( const Vec v) const
inlineinherited

Subtract vector.

Parameters
vvector
Returns
vector

Definition at line 203 of file Vec.hh.

203 { Vec r=*this; return r-=v; }
data_type r[M+1]
Definition: JPolint.hh:742
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
data_type v[N+1][M+1]
Definition: JPolint.hh:740
Vec Vec::__mul__ ( double  d) const
inlineinherited

Multiply vector.

Parameters
dfactor
Returns
vector

Definition at line 211 of file Vec.hh.

211 { Vec r=*this; return r*=d; }
data_type r[M+1]
Definition: JPolint.hh:742
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Vec Vec::__rmul__ ( double  d) const
inlineinherited

Multiply vector.

Parameters
dfactor
Returns
vector

Definition at line 219 of file Vec.hh.

219 { return __mul__(d); }
Vec __mul__(double d) const
Multiply vector.
Definition: Vec.hh:211
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Vec Vec::__div__ ( double  d) const
inlineinherited

Divide vector.

Parameters
dfactor
Returns
vector

Definition at line 227 of file Vec.hh.

227 { Vec r=*this; return r/=d; }
data_type r[M+1]
Definition: JPolint.hh:742
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
Vec& Vec::rotate_z ( double  ang)
inlineinherited

Rotate around z-axis with given angle.

Parameters
angangle [rad]
Returns
this vector

Definition at line 235 of file Vec.hh.

236  {
237  const Vec o = *this;
238  x = o.x *cos(ang) - o.y * sin(ang);
239  y = o.x *sin(ang) + o.y * cos(ang);
240  z = o.z;
241  return *this;
242  }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JConvertDetectorFormat a $DETECTOR[1] o
Vec& Vec::rotate_x ( double  ang)
inlineinherited

Rotate around x-axis with given angle.

Parameters
angangle [rad]
Returns
this vector

Definition at line 250 of file Vec.hh.

251  {
252  const Vec o = *this;
253  x = o.x;
254  y = o.y *cos(ang) + o.z * -sin(ang);
255  z = o.y *sin(ang) + o.z * cos(ang);
256  return *this;
257  }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JConvertDetectorFormat a $DETECTOR[1] o
Vec& Vec::rotate_y ( double  ang)
inlineinherited

Rotate around y-axis with given angle.

Parameters
angangle [rad]
Returns
this vector

Definition at line 265 of file Vec.hh.

266  {
267  const Vec o = *this;
268  x = o.x *cos(ang) + o.z * sin(ang);
269  y = o.y;
270  z = -o.x *sin(ang) + o.z * cos(ang);
271  return *this;
272  }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JConvertDetectorFormat a $DETECTOR[1] o

Member Data Documentation

double Vec::x
inherited

Definition at line 14 of file Vec.hh.

double Vec::y
inherited

Definition at line 14 of file Vec.hh.

double Vec::z
inherited

Definition at line 14 of file Vec.hh.


The documentation for this struct was generated from the following file: