Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 Member Functions

 JOmega3D ()
 Default constructor. More...
 
 JOmega3D (const JAngle3D &dir)
 Constructor. More...
 
 JOmega3D (const double grid)
 Constructor. More...
 
 JOmega3D (const JAngle3D &dir, const JAngleRange &theta, const double grid)
 Constructor. More...
 
void configure (const JAngle3D &dir, const JAngleRange &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 64 of file JOmega3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JOmega3D::JOmega3D ( )
inline

Default constructor.

Definition at line 71 of file JOmega3D.hh.

71  :
72  JOmega3D_t()
73  {}
Base class for direction set.
Definition: JOmega3D.hh:30
JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D dir)
inline

Constructor.

Parameters
dirdirection

Definition at line 81 of file JOmega3D.hh.

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

Constructor.

Parameters
gridangular spacing [rad]

Definition at line 93 of file JOmega3D.hh.

93  :
94  JOmega3D_t()
95  {
96  configure(JAngle3D(0.0,0.0), JAngleRange(0.0,PI), grid);
97  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:31
void configure(const JAngle3D &dir, const JAngleRange &theta, const double grid)
Configure direction set.
Definition: JOmega3D.hh:124
JRange< double > JAngleRange
Type definition for angle range.
Definition: JAngleRange.hh:19
static const double PI
Constants.
Definition: JConstants.hh:20
Base class for direction set.
Definition: JOmega3D.hh:30
JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D dir,
const JAngleRange &  theta,
const double  grid 
)
inline

Constructor.

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

Definition at line 108 of file JOmega3D.hh.

110  :
111  JOmega3D_t()
112  {
113  configure(dir, theta, grid);
114  }
void configure(const JAngle3D &dir, const JAngleRange &theta, const double grid)
Configure direction set.
Definition: JOmega3D.hh:124
Base class for direction set.
Definition: JOmega3D.hh:30

Member Function Documentation

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

Configure direction set.

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

Definition at line 124 of file JOmega3D.hh.

127  {
128  clear();
129 
130  // sanity checks
131 
132  double thetaMin = theta.getLowerLimit();
133  double thetaMax = theta.getUpperLimit();
134 
135  if (thetaMin < 0.0) { thetaMin = 0.0; }
136  if (thetaMin > PI) { thetaMin = PI; }
137  if (thetaMax < 0.0) { thetaMax = 0.0; }
138  if (thetaMax > PI) { thetaMax = PI; }
139 
140  if (thetaMax > thetaMin) {
141 
142  const JRotation3D R(dir);
143 
144  const double rad = thetaMax - thetaMin;
145  const double bin = rad / floor(rad/(1.4*grid) + 0.5); // polar angle step size
146  const double unit = 2.0 * sqrt(1.0 - cos(grid)); // azimuth angle unit step size
147 
148  for (double theta = thetaMin; theta < thetaMax + 0.5*bin; theta += bin) {
149 
150  double step;
151 
152  if (theta > 0.5*bin && PI - theta > 0.5*bin)
153  step = PI / floor(PI*sin(theta)/unit + 0.5); // polar angle dependent step size
154  else
155  step = 2.0*PI; // pole
156 
157  for (double phi = 0.0; phi < 2.0*PI - 0.5*step; phi += step) {
158  push_back(JDirection3D(JAngle3D(theta,phi)).rotate_back(R));
159  }
160  }
161  }
162  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:31
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
Rotation matrix.
Definition: JRotation3D.hh:111
static const double PI
Constants.
Definition: JConstants.hh:20
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
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 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  }
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:228

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