Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
JGEOMETRY3D::JVersor3D Class Reference

Data structure for normalised vector in three dimensions. More...

#include <JVersor3D.hh>

Inheritance diagram for JGEOMETRY3D::JVersor3D:
JMATH::JMath< JVersor3D > JGEOMETRY3D::JDirection3D JGEOMETRY3D::JAxis3D JDETECTOR::JPMT JGEOMETRY3D::JTrack3D JTRIGGER::JHitL0 JTRIGGER::JPMTHeader JFIT::JPMTW0 JGEOMETRY3D::JTrack3E JFIT::JHitW0 JTRIGGER::JFrame< JElement_t > JTRIGGER::JFrame< JElement_t, JAllocator_t > JTRIGGER::JFrameClone< JElement_t >

Public Member Functions

 JVersor3D ()
 Default constructor. More...
 
 JVersor3D (const double dx, const double dy, const double dz)
 Constructor. More...
 
JVersor3Dnegate ()
 Negate versor. More...
 
bool equals (const JVersor3D &versor) const
 Check equality. More...
 
double getDX () const
 Get x direction. More...
 
double getDY () const
 Get y direction. More...
 
double getDZ () const
 Get z direction. More...
 
double getTheta () const
 Get theta angle. More...
 
double getPhi () const
 Get phi angle. More...
 
double getDot (const JVersor3D &versor) const
 Get dot product. More...
 
JVersor3Dnormalise ()
 Normalise versor. More...
 
JVersor3Dmul (const JNullType &object)
 Multiply with object. More...
 

Protected Attributes

double __dx
 
double __dy
 
double __dz
 

Detailed Description

Data structure for normalised vector in three dimensions.

Definition at line 23 of file JVersor3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JVersor3D::JVersor3D ( )
inline

Default constructor.

This constructor yields a unit z-vector.

Definition at line 31 of file JVersor3D.hh.

31  :
32  __dx(0.0),
33  __dy(0.0),
34  __dz(1.0)
35  {}
JGEOMETRY3D::JVersor3D::JVersor3D ( const double  dx,
const double  dy,
const double  dz 
)
inline

Constructor.

Parameters
dxdx value
dydy value
dzdz value

Definition at line 45 of file JVersor3D.hh.

47  :
48  __dx(dx),
49  __dy(dy),
50  __dz(dz)
51  {
52  normalise();
53  }
JVersor3D & normalise()
Normalise versor.
Definition: JVersor3D.hh:166

Member Function Documentation

JVersor3D& JGEOMETRY3D::JVersor3D::negate ( )
inline

Negate versor.

Returns
this versor

Definition at line 61 of file JVersor3D.hh.

62  {
63  __dx = -__dx;
64  __dy = -__dy;
65  __dz = -__dz;
66 
67  return *this;
68  }
bool JGEOMETRY3D::JVersor3D::equals ( const JVersor3D versor) const
inline

Check equality.

Parameters
versorversor
Returns
true if versors are equal; else false

Definition at line 77 of file JVersor3D.hh.

78  {
79  return (getDX() == versor.getDX() &&
80  getDY() == versor.getDY() &&
81  getDZ() == versor.getDZ());
82  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
double JGEOMETRY3D::JVersor3D::getDX ( ) const
inline

Get x direction.

Returns
x direction

Definition at line 90 of file JVersor3D.hh.

91  {
92  return __dx;
93  }
double JGEOMETRY3D::JVersor3D::getDY ( ) const
inline

Get y direction.

Returns
y direction

Definition at line 101 of file JVersor3D.hh.

102  {
103  return __dy;
104  }
double JGEOMETRY3D::JVersor3D::getDZ ( ) const
inline

Get z direction.

Returns
z direction

Definition at line 112 of file JVersor3D.hh.

113  {
114  return __dz;
115  }
double JGEOMETRY3D::JVersor3D::getTheta ( ) const
inline

Get theta angle.

Returns
theta angle [rad]

Definition at line 123 of file JVersor3D.hh.

124  {
125  if (__dz > +1.0)
126  return 0.0;
127  else if (__dz < -1.0)
128  return JTOOLS::PI;
129  else
130  return acos(__dz);
131  }
static const double PI
Constants.
Definition: JConstants.hh:20
double JGEOMETRY3D::JVersor3D::getPhi ( ) const
inline

Get phi angle.

Returns
phi angle [rad]

Definition at line 139 of file JVersor3D.hh.

140  {
141  return atan2(__dy, __dx);
142  }
double JGEOMETRY3D::JVersor3D::getDot ( const JVersor3D versor) const
inline

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 151 of file JVersor3D.hh.

152  {
153  return
154  getDX() * versor.getDX() +
155  getDY() * versor.getDY() +
156  getDZ() * versor.getDZ();
157  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
JVersor3D& JGEOMETRY3D::JVersor3D::normalise ( )
inline

Normalise versor.

This operation may set the result to the unit z-vector.

Returns
this versor

Definition at line 166 of file JVersor3D.hh.

167  {
168  const double v = sqrt(getDX()*getDX() + getDY()*getDY() + getDZ()*getDZ());
169 
170  if (v != 0.0) {
171  __dx /= v;
172  __dy /= v;
173  __dz /= v;
174  }
175 
176  return *this;
177  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
JVersor3D & JMATH::JMath< JVersor3D , JNullType >::mul ( const JNullType object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
Auxiliary class for product evaluation of objects.
Definition: JCalculator.hh:18

Member Data Documentation

double JGEOMETRY3D::JVersor3D::__dx
protected

Definition at line 180 of file JVersor3D.hh.

double JGEOMETRY3D::JVersor3D::__dy
protected

Definition at line 181 of file JVersor3D.hh.

double JGEOMETRY3D::JVersor3D::__dz
protected

Definition at line 182 of file JVersor3D.hh.


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