RooGrid is a utility class for RooMCIntegrator which implements an adaptive multi-dimensional Monte Carlo numerical integration, following the VEGAS algorithm.
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 | |
double & | coord (Int_t i, Int_t j) |
double & | newCoord (Int_t i) |
double & | value (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>
RooGrid::RooGrid | ( | const RooAbsFunc & | function | ) |
Constructor with given function binding.
Definition at line 43 of file RooGrid.cxx.
Add the specified amount to bin[j] of the 1D histograms associated with each axis j.
Definition at line 262 of file RooGrid.cxx.
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.
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.
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.
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.
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.
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.
void RooGrid::resetValues | ( | ) |
Reset the values associated with each grid cell.
Definition at line 145 of file RooGrid.cxx.
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |