Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Public Types | Public Member Functions | List of all members
JGEOMETRY3D::JOmega3D_t Struct Reference

Base class for direction set. More...

#include <JOmega3D.hh>

Inheritance diagram for JGEOMETRY3D::JOmega3D_t:
std::vector< JAngle3D > JGEOMETRY3D::JOmega3D

Public Types

typedef std::pair< double, double > range_type
 

Public Member Functions

int find (const JAngle3D &dir) const
 Get index of direction closest to given direction. More...
 

Detailed Description

Base class for direction set.

Definition at line 29 of file JOmega3D.hh.

Member Typedef Documentation

◆ range_type

Definition at line 32 of file JOmega3D.hh.

Member Function Documentation

◆ find()

int JGEOMETRY3D::JOmega3D_t::find ( const JAngle3D dir) const
inline

Get index of direction closest to given direction.

Parameters
dirdirection
Returns
index (-1 if error)

Definition at line 41 of file JOmega3D.hh.

42  {
43  double dot = -1.0;
44  int index = -1;
45 
46  for (const_iterator i = this->begin(); i != this->end(); ++i) {
47 
48  const double x = dir.getDot(*i);
49 
50  if (x > dot) {
51  dot = x;
52  index = std::distance(this->begin(), i);
53  }
54  }
55 
56  return index;
57  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
double getDot(const JAngle3D &angle) const
Get dot product.
Definition: JAngle3D.hh:230

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