13#ifndef ROOCFUNCTION1BINDING
14#define ROOCFUNCTION1BINDING
42template<
class VO,
class VI>
47 void add(
const char*
name, VO (*ptr)(VI),
const char* arg1name=
"x") {
82 std::map<std::string,VO (*)(VI)>
_ptrmap ;
90template<
class VO,
class VI>
107 const char* result =
fmap().lookupName(
_ptr) ;
108 if (result && strlen(result)) {
116 temp._funcptr =
_ptr;
117 return Form(
"(%p)",temp._ptr) ;
122 return fmap().lookupArgName(
_ptr,iarg) ;
144template<
class VO,
class VI>
147template<
class VO,
class VI>
159 typedef ::RooCFunction1Ref<VO,VI> thisClass;
169 tmpName.Streamer(R__b) ;
171 if (tmpName==
"UNKNOWN" && R__v>0) {
173 coutW(ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
174 _ptr = dummyFunction ;
179 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
182 coutW(ObjectHandling) <<
"ERROR: Objected embeds pointer to function named " << tmpName
183 <<
" but no such function is registered, object will not be functional" << std::endl ;
196 TString tmpName = fmap().lookupName(_ptr) ;
197 if (tmpName.
Length()==0) {
203 temp._funcptr = _ptr;
204 coutW(ObjectHandling) <<
"WARNING: Cannot persist unknown function pointer " <<
Form(
"%p",temp._ptr)
205 <<
" written object will not be functional when read back" << std::endl ;
210 tmpName.Streamer(R__b) ;
219template<
class VO,
class VI>
232 os <<
"[ function=" <<
func.name() <<
" " ;
259template<
class VO,
class VI>
263 x(func.argName(0),func.argName(0),this,_x)
272template<
class VO,
class VI>
283template<
class VO,
class VI>
296 os <<
"[ function=" <<
func.name() <<
" " ;
323template<
class VO,
class VI>
327 x(func.argName(0),func.argName(0),this,_x)
336template<
class VO,
class VI>
#define ClassDef(name, id)
char * Form(const char *fmt,...)
Int_t numProxies() const
Return the number of registered proxies.
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
RooAbsProxy is the abstact interface for proxy classes.
virtual void print(std::ostream &os, Bool_t addContents=kFALSE) const
Print proxy name.
virtual const char * name() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooCFunction1Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
RooCFunction1Ref< VO, VI > func
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
virtual ~RooCFunction1Binding()
virtual TObject * clone(const char *newname) const
VO(*)(VI) lookupPtr(const char *name)
const char * lookupArgName(VO(*ptr)(VI), UInt_t iarg)
void add(const char *name, VO(*ptr)(VI), const char *arg1name="x")
std::map< VO(*)(VI), std::vector< std::string > > _argnamemap
std::map< VO(*)(VI), std::string > _namemap
std::map< std::string, VO(*)(VI)> _ptrmap
const char * lookupName(VO(*ptr)(VI))
RooCFunction1Ref< VO, VI > func
void printArgs(std::ostream &os) const
Print object arguments, ie its proxies.
RooCFunction1PdfBinding()
virtual TObject * clone(const char *newname) const
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
virtual ~RooCFunction1PdfBinding()
RooCFunction1Ref(VO(*ptr)(VI)=0)
static VO dummyFunction(VI)
VO operator()(VI x) const
const char * name() const
const char * argName(Int_t iarg)
static RooCFunction1Map< VO, VI > & fmap()
static RooCFunction1Map< VO, VI > * _fmap
Pointer to embedded function.
Buffer base class used for serializing objects.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
Mother of all ROOT objects.
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
Double_t(* CFUNCD1D)(Double_t)
Double_t(* CFUNCD1I)(Int_t)
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)