00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "Riostream.h"
00027 #include "RooFunctor1DBinding.h"
00028
00029 using namespace std ;
00030
00031 ClassImp(RooFunctor1DBinding)
00032 ClassImp(RooFunctor1DPdfBinding)
00033 ;
00034
00035
00036 RooFunctor1DBinding::RooFunctor1DBinding(const char *name, const char *title, const ROOT::Math::IBaseFunctionOneDim& ftor, RooAbsReal& x) :
00037 RooAbsReal(name,title),
00038 func(&ftor),
00039 var("x","x",this,x)
00040 {
00041 }
00042
00043
00044 RooFunctor1DBinding::RooFunctor1DBinding(const RooFunctor1DBinding& other, const char* name) :
00045 RooAbsReal(other,name),
00046 func(other.func),
00047 var("x",this,other.var)
00048 {
00049
00050 }
00051
00052
00053
00054 void RooFunctor1DBinding::printArgs(ostream& os) const {
00055
00056 os << "[ function=" << func << " " ;
00057 for (Int_t i=0 ; i<numProxies() ; i++) {
00058 RooAbsProxy* p = getProxy(i) ;
00059 if (!TString(p->name()).BeginsWith("!")) {
00060 p->print(os) ;
00061 os << " " ;
00062 }
00063 }
00064 os << "]" ;
00065 }
00066
00067 Double_t RooFunctor1DBinding::evaluate() const {
00068
00069 return (*func)(var.arg().getVal()) ;
00070 }
00071
00072
00073
00074 RooFunctor1DPdfBinding::RooFunctor1DPdfBinding(const char *name, const char *title, const ROOT::Math::IBaseFunctionOneDim& ftor, RooAbsReal& x) :
00075 RooAbsPdf(name,title),
00076 func(&ftor),
00077 var("x","x",this,x)
00078 {
00079 }
00080
00081
00082 RooFunctor1DPdfBinding::RooFunctor1DPdfBinding(const RooFunctor1DPdfBinding& other, const char* name) :
00083 RooAbsPdf(other,name),
00084 func(other.func),
00085 var("x",this,other.var)
00086 {
00087
00088 }
00089
00090
00091
00092 void RooFunctor1DPdfBinding::printArgs(ostream& os) const {
00093
00094 os << "[ function=" << func << " " ;
00095 for (Int_t i=0 ; i<numProxies() ; i++) {
00096 RooAbsProxy* p = getProxy(i) ;
00097 if (!TString(p->name()).BeginsWith("!")) {
00098 p->print(os) ;
00099 os << " " ;
00100 }
00101 }
00102 os << "]" ;
00103 }
00104
00105 Double_t RooFunctor1DPdfBinding::evaluate() const {
00106
00107 return (*func)(var.arg().getVal()) ;
00108 }
00109
00110
00111
00112
00113 namespace RooFit {
00114
00115 RooAbsReal* bindFunction(const char* name, const ROOT::Math::IBaseFunctionOneDim& ftor, RooAbsReal& var) {
00116 return new RooFunctor1DBinding(name,name,ftor,var) ;
00117 }
00118
00119 RooAbsPdf* bindPdf(const char* name, const ROOT::Math::IBaseFunctionOneDim& ftor, RooAbsReal& var) {
00120 return new RooFunctor1DPdfBinding(name,name,ftor,var) ;
00121 }
00122
00123 }
00124
00125
00126