Jpp  18.5.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
JGEOMETRY3D::JOmega3D Class Reference

Direction set covering (part of) solid angle. More...

#include <JOmega3D.hh>

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

Public Types

typedef std::pair< double, double > range_type
 

Public Member Functions

 JOmega3D ()
 Default constructor. More...
 
 JOmega3D (const JAngle3D &dir)
 Constructor. More...
 
 JOmega3D (const double grid)
 Constructor. More...
 
 JOmega3D (const JAngle3D &dir, const range_type &theta, const double grid)
 Constructor. More...
 
void configure (const JAngle3D &dir, const range_type &theta, const double grid)
 Configure direction set. More...
 
int find (const JAngle3D &dir) const
 Get index of direction closest to given direction. More...
 

Detailed Description

Direction set covering (part of) solid angle.


The set consists of approximately equally spaced directions.
In this, the spacing in azimuth angle is zenith angle dependent.

Definition at line 66 of file JOmega3D.hh.

Member Typedef Documentation

typedef std::pair<double, double> JGEOMETRY3D::JOmega3D_t::range_type
inherited

Definition at line 32 of file JOmega3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JOmega3D::JOmega3D ( )
inline

Default constructor.

Definition at line 73 of file JOmega3D.hh.

73  :
74  JOmega3D_t()
75  {}
Base class for direction set.
Definition: JOmega3D.hh:29
JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D dir)
inline

Constructor.

Parameters
dirdirection

Definition at line 83 of file JOmega3D.hh.

83  :
84  JOmega3D_t()
85  {
86  push_back(dir);
87  }
Base class for direction set.
Definition: JOmega3D.hh:29
JGEOMETRY3D::JOmega3D::JOmega3D ( const double  grid)
inline

Constructor.

Parameters
gridangular spacing [rad]

Definition at line 95 of file JOmega3D.hh.

95  :
96  JOmega3D_t()
97  {
98  configure(JAngle3D(0.0,0.0), range_type(0.0,PI), grid);
99  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:33
std::pair< double, double > range_type
Definition: JOmega3D.hh:32
static const double PI
Mathematical constants.
void configure(const JAngle3D &dir, const range_type &theta, const double grid)
Configure direction set.
Definition: JOmega3D.hh:126
Base class for direction set.
Definition: JOmega3D.hh:29
JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D dir,
const range_type theta,
const double  grid 
)
inline

Constructor.

Parameters
dirprincipal direction
thetapolar angle range [rad]
gridangular spacing [rad]

Definition at line 110 of file JOmega3D.hh.

112  :
113  JOmega3D_t()
114  {
115  configure(dir, theta, grid);
116  }
void configure(const JAngle3D &dir, const range_type &theta, const double grid)
Configure direction set.
Definition: JOmega3D.hh:126
Base class for direction set.
Definition: JOmega3D.hh:29

Member Function Documentation

void JGEOMETRY3D::JOmega3D::configure ( const JAngle3D dir,
const range_type theta,
const double  grid 
)
inline

Configure direction set.

Parameters
dirprincipal direction
thetapolar angle range [rad]
gridangular spacing [rad]

Definition at line 126 of file JOmega3D.hh.

129  {
130  clear();
131 
132  // sanity checks
133 
134  double thetaMin = theta.first;
135  double thetaMax = theta.second;
136 
137  if (thetaMin < 0.0) { thetaMin = 0.0; }
138  if (thetaMin > PI) { thetaMin = PI; }
139  if (thetaMax < 0.0) { thetaMax = 0.0; }
140  if (thetaMax > PI) { thetaMax = PI; }
141 
142  if (thetaMax > thetaMin) {
143 
144  const JRotation3D R(dir);
145 
146  const double rad = thetaMax - thetaMin;
147  const double bin = rad / floor(rad/(1.4*grid) + 0.5); // polar angle step size
148  const double unit = 2.0 * sqrt(1.0 - cos(grid)); // azimuth angle unit step size
149 
150  for (double theta = thetaMin; theta < thetaMax + 0.5*bin; theta += bin) {
151 
152  double step;
153 
154  if (theta > 0.5*bin && PI - theta > 0.5*bin)
155  step = PI / floor(PI*sin(theta)/unit + 0.5); // polar angle dependent step size
156  else
157  step = 2.0*PI; // pole
158 
159  for (double phi = 0.0; phi < 2.0*PI - 0.5*step; phi += step) {
160  push_back(JDirection3D(JAngle3D(theta,phi)).rotate_back(R));
161  }
162  }
163  }
164  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:33
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:33
Rotation matrix.
Definition: JRotation3D.hh:111
then usage set_variable ACOUSTICS_WORKDIR $WORKDIR set_variable FORMULA sin([0]+2 *$PI *([1]+[2]*x)*x)" set_variable DY 1.0e-8 mkdir $WORKDIR for DETECTOR in $DETECTORS[*]
static const double PI
Mathematical constants.
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
int JGEOMETRY3D::JOmega3D_t::find ( const JAngle3D dir) const
inlineinherited

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 class was generated from the following file: