Jpp
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 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 30 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 39 of file JOmega3D.hh.

40  {
41  double dot = -1.0;
42  int index = -1;
43 
44  for (const_iterator i = this->begin(); i != this->end(); ++i) {
45 
46  const double x = dir.getDot(*i);
47 
48  if (x > dot) {
49  dot = x;
50  index = std::distance(this->begin(), i);
51  }
52  }
53 
54  return index;
55  }

The documentation for this struct was generated from the following file:
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JGEOMETRY3D::JAngle3D::getDot
double getDot(const JAngle3D &angle) const
Get dot product.
Definition: JAngle3D.hh:227