Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JMARKOV::JExpRsqInvGenerator Class Reference

Implementation of the JGenerator interface. More...

#include <JMarkovGenerator.hh>

Inheritance diagram for JMARKOV::JExpRsqInvGenerator:
JMARKOV::JGenerator

Public Member Functions

 JExpRsqInvGenerator (double _lambda)
 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 lambda
 

Detailed Description

Implementation of the JGenerator interface.

Generates positions according to the distribution

1/r^2 exp(-r/lambda)

around the origin.

Definition at line 155 of file JMarkovGenerator.hh.

Constructor & Destructor Documentation

◆ JExpRsqInvGenerator()

JMARKOV::JExpRsqInvGenerator::JExpRsqInvGenerator ( double _lambda)
inline

Constructor.

The argument is the radius of the ball.

Definition at line 161 of file JMarkovGenerator.hh.

161: lambda(_lambda) {}

Member Function Documentation

◆ getPosition()

JPosition3D JMARKOV::JExpRsqInvGenerator::getPosition ( )
inlinevirtual

Return a randomly generated position.

Implements JMARKOV::JGenerator.

Definition at line 163 of file JMarkovGenerator.hh.

163 {
164 double xi = gRandom->Uniform() ;
165 double r = -lambda*log(1-xi) ;
166 double x,y,z ;
167 gRandom->Sphere(x,y,z,r) ;
168 return JPosition3D(x,y,z) ;
169 }

◆ getWeight()

double JMARKOV::JExpRsqInvGenerator::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 171 of file JMarkovGenerator.hh.

171 {
172 double r = pos.getLength() ;
173 return lambda*exp(-r/lambda)/(r*r*4*M_PI) ;
174 }

Member Data Documentation

◆ lambda

const double JMARKOV::JExpRsqInvGenerator::lambda
protected

Definition at line 178 of file JMarkovGenerator.hh.


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