Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooGrid Class Reference

RooGrid is a utility class for RooMCIntegrator which implements an adaptive multi-dimensional Monte Carlo numerical integration, following the VEGAS algorithm.

Definition at line 27 of file RooGrid.h.

Public Types

enum  { maxBins = 50 }
 

Public Member Functions

 RooGrid ()
 
 RooGrid (const RooAbsFunc &function)
 Constructor with given function binding.
 
void accumulate (const UInt_t bin[], double amount)
 Add the specified amount to bin[j] of the 1D histograms associated with each axis j.
 
double coord (Int_t i, Int_t j) const
 
void firstBox (UInt_t box[]) const
 Reset the specified array of box indices to refer to the first box in the standard traversal order.
 
void generatePoint (const UInt_t box[], double x[], UInt_t bin[], double &vol, bool useQuasiRandom=true) const
 Generate a random vector in the specified box and store its coordinates in the x[] array provided, the corresponding bin indices in the bin[] array, and the volume of this bin in vol.
 
UInt_t getDimension () const
 
UInt_t getNBins () const
 
UInt_t getNBoxes () const
 
double getVolume () const
 
bool initialize (const RooAbsFunc &function)
 Calculate and store the grid dimensions and volume using the specified function, and initialize the grid using a single bin.
 
bool isValid () const
 
bool nextBox (UInt_t box[]) const
 Update the specified array of box indices to refer to the next box in the standard traversal order and return true, or else return false if we the indices already refer to the last box.
 
void print (std::ostream &os, bool verbose=false, std::string const &indent="") const
 Print info about this object to the specified stream.
 
void refine (double alpha=1.5)
 Refine the grid using the values that have been accumulated so far.
 
void resetValues ()
 Reset the values associated with each grid cell.
 
void resize (UInt_t bins)
 Adjust the subdivision of each axis to give the specified number of bins, using an algorithm that preserves relative bin density.
 
void setNBoxes (UInt_t boxes)
 
double value (Int_t i, Int_t j) const
 

Protected Member Functions

doublecoord (Int_t i, Int_t j)
 
doublenewCoord (Int_t i)
 
doublevalue (Int_t i, Int_t j)
 

Protected Attributes

UInt_t _bins = 0
 Number of bins.
 
UInt_t _boxes = 0
 Numbser of boxes.
 
std::vector< double_d
 ! Internal workspace
 
std::vector< double_delx
 ! Internal workspace
 
UInt_t _dim = 0
 Number of dimensions, bins and boxes.
 
bool _valid = false
 Is configuration valid.
 
double _vol = 0.0
 Volume.
 
std::vector< double_weight
 ! Internal workspace
 
std::vector< double_xi
 ! Internal workspace
 
std::vector< double_xin
 ! Internal workspace
 
std::vector< double_xl
 ! Internal workspace
 
std::vector< double_xu
 ! Internal workspace
 

#include <RooGrid.h>

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
maxBins 

Definition at line 53 of file RooGrid.h.

Constructor & Destructor Documentation

◆ RooGrid() [1/2]

RooGrid::RooGrid ( )
inline

Definition at line 29 of file RooGrid.h.

◆ RooGrid() [2/2]

RooGrid::RooGrid ( const RooAbsFunc function)

Constructor with given function binding.

Definition at line 43 of file RooGrid.cxx.

Member Function Documentation

◆ accumulate()

void RooGrid::accumulate ( const UInt_t  bin[],
double  amount 
)

Add the specified amount to bin[j] of the 1D histograms associated with each axis j.

Definition at line 262 of file RooGrid.cxx.

◆ coord() [1/2]

double & RooGrid::coord ( Int_t  i,
Int_t  j 
)
inlineprotected

Definition at line 60 of file RooGrid.h.

◆ coord() [2/2]

double RooGrid::coord ( Int_t  i,
Int_t  j 
) const
inline

Definition at line 56 of file RooGrid.h.

◆ firstBox()

void RooGrid::firstBox ( UInt_t  box[]) const

Reset the specified array of box indices to refer to the first box in the standard traversal order.

Definition at line 210 of file RooGrid.cxx.

◆ generatePoint()

void RooGrid::generatePoint ( const UInt_t  box[],
double  x[],
UInt_t  bin[],
double vol,
bool  useQuasiRandom = true 
) const

Generate a random vector in the specified box and store its coordinates in the x[] array provided, the corresponding bin indices in the bin[] array, and the volume of this bin in vol.

The box is specified by the array box[] of box integer indices that each range from 0 to getNBoxes()-1.

