00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * @(#)root/roofitcore:$Id: RooFunctor.h 28259 2009-04-16 16:21:16Z wouter $ 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_FUNCTOR 00017 #define ROO_FUNCTOR 00018 00019 #include "RooArgSet.h" 00020 #include "RooAbsReal.h" 00021 00022 class RooAbsFunc ; 00023 class RooAbsPdf ; 00024 00025 class RooFunctor { 00026 00027 public: 00028 RooFunctor(const RooAbsFunc& func) ; 00029 RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters) ; 00030 RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters, const RooArgSet& nset) ; 00031 RooFunctor(const RooFunctor&) ; 00032 virtual ~RooFunctor() ; 00033 00034 Int_t nObs() const { 00035 // Number of observables 00036 return _nobs ; 00037 } 00038 Int_t nPar() const { 00039 // Number of parameters; 00040 return _npar ; 00041 } 00042 00043 //Int_t numCall() const { return _binding->numCall() ; } 00044 //void resetNumCall() const { _binding->resetNumCall() ; } 00045 00046 00047 Double_t operator()(Double_t x) const { return eval(x) ; } 00048 Double_t operator()(const Double_t* x, const Double_t* p) const { return eval(x,p) ; } 00049 Double_t operator()(const Double_t* x) const { return eval(x) ; } 00050 00051 Double_t eval(const Double_t* /*x*/, const Double_t* /*p*/) const ; 00052 Double_t eval(const Double_t* /*x*/) const ; 00053 Double_t eval(Double_t /*x*/) const ; 00054 00055 RooAbsFunc& binding() { return *_binding ; } 00056 00057 protected: 00058 00059 Bool_t _ownBinding ; // Do we own the binding function 00060 RooArgSet _nset ; // Normalization observables 00061 RooAbsFunc* _binding ; // Function binding 00062 Double_t* _x ; //! Transfer array ; 00063 Int_t _npar ; //! Number of parameters ; 00064 Int_t _nobs ; //! Number of observables ; 00065 00066 ClassDef(RooFunctor,0) // Export RooAbsReal as functor 00067 }; 00068 00069 #endif 00070