Logo ROOT   6.14/05
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 
23 public:
24 
25  // Constructors, assignment etc
27  RooIntegrator1D() ;
28 
29  RooIntegrator1D(const RooAbsFunc& function, SummationRule rule= Trapezoid,
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) ;
35  RooIntegrator1D(const RooAbsFunc& function, Double_t xmin, Double_t xmax,
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 
45  Bool_t setLimits(Double_t* xmin, Double_t* xmax);
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 
53 protected:
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  mutable Double_t _xmin; //! Lower integration bound
79  mutable Double_t _xmax; //! Upper integration bound
80  mutable 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
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
Double_t * _s
Integrator workspace.
float xmin
Definition: THbookFile.cxx:93
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
Double_t _extrapError
Extrapolated value.
RooIntegrator1D()
coverity[UNINIT_CTOR] Default constructor
Double_t * _c
Integrator workspace.
Double_t * xvec(Double_t &xx)
Integrator workspace.
virtual Bool_t setUseIntegrandLimits(Bool_t flag)
Interface function that allows to defer limit definition to integrand definition. ...
RooNumIntFactory is a factory to instantiate numeric integrators from a given function binding and a ...
Bool_t initialize()
Initialize the integrator.
static void registerIntegrator(RooNumIntFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
Double_t _extrapValue
Size of integration range.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Double_t addMidpoints(Int_t n)
Calculate the n-th stage of refinement of the Second Euler-Maclaurin summation rule which has the use...
virtual Bool_t setLimits(Double_t *, Double_t *)
virtual ~RooIntegrator1D()
Destructor.
Double_t addTrapezoids(Int_t n)
Calculate the n-th stage of refinement of the extended trapezoidal summation rule.
virtual Bool_t canIntegrate1D() const
Double_t _savedResult
Integrator workspace.
#define ClassDef(name, id)
Definition: Rtypes.h:320
Double_t _range
Upper integration bound.
virtual Bool_t canIntegrateOpenEnded() const
Double_t * _d
Integrator workspace.
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.
virtual Double_t integral(const Double_t *yvec=0)
Calculate numeric integral at given set of function binding parameters.
float xmax
Definition: THbookFile.cxx:93
Bool_t setLimits(Double_t *xmin, Double_t *xmax)
Change our integration limits.
const Bool_t kFALSE
Definition: RtypesCore.h:88
RooIntegrator1D implements an adaptive one-dimensional numerical integration algorithm.
virtual Bool_t canIntegrate2D() const
double Double_t
Definition: RtypesCore.h:55
virtual Bool_t canIntegrateND() const
Double_t * _h
Error on extrapolated value.
Bool_t _useIntegrandLimits
Double_t _xmax
Lower integration bound.
void extrapolate(Int_t n)
Extrapolate result to final value.
SummationRule _rule
const Bool_t kTRUE
Definition: RtypesCore.h:87
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:23
const Int_t n
Definition: legend1.C:16