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 
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) ;
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 
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  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
RooIntegrator1D::_extrapError
Double_t _extrapError
Extrapolated value.
Definition: RooIntegrator1D.h:96
RooIntegrator1D::_minStepsZero
Int_t _minStepsZero
Definition: RooIntegrator1D.h:79
n
const Int_t n
Definition: legend1.C:16
RooNumIntFactory
Definition: RooNumIntFactory.h:30
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooIntegrator1D::_c
Double_t * _c
Integrator workspace.
Definition: RooIntegrator1D.h:99
RooIntegrator1D::integral
virtual Double_t integral(const Double_t *yvec=0)
Calculate numeric integral at given set of function binding parameters.
Definition: RooIntegrator1D.cxx:275
RooIntegrator1D::_xmin
Double_t _xmin
Definition: RooIntegrator1D.h:92
RooIntegrator1D::_xmax
Double_t _xmax
Lower integration bound.
Definition: RooIntegrator1D.h:93
RooNumIntConfig.h
RooIntegrator1D::setLimits
Bool_t setLimits(Double_t *xmin, Double_t *xmax)
Change our integration limits.
Definition: RooIntegrator1D.cxx:240
xmax
float xmax
Definition: THbookFile.cxx:95
RooIntegrator1D::checkLimits
virtual Bool_t checkLimits() const
Check that our integration range is finite and otherwise return kFALSE.
Definition: RooIntegrator1D.cxx:256
RooIntegrator1D::setUseIntegrandLimits
virtual Bool_t setUseIntegrandLimits(Bool_t flag)
Interface function that allows to defer limit definition to integrand definition.
Definition: RooIntegrator1D.h:60
RooIntegrator1D::initialize
Bool_t initialize()
Initialize the integrator.
Definition: RooIntegrator1D.cxx:191
RooIntegrator1D::_range
Double_t _range
Upper integration bound.
Definition: RooIntegrator1D.h:94
RooIntegrator1D::registerIntegrator
static void registerIntegrator(RooNumIntFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
Definition: RooIntegrator1D.cxx:54
RooIntegrator1D::Midpoint
@ Midpoint
Definition: RooIntegrator1D.h:54
bool
RooAbsFunc
Definition: RooAbsFunc.h:23
RooIntegrator1D::_doExtrap
Bool_t _doExtrap
Definition: RooIntegrator1D.h:83
RooIntegrator1D::Trapezoid
@ Trapezoid
Definition: RooIntegrator1D.h:54
RooIntegrator1D::_savedResult
Double_t _savedResult
Integrator workspace.
Definition: RooIntegrator1D.h:101
RooAbsIntegrator::setLimits
virtual Bool_t setLimits(Double_t *, Double_t *)
Definition: RooAbsIntegrator.h:75
xmin
float xmin
Definition: THbookFile.cxx:95
RooIntegrator1D
Definition: RooIntegrator1D.h:22
RooIntegrator1D::_maxSteps
Int_t _maxSteps
Definition: RooIntegrator1D.h:78
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooIntegrator1D::_d
Double_t * _d
Integrator workspace.
Definition: RooIntegrator1D.h:100
RooAbsIntegrator.h
RooIntegrator1D::_fixSteps
Int_t _fixSteps
Definition: RooIntegrator1D.h:80
RooIntegrator1D::_epsAbs
Double_t _epsAbs
Definition: RooIntegrator1D.h:81
RooIntegrator1D::extrapolate
void extrapolate(Int_t n)
Extrapolate result to final value.
Definition: RooIntegrator1D.cxx:417
RooIntegrator1D::xvec
Double_t * xvec(Double_t &xx)
Integrator workspace.
Definition: RooIntegrator1D.h:103
RooIntegrator1D::_rule
SummationRule _rule
Definition: RooIntegrator1D.h:77
RooIntegrator1D::_epsRel
Double_t _epsRel
Definition: RooIntegrator1D.h:82
RooIntegrator1D::canIntegrateND
virtual Bool_t canIntegrateND() const
Definition: RooIntegrator1D.h:64
RooIntegrator1D::_nPoints
@ _nPoints
Definition: RooIntegrator1D.h:84
RooIntegrator1D::SummationRule
SummationRule
Definition: RooIntegrator1D.h:40
RooIntegrator1D::_h
Double_t * _h
Error on extrapolated value.
Definition: RooIntegrator1D.h:97
RooIntegrator1D::addMidpoints
Double_t addMidpoints(Int_t n)
Calculate the n-th stage of refinement of the Second Euler-Maclaurin summation rule which has the use...
Definition: RooIntegrator1D.cxx:356
Double_t
double Double_t
Definition: RtypesCore.h:59
RooIntegrator1D::~RooIntegrator1D
virtual ~RooIntegrator1D()
Destructor.
Definition: RooIntegrator1D.cxx:224
RooIntegrator1D::RooIntegrator1D
RooIntegrator1D()
coverity[UNINIT_CTOR] Default constructor
Definition: RooIntegrator1D.cxx:79
RooIntegrator1D::clone
virtual RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const
Clone integrator with new function binding and configuration. Needed by RooNumIntFactory.
Definition: RooIntegrator1D.cxx:181
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooNumIntConfig
Definition: RooNumIntConfig.h:25
RooIntegrator1D::_useIntegrandLimits
Bool_t _useIntegrandLimits
Definition: RooIntegrator1D.h:74
RooIntegrator1D::_s
Double_t * _s
Integrator workspace.
Definition: RooIntegrator1D.h:98
RooAbsIntegrator
Definition: RooAbsIntegrator.h:22
RooIntegrator1D::_extrapValue
Double_t _extrapValue
Size of integration range.
Definition: RooIntegrator1D.h:95
RooIntegrator1D::_x
Double_t * _x
Definition: RooIntegrator1D.h:105
RooIntegrator1D::addTrapezoids
Double_t addTrapezoids(Int_t n)
Calculate the n-th stage of refinement of the extended trapezoidal summation rule.
Definition: RooIntegrator1D.cxx:388
RooIntegrator1D::canIntegrate2D
virtual Bool_t canIntegrate2D() const
Definition: RooIntegrator1D.h:63
RooIntegrator1D::canIntegrateOpenEnded
virtual Bool_t canIntegrateOpenEnded() const
Definition: RooIntegrator1D.h:65
RooIntegrator1D::canIntegrate1D
virtual Bool_t canIntegrate1D() const
Definition: RooIntegrator1D.h:62
int