00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * File: $Id: RooAbsFunc.h,v 1.9 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_FUNC 00017 #define ROO_ABS_FUNC 00018 00019 #include "Rtypes.h" 00020 #include <list> 00021 class RooAbsRealLValue ; 00022 00023 class RooAbsFunc { 00024 public: 00025 inline RooAbsFunc(UInt_t dimension) : _ncall(0), _dimension(dimension), _valid(kTRUE) { } 00026 inline RooAbsFunc(const RooAbsFunc& other) : _ncall(0), _dimension(other._dimension), _valid(kTRUE) { } 00027 00028 inline virtual ~RooAbsFunc() { } 00029 inline UInt_t getDimension() const { 00030 // Dimension of function 00031 return _dimension; 00032 } 00033 inline Bool_t isValid() const { 00034 // Is function in valid state 00035 return _valid; 00036 } 00037 00038 virtual Double_t operator()(const Double_t xvector[]) const = 0; 00039 virtual Double_t getMinLimit(UInt_t dimension) const = 0; 00040 virtual Double_t getMaxLimit(UInt_t dimension) const = 0; 00041 00042 Int_t numCall() const { 00043 // Return number of function calls since last reset 00044 return _ncall ; 00045 } 00046 void resetNumCall() const { 00047 // Reset function call counter 00048 _ncall = 0 ; 00049 } 00050 00051 virtual void saveXVec() const { 00052 // Interface to save current values of observables (if supported by binding implementation) 00053 } ; 00054 virtual void restoreXVec() const { 00055 // Interface to restore observables to saved values (if supported 00056 // by binding implementation) 00057 } ; 00058 00059 virtual const char* getName() const { 00060 // Name of function binding 00061 return "(unnamed)" ; 00062 } 00063 00064 virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const { 00065 // Interface for returning an optional hint for initial sampling points when constructing a curve 00066 // projected on observable. 00067 return 0 ; 00068 } 00069 00070 protected: 00071 mutable Int_t _ncall ; // Function call counter 00072 UInt_t _dimension; // Number of observables 00073 Bool_t _valid; // Is binding in valid state? 00074 ClassDef(RooAbsFunc,0) // Abstract real-valued function interface 00075 }; 00076 00077 #endif 00078