57 samplingMode.defineType(
"Importance",RooMCIntegrator::Importance) ;
58 samplingMode.defineType(
"ImportanceOnly",RooMCIntegrator::ImportanceOnly) ;
59 samplingMode.defineType(
"Stratified",RooMCIntegrator::Stratified) ;
63 genType.defineType(
"QuasiRandom",RooMCIntegrator::QuasiRandom) ;
64 genType.defineType(
"PseudoRandom",RooMCIntegrator::PseudoRandom) ;
65 genType.setIndex(RooMCIntegrator::QuasiRandom) ;
72 RooRealVar alpha(
"alpha",
"Grid structure constant",1.5) ;
79 return std::make_unique<RooMCIntegrator>(function,config);
83 std::string
name =
"RooMCIntegrator";
109 if(!(_valid= _grid.isValid()))
return;
110 if(_verbose) _grid.print(std::cout);
124 _alpha =
configSet.getRealValue(
"alpha",1.5) ;
132 if(!(_valid= _grid.isValid()))
return;
133 if(_verbose) _grid.print(std::cout);
141bool RooMCIntegrator::checkLimits()
const
143 return _grid.initialize(*integrand());
154double RooMCIntegrator::integral(
const double* )
176 if(stage ==
AllStages) _grid.initialize(*_function);
189 UInt_t bins = RooGrid::maxBins;
191 UInt_t dim(_grid.getDimension());
201 if (2*
boxes >= RooGrid::maxBins) {
206 if(bins > RooGrid::maxBins) bins= RooGrid::maxBins;
208 oocxcoutD((
TObject*)
nullptr,Integration) <<
"RooMCIntegrator: using stratified sampling with " << bins <<
" bins and "
212 oocxcoutD((
TObject*)
nullptr,Integration) <<
"RooMCIntegrator: using importance sampling with " << bins <<
" bins and "
213 <<
boxes <<
" boxes" << std::endl;
226 _jac = _grid.getVolume()*std::pow((
double)bins,(
double)dim)/
calls;
229 _grid.setNBoxes(
boxes);
230 if(bins != _grid.getNBins()) _grid.resize(bins);
234 std::vector<UInt_t>
box(_grid.getDimension());
235 std::vector<UInt_t> bin(_grid.getDimension());
236 std::vector<double>
x(_grid.getDimension());
244 for (
UInt_t it = 0; it < iterations; it++) {
256 _grid.firstBox(
box.data());
270 q+=
d *
d * (k / (k + 1.0));
282 if(_timer.RealTime() > 30) {
283 std::size_t
index = 0;
286 for (
unsigned int i=0; i < _grid.getDimension(); ++i) {
290 oocoutP(
nullptr, Integration) <<
"RooMCIntegrator: still working ... iteration "
291 << it <<
'/' << iterations <<
" box " <<
index <<
"/"<< std::pow(_grid.getNBoxes(), _grid.getDimension()) << std::endl;
298 }
while(_grid.nextBox(
box.data()));
338 if(it + 1 == iterations) _grid.print(std::cout,
true);
340 _grid.refine(_alpha);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Abstract interface for integrators of real-valued functions that implement the RooAbsFunc interface.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
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.
Factory to instantiate numeric integrators from a given function binding and a given configuration.
Variable that can be changed from the outside.
Mother of all ROOT objects.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void function(const Char_t *name_, T fun, const Char_t *docstring=0)