Jpp  16.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JMARKOV::JBallGenerator Class Reference

Implementation of the JGenerator interface. More...

#include <JMarkovGenerator.hh>

Inheritance diagram for JMARKOV::JBallGenerator:
JMARKOV::JGenerator

Public Member Functions

 JBallGenerator (double _R)
 Constructor. More...
 
JPosition3D getPosition ()
 Return a randomly generated position. More...
 
double getWeight (JPosition3D pos)
 return the weight (=probability density dP/dV) for the given position. More...
 

Protected Member Functions

void setVolume ()
 

Protected Attributes

const double R
 
const double Rcube
 
double V
 

Detailed Description

Implementation of the JGenerator interface.

Generates positions uniformly within a ball of a given radius centered around the origin.

Definition at line 110 of file JMarkovGenerator.hh.

Constructor & Destructor Documentation

JMARKOV::JBallGenerator::JBallGenerator ( double  _R)
inline

Constructor.

The argument is the radius of the ball.

Definition at line 116 of file JMarkovGenerator.hh.

116  : R(_R), Rcube(_R*_R*_R) {
117  setVolume() ;
118  }

Member Function Documentation

JPosition3D JMARKOV::JBallGenerator::getPosition ( )
inlinevirtual

Return a randomly generated position.

Implements JMARKOV::JGenerator.

Definition at line 120 of file JMarkovGenerator.hh.

120  {
121  double rcube = gRandom->Uniform(0,Rcube) ;
122  double r = pow(rcube,1.0/3.0) ;
123  double x,y,z ;
124  gRandom->Sphere(x,y,z,r) ;
125  return JPosition3D(x,y,z) ;
126  }
data_type r[M+1]
Definition: JPolint.hh:758
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:98
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
double JMARKOV::JBallGenerator::getWeight ( JPosition3D  pos)
inlinevirtual

return the weight (=probability density dP/dV) for the given position.

When the generator is properly normalized, the integral of this quantity over the whole space is 1.

Implements JMARKOV::JGenerator.

Definition at line 128 of file JMarkovGenerator.hh.

128  {
129  if( pos.getLength()>R ) return 0.0 ;
130  return 1.0/V ;
131  }
double getLength() const
Get length.
Definition: JVector3D.hh:246
void JMARKOV::JBallGenerator::setVolume ( )
inlineprotected

Definition at line 135 of file JMarkovGenerator.hh.

135 { V = 4.0/3.0*M_PI*Rcube ; }

Member Data Documentation

const double JMARKOV::JBallGenerator::R
protected

Definition at line 137 of file JMarkovGenerator.hh.

const double JMARKOV::JBallGenerator::Rcube
protected

Definition at line 138 of file JMarkovGenerator.hh.

double JMARKOV::JBallGenerator::V
protected

Definition at line 139 of file JMarkovGenerator.hh.


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