RooIntegrator1D.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooIntegrator1D.h,v 1.21 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 #ifndef ROO_INTEGRATOR_1D
00017 #define ROO_INTEGRATOR_1D
00018 
00019 #include "RooAbsIntegrator.h"
00020 #include "RooNumIntConfig.h"
00021 
00022 class RooIntegrator1D : public RooAbsIntegrator {
00023 public:
00024 
00025   // Constructors, assignment etc
00026   enum SummationRule { Trapezoid, Midpoint };
00027   RooIntegrator1D() ;
00028 
00029   RooIntegrator1D(const RooAbsFunc& function, SummationRule rule= Trapezoid,
00030                   Int_t maxSteps= 0, Double_t eps= 0) ; 
00031   RooIntegrator1D(const RooAbsFunc& function, Double_t xmin, Double_t xmax,
00032                   SummationRule rule= Trapezoid, Int_t maxSteps= 0, Double_t eps= 0) ; 
00033 
00034   RooIntegrator1D(const RooAbsFunc& function, const RooNumIntConfig& config) ;
00035   RooIntegrator1D(const RooAbsFunc& function, Double_t xmin, Double_t xmax, 
00036                   const RooNumIntConfig& config) ;
00037 
00038   virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const ;
00039   virtual ~RooIntegrator1D();
00040 
00041   virtual Bool_t checkLimits() const;
00042   virtual Double_t integral(const Double_t *yvec=0) ;
00043 
00044   using RooAbsIntegrator::setLimits ;
00045   Bool_t setLimits(Double_t* xmin, Double_t* xmax);
00046   virtual Bool_t setUseIntegrandLimits(Bool_t flag) {_useIntegrandLimits = flag ; return kTRUE ; }
00047 
00048   virtual Bool_t canIntegrate1D() const { return kTRUE ; }
00049   virtual Bool_t canIntegrate2D() const { return kFALSE ; }
00050   virtual Bool_t canIntegrateND() const { return kFALSE ; }
00051   virtual Bool_t canIntegrateOpenEnded() const { return kFALSE ; }
00052 
00053 protected:
00054 
00055   friend class RooNumIntFactory ;
00056   static void registerIntegrator(RooNumIntFactory& fact) ;      
00057 
00058   Bool_t initialize();
00059 
00060   Bool_t _useIntegrandLimits;  // If true limits of function binding are ued
00061 
00062   // Integrator configuration
00063   SummationRule _rule;
00064   Int_t _maxSteps ;      // Maximum number of steps
00065   Int_t _minStepsZero ;  // Minimum number of steps to declare convergence to zero
00066   Int_t _fixSteps ;      // Fixed number of steps 
00067   Double_t _epsAbs ;     // Absolute convergence tolerance
00068   Double_t _epsRel ;     // Relative convergence tolerance
00069   Bool_t _doExtrap ;     // Apply conversion step?
00070   enum { _nPoints = 5 };
00071 
00072   // Numerical integrator support functions
00073   Double_t addTrapezoids(Int_t n) ;
00074   Double_t addMidpoints(Int_t n) ;
00075   void extrapolate(Int_t n) ;
00076   
00077   // Numerical integrator workspace
00078   mutable Double_t _xmin;              //! Lower integration bound
00079   mutable Double_t _xmax;              //! Upper integration bound
00080   mutable Double_t _range;             //! Size of integration range
00081   Double_t _extrapValue;               //! Extrapolated value
00082   Double_t _extrapError;               //! Error on extrapolated value
00083   Double_t *_h ;                       //! Integrator workspace
00084   Double_t *_s ;                       //! Integrator workspace
00085   Double_t *_c ;                       //! Integrator workspace
00086   Double_t *_d ;                       //! Integrator workspace
00087   Double_t _savedResult;               //! Integrator workspace
00088 
00089   Double_t* xvec(Double_t& xx) { _x[0] = xx ; return _x ; }
00090 
00091   Double_t *_x ; //! do not persist
00092 
00093   ClassDef(RooIntegrator1D,0) // 1-dimensional numerical integration engine
00094 };
00095 
00096 #endif

Generated on Tue Jul 5 14:26:12 2011 for ROOT_528-00b_version by  doxygen 1.5.1