13#ifndef ROOCFUNCTION4BINDING
14#define ROOCFUNCTION4BINDING
44template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
49 void add(
const char*
name, VO (*ptr)(VI1,VI2,VI3,VI4),
const char* arg1name=
"x",
const char* arg2name=
"y",
50 const char* arg3name=
"z",
const char* arg4name=
"w") {
89 std::map<std::string,VO (*)(VI1,VI2,VI3,VI4)>
_ptrmap ;
90 std::map<VO (*)(VI1,VI2,VI3,VI4),std::string>
_namemap ;
91 std::map<VO (*)(VI1,VI2,VI3,VI4),std::vector<std::string> >
_argnamemap ;
97template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
122 temp._funcptr =
_ptr;
123 return Form(
"(%p)",temp._ptr) ;
128 return fmap().lookupArgName(
_ptr,iarg) ;
156template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
159template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
171 typedef ::RooCFunction4Ref<VO,VI1,VI2,VI3,VI4> thisClass;
183 if (tmpName==
"UNKNOWN" && R__v>0) {
185 coutW(ObjectHandling) <<
"WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
186 _ptr = dummyFunction ;
191 _ptr = fmap().lookupPtr(tmpName.
Data()) ;
194 coutW(ObjectHandling) <<
"ERROR: Objected embeds pointer to function named " << tmpName
195 <<
" but no such function is registered, object will not be functional" << std::endl ;
208 TString tmpName = fmap().lookupName(_ptr) ;
209 if (tmpName.
Length()==0) {
210 coutW(ObjectHandling) <<
"WARNING: Cannot persist unknown function pointer " <<
Form(
"0x%zx",(
size_t)_ptr)
211 <<
" written object will not be functional when read back" << std::endl ;
225template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
237 os <<
"[ function=" <<
func.name() <<
" " ;
267template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
268RooCFunction4Binding<VO,VI1,VI2,VI3,VI4>::RooCFunction4Binding(
const char *
name,
const char *title, VO (*_func)(VI1,VI2,VI3,VI4),
272 x(func.argName(0),func.argName(0),this,_x),
273 y(func.argName(1),func.argName(1),this,_y),
274 z(func.argName(2),func.argName(2),this,_z),
275 w(func.argName(3),func.argName(3),this,_w)
284template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
297template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
309 os <<
"[ function=" <<
func.name() <<
" " ;
339template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
340RooCFunction4PdfBinding<VO,VI1,VI2,VI3,VI4>::RooCFunction4PdfBinding(
const char *
name,
const char *title, VO (*_func)(VI1,VI2,VI3,VI4),
344 x(func.argName(0),func.argName(0),this,_x),
345 y(func.argName(1),func.argName(1),this,_y),
346 z(func.argName(2),func.argName(2),this,_z),
347 w(func.argName(3),func.argName(3),this,_w)
356template<
class VO,
class VI1,
class VI2,
class VI3,
class VI4>
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...
RooCFunction4Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void printArgs(std::ostream &os) const override
Print object arguments, ie its proxies.
RooCFunction4Ref< VO, VI1, VI2, VI3, VI4 > func
TObject * clone(const char *newname) const override
VO(*)(VI1, VI2, VI3, VI4) lookupPtr(const char *name)
std::map< std::string, VO(*)(VI1, VI2, VI3, VI4)> _ptrmap
const char * lookupName(VO(*ptr)(VI1, VI2, VI3, VI4))
void add(const char *name, VO(*ptr)(VI1, VI2, VI3, VI4), const char *arg1name="x", const char *arg2name="y", const char *arg3name="z", const char *arg4name="w")
const char * lookupArgName(VO(*ptr)(VI1, VI2, VI3, VI4), UInt_t iarg)
std::map< VO(*)(VI1, VI2, VI3, VI4), std::vector< std::string > > _argnamemap
std::map< VO(*)(VI1, VI2, VI3, VI4), std::string > _namemap
void printArgs(std::ostream &os) const override
Print object arguments, ie its proxies.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooCFunction4PdfBinding()
TObject * clone(const char *newname) const override
RooCFunction4Ref< VO, VI1, VI2, VI3, VI4 > func
static RooCFunction4Map< VO, VI1, VI2, VI3, VI4 > * _fmap
Pointer to embedded function.
RooCFunction4Ref(VO(*ptr)(VI1, VI2, VI3, VI4)=nullptr)
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * argName(Int_t iarg)
const char * name() const
VO(* func_t)(VI1, VI2, VI3, VI4)
VO operator()(VI1 x, VI2 y, VI3 z, VI4 w) const
static RooCFunction4Map< VO, VI1, VI2, VI3, VI4 > & fmap()
static VO dummyFunction(VI1, VI2, VI3, VI4)
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(* CFUNCD4DDDB)(double, double, double, bool)
double(* CFUNCD4DDDD)(double, double, double, double)
RooAbsPdf * bindPdf(const char *name, CFUNCD1D func, RooAbsReal &x)
double(* CFUNCD4DDDI)(double, double, double, Int_t)
RooAbsReal * bindFunction(const char *name, CFUNCD1D func, RooAbsReal &x)