Jpp  19.1.0-rc.1
the software that should make you happy
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JMARKOV::JUniformGenerator Class Reference

Implementation of the JGenerator interface. More...

#include <JMarkovGenerator.hh>

Inheritance diagram for JMARKOV::JUniformGenerator:
JMARKOV::JGenerator

Public Member Functions

 JUniformGenerator (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Constructor. More...
 
 JUniformGenerator (JPosition3D _posmin, JPosition3D _posmax)
 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 Member Functions

void setVolume ()
 

Protected Attributes

JPosition3D posmin
 
JPosition3D posmax
 
double V
 

Detailed Description

Implementation of the JGenerator interface.

Generates positions uniformly within a rectangular cuboid,

Definition at line 64 of file JMarkovGenerator.hh.

Constructor & Destructor Documentation

◆ JUniformGenerator() [1/2]

JMARKOV::JUniformGenerator::JUniformGenerator ( double  xmin,
double  ymin,
double  zmin,
double  xmax,
double  ymax,
double  zmax 
)
inline

Constructor.

The arguments are the limits of each coordinate.

Definition at line 71 of file JMarkovGenerator.hh.

71  : posmin(xmin,ymin,zmin), posmax(xmax,ymax,zmax) {
72  setVolume() ;
73  }
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23

◆ JUniformGenerator() [2/2]

JMARKOV::JUniformGenerator::JUniformGenerator ( JPosition3D  _posmin,
JPosition3D  _posmax 
)
inline

Constructor.

The arguments are the 'lower left bottom' corner and the 'upper right top' corner.

Definition at line 79 of file JMarkovGenerator.hh.

79  : posmin(_posmin), posmax(_posmax) {
80  setVolume() ;
81  }

Member Function Documentation

◆ getPosition()

JPosition3D JMARKOV::JUniformGenerator::getPosition ( )
inlinevirtual

Return a randomly generated position.

Implements JMARKOV::JGenerator.

Definition at line 83 of file JMarkovGenerator.hh.

83  {
84  double x = gRandom->Uniform( posmin.getX(), posmax.getX() ) ;
85  double y = gRandom->Uniform( posmin.getY(), posmax.getY() ) ;
86  double z = gRandom->Uniform( posmin.getZ(), posmax.getZ() ) ;
87  return JPosition3D(x,y,z) ;
88  }
Data structure for position in three dimensions.
Definition: JPosition3D.hh:38
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double getX() const
Get x position.
Definition: JVector3D.hh:94

◆ getWeight()

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

90  {
91  if( pos.getX() < posmin.getX() || pos.getX() > posmax.getX() ) return 0.0 ;
92  if( pos.getY() < posmin.getY() || pos.getY() > posmax.getY() ) return 0.0 ;
93  if( pos.getZ() < posmin.getZ() || pos.getZ() > posmax.getZ() ) return 0.0 ;
94  return 1.0/V ;
95  }

◆ setVolume()

void JMARKOV::JUniformGenerator::setVolume ( )
inlineprotected

Definition at line 99 of file JMarkovGenerator.hh.

99  {
100  V = (posmax.getX()-posmin.getX())*(posmax.getY()-posmin.getY())*(posmax.getZ()-posmin.getZ()) ;
101  }

Member Data Documentation

◆ posmin

JPosition3D JMARKOV::JUniformGenerator::posmin
protected

Definition at line 103 of file JMarkovGenerator.hh.

◆ posmax

JPosition3D JMARKOV::JUniformGenerator::posmax
protected

Definition at line 104 of file JMarkovGenerator.hh.

◆ V

double JMARKOV::JUniformGenerator::V
protected

Definition at line 105 of file JMarkovGenerator.hh.


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