00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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;
00061
00062
00063 SummationRule _rule;
00064 Int_t _maxSteps ;
00065 Int_t _minStepsZero ;
00066 Int_t _fixSteps ;
00067 Double_t _epsAbs ;
00068 Double_t _epsRel ;
00069 Bool_t _doExtrap ;
00070 enum { _nPoints = 5 };
00071
00072
00073 Double_t addTrapezoids(Int_t n) ;
00074 Double_t addMidpoints(Int_t n) ;
00075 void extrapolate(Int_t n) ;
00076
00077
00078 mutable Double_t _xmin;
00079 mutable Double_t _xmax;
00080 mutable Double_t _range;
00081 Double_t _extrapValue;
00082 Double_t _extrapError;
00083 Double_t *_h ;
00084 Double_t *_s ;
00085 Double_t *_c ;
00086 Double_t *_d ;
00087 Double_t _savedResult;
00088
00089 Double_t* xvec(Double_t& xx) { _x[0] = xx ; return _x ; }
00090
00091 Double_t *_x ;
00092
00093 ClassDef(RooIntegrator1D,0)
00094 };
00095
00096 #endif