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

Implementation of the JGenerator interface. More...

#include <JMarkovGenerator.hh>

Inheritance diagram for JMARKOV::JSingularityGenerator:
JMARKOV::JGenerator

Public Member Functions

 JSingularityGenerator (double _R, JPosition3D _x0)
 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 Attributes

const double R
 
const double C
 
JPosition3D x0
 

Detailed Description

Implementation of the JGenerator interface.

Generates positions according to a probability density proportional to 1/r^2 centered around some point.

Definition at line 237 of file JMarkovGenerator.hh.

Constructor & Destructor Documentation

JMARKOV::JSingularityGenerator::JSingularityGenerator ( double  _R,
JPosition3D  _x0 
)
inline

Constructor.

The argument is the maximal distance from _x0

Definition at line 243 of file JMarkovGenerator.hh.

243 : R(_R), C(1.0/(4*M_PI*R)), x0(_x0) {}

Member Function Documentation

JPosition3D JMARKOV::JSingularityGenerator::getPosition ( )
inlinevirtual

Return a randomly generated position.

Implements JMARKOV::JGenerator.

Definition at line 245 of file JMarkovGenerator.hh.

245  {
246  double r = gRandom->Uniform(0,R) ;
247  double x,y,z ;
248  gRandom->Sphere(x,y,z,r) ;
249  return JPosition3D(x,y,z)+x0 ;
250  }
data_type r[M+1]
Definition: JPolint.hh:868
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
double JMARKOV::JSingularityGenerator::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 252 of file JMarkovGenerator.hh.

252  {
253  pos -= x0 ;
254  if( pos.getLength()>R ) return 0.0 ;
255  return C/pos.getLengthSquared() ;
256  }
double getLength() const
Get length.
Definition: JVector3D.hh:246
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235

Member Data Documentation

const double JMARKOV::JSingularityGenerator::R
protected

Definition at line 260 of file JMarkovGenerator.hh.

const double JMARKOV::JSingularityGenerator::C
protected

Definition at line 261 of file JMarkovGenerator.hh.

JPosition3D JMARKOV::JSingularityGenerator::x0
protected

Definition at line 262 of file JMarkovGenerator.hh.


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