Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRombergIntegrator.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooRombergIntegrator.h,v 1.21 2007/05/11 09:11:30 verkerke Exp $
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_INTEGRATOR_1D
17#define ROO_INTEGRATOR_1D
18
19#include "RooAbsIntegrator.h"
20#include "RooNumIntConfig.h"
21
22#include <ROOT/RSpan.hxx>
23
24#include <functional>
25
26namespace RooFit {
27namespace Detail {
28
29std::pair<double, int> integrate1d(std::function<double(double)> func, bool doTrapezoid, int maxSteps, int minStepsZero,
30 int fixSteps, double epsAbs, double epsRel, bool doExtrap, double xmin, double xmax,
31 std::span<double> hArr, std::span<double> sArr);
32
33} // namespace Detail
34} // namespace RooFit
35
37public:
38 // Constructors, assignment etc
40
41 RooRombergIntegrator(const RooAbsFunc &function, SummationRule rule = Trapezoid, int maxSteps = 0, double eps = 0);
42 RooRombergIntegrator(const RooAbsFunc &function, double xmin, double xmax, SummationRule rule = Trapezoid,
43 int maxSteps = 0, double eps = 0);
44
45 RooRombergIntegrator(const RooAbsFunc &function, const RooNumIntConfig &config, int nDim = 1,
46 bool doSegmentation = false);
47 RooRombergIntegrator(const RooAbsFunc &function, double xmin, double xmax, const RooNumIntConfig &config,
48 int nDim = 1);
49
50 bool checkLimits() const override;
51 double integral(const double *yvec = nullptr) override;
52
54 bool setLimits(double *xmin, double *xmax) override;
55 bool setUseIntegrandLimits(bool flag) override
56 {
58 return true;
59 }
60
61protected:
62 friend class RooNumIntFactory;
63 static void registerIntegrator(RooNumIntFactory &fact);
64
65 bool initialize();
66 double integral(int iDim, int nSeg, std::span<double> wksp);
67
68 bool _useIntegrandLimits; ///< If true limits of function binding are used
69
70 // Integrator configuration
71 int _nDim = 1;
73 int _maxSteps; ///< Maximum number of steps
74 int _minStepsZero = 999; ///< Minimum number of steps to declare convergence to zero
75 int _fixSteps = 0; ///< Fixed number of steps
76 double _epsAbs; ///< Absolute convergence tolerance
77 double _epsRel; ///< Relative convergence tolerance
78 bool _doExtrap = true; ///< Apply conversion step?
79 int _nSeg = 1; ///< Number of segments
80 std::vector<double> _xmin; ///<! Lower integration bounds
81 std::vector<double> _xmax; ///<! Upper integration bounds
82
83 // Numerical integrator workspace
84 std::vector<double> _wksp; ///<! Integrator workspace
85 std::vector<double> _x; //! do not persist
86};
87
88#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 *)
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.
Adaptive numerical integration algorithm.
std::vector< double > _xmin
! Lower integration bounds
std::vector< double > _wksp
! Integrator workspace
bool _useIntegrandLimits
If true limits of function binding are used.
static void registerIntegrator(RooNumIntFactory &fact)
Register integrator plugins, their parameters and capabilities with RooNumIntFactory.
double _epsRel
Relative convergence tolerance.
bool checkLimits() const override
Check that our integration range is finite and otherwise return false.
bool initialize()
Initialize the integrator.
double integral(const double *yvec=nullptr) override
bool _doExtrap
Apply conversion step?
int _nSeg
Number of segments.
std::vector< double > _xmax
! Upper integration bounds
bool setLimits(double *xmin, double *xmax) override
Change our integration limits.
int _fixSteps
Fixed number of steps.
double _epsAbs
Absolute convergence tolerance.
int _maxSteps
Maximum number of steps.
bool setUseIntegrandLimits(bool flag) override
Interface function that allows to defer limit definition to integrand definition.
int _minStepsZero
Minimum number of steps to declare convergence to zero.
std::vector< double > _x
std::pair< double, int > integrate1d(std::function< double(double)> func, bool doTrapezoid, int maxSteps, int minStepsZero, int fixSteps, double epsAbs, double epsRel, bool doExtrap, double xmin, double xmax, std::span< double > hArr, std::span< double > sArr)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26