Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 JUniformGenerator (JPosition3D _posmin, JPosition3D _posmax)
 Constructor.
 
JPosition3D getPosition ()
 Return a randomly generated position.
 
double getWeight (JPosition3D pos)
 return the weight (=probability density dP/dV) for the given position.
 

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 }

◆ 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 }
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 {
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: