57 RooCategory samplingMode(
"samplingMode",
"Sampling Mode") ;
69 verbose.defineType(
"true",1) ;
70 verbose.defineType(
"false",0) ;
73 RooRealVar alpha(
"alpha",
"Grid structure constant",1.5) ;
74 RooRealVar nRefineIter(
"nRefineIter",
"Number of refining iterations",5) ;
75 RooRealVar nRefinePerDim(
"nRefinePerDim",
"Number of refining samples (per dimension)",1000) ;
76 RooRealVar nIntPerDim(
"nIntPerDim",
"Number of integration samples (per dimension)",5000) ;
111 _alpha(1.5), _mode(
mode), _genType(genType),
112 _nRefineIter(5),_nRefinePerDim(1000),_nIntegratePerDim(5000)
233 bins= boxes/box_per_bin;
235 boxes = box_per_bin * bins;
236 oocxcoutD((
TObject*)0,Integration) <<
"RooMCIntegrator: using stratified sampling with " << bins <<
" bins and "
237 << box_per_bin <<
" boxes/bin" << endl;
240 oocxcoutD((
TObject*)0,Integration) <<
"RooMCIntegrator: using importance sampling with " << bins <<
" bins and "
241 << boxes <<
" boxes" << endl;
246 double tot_boxes =
TMath::Power((
double)boxes,(
double)dim);
268 double cum_int(0),cum_sig(0);
271 for (
UInt_t it = 0; it < iterations; it++) {
272 double intgrl(0),intgrl_sq(0),sig(0),jacbin(
_jac);
289 double fval= jacbin*bin_vol*
integrand(
x.data());
293 q+=
d *
d * (k / (k + 1.0));
306 std::size_t
index = 0;
307 std::size_t sizeOfDim = 1;
313 coutP(Integration) <<
"RooMCIntegrator: still working ... iteration "
335 intgrl_sq = intgrl * intgrl;
353 cum_int += (intgrl - cum_int) / (it + 1.0);
356 oocxcoutD((
TObject*)0,Integration) <<
"=== Iteration " <<
_it_num <<
" : I = " << intgrl <<
" +/- " << sqrt(sig) << endl
357 <<
" Cumulative : I = " << cum_int <<
" +/- " << cum_sig <<
"( chi2 = " <<
_chisq
361 if(it + 1 == iterations)
_grid.
print(std::cout,
true);
366 if(absError) *absError = cum_sig;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char mode
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
Int_t getCatIndex(const char *name, Int_t defVal=0, bool verbose=false) const
Get index value of a RooAbsCategory stored in set with given name.
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
const RooAbsFunc * _function
Pointer to function binding of integrand.
const RooAbsFunc * integrand() const
Return integrand function binding.
bool _valid
Is integrator in valid state?
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory is an object to represent discrete states.
bool setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code of the desired state.
bool defineType(const std::string &label)
Define a state with given name.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
UInt_t getDimension() const
bool initialize(const RooAbsFunc &function)
Calculate and store the grid dimensions and volume using the specified function, and initialize the g...
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,...
void resetValues()
Reset the values associated with each grid cell.
void accumulate(const UInt_t bin[], double amount)
Add the specified amount to bin[j] of the 1D histograms associated with each axis j.
bool nextBox(UInt_t box[]) const
Update the specified array of box indices to refer to the next box in the standard traversal order an...
void resize(UInt_t bins)
Adjust the subdivision of each axis to give the specified number of bins, using an algorithm that pre...
void setNBoxes(UInt_t boxes)
void refine(double alpha=1.5)
Refine the grid using the values that have been accumulated so far.
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 print(std::ostream &os, bool verbose=false, std::string const &indent="") const
Print info about this object to the specified stream.
RooMCIntegrator implements an adaptive multi-dimensional Monte Carlo numerical integration,...
GeneratorType _genType
Generator type.
RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const override
Return clone of this generator operating on given function with given configuration Needed to support...
RooMCIntegrator()
Default constructor.
static void registerIntegrator(RooNumIntFactory &fact)
This function registers class RooMCIntegrator, its configuration options and its capabilities with Ro...
Int_t _nIntegratePerDim
Number of integration samplings (per dim)
~RooMCIntegrator() override
Destructor.
bool checkLimits() const override
Check if we can integrate over the current domain.
double _sigma
Scratch variables preserved between calls to vegas1/2/2.
double vegas(Stage stage, UInt_t calls, UInt_t iterations, double *absError=nullptr)
Perform one step of Monte Carlo integration using the specified number of iterations with (approximat...
bool _verbose
Verbosity control.
Int_t _mode
Sampling mode.
Int_t _nRefinePerDim
Number of refinement samplings (per dim)
double _alpha
Grid stiffness parameter.
UInt_t _calls_per_box
Scratch variables preserved between calls to vegas1/2/2.
Int_t _nRefineIter
Number of refinement iterations.
double integral(const double *yvec=nullptr) override
Evaluate the integral using a fixed number of calls to evaluate the integrand equal to about 10k per ...
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
static RooNumIntConfig & defaultConfig()
Return reference to instance of default numeric integrator configuration object.
RooNumIntFactory is a factory to instantiate numeric integrators from a given function binding and a ...
bool storeProtoIntegrator(RooAbsIntegrator *proto, const RooArgSet &defConfig, const char *depName="")
Method accepting registration of a prototype numeric integrator along with a RooArgSet of its default...
RooRealVar represents a variable that can be changed from the outside.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.