00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * File: $Id: RooAbsIntegrator.h,v 1.18 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_ABS_INTEGRATOR 00017 #define ROO_ABS_INTEGRATOR 00018 00019 #include "RooAbsFunc.h" 00020 #include "RooNumIntConfig.h" 00021 00022 class RooAbsIntegrator : public TObject { 00023 public: 00024 RooAbsIntegrator() ; 00025 RooAbsIntegrator(const RooAbsFunc& function, Bool_t printEvalCounter=kFALSE); 00026 inline virtual ~RooAbsIntegrator() { 00027 // Destructor 00028 } 00029 virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const = 0 ; 00030 00031 inline Bool_t isValid() const { 00032 // Is integrator in valid state 00033 return _valid; 00034 } 00035 00036 inline Double_t integrand(const Double_t x[]) const { 00037 // Return value of integrand at given observable values 00038 return (*_function)(x); 00039 } 00040 inline const RooAbsFunc *integrand() const { 00041 // Return integrand function binding 00042 return _function; 00043 } 00044 00045 inline virtual Bool_t checkLimits() const { 00046 // If true, finite limits are required on the observable range 00047 return kTRUE; 00048 } 00049 00050 Double_t calculate(const Double_t *yvec=0) ; 00051 virtual Double_t integral(const Double_t *yvec=0)=0 ; 00052 00053 virtual Bool_t canIntegrate1D() const = 0 ; 00054 virtual Bool_t canIntegrate2D() const = 0 ; 00055 virtual Bool_t canIntegrateND() const = 0 ; 00056 virtual Bool_t canIntegrateOpenEnded() const = 0 ; 00057 00058 Bool_t printEvalCounter() const { return _printEvalCounter ; } 00059 void setPrintEvalCounter(Bool_t value) { _printEvalCounter = value ; } 00060 00061 virtual Bool_t setLimits(Double_t*, Double_t*) { return kFALSE ; } 00062 virtual Bool_t setLimits(Double_t xmin, Double_t xmax) ; 00063 virtual Bool_t setUseIntegrandLimits(Bool_t flag) ; 00064 00065 protected: 00066 00067 const RooAbsFunc *_function; // Pointer to function binding of integrand 00068 Bool_t _valid; // Is integrator in valid state? 00069 Bool_t _printEvalCounter ; // If true print number of function evaluation required for integration 00070 00071 ClassDef(RooAbsIntegrator,0) // Abstract interface for real-valued function integrators 00072 }; 00073 00074 #endif