/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 * @(#)root/roofitcore:$Id$
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/
#ifndef ROO_FUNCTOR
#define ROO_FUNCTOR

#include "RooArgSet.h"
#include "RooAbsReal.h"

class RooAbsFunc ;
class RooAbsPdf ;

class RooFunctor {

public:
  RooFunctor(const RooAbsFunc& func) ;
  RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters) ;
  RooFunctor(const RooAbsReal& func, const RooArgList& observables, const RooArgList& parameters, const RooArgSet& nset) ;
  RooFunctor(const RooFunctor&) ;
  virtual ~RooFunctor() ;

  Int_t nObs() const { 
    // Number of observables
    return _nobs ; 
  }
  Int_t nPar() const { 
    // Number of parameters;
    return _npar ;
  }

  //Int_t numCall() const { return _binding->numCall() ; }
  //void resetNumCall() const { _binding->resetNumCall() ; }

  
  Double_t operator()(Double_t x) const { return eval(x) ; }
  Double_t operator()(const Double_t* x, const Double_t* p) const { return eval(x,p) ; }
  Double_t operator()(const Double_t* x) const { return eval(x) ; }

  Double_t eval(const Double_t* /*x*/, const Double_t* /*p*/) const ;
  Double_t eval(const Double_t* /*x*/) const ;
  Double_t eval(Double_t  /*x*/) const ;
  
  RooAbsFunc& binding() { return *_binding ; }

protected:

  Bool_t          _ownBinding ; // Do we own the binding function 
  RooArgSet       _nset ; // Normalization observables
  RooAbsFunc*     _binding ; // Function binding
  Double_t*       _x ; //! Transfer array ;
  Int_t           _npar ; //! Number of parameters ;
  Int_t           _nobs ; //! Number of observables ;

  ClassDef(RooFunctor,0) // Export RooAbsReal as functor
};

#endif

 RooFunctor.h:1
 RooFunctor.h:2
 RooFunctor.h:3
 RooFunctor.h:4
 RooFunctor.h:5
 RooFunctor.h:6
 RooFunctor.h:7
 RooFunctor.h:8
 RooFunctor.h:9
 RooFunctor.h:10
 RooFunctor.h:11
 RooFunctor.h:12
 RooFunctor.h:13
 RooFunctor.h:14
 RooFunctor.h:15
 RooFunctor.h:16
 RooFunctor.h:17
 RooFunctor.h:18
 RooFunctor.h:19
 RooFunctor.h:20
 RooFunctor.h:21
 RooFunctor.h:22
 RooFunctor.h:23
 RooFunctor.h:24
 RooFunctor.h:25
 RooFunctor.h:26
 RooFunctor.h:27
 RooFunctor.h:28
 RooFunctor.h:29
 RooFunctor.h:30
 RooFunctor.h:31
 RooFunctor.h:32
 RooFunctor.h:33
 RooFunctor.h:34
 RooFunctor.h:35
 RooFunctor.h:36
 RooFunctor.h:37
 RooFunctor.h:38
 RooFunctor.h:39
 RooFunctor.h:40
 RooFunctor.h:41
 RooFunctor.h:42
 RooFunctor.h:43
 RooFunctor.h:44
 RooFunctor.h:45
 RooFunctor.h:46
 RooFunctor.h:47
 RooFunctor.h:48
 RooFunctor.h:49
 RooFunctor.h:50
 RooFunctor.h:51
 RooFunctor.h:52
 RooFunctor.h:53
 RooFunctor.h:54
 RooFunctor.h:55
 RooFunctor.h:56
 RooFunctor.h:57
 RooFunctor.h:58
 RooFunctor.h:59
 RooFunctor.h:60
 RooFunctor.h:61
 RooFunctor.h:62
 RooFunctor.h:63
 RooFunctor.h:64
 RooFunctor.h:65
 RooFunctor.h:66
 RooFunctor.h:67
 RooFunctor.h:68
 RooFunctor.h:69
 RooFunctor.h:70