Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooBinIntegrator.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_BIN_INTEGRATOR
17#define ROO_BIN_INTEGRATOR
18
19#include "RooAbsIntegrator.h"
20#include "RooNumIntConfig.h"
21#include <vector>
22#include <list>
23
25public:
26 // Constructors, assignment etc
27
28 RooBinIntegrator(const RooAbsFunc &function, int numBins = 100);
29 RooBinIntegrator(const RooAbsFunc &function, const RooNumIntConfig &config);
30
31 bool checkLimits() const override;
32 double integral(const double *yvec = nullptr) override;
33
35 bool setLimits(double *xmin, double *xmax) override;
36 bool setUseIntegrandLimits(bool flag) override
37 {
39 return true;
40 }
41
42protected:
43 friend class RooNumIntFactory;
44 static void registerIntegrator(RooNumIntFactory &fact);
46
47 // Numerical integrator workspace
48 mutable std::vector<double> _xmin; ///<! Lower integration bound
49 mutable std::vector<double> _xmax; ///<! Upper integration bound
50 std::vector<std::vector<double>> _binb; ///<! list of bin boundaries
51 mutable Int_t _numBins = 0; ///<! Size of integration range
52
53 bool _useIntegrandLimits = false; ///< If true limits of function binding are ued
54
55 double *xvec(double xx)
56 {
57 _x[0] = xx;
58 return _x.data();
59 }
60 double *xvec(double xx, double yy)
61 {
62 _x[0] = xx;
63 _x[1] = yy;
64 return _x.data();
65 }
66 double *xvec(double xx, double yy, double zz)
67 {
68 _x[0] = xx;
69 _x[1] = yy;
70 _x[2] = zz;
71 return _x.data();
72 }
73
74 std::vector<double> _x; ///<! do not persist
75};
76
77#endif
float xmin
float xmax
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition RooAbsFunc.h:27
Abstract interface for integrators of real-valued functions that implement the RooAbsFunc interface.
virtual bool setLimits(double *, double *)
Computes the integral over a binned distribution by summing the bin contents of all bins.
double * xvec(double xx, double yy)
std::vector< double > _xmax
! Upper integration bound
static void registerIntegrator(RooNumIntFactory &fact)
Register RooBinIntegrator, is parameters and capabilities with RooNumIntFactory.
RooBinIntegrator(const RooBinIntegrator &)
double * xvec(double xx, double yy, double zz)
Int_t _numBins
! Size of integration range
bool setLimits(double *xmin, double *xmax) override
Change our integration limits.
std::vector< std::vector< double > > _binb
! list of bin boundaries
std::vector< double > _xmin
! Lower integration bound
double * xvec(double xx)
std::vector< double > _x
! do not persist
bool _useIntegrandLimits
If true limits of function binding are ued.
bool checkLimits() const override
Check that our integration range is finite and otherwise return false.
double integral(const double *yvec=nullptr) override
Calculate numeric integral at given set of function binding parameters.
bool setUseIntegrandLimits(bool flag) override
Interface function that allows to defer limit definition to integrand definition.
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
Factory to instantiate numeric integrators from a given function binding and a given configuration.