Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooIntegrator1D.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooIntegrator1D.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
23public:
24
25 // Constructors, assignment etc
28
30 Int_t maxSteps= 0, double eps= 0) ;
31 RooIntegrator1D(const RooAbsFunc& function, double xmin, double xmax,
32 SummationRule rule= Trapezoid, Int_t maxSteps= 0, double eps= 0) ;
33
34 RooIntegrator1D(const RooAbsFunc& function, const RooNumIntConfig& config) ;
35 RooIntegrator1D(const RooAbsFunc& function, double xmin, double xmax,
36 const RooNumIntConfig& config) ;
37
38 RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const override ;
39
40 bool checkLimits() const override;
41 double integral(const double *yvec=nullptr) 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 false ; }
49 bool canIntegrateND() const override { return false ; }
50 bool canIntegrateOpenEnded() const override { return false ; }
51
52protected:
53
54 friend class RooNumIntFactory ;
55 static void registerIntegrator(RooNumIntFactory& fact) ;
56
57 bool initialize();
58
59 bool _useIntegrandLimits; ///< If true limits of function binding are used
60
61 // Integrator configuration
63 Int_t _maxSteps ; ///< Maximum number of steps
64 Int_t _minStepsZero ; ///< Minimum number of steps to declare convergence to zero
65 Int_t _fixSteps ; ///< Fixed number of steps
66 double _epsAbs ; ///< Absolute convergence tolerance
67 double _epsRel ; ///< Relative convergence tolerance
68 bool _doExtrap ; ///< Apply conversion step?
69 enum { _nPoints = 5 };
70
71 // Numerical integrator support functions
72 double addTrapezoids(Int_t n) ;
73 double addMidpoints(Int_t n) ;
74 void extrapolate(Int_t n) ;
75
76 // Numerical integrator workspace
77 double _xmin; ///<! Lower integration bound
78 double _xmax; ///<! Upper integration bound
79 double _range; ///<! Size of integration range
80 double _extrapValue; ///<! Extrapolated value
81 double _extrapError; ///<! Error on extrapolated value
82 std::vector<double> _h ; ///<! Integrator workspace
83 std::vector<double> _s ; ///<! Integrator workspace
84 std::vector<double> _c ; ///<! Integrator workspace
85 std::vector<double> _d ; ///<! Integrator workspace
86 double _savedResult; ///<! Integrator workspace
87
88 double* xvec(double& xx) { _x[0] = xx ; return _x.data(); }
89
90 std::vector<double> _x ; //! do not persist
91
92 ClassDefOverride(RooIntegrator1D,0) // 1-dimensional numerical integration engine
93};
94
95#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
float xmin
float xmax
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 *)
RooIntegrator1D implements an adaptive one-dimensional numerical integration algorithm.
std::vector< double > _c
! Integrator workspace
bool setUseIntegrandLimits(bool flag) override
Interface function that allows to defer limit definition to integrand definition.
RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const override
Clone integrator with new function binding and configuration. Needed by RooNumIntFactory.
void extrapolate(Int_t n)
Extrapolate result to final value.
double _xmax
! Upper integration bound
double addMidpoints(Int_t n)
Calculate the n-th stage of refinement of the Second Euler-Maclaurin summation rule which has the use...
double _extrapError
! Error on extrapolated value
bool _doExtrap
Apply conversion step?
Int_t _minStepsZero
Minimum number of steps to declare convergence to zero.
SummationRule _rule
bool canIntegrateND() const override
double * xvec(double &xx)
double addTrapezoids(Int_t n)
Calculate the n-th stage of refinement of the extended trapezoidal summation rule.
std::vector< double > _d
! Integrator workspace
double integral(const double *yvec=nullptr) override
Calculate numeric integral at given set of function binding parameters.
double _xmin
! Lower integration bound
bool _useIntegrandLimits
If true limits of function binding are used.
bool canIntegrate2D() const override
std::vector< double > _h
! Integrator workspace
double _epsRel
Relative convergence tolerance.
Int_t _maxSteps
Maximum number of steps.
Int_t _fixSteps
Fixed number of steps.
bool initialize()
Initialize the integrator.
double _savedResult
! Integrator workspace
double _range
! Size of integration range
std::vector< double > _x
bool canIntegrate1D() const override
static void registerIntegrator(RooNumIntFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
bool setLimits(double *xmin, double *xmax) override
Change our integration limits.
std::vector< double > _s
! Integrator workspace
bool checkLimits() const override
Check that our integration range is finite and otherwise return false.
bool canIntegrateOpenEnded() const override
double _epsAbs
Absolute convergence tolerance.
double _extrapValue
! Extrapolated value
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 ...
const Int_t n
Definition legend1.C:16