57 RooRealVar numBins(
"numBins",
"Number of bins in range",100) ;
96 const bool useBatchMode =
false;
110 oocoutW((
TObject*)0,Integration) <<
"RooBinIntegrator::RooBinIntegrator WARNING: integrand provide no binning definition observable #"
111 << i <<
" substituting default binning of " <<
_numBins <<
" bins" << endl ;
112 tmp.reset(
new list<Double_t> );
117 _binb.emplace_back(tmp->begin(), tmp->end());
120 const std::vector<double>& binb =
_binb.back();
122 for (
unsigned int ibin = 0; ibin < binb.size() - 1; ++ibin) {
123 binCentres[ibin] = (binb[ibin + 1] + binb[ibin]) / 2.;
136 RooBinIntegrator(function, static_cast<
int>(config.getConfigSection(
"RooBinIntegrator").getRealValue(
"numBins")))
170 oocoutE((
TObject*)0,Integration) <<
"RooBinIntegrator::setLimits: cannot override integrand's limits" << endl;
196 oocoutE((
TObject*)0,Integration) <<
"RooBinIntegrator::checkLimits: bad range with min >= max (_xmin = " <<
_xmin[i] <<
" _xmax = " <<
_xmax[i] <<
")" << endl;
217 const std::vector<double>& binb =
_binb[0];
226 assert(results.size() == binb.size() - 1);
228 for (
unsigned int ibin = 0; ibin < binb.size() - 1; ++ibin) {
229 const double width = binb[ibin + 1] - binb[ibin];
234 for (
unsigned int ibin=0; ibin < binb.size() - 1; ++ibin) {
235 const double xhi = binb[ibin + 1];
236 const double xlo = binb[ibin];
237 const double xcenter = (xhi+xlo)/2.;
243 const std::vector<double>& binbx =
_binb[0];
244 const std::vector<double>& binby =
_binb[1];
246 for (
unsigned int ibin1=0; ibin1 < binbx.size() - 1; ++ibin1) {
247 const double x1hi = binbx[ibin1 + 1];
248 const double x1lo = binbx[ibin1];
251 for (
unsigned int ibin2=0; ibin2 < binby.size() - 1; ++ibin2) {
252 const double x2hi = binby[ibin2 + 1];
253 const double x2lo = binby[ibin2];
254 const double x2center = (x2hi+x2lo)/2.;
256 const double binInt =
integrand(
xvec(x1center,x2center))*(x1hi-x1lo)*(x2hi-x2lo) ;
261 const std::vector<double>& binbx =
_binb[0];
262 const std::vector<double>& binby =
_binb[1];
263 const std::vector<double>& binbz =
_binb[2];
265 for (
unsigned int ibin1=0; ibin1 < binbx.size() - 1; ++ibin1) {
266 const double x1hi = binbx[ibin1 + 1];
267 const double x1lo = binbx[ibin1];
270 for (
unsigned int ibin2=0; ibin2 < binby.size() - 1; ++ibin2) {
271 const double x2hi = binby[ibin2 + 1];
272 const double x2lo = binby[ibin2];
273 const double x2center = (x2hi+x2lo)/2.;
275 for (
unsigned int ibin3=0; ibin3 < binbz.size() - 1; ++ibin3) {
276 const double x3hi = binbz[ibin3 + 1];
277 const double x3lo = binbz[ibin3];
278 const double x3center = (x3hi+x3lo)/2.;
280 const double binInt =
integrand(
xvec(x1center,x2center,x3center))*(x1hi-x1lo)*(x2hi-x2lo)*(x3hi-x3lo);
include TDocParser_001 C image html pict1_TDocParser_001 png width
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
virtual Double_t getMinLimit(UInt_t dimension) const =0
virtual std::list< Double_t > * binBoundaries(Int_t) const
virtual Double_t getMaxLimit(UInt_t dimension) const =0
UInt_t getDimension() const
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
const RooAbsFunc * _function
const RooAbsFunc * integrand() const
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooBinIntegrator computes the integral over a binned distribution by summing the bin contents of all ...
std::vector< Double_t > _xmin
static void registerIntegrator(RooNumIntFactory &fact)
Register RooBinIntegrator, is parameters and capabilities with RooNumIntFactory.
Int_t _numBins
list of bin boundaries
std::vector< Double_t > _xmax
Lower integration bound.
virtual ~RooBinIntegrator()
Destructor.
Bool_t _useIntegrandLimits
Size of integration range.
virtual RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const
Clone integrator with new function binding and configuration. Needed by RooNumIntFactory.
std::vector< std::vector< double > > _binb
Upper integration bound.
virtual Bool_t checkLimits() const
Check that our integration range is finite and otherwise return kFALSE.
virtual Double_t integral(const Double_t *yvec=0)
Calculate numeric integral at given set of function binding parameters.
double * xvec(double xx)
Run context to save bin centres in between invocations.
std::unique_ptr< RooBatchCompute::RunContext > _evalDataOrig
Run context for evaluating a function.
Bool_t setLimits(Double_t *xmin, Double_t *xmax)
Change our integration limits.
RooBinIntegrator()
Default constructor.
std::unique_ptr< RooBatchCompute::RunContext > _evalData
virtual Bool_t setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
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_t storeProtoIntegrator(RooAbsIntegrator *proto, const RooArgSet &defConfig, const char *depName="")
Method accepting registration of a prototype numeric integrator along with a RooArgSet of its default...
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
RooSpan< const double > getValuesOfBoundFunction(RooBatchCompute::RunContext &evalData) const
Evaluate the bound object at all locations indicated by the data in evalData.
RooRealVar represents a variable that can be changed from the outside.
A simple container to hold a batch of data values.
Mother of all ROOT objects.
This struct enables passing computation data around between elements of a computation graph.
static uint64_t sum(uint64_t i)