Logo ROOT  
Reference Guide
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 ~RooIntegrator1D() override;
40
41 bool checkLimits() const override;
42 double integral(const double *yvec=0) override ;
43
45 bool setLimits(double* xmin, double* xmax) override;
46 bool setUseIntegrandLimits(bool flag) override {_useIntegrandLimits = flag ; return true ; }
47
48 bool canIntegrate1D() const override { return true ; }
49 bool canIntegrate2D() const override { return false ; }
50 bool canIntegrateND() const override { return false ; }
51 bool canIntegrateOpenEnded() const override { return false ; }
52
53protected:
54
55 friend class RooNumIntFactory ;
56 static void registerIntegrator(RooNumIntFactory& fact) ;
57
58 bool initialize();
59
60 bool _useIntegrandLimits; ///< If true limits of function binding are used
61
62 // Integrator configuration
64 Int_t _maxSteps ; ///< Maximum number of steps
65 Int_t _minStepsZero ; ///< Minimum number of steps to declare convergence to zero
66 Int_t _fixSteps ; ///< Fixed number of steps
67 double _epsAbs ; ///< Absolute convergence tolerance
68 double _epsRel ; ///< Relative convergence tolerance
69 bool _doExtrap ; ///< Apply conversion step?
70 enum { _nPoints = 5 };
71
72 // Numerical integrator support functions
73 double addTrapezoids(Int_t n) ;
74 double addMidpoints(Int_t n) ;
75 void extrapolate(Int_t n) ;
76
77 // Numerical integrator workspace
78 double _xmin; ///<! Lower integration bound
79 double _xmax; ///<! Upper integration bound
80 double _range; ///<! Size of integration range
81 double _extrapValue; ///<! Extrapolated value
82 double _extrapError; ///<! Error on extrapolated value
83 double *_h ; ///<! Integrator workspace
84 double *_s ; ///<! Integrator workspace
85 double *_c ; ///<! Integrator workspace
86 double *_d ; ///<! Integrator workspace
87 double _savedResult; ///<! Integrator workspace
88
89 double* xvec(double& xx) { _x[0] = xx ; return _x ; }
90
91 double *_x ; //! do not persist
92
93 ClassDefOverride(RooIntegrator1D,0) // 1-dimensional numerical integration engine
94};
95
96#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 *)
RooIntegrator1D implements an adaptive one-dimensional numerical integration algorithm.
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 * _s
! Integrator workspace
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.
double _xmin
! Lower integration bound
bool _useIntegrandLimits
If true limits of function binding are used.
bool canIntegrate2D() const override
double * _d
! Integrator workspace
double _epsRel
Relative convergence tolerance.
Int_t _maxSteps
Maximum number of steps.
double * _h
! Integrator workspace
Int_t _fixSteps
Fixed number of steps.
bool initialize()
Initialize the integrator.
double _savedResult
! Integrator workspace
~RooIntegrator1D() override
Destructor.
double _range
! Size of integration range
bool canIntegrate1D() const override
static void registerIntegrator(RooNumIntFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
double * _c
! Integrator workspace
bool setLimits(double *xmin, double *xmax) override
Change our integration limits.
double integral(const double *yvec=0) override
Calculate numeric integral at given set of function binding parameters.
RooIntegrator1D()
coverity[UNINIT_CTOR] Default constructor
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
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:167