Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
JPosition3D getPosition ()
 Return a randomly generated position.
 
double getWeight (JPosition3D pos)
 return the weight (=probability density dP/dV) for the given position.
 

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 241 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 247 of file JMarkovGenerator.hh.

247: 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 249 of file JMarkovGenerator.hh.

249 {
250 double r = gRandom->Uniform(0,R) ;
251 double x,y,z ;
252 gRandom->Sphere(x,y,z,r) ;
253 return JPosition3D(x,y,z)+x0 ;
254 }

◆ 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 256 of file JMarkovGenerator.hh.

256 {
257 pos -= x0 ;
258 if( pos.getLength()>R ) return 0.0 ;
259 return C/pos.getLengthSquared() ;
260 }
double getLengthSquared() const
Get length squared.
Definition JVector3D.hh:235

Member Data Documentation

◆ R

const double JMARKOV::JSingularityGenerator::R
protected

Definition at line 264 of file JMarkovGenerator.hh.

◆ C

const double JMARKOV::JSingularityGenerator::C
protected

Definition at line 265 of file JMarkovGenerator.hh.

◆ x0

JPosition3D JMARKOV::JSingularityGenerator::x0
protected

Definition at line 266 of file JMarkovGenerator.hh.


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