Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Public Member Functions | Protected Attributes | List of all members
JMARKOV::JGaussianGenerator Class Reference

Implementation of the JGenerator interface. More...

#include <JMarkovGenerator.hh>

Inheritance diagram for JMARKOV::JGaussianGenerator:
JMARKOV::JGenerator

Public Member Functions

 JGaussianGenerator (double _sigma)
 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 sigma
 
double C
 

Detailed Description

Implementation of the JGenerator interface.

Generates positions according to a 3D Gaussian distribution centered around the origin.

Definition at line 368 of file JMarkovGenerator.hh.

Constructor & Destructor Documentation

◆ JGaussianGenerator()

JMARKOV::JGaussianGenerator::JGaussianGenerator ( double  _sigma)
inline

Constructor.

The argument is the width of the gaussian.

Definition at line 374 of file JMarkovGenerator.hh.

374  : sigma(_sigma) {
375  C = 1.0 / ( 2*M_PI*sqrt(2*M_PI) * sigma * sigma * sigma ) ;
376  }

Member Function Documentation

◆ getPosition()

JPosition3D JMARKOV::JGaussianGenerator::getPosition ( )
inlinevirtual

Return a randomly generated position.

Implements JMARKOV::JGenerator.

Definition at line 378 of file JMarkovGenerator.hh.

378  {
379  double x = gRandom->Gaus(0,sigma) ;
380  double y = gRandom->Gaus(0,sigma) ;
381  double z = gRandom->Gaus(0,sigma) ;
382  return JPosition3D(x,y,z) ;
383  }
Data structure for position in three dimensions.
Definition: JPosition3D.hh:38

◆ getWeight()

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

385  {
386  return C*exp(-0.5*pos.getLengthSquared()/(sigma*sigma)) ;
387  }
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235

Member Data Documentation

◆ sigma

const double JMARKOV::JGaussianGenerator::sigma
protected

Definition at line 391 of file JMarkovGenerator.hh.

◆ C

double JMARKOV::JGaussianGenerator::C
protected

Definition at line 392 of file JMarkovGenerator.hh.


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