13#ifndef ROOCFUNCTION2BINDING
14#define ROOCFUNCTION2BINDING
50template<
class VO,
class VI1,
class VI2>
55 void add(
const char*
name, VO (*ptr)(VI1,VI2),
const char* arg1name=
"x",
const char* arg2name=
"y") {
91 std::map<std::string,VO (*)(VI1,VI2)>
_ptrmap ;
92 std::map<VO (*)(VI1,VI2),std::string>
_namemap ;
93 std::map<VO (*)(VI1,VI2),std::vector<std::string> >
_argnamemap ;
99template<
class VO,
class VI1,
class VI2>
124 temp._funcptr =
_ptr;
125 return Form(
"(%p)",temp._ptr) ;
130 return fmap().lookupArgName(
_ptr,iarg) ;
158template<
class VO,
class VI1,
class VI2>
162template<
class VO,
class VI1,
class VI2>
174 typedef ::RooCFunction2Ref<VO,VI1,VI2> thisClass;
186 if (tmpName==
"UNKNOWN" && R__v>0) {
188 coutW(ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
189 _ptr = dummyFunction ;
194 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
197 coutW(ObjectHandling) <<
"ERROR: Objected embeds pointer to function named " << tmpName
198 <<
" but no such function is registered, object will not be functional" << std::endl ;
211 TString tmpName = fmap().lookupName(_ptr) ;
212 if (tmpName.
Length()==0) {
213 coutW(ObjectHandling) <<
"WARNING: Cannot persist unknown function pointer " <<
Form(
"0x%zx", (
size_t)_ptr)
214 <<
" written object will not be functional when read back" << std::endl ;
228template<
class VO,
class VI1,
class VI2>
240 os <<
"[ function=" <<
func.name() <<
" " ;
267template<
class VO,
class VI1,
class VI2>
272 x(func.argName(0),func.argName(0),this,_x),
273 y(func.argName(1),func.argName(1),this,_y)
282template<
class VO,
class VI1,
class VI2>
295template<
class VO,
class VI1,
class VI2>
307 os <<
"[ function=" <<
func.name() <<
" " ;
334template<
class VO,
class VI1,
class VI2>
339 x(func.argName(0),func.argName(0),this,_x),
340 y(func.argName(1),func.argName(1),this,_y)
349template<
class VO,
class VI1,
class VI2>
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Int_t numProxies() const
Return the number of registered proxies.
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
Abstract interface for all probability density functions.
RooAbsProxy is the abstract interface for proxy classes.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooCFunction2Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
RooCFunction2Ref< VO, VI1, VI2 > func
void printArgs(std::ostream &os) const override
Print object arguments, ie its proxies.
TObject * clone(const char *newname) const override
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
std::map< VO(*)(VI1, VI2), std::vector< std::string > > _argnamemap
std::map< std::string, VO(*)(VI1, VI2)> _ptrmap
std::map< VO(*)(VI1, VI2), std::string > _namemap
void add(const char *name, VO(*ptr)(VI1, VI2), const char *arg1name="x", const char *arg2name="y")
VO(*)(VI1, VI2) lookupPtr(const char *name)
const char * lookupArgName(VO(*ptr)(VI1, VI2), UInt_t iarg)
const char * lookupName(VO(*ptr)(VI1, VI2))
TObject * clone(const char *newname) const override
void printArgs(std::ostream &os) const override
Print object arguments, ie its proxies.
RooCFunction2PdfBinding()
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooCFunction2Ref< VO, VI1, VI2 > func
const char * argName(Int_t iarg)
VO operator()(VI1 x, VI2 y) const
RooCFunction2Ref(VO(*ptr)(VI1, VI2)=nullptr)
static RooCFunction2Map< VO, VI1, VI2 > & fmap()
static VO dummyFunction(VI1, VI2)
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * name() const
static RooCFunction2Map< VO, VI1, VI2 > * _fmap
Pointer to embedded function.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=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
virtual void Streamer(TBuffer &)
Stream a string object.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
double(* CFUNCD2ID)(Int_t, double)
double(* CFUNCD2DD)(double, double)
double(* CFUNCD2DI)(double, Int_t)
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)
double(* CFUNCD2UD)(UInt_t, double)
double(* CFUNCD2II)(Int_t, Int_t)