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_t eps= 0) ;
32 SummationRule rule= Trapezoid, Int_t maxSteps= 0, Double_t eps= 0) ;
33
34 RooIntegrator1D(const RooAbsFunc& function, const RooNumIntConfig& config) ;
36 const RooNumIntConfig& config) ;
37
38 virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const ;
39 virtual ~RooIntegrator1D();
40
41 virtual Bool_t checkLimits() const;
42 virtual Double_t integral(const Double_t *yvec=0) ;
43
46 virtual Bool_t setUseIntegrandLimits(Bool_t flag) {_useIntegrandLimits = flag ; return kTRUE ; }
47
48 virtual Bool_t canIntegrate1D() const { return kTRUE ; }
49 virtual Bool_t canIntegrate2D() const { return kFALSE ; }
50 virtual Bool_t canIntegrateND() const { return kFALSE ; }
51 virtual Bool_t canIntegrateOpenEnded() const { return kFALSE ; }
52
53protected:
54
55 friend class RooNumIntFactory ;
56 static void registerIntegrator(RooNumIntFactory& fact) ;
57
59
60 Bool_t _useIntegrandLimits; // If true limits of function binding are ued
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_t _epsAbs ; // Absolute convergence tolerance
68 Double_t _epsRel ; // Relative convergence tolerance
69 Bool_t _doExtrap ; // Apply conversion step?
70 enum { _nPoints = 5 };
71
72 // Numerical integrator support functions
75 void extrapolate(Int_t n) ;
76
77 // Numerical integrator workspace
78 Double_t _xmin; //! Lower integration bound
79 Double_t _xmax; //! Upper integration bound
80 Double_t _range; //! Size of integration range
81 Double_t _extrapValue; //! Extrapolated value
82 Double_t _extrapError; //! Error on extrapolated value
83 Double_t *_h ; //! Integrator workspace
84 Double_t *_s ; //! Integrator workspace
85 Double_t *_c ; //! Integrator workspace
86 Double_t *_d ; //! Integrator workspace
87 Double_t _savedResult; //! Integrator workspace
88
89 Double_t* xvec(Double_t& xx) { _x[0] = xx ; return _x ; }
90
91 Double_t *_x ; //! do not persist
92
93 ClassDef(RooIntegrator1D,0) // 1-dimensional numerical integration engine
94};
95
96#endif
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
float xmin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:23
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
virtual Bool_t setLimits(Double_t *, Double_t *)
RooIntegrator1D implements an adaptive one-dimensional numerical integration algorithm.
Double_t addTrapezoids(Int_t n)
Calculate the n-th stage of refinement of the extended trapezoidal summation rule.
Double_t _range
Upper integration bound.
virtual Bool_t checkLimits() const
Check that our integration range is finite and otherwise return kFALSE.
virtual RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const
Clone integrator with new function binding and configuration. Needed by RooNumIntFactory.
void extrapolate(Int_t n)
Extrapolate result to final value.
Double_t * xvec(Double_t &xx)
Integrator workspace.
virtual Bool_t canIntegrate2D() const
Bool_t setLimits(Double_t *xmin, Double_t *xmax)
Change our integration limits.
SummationRule _rule
Double_t _extrapValue
Size of integration range.
virtual ~RooIntegrator1D()
Destructor.
Bool_t initialize()
Initialize the integrator.
virtual Double_t integral(const Double_t *yvec=0)
Calculate numeric integral at given set of function binding parameters.
virtual Bool_t canIntegrateND() const
virtual Bool_t setUseIntegrandLimits(Bool_t flag)
Interface function that allows to defer limit definition to integrand definition.
Double_t addMidpoints(Int_t n)
Calculate the n-th stage of refinement of the Second Euler-Maclaurin summation rule which has the use...
Double_t * _d
Integrator workspace.
Bool_t _useIntegrandLimits
static void registerIntegrator(RooNumIntFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
Double_t * _h
Error on extrapolated value.
Double_t _savedResult
Integrator workspace.
virtual Bool_t canIntegrateOpenEnded() const
virtual Bool_t canIntegrate1D() const
Double_t _extrapError
Extrapolated value.
RooIntegrator1D()
coverity[UNINIT_CTOR] Default constructor
Double_t * _c
Integrator workspace.
Double_t * _s
Integrator workspace.
Double_t _xmax
Lower integration bound.
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:151