53 samplingMode.defineType(
"Importance",RooMCIntegrator::Importance) ;
54 samplingMode.defineType(
"ImportanceOnly",RooMCIntegrator::ImportanceOnly) ;
55 samplingMode.defineType(
"Stratified",RooMCIntegrator::Stratified) ;
59 genType.defineType(
"QuasiRandom",RooMCIntegrator::QuasiRandom) ;
60 genType.defineType(
"PseudoRandom",RooMCIntegrator::PseudoRandom) ;
61 genType.setIndex(RooMCIntegrator::QuasiRandom) ;
68 RooRealVar alpha(
"alpha",
"Grid structure constant",1.5) ;
75 return std::make_unique<RooMCIntegrator>(function,config);
79 std::string
name =
"RooMCIntegrator";
105 if(!(_valid= _grid.isValid()))
return;
106 if(_verbose) _grid.print(std::cout);
120 _alpha =
configSet.getRealValue(
"alpha",1.5) ;
128 if(!(_valid= _grid.isValid()))
return;
129 if(_verbose) _grid.print(std::cout);
137bool RooMCIntegrator::checkLimits()
const
139 return _grid.initialize(*integrand());
150double RooMCIntegrator::integral(
const double* )
172 if(stage ==
AllStages) _grid.initialize(*_function);
185 UInt_t bins = RooGrid::maxBins;
187 UInt_t dim(_grid.getDimension());
197 if (2*
boxes >= RooGrid::maxBins) {
202 if(bins > RooGrid::maxBins) bins= RooGrid::maxBins;
204 oocxcoutD((
TObject*)
nullptr,Integration) <<
"RooMCIntegrator: using stratified sampling with " << bins <<
" bins and "
208 oocxcoutD((
TObject*)
nullptr,Integration) <<
"RooMCIntegrator: using importance sampling with " << bins <<
" bins and "
209 <<
boxes <<
" boxes" << std::endl;
222 _jac = _grid.getVolume()*std::pow((
double)bins,(
double)dim)/
calls;
225 _grid.setNBoxes(
boxes);
226 if(bins != _grid.getNBins()) _grid.resize(bins);
230 std::vector<UInt_t>
box(_grid.getDimension());
231 std::vector<UInt_t>
bin(_grid.getDimension());
232 std::vector<double>
x(_grid.getDimension());
240 for (
UInt_t it = 0; it < iterations; it++) {
252 _grid.firstBox(
box.data());
266 q+=
d *
d * (k / (k + 1.0));
278 if(_timer.RealTime() > 30) {
279 std::size_t
index = 0;
282 for (
unsigned int i=0; i < _grid.getDimension(); ++i) {
286 oocoutP(
nullptr, Integration) <<
"RooMCIntegrator: still working ... iteration "
287 << it <<
'/' << iterations <<
" box " <<
index <<
"/"<< std::pow(_grid.getNBoxes(), _grid.getDimension()) << std::endl;
294 }
while(_grid.nextBox(
box.data()));
334 if(it + 1 == iterations) _grid.print(std::cout,
true);
336 _grid.refine(_alpha);
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
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)