Logo ROOT  
Reference Guide
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
24namespace RooBatchCompute {
25struct RunContext;
26}
27
29public:
30
31 // Constructors, assignment etc
33
36
37 RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const override ;
38 ~RooBinIntegrator() override;
39
40 bool checkLimits() const override;
41 double integral(const double *yvec=0) override ;
42
44 bool setLimits(double* xmin, double* xmax) override;
45 bool setUseIntegrandLimits(bool flag) override {_useIntegrandLimits = flag ; return true ; }
46
47 bool canIntegrate1D() const override { return true ; }
48 bool canIntegrate2D() const override { return true ; }
49 bool canIntegrateND() const override { return true ; }
50 bool canIntegrateOpenEnded() const override { return false ; }
51
52protected:
53
54 friend class RooNumIntFactory ;
55 static void registerIntegrator(RooNumIntFactory& fact) ;
57
58 // Numerical integrator workspace
59 mutable std::vector<double> _xmin; ///<! Lower integration bound
60 mutable std::vector<double> _xmax; ///<! Upper integration bound
61 std::vector<std::vector<double>> _binb; ///<! list of bin boundaries
62 mutable Int_t _numBins; ///<! Size of integration range
63
64 bool _useIntegrandLimits; ///< If true limits of function binding are ued
65
66 std::unique_ptr<RooBatchCompute::RunContext> _evalData; ///<! Run context for evaluating a function.
67 std::unique_ptr<RooBatchCompute::RunContext> _evalDataOrig; ///<! Run context to save bin centres in between invocations.
68
69 double* xvec(double xx) { _x[0] = xx ; return _x ; }
70 double* xvec(double xx, double yy) { _x[0] = xx ; _x[1] = yy ; return _x ; }
71 double* xvec(double xx, double yy, double zz) { _x[0] = xx ; _x[1] = yy ; _x[2] = zz ; return _x ; }
72
73 double *_x ; ///<! do not persist
74
75 ClassDefOverride(RooBinIntegrator,0) // 1-dimensional numerical integration engine
76};
77
78#endif
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
float xmin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
virtual bool setLimits(double *, double *)
RooBinIntegrator computes the integral over a binned distribution by summing the bin contents of all ...
double integral(const double *yvec=0) override
Calculate numeric integral at given set of function binding parameters.
double * xvec(double xx, double yy)
std::vector< double > _xmax
! Upper 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.
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.
bool canIntegrateOpenEnded() const override
bool canIntegrate2D() const override
std::vector< std::vector< double > > _binb
! list of bin boundaries
bool canIntegrate1D() const override
std::vector< double > _xmin
! Lower integration bound
double * xvec(double xx)
std::unique_ptr< RooBatchCompute::RunContext > _evalDataOrig
! Run context to save bin centres in between invocations.
bool _useIntegrandLimits
If true limits of function binding are ued.
bool canIntegrateND() const override
RooBinIntegrator()
Default constructor.
bool checkLimits() const override
Check that our integration range is finite and otherwise return false.
double * _x
! do not persist
std::unique_ptr< RooBatchCompute::RunContext > _evalData
! Run context for evaluating a function.
~RooBinIntegrator() override
Destructor.
bool setUseIntegrandLimits(bool flag) override
Interface function that allows to defer limit definition to integrand definition.
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
RooNumIntFactory is a factory to instantiate numeric integrators from a given function binding and a ...
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:167
Namespace for dispatching RooFit computations to various backends.