Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooAdaptiveGaussKronrodIntegrator1D.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooAdaptiveGaussKronrodIntegrator1D.h,v 1.5 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_ADAPTIVE_GAUSS_KRONROD_INTEGRATOR_1D
17 #define ROO_ADAPTIVE_GAUSS_KRONROD_INTEGRATOR_1D
18 
19 #include "RooAbsIntegrator.h"
20 #include "RooNumIntConfig.h"
21 
22 double RooAdaptiveGaussKronrodIntegrator1D_GSL_GlueFunction(double x, void *data) ;
23 
24 class RooAdaptiveGaussKronrodIntegrator1D : public RooAbsIntegrator {
25 public:
26 
27  // Constructors, assignment etc
28  RooAdaptiveGaussKronrodIntegrator1D() ;
29  RooAdaptiveGaussKronrodIntegrator1D(const RooAbsFunc& function, const RooNumIntConfig& config) ;
30  RooAdaptiveGaussKronrodIntegrator1D(const RooAbsFunc& function, Double_t xmin, Double_t xmax,
31  const RooNumIntConfig& config) ;
32  virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const ;
33  virtual ~RooAdaptiveGaussKronrodIntegrator1D();
34 
35  virtual Bool_t checkLimits() const;
36  virtual Double_t integral(const Double_t *yvec=0) ;
37 
38  using RooAbsIntegrator::setLimits ;
39  Bool_t setLimits(Double_t* xmin, Double_t* xmax);
40  virtual Bool_t setUseIntegrandLimits(Bool_t flag) {
41  // If flag is true, intergration limits are taken from definition in input function binding
42  _useIntegrandLimits = flag ; return kTRUE ;
43  }
44 
45  virtual Bool_t canIntegrate1D() const {
46  // We can integrate 1-dimensional functions
47  return kTRUE ;
48  }
49  virtual Bool_t canIntegrate2D() const {
50  // We can not integrate 2-dimensional functions
51  return kFALSE ;
52  }
53  virtual Bool_t canIntegrateND() const {
54  // We can not integrate >2-dimensional functions
55  return kFALSE ;
56  }
57  virtual Bool_t canIntegrateOpenEnded() const {
58  // We can integrate over open-ended domains
59  return kTRUE ;
60  }
61 
62 protected:
63 
64  friend class RooNumIntFactory ;
65  static void registerIntegrator(RooNumIntFactory& fact) ;
66 
67  enum DomainType { Closed, OpenLo, OpenHi, Open } ;
68  mutable DomainType _domainType ;
69 
70  friend double RooAdaptiveGaussKronrodIntegrator1D_GSL_GlueFunction(double x, void *data) ;
71 
72  Bool_t initialize();
73 
74  Bool_t _useIntegrandLimits;
75 
76  Double_t* xvec(Double_t& xx) {
77  // Return contents of xx in internal array pointer
78  _x[0] = xx ; return _x ;
79  }
80  Double_t *_x ; //! Current coordinate
81 
82  Double_t _epsAbs ; // Absolute precision
83  Double_t _epsRel ; // Relative precision
84  Int_t _methodKey ; // GSL method key
85  Int_t _maxSeg ; // Maximum number of segments
86  void* _workspace ; // GSL workspace
87 
88  mutable Double_t _xmin; //! Lower integration bound
89  mutable Double_t _xmax; //! Upper integration bound
90 
91  ClassDef(RooAdaptiveGaussKronrodIntegrator1D,0) // 1-dimensional adaptive Gauss-Kronrod numerical integration engine
92 };
93 
94 #endif