Jpp  16.0.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 60 of file JMarkovGenerator.hh.

Constructor & Destructor Documentation

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

67  : posmin(xmin,ymin,zmin), posmax(xmax,ymax,zmax) {
68  setVolume() ;
69  }
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 75 of file JMarkovGenerator.hh.

75  : posmin(_posmin), posmax(_posmax) {
76  setVolume() ;
77  }

Member Function Documentation

JPosition3D JMARKOV::JUniformGenerator::getPosition ( )
inlinevirtual

Return a randomly generated position.

Implements JMARKOV::JGenerator.

Definition at line 79 of file JMarkovGenerator.hh.

79  {
80  double x = gRandom->Uniform( posmin.getX(), posmax.getX() ) ;
81  double y = gRandom->Uniform( posmin.getY(), posmax.getY() ) ;
82  double z = gRandom->Uniform( posmin.getZ(), posmax.getZ() ) ;
83  return JPosition3D(x,y,z) ;
84  }
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getX() const
Get x position.
Definition: JVector3D.hh:94
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
double getZ() const
Get z position.
Definition: JVector3D.hh:115
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 86 of file JMarkovGenerator.hh.

86  {
87  if( pos.getX() < posmin.getX() || pos.getX() > posmax.getX() ) return 0.0 ;
88  if( pos.getY() < posmin.getY() || pos.getY() > posmax.getY() ) return 0.0 ;
89  if( pos.getZ() < posmin.getZ() || pos.getZ() > posmax.getZ() ) return 0.0 ;
90  return 1.0/V ;
91  }
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getZ() const
Get z position.
Definition: JVector3D.hh:115
void JMARKOV::JUniformGenerator::setVolume ( )
inlineprotected

Definition at line 95 of file JMarkovGenerator.hh.

95  {
97  }
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getZ() const
Get z position.
Definition: JVector3D.hh:115

Member Data Documentation

JPosition3D JMARKOV::JUniformGenerator::posmin
protected

Definition at line 99 of file JMarkovGenerator.hh.

JPosition3D JMARKOV::JUniformGenerator::posmax
protected

Definition at line 100 of file JMarkovGenerator.hh.

double JMARKOV::JUniformGenerator::V
protected

Definition at line 101 of file JMarkovGenerator.hh.


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