57 RooRealVar numBins(
"numBins",
"Number of bins in range",100) ;
102 oocoutW((
TObject*)0,
Integration) <<
"RooBinIntegrator::RooBinIntegrator WARNING: integrand provide no binning definition observable #"
103 << i <<
" substituting default binning of " <<
_numBins <<
" bins" << endl ;
104 tmp.reset(
new list<Double_t> );
109 _binb.emplace_back(tmp->begin(), tmp->end());
112 const std::vector<double>& binb =
_binb.back();
114 for (
unsigned int ibin = 0; ibin < binb.size() - 1; ++ibin) {
115 binCentres[ibin] = (binb[ibin + 1] + binb[ibin]) / 2.;
151 oocoutW((
TObject*)0,
Integration) <<
"RooBinIntegrator::RooBinIntegrator WARNING: integrand provide no binning definition observable #"
152 << i <<
" substituting default binning of " <<
_numBins <<
" bins" << endl ;
153 tmp.reset(
new list<Double_t> );
158 _binb.emplace_back(tmp->begin(), tmp->end());
161 const std::vector<double>& binb =
_binb.back();
163 for (
unsigned int ibin = 0; ibin < binb.size() - 1; ++ibin) {
164 binCentres[ibin] = (binb[ibin + 1] + binb[ibin]) / 2.;
249 const std::vector<double>& binb =
_binb[0];
257 auto results = realBinding->getValuesOfBoundFunction(*
_evalData);
258 assert(results.size() == binb.size() - 1);
260 for (
unsigned int ibin = 0; ibin < binb.size() - 1; ++ibin) {
261 const double width = binb[ibin + 1] - binb[ibin];
266 for (
unsigned int ibin=0; ibin < binb.size() - 1; ++ibin) {
267 const double xhi = binb[ibin + 1];
268 const double xlo = binb[ibin];
269 const double xcenter = (xhi+xlo)/2.;
275 const std::vector<double>& binbx =
_binb[0];
276 const std::vector<double>& binby =
_binb[1];
278 for (
unsigned int ibin1=0; ibin1 < binbx.size() - 1; ++ibin1) {
279 const double x1hi = binbx[ibin1 + 1];
280 const double x1lo = binbx[ibin1];
283 for (
unsigned int ibin2=0; ibin2 < binby.size() - 1; ++ibin2) {
284 const double x2hi = binby[ibin2 + 1];
285 const double x2lo = binby[ibin2];
286 const double x2center = (x2hi+x2lo)/2.;
288 const double binInt =
integrand(
xvec(x1center,x2center))*(x1hi-x1lo)*(x2hi-x2lo) ;
293 const std::vector<double>& binbx =
_binb[0];
294 const std::vector<double>& binby =
_binb[1];
295 const std::vector<double>& binbz =
_binb[2];
297 for (
unsigned int ibin1=0; ibin1 < binbx.size() - 1; ++ibin1) {
298 const double x1hi = binbx[ibin1 + 1];
299 const double x1lo = binbx[ibin1];
302 for (
unsigned int ibin2=0; ibin2 < binby.size() - 1; ++ibin2) {
303 const double x2hi = binby[ibin2 + 1];
304 const double x2lo = binby[ibin2];
305 const double x2center = (x2hi+x2lo)/2.;
307 for (
unsigned int ibin3=0; ibin3 < binbz.size() - 1; ++ibin3) {
308 const double x3hi = binbz[ibin3 + 1];
309 const double x3lo = binbz[ibin3];
310 const double x3center = (x3hi+x3lo)/2.;
312 const double binInt =
integrand(
xvec(x1center,x2center,x3center))*(x1hi-x1lo)*(x2hi-x2lo)*(x3hi-x3lo);
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.
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
Pointer to function binding of integrand.
const RooAbsFunc * integrand() const
Return integrand function binding.
Bool_t isValid() const
Is integrator in valid state.
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 ...
Bool_t setLimits(Double_t *xmin, Double_t *xmax) override
Change our integration limits.
std::vector< Double_t > _xmin
! Lower integration bound
RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const override
Clone integrator with new function binding and configuration. Needed by RooNumIntFactory.
static void registerIntegrator(RooNumIntFactory &fact)
Register RooBinIntegrator, is parameters and capabilities with RooNumIntFactory.
Int_t _numBins
! Size of integration range
Double_t * _x
! do not persist
std::vector< Double_t > _xmax
! Upper integration bound
Bool_t _useIntegrandLimits
If true limits of function binding are ued.
Bool_t checkLimits() const override
Check that our integration range is finite and otherwise return kFALSE.
std::vector< std::vector< double > > _binb
! list of bin boundaries
std::unique_ptr< RooBatchCompute::RunContext > _evalDataOrig
! Run context to save bin centres in between invocations.
RooBinIntegrator()
Default constructor.
Double_t integral(const Double_t *yvec=0) override
Calculate numeric integral at given set of function binding parameters.
TClass * IsA() const override
std::unique_ptr< RooBatchCompute::RunContext > _evalData
! Run context for evaluating a function.
~RooBinIntegrator() override
Destructor.
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...
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_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...
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.
virtual const char * GetName() const
Returns name of object.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
This struct enables passing computation data around between elements of a computation graph.
static uint64_t sum(uint64_t i)