Jpp
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

◆ JSingularityGenerator()

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

◆ getPosition()

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  }

◆ getWeight()

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  }

Member Data Documentation

◆ R

const double JMARKOV::JSingularityGenerator::R
protected

Definition at line 260 of file JMarkovGenerator.hh.

◆ C

const double JMARKOV::JSingularityGenerator::C
protected

Definition at line 261 of file JMarkovGenerator.hh.

◆ x0

JPosition3D JMARKOV::JSingularityGenerator::x0
protected

Definition at line 262 of file JMarkovGenerator.hh.


The documentation for this class was generated from the following file:
JMARKOV::JSingularityGenerator::x0
JPosition3D x0
Definition: JMarkovGenerator.hh:262
JGEOMETRY3D::JVector3D::getLengthSquared
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:234
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JMARKOV::JSingularityGenerator::R
const double R
Definition: JMarkovGenerator.hh:260
JMARKOV::JSingularityGenerator::C
const double C
Definition: JMarkovGenerator.hh:261
JTOOLS::r
data_type r[M+1]
Definition: JPolint.hh:709
JGEOMETRY3D::JVector3D::getLength
double getLength() const
Get length.
Definition: JVector3D.hh:245