Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooFunctorBinding.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id$
5  * Authors: *
6  * WV, Wouter Verkerke, NIKHEF, verkerke@nikhef.nl *
7  * *
8  * Copyright (c) 2000-2008, NIKHEF, Regents of the University of California *
9  * and Stanford University. All rights reserved. *
10  * *
11  *****************************************************************************/
12 
13 #ifndef ROOFUNCTORBINDING
14 #define ROOFUNCTORBINDING
15 
16 #include "TString.h"
17 #include "RooAbsReal.h"
18 #include "RooArgList.h"
19 #include "RooListProxy.h"
20 #include "RooAbsPdf.h"
21 #include "RooRealProxy.h"
22 #include "RooMsgService.h"
23 #include <string>
24 #include <map>
25 #include <vector>
26 #include "Math/IFunction.h"
27 
28 namespace RooFit {
29 
30 RooAbsReal* bindFunction(const char* name, const ROOT::Math::IBaseFunctionMultiDim& ftor,const RooArgList& vars) ;
31 RooAbsPdf* bindPdf(const char* name, const ROOT::Math::IBaseFunctionMultiDim& ftor, const RooArgList& vars) ;
32 
33 }
34 
35 class RooFunctorBinding : public RooAbsReal {
36 public:
37  RooFunctorBinding() : func(0), x(0) {
38  // Default constructor
39  } ;
40  RooFunctorBinding(const char *name, const char *title, const ROOT::Math::IBaseFunctionMultiDim& ftor, const RooArgList& vars);
41  RooFunctorBinding(const RooFunctorBinding& other, const char* name=0) ;
42  virtual TObject* clone(const char* newname) const { return new RooFunctorBinding(*this,newname); }
43  inline virtual ~RooFunctorBinding() { delete[] x ; }
44  void printArgs(std::ostream& os) const ;
45 
46 protected:
47 
48  Double_t evaluate() const ;
49 
50  const ROOT::Math::IBaseFunctionMultiDim* func ; // Functor
51  RooListProxy vars ; // Argument reference
52  Double_t* x ; // Argument value array
53 
54 
55 private:
56 
57  ClassDef(RooFunctorBinding,1) // RooAbsReal binding to a ROOT::Math::IBaseFunctionMultiDim
58 };
59 
60 
61 
62 class RooFunctorPdfBinding : public RooAbsPdf {
63 public:
64  RooFunctorPdfBinding() : func(0), x(0) {
65  // Default constructor
66  } ;
67  RooFunctorPdfBinding(const char *name, const char *title, const ROOT::Math::IBaseFunctionMultiDim& ftor, const RooArgList& vars);
68  RooFunctorPdfBinding(const RooFunctorPdfBinding& other, const char* name=0) ;
69  virtual TObject* clone(const char* newname) const { return new RooFunctorPdfBinding(*this,newname); }
70  inline virtual ~RooFunctorPdfBinding() { delete[] x ; }
71  void printArgs(std::ostream& os) const ;
72 
73 protected:
74 
75  Double_t evaluate() const ;
76 
77  const ROOT::Math::IBaseFunctionMultiDim* func ; // Functor
78  RooListProxy vars ; // Argument reference
79  Double_t* x ; // Argument value array
80 
81 
82 private:
83 
84  ClassDef(RooFunctorPdfBinding,1) // RooAbsPdf binding to a ROOT::Math::IBaseFunctionMultiDim
85 };
86 
87 
88 #endif