Definition at line 162 of file RooGrid.cxx.

◆ getDimension()

UInt_t RooGrid::getDimension ( ) const
inline

Definition at line 36 of file RooGrid.h.

◆ getNBins()

UInt_t RooGrid::getNBins ( ) const
inline

Definition at line 38 of file RooGrid.h.

◆ getNBoxes()

UInt_t RooGrid::getNBoxes ( ) const
inline

Definition at line 39 of file RooGrid.h.

◆ getVolume()

double RooGrid::getVolume ( ) const
inline

Definition at line 37 of file RooGrid.h.

◆ initialize()

bool RooGrid::initialize ( const RooAbsFunc function)

Calculate and store the grid dimensions and volume using the specified function, and initialize the grid using a single bin.

Return true, or else false if the range is not valid.

Definition at line 72 of file RooGrid.cxx.

◆ isValid()

bool RooGrid::isValid ( ) const
inline

Definition at line 35 of file RooGrid.h.

◆ newCoord()

double & RooGrid::newCoord ( Int_t  i)
inlineprotected

Definition at line 62 of file RooGrid.h.

◆ nextBox()

bool RooGrid::nextBox ( UInt_t  box[]) const

Update the specified array of box indices to refer to the next box in the standard traversal order and return true, or else return false if we the indices already refer to the last box.

Definition at line 222 of file RooGrid.cxx.

◆ print()

void RooGrid::print ( std::ostream &  os,
bool  verbose = false,
std::string const &  indent = "" 
) const

Print info about this object to the specified stream.

Definition at line 241 of file RooGrid.cxx.

◆ refine()

void RooGrid::refine ( double  alpha = 1.5)

Refine the grid using the values that have been accumulated so far.

The parameter alpha controls the stiffness of the rebinning and should usually be between 1 (stiffer) and 2 (more flexible). A value of zero prevents any rebinning.

Definition at line 274 of file RooGrid.cxx.

◆ resetValues()

void RooGrid::resetValues ( )

Reset the values associated with each grid cell.

Definition at line 145 of file RooGrid.cxx.

◆ resize()

void RooGrid::resize ( UInt_t  bins)

Adjust the subdivision of each axis to give the specified number of bins, using an algorithm that preserves relative bin density.

The new binning can be finer or coarser than the original binning.

Definition at line 108 of file RooGrid.cxx.

◆ setNBoxes()

void RooGrid::setNBoxes ( UInt_t  boxes)
inline

Definition at line 40 of file RooGrid.h.

◆ value() [1/2]

double & RooGrid::value ( Int_t  i,
Int_t  j 
)
inlineprotected

Definition at line 61 of file RooGrid.h.

◆ value() [2/2]

double RooGrid::value ( Int_t  i,
Int_t  j 
) const
inline

Definition at line 57 of file RooGrid.h.

Member Data Documentation

◆ _bins

UInt_t RooGrid::_bins = 0
protected

Number of bins.

Definition at line 66 of file RooGrid.h.

◆ _boxes

UInt_t RooGrid::_boxes = 0
protected

Numbser of boxes.

Definition at line 67 of file RooGrid.h.

◆ _d

std::vector<double> RooGrid::_d
protected

! Internal workspace

Definition at line 73 of file RooGrid.h.

◆ _delx

std::vector<double> RooGrid::_delx
protected

! Internal workspace

Definition at line 72 of file RooGrid.h.

◆ _dim

UInt_t RooGrid::_dim = 0
protected

Number of dimensions, bins and boxes.

Definition at line 65 of file RooGrid.h.

◆ _valid

bool RooGrid::_valid = false
protected

Is configuration valid.

Definition at line 64 of file RooGrid.h.

◆ _vol

double RooGrid::_vol = 0.0
protected

Volume.

Definition at line 68 of file RooGrid.h.

◆ _weight

std::vector<double> RooGrid::_weight
protected

! Internal workspace

Definition at line 76 of file RooGrid.h.

◆ _xi

std::vector<double> RooGrid::_xi
protected

! Internal workspace

Definition at line 74 of file RooGrid.h.

◆ _xin

std::vector<double> RooGrid::_xin
protected

! Internal workspace

Definition at line 75 of file RooGrid.h.

◆ _xl

std::vector<double> RooGrid::_xl
protected

! Internal workspace

Definition at line 70 of file RooGrid.h.

◆ _xu

std::vector<double> RooGrid::_xu
protected

! Internal workspace

Definition at line 71 of file RooGrid.h.

Libraries for RooGrid:

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