#ifndef ROOCFUNCTION3BINDING
#define ROOCFUNCTION3BINDING
#include "TString.h"
#include "RooAbsReal.h"
#include "RooRealProxy.h"
#include "RooMsgService.h"
#include "RooAbsPdf.h"
#include <string>
#include <map>
#include <vector>
namespace RooFit {
typedef Double_t (*CFUNCD3DDD)(Double_t,Double_t,Double_t) ;
typedef Double_t (*CFUNCD3DDB)(Double_t,Double_t,Bool_t) ;
typedef Double_t (*CFUNCD3DII)(Double_t,Int_t,Int_t) ;
typedef Double_t (*CFUNCD3UDU)(UInt_t,Double_t,UInt_t) ;
typedef Double_t (*CFUNCD3UDD)(UInt_t,Double_t,Double_t) ;
typedef Double_t (*CFUNCD3UUD)(UInt_t,UInt_t,Double_t) ;
RooAbsReal* bindFunction(const char* name,CFUNCD3DDD func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsReal* bindFunction(const char* name,CFUNCD3DDB func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsReal* bindFunction(const char* name,CFUNCD3DII func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsReal* bindFunction(const char* name,CFUNCD3UDU func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsReal* bindFunction(const char* name,CFUNCD3UDD func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsReal* bindFunction(const char* name,CFUNCD3UUD func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsPdf* bindPdf(const char* name,CFUNCD3DDD func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsPdf* bindPdf(const char* name,CFUNCD3DDB func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsPdf* bindPdf(const char* name,CFUNCD3DII func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsPdf* bindPdf(const char* name,CFUNCD3UDU func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsPdf* bindPdf(const char* name,CFUNCD3UDD func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
RooAbsPdf* bindPdf(const char* name,CFUNCD3UUD func,RooAbsReal& x, RooAbsReal& y, RooAbsReal& z) ;
}
template<class VO, class VI1, class VI2, class VI3>
class RooCFunction3Map {
public:
RooCFunction3Map() {} ;
void add(const char* name, VO (*ptr)(VI1,VI2,VI3), const char* arg1name="x", const char* arg2name="y", const char* arg3name="z") {
_ptrmap[name] = ptr ;
_namemap[ptr] = name ;
_argnamemap[ptr].push_back(arg1name) ;
_argnamemap[ptr].push_back(arg2name) ;
_argnamemap[ptr].push_back(arg3name) ;
}
const char* lookupName(VO (*ptr)(VI1,VI2,VI3)) {
return _namemap[ptr].c_str() ;
}
VO (*lookupPtr(const char* name))(VI1,VI2,VI3) {
return _ptrmap[name] ;
}
const char* lookupArgName(VO (*ptr)(VI1,VI2,VI3), UInt_t iarg) {
if (iarg<_argnamemap[ptr].size()) {
return (_argnamemap[ptr])[iarg].c_str() ;
}
switch (iarg) {
case 0: return "x" ;
case 1: return "y" ;
case 2: return "z" ;
}
return "w" ;
}
private:
#ifndef __CINT__
std::map<std::string,VO (*)(VI1,VI2,VI3)> _ptrmap ;
std::map<VO (*)(VI1,VI2,VI3),std::string> _namemap ;
std::map<VO (*)(VI1,VI2,VI3),std::vector<std::string> > _argnamemap ;
#endif
} ;
template<class VO, class VI1, class VI2, class VI3>
class RooCFunction3Ref : public TObject {
public:
RooCFunction3Ref(VO (*ptr)(VI1,VI2,VI3)=0) : _ptr(ptr) {
} ;
~RooCFunction3Ref() {} ;
VO operator()(VI1 x,VI2 y, VI3 z) const {
return (*_ptr)(x,y,z) ;
}
const char* name() const {
const char* result = fmap().lookupName(_ptr) ;
if (result && strlen(result)) {
return result ;
}
union {
void *_ptr;
func_t _funcptr;
} temp;
temp._funcptr = _ptr;
return Form("(%p)",temp._ptr) ;
}
const char* argName(Int_t iarg) {
return fmap().lookupArgName(_ptr,iarg) ;
}
static RooCFunction3Map<VO,VI1,VI2,VI3>& fmap() {
if (!_fmap) {
_fmap = new RooCFunction3Map<VO,VI1,VI2,VI3> ;
}
return *_fmap ;
}
private:
static VO dummyFunction(VI1,VI2,VI3) {
return 0 ;
}
typedef VO (*func_t)(VI1,VI2,VI3) ;
func_t _ptr;
static RooCFunction3Map<VO,VI1,VI2,VI3>* _fmap ;
ClassDef(RooCFunction3Ref,1)
} ;
template<class VO, class VI1, class VI2, class VI3>
void RooCFunction3Ref<VO,VI1,VI2,VI3>::Streamer(TBuffer &R__b)
{
typedef ::RooCFunction3Ref<VO,VI1,VI2,VI3> thisClass;
if (R__b.IsReading()) {
UInt_t R__s, R__c;
Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
TString tmpName ;
tmpName.Streamer(R__b) ;
if (tmpName=="UNKNOWN" && R__v>0) {
coutW(ObjectHandling) << "WARNING: Objected embeds function pointer to unknown function, object will not be functional" << std::endl ;
_ptr = dummyFunction ;
} else {
_ptr = fmap().lookupPtr(tmpName.Data()) ;
if (_ptr==0) {
coutW(ObjectHandling) << "ERROR: Objected embeds pointer to function named " << tmpName
<< " but no such function is registered, object will not be functional" << std::endl ;
}
}
R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
} else {
UInt_t R__c;
R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
TString tmpName = fmap().lookupName(_ptr) ;
if (tmpName.Length()==0) {
union {
void *_ptr;
func_t _funcptr;
} temp;
temp._funcptr = _ptr;
coutW(ObjectHandling) << "WARNING: Cannot persist unknown function pointer " << Form("%p",temp._ptr)
<< " written object will not be functional when read back" << std::endl ;
tmpName="UNKNOWN" ;
}
tmpName.Streamer(R__b) ;
R__b.SetByteCount(R__c, kTRUE);
}
}
template<class VO,class VI1, class VI2, class VI3>
class RooCFunction3Binding : public RooAbsReal {
public:
RooCFunction3Binding() {
} ;
RooCFunction3Binding(const char *name, const char *title, VO (*_func)(VI1,VI2,VI3), RooAbsReal& _x, RooAbsReal& _y, RooAbsReal& _z);
RooCFunction3Binding(const RooCFunction3Binding& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new RooCFunction3Binding(*this,newname); }
inline virtual ~RooCFunction3Binding() { }
void printArgs(std::ostream& os) const {
os << "[ function=" << func.name() << " " ;
for (Int_t i=0 ; i<numProxies() ; i++) {
RooAbsProxy* p = getProxy(i) ;
if (!TString(p->name()).BeginsWith("!")) {
p->print(os) ;
os << " " ;
}
}
os << "]" ;
}
protected:
RooCFunction3Ref<VO,VI1,VI2,VI3> func ;
RooRealProxy x ;
RooRealProxy y ;
RooRealProxy z ;
Double_t evaluate() const {
return func(x,y,z) ;
}
private:
ClassDef(RooCFunction3Binding,1)
};
template<class VO,class VI1, class VI2, class VI3>
RooCFunction3Binding<VO,VI1,VI2,VI3>::RooCFunction3Binding(const char *name, const char *title, VO (*_func)(VI1,VI2,VI3),
RooAbsReal& _x, RooAbsReal& _y, RooAbsReal& _z) :
RooAbsReal(name,title),
func(_func),
x(func.argName(0),func.argName(0),this,_x),
y(func.argName(1),func.argName(1),this,_y),
z(func.argName(2),func.argName(2),this,_z)
{
}
template<class VO,class VI1, class VI2, class VI3>
RooCFunction3Binding<VO,VI1,VI2,VI3>::RooCFunction3Binding(const RooCFunction3Binding& other, const char* name) :
RooAbsReal(other,name),
func(other.func),
x("x",this,other.x),
y("y",this,other.y),
z("z",this,other.z)
{
}
template<class VO,class VI1, class VI2, class VI3>
class RooCFunction3PdfBinding : public RooAbsPdf {
public:
RooCFunction3PdfBinding() {
} ;
RooCFunction3PdfBinding(const char *name, const char *title, VO (*_func)(VI1,VI2,VI3), RooAbsReal& _x, RooAbsReal& _y, RooAbsReal& _z);
RooCFunction3PdfBinding(const RooCFunction3PdfBinding& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new RooCFunction3PdfBinding(*this,newname); }
inline virtual ~RooCFunction3PdfBinding() { }
void printArgs(std::ostream& os) const {
os << "[ function=" << func.name() << " " ;
for (Int_t i=0 ; i<numProxies() ; i++) {
RooAbsProxy* p = getProxy(i) ;
if (!TString(p->name()).BeginsWith("!")) {
p->print(os) ;
os << " " ;
}
}
os << "]" ;
}
protected:
RooCFunction3Ref<VO,VI1,VI2,VI3> func ;
RooRealProxy x ;
RooRealProxy y ;
RooRealProxy z ;
Double_t evaluate() const {
return func(x,y,z) ;
}
private:
ClassDef(RooCFunction3PdfBinding,1)
};
template<class VO,class VI1, class VI2, class VI3>
RooCFunction3PdfBinding<VO,VI1,VI2,VI3>::RooCFunction3PdfBinding(const char *name, const char *title, VO (*_func)(VI1,VI2,VI3),
RooAbsReal& _x, RooAbsReal& _y, RooAbsReal& _z) :
RooAbsPdf(name,title),
func(_func),
x(func.argName(0),func.argName(0),this,_x),
y(func.argName(1),func.argName(1),this,_y),
z(func.argName(2),func.argName(2),this,_z)
{
}
template<class VO,class VI1, class VI2, class VI3>
RooCFunction3PdfBinding<VO,VI1,VI2,VI3>::RooCFunction3PdfBinding(const RooCFunction3PdfBinding& other, const char* name) :
RooAbsPdf(other,name),
func(other.func),
x("x",this,other.x),
y("y",this,other.y),
z("z",this,other.z)
{
}
#endif
RooCFunction3Binding.h:10 RooCFunction3Binding.h:11 RooCFunction3Binding.h:12 RooCFunction3Binding.h:13 RooCFunction3Binding.h:14 RooCFunction3Binding.h:15 RooCFunction3Binding.h:16 RooCFunction3Binding.h:17 RooCFunction3Binding.h:18 RooCFunction3Binding.h:19 RooCFunction3Binding.h:20 RooCFunction3Binding.h:21 RooCFunction3Binding.h:22 RooCFunction3Binding.h:23 RooCFunction3Binding.h:24 RooCFunction3Binding.h:25 RooCFunction3Binding.h:26 RooCFunction3Binding.h:27 RooCFunction3Binding.h:28 RooCFunction3Binding.h:29 RooCFunction3Binding.h:30 RooCFunction3Binding.h:31 RooCFunction3Binding.h:32 RooCFunction3Binding.h:33 RooCFunction3Binding.h:34 RooCFunction3Binding.h:35 RooCFunction3Binding.h:36 RooCFunction3Binding.h:37 RooCFunction3Binding.h:38 RooCFunction3Binding.h:39 RooCFunction3Binding.h:40 RooCFunction3Binding.h:41 RooCFunction3Binding.h:42 RooCFunction3Binding.h:43 RooCFunction3Binding.h:44 RooCFunction3Binding.h:45 RooCFunction3Binding.h:46 RooCFunction3Binding.h:47 RooCFunction3Binding.h:48 RooCFunction3Binding.h:49 RooCFunction3Binding.h:50 RooCFunction3Binding.h:51 RooCFunction3Binding.h:52 RooCFunction3Binding.h:53 RooCFunction3Binding.h:54 RooCFunction3Binding.h:55 RooCFunction3Binding.h:56 RooCFunction3Binding.h:57 RooCFunction3Binding.h:58 RooCFunction3Binding.h:59 RooCFunction3Binding.h:60 RooCFunction3Binding.h:61 RooCFunction3Binding.h:62 RooCFunction3Binding.h:63 RooCFunction3Binding.h:64 RooCFunction3Binding.h:65 RooCFunction3Binding.h:66 RooCFunction3Binding.h:67 RooCFunction3Binding.h:68 RooCFunction3Binding.h:69 RooCFunction3Binding.h:70 RooCFunction3Binding.h:71 RooCFunction3Binding.h:72 RooCFunction3Binding.h:73 RooCFunction3Binding.h:74 RooCFunction3Binding.h:75 RooCFunction3Binding.h:76 RooCFunction3Binding.h:77 RooCFunction3Binding.h:78 RooCFunction3Binding.h:79 RooCFunction3Binding.h:80 RooCFunction3Binding.h:81 RooCFunction3Binding.h:82 RooCFunction3Binding.h:83 RooCFunction3Binding.h:84 RooCFunction3Binding.h:85 RooCFunction3Binding.h:86 RooCFunction3Binding.h:87 RooCFunction3Binding.h:88 RooCFunction3Binding.h:89 RooCFunction3Binding.h:90 RooCFunction3Binding.h:91 RooCFunction3Binding.h:92 RooCFunction3Binding.h:93 RooCFunction3Binding.h:94 RooCFunction3Binding.h:95 RooCFunction3Binding.h:96 RooCFunction3Binding.h:97 RooCFunction3Binding.h:98 RooCFunction3Binding.h:99 RooCFunction3Binding.h:100 RooCFunction3Binding.h:101 RooCFunction3Binding.h:102 RooCFunction3Binding.h:103 RooCFunction3Binding.h:104 RooCFunction3Binding.h:105 RooCFunction3Binding.h:106 RooCFunction3Binding.h:107 RooCFunction3Binding.h:108 RooCFunction3Binding.h:109 RooCFunction3Binding.h:110 RooCFunction3Binding.h:111 RooCFunction3Binding.h:112 RooCFunction3Binding.h:113 RooCFunction3Binding.h:114 RooCFunction3Binding.h:115 RooCFunction3Binding.h:116 RooCFunction3Binding.h:117 RooCFunction3Binding.h:118 RooCFunction3Binding.h:119 RooCFunction3Binding.h:120 RooCFunction3Binding.h:121 RooCFunction3Binding.h:122 RooCFunction3Binding.h:123 RooCFunction3Binding.h:124 RooCFunction3Binding.h:125 RooCFunction3Binding.h:126 RooCFunction3Binding.h:127 RooCFunction3Binding.h:128 RooCFunction3Binding.h:129 RooCFunction3Binding.h:130 RooCFunction3Binding.h:131 RooCFunction3Binding.h:132 RooCFunction3Binding.h:133 RooCFunction3Binding.h:134 RooCFunction3Binding.h:135 RooCFunction3Binding.h:136 RooCFunction3Binding.h:137 RooCFunction3Binding.h:138 RooCFunction3Binding.h:139 RooCFunction3Binding.h:140 RooCFunction3Binding.h:141 RooCFunction3Binding.h:142 RooCFunction3Binding.h:143 RooCFunction3Binding.h:144 RooCFunction3Binding.h:145 RooCFunction3Binding.h:146 RooCFunction3Binding.h:147 RooCFunction3Binding.h:148 RooCFunction3Binding.h:149 RooCFunction3Binding.h:150 RooCFunction3Binding.h:151 RooCFunction3Binding.h:152 RooCFunction3Binding.h:153 RooCFunction3Binding.h:154 RooCFunction3Binding.h:155 RooCFunction3Binding.h:156 RooCFunction3Binding.h:157 RooCFunction3Binding.h:158 RooCFunction3Binding.h:159 RooCFunction3Binding.h:160 RooCFunction3Binding.h:161 RooCFunction3Binding.h:162 RooCFunction3Binding.h:163 RooCFunction3Binding.h:164 RooCFunction3Binding.h:165 RooCFunction3Binding.h:166 RooCFunction3Binding.h:167 RooCFunction3Binding.h:168 RooCFunction3Binding.h:169 RooCFunction3Binding.h:170 RooCFunction3Binding.h:171 RooCFunction3Binding.h:172 RooCFunction3Binding.h:173 RooCFunction3Binding.h:174 RooCFunction3Binding.h:175 RooCFunction3Binding.h:176 RooCFunction3Binding.h:177 RooCFunction3Binding.h:178 RooCFunction3Binding.h:179 RooCFunction3Binding.h:180 RooCFunction3Binding.h:181 RooCFunction3Binding.h:182 RooCFunction3Binding.h:183 RooCFunction3Binding.h:184 RooCFunction3Binding.h:185 RooCFunction3Binding.h:186 RooCFunction3Binding.h:187 RooCFunction3Binding.h:188 RooCFunction3Binding.h:189 RooCFunction3Binding.h:190 RooCFunction3Binding.h:191 RooCFunction3Binding.h:192 RooCFunction3Binding.h:193 RooCFunction3Binding.h:194 RooCFunction3Binding.h:195 RooCFunction3Binding.h:196 RooCFunction3Binding.h:197 RooCFunction3Binding.h:198 RooCFunction3Binding.h:199 RooCFunction3Binding.h:200 RooCFunction3Binding.h:201 RooCFunction3Binding.h:202 RooCFunction3Binding.h:203 RooCFunction3Binding.h:204 RooCFunction3Binding.h:205 RooCFunction3Binding.h:206 RooCFunction3Binding.h:207 RooCFunction3Binding.h:208 RooCFunction3Binding.h:209 RooCFunction3Binding.h:210 RooCFunction3Binding.h:211 RooCFunction3Binding.h:212 RooCFunction3Binding.h:213 RooCFunction3Binding.h:214 RooCFunction3Binding.h:215 RooCFunction3Binding.h:216 RooCFunction3Binding.h:217 RooCFunction3Binding.h:218 RooCFunction3Binding.h:219 RooCFunction3Binding.h:220 RooCFunction3Binding.h:221 RooCFunction3Binding.h:222 RooCFunction3Binding.h:223 RooCFunction3Binding.h:224 RooCFunction3Binding.h:225 RooCFunction3Binding.h:226 RooCFunction3Binding.h:227 RooCFunction3Binding.h:228 RooCFunction3Binding.h:229 RooCFunction3Binding.h:230 RooCFunction3Binding.h:231 RooCFunction3Binding.h:232 RooCFunction3Binding.h:233 RooCFunction3Binding.h:234 RooCFunction3Binding.h:235 RooCFunction3Binding.h:236 RooCFunction3Binding.h:237 RooCFunction3Binding.h:238 RooCFunction3Binding.h:239 RooCFunction3Binding.h:240 RooCFunction3Binding.h:241 RooCFunction3Binding.h:242 RooCFunction3Binding.h:243 RooCFunction3Binding.h:244 RooCFunction3Binding.h:245 RooCFunction3Binding.h:246 RooCFunction3Binding.h:247 RooCFunction3Binding.h:248 RooCFunction3Binding.h:249 RooCFunction3Binding.h:250 RooCFunction3Binding.h:251 RooCFunction3Binding.h:252 RooCFunction3Binding.h:253 RooCFunction3Binding.h:254 RooCFunction3Binding.h:255 RooCFunction3Binding.h:256 RooCFunction3Binding.h:257 RooCFunction3Binding.h:258 RooCFunction3Binding.h:259 RooCFunction3Binding.h:260 RooCFunction3Binding.h:261 RooCFunction3Binding.h:262 RooCFunction3Binding.h:263 RooCFunction3Binding.h:264 RooCFunction3Binding.h:265 RooCFunction3Binding.h:266 RooCFunction3Binding.h:267 RooCFunction3Binding.h:268 RooCFunction3Binding.h:269 RooCFunction3Binding.h:270 RooCFunction3Binding.h:271 RooCFunction3Binding.h:272 RooCFunction3Binding.h:273 RooCFunction3Binding.h:274 RooCFunction3Binding.h:275 RooCFunction3Binding.h:276 RooCFunction3Binding.h:277 RooCFunction3Binding.h:278 RooCFunction3Binding.h:279 RooCFunction3Binding.h:280 RooCFunction3Binding.h:281 RooCFunction3Binding.h:282 RooCFunction3Binding.h:283 RooCFunction3Binding.h:284 RooCFunction3Binding.h:285 RooCFunction3Binding.h:286 RooCFunction3Binding.h:287 RooCFunction3Binding.h:288 RooCFunction3Binding.h:289 RooCFunction3Binding.h:290 RooCFunction3Binding.h:291 RooCFunction3Binding.h:292 RooCFunction3Binding.h:293 RooCFunction3Binding.h:294 RooCFunction3Binding.h:295 RooCFunction3Binding.h:296 RooCFunction3Binding.h:297 RooCFunction3Binding.h:298 RooCFunction3Binding.h:299 RooCFunction3Binding.h:300 RooCFunction3Binding.h:301 RooCFunction3Binding.h:302 RooCFunction3Binding.h:303 RooCFunction3Binding.h:304 RooCFunction3Binding.h:305 RooCFunction3Binding.h:306 RooCFunction3Binding.h:307 RooCFunction3Binding.h:308 RooCFunction3Binding.h:309 RooCFunction3Binding.h:310 RooCFunction3Binding.h:311 RooCFunction3Binding.h:312 RooCFunction3Binding.h:313 RooCFunction3Binding.h:314 RooCFunction3Binding.h:315 RooCFunction3Binding.h:316 RooCFunction3Binding.h:317 RooCFunction3Binding.h:318 RooCFunction3Binding.h:319 RooCFunction3Binding.h:320 RooCFunction3Binding.h:321 RooCFunction3Binding.h:322 RooCFunction3Binding.h:323 RooCFunction3Binding.h:324 RooCFunction3Binding.h:325 RooCFunction3Binding.h:326 RooCFunction3Binding.h:327 RooCFunction3Binding.h:328 RooCFunction3Binding.h:329 RooCFunction3Binding.h:330 RooCFunction3Binding.h:331 RooCFunction3Binding.h:332 RooCFunction3Binding.h:333 RooCFunction3Binding.h:334 RooCFunction3Binding.h:335 RooCFunction3Binding.h:336 RooCFunction3Binding.h:337 RooCFunction3Binding.h:338 RooCFunction3Binding.h:339 RooCFunction3Binding.h:340 RooCFunction3Binding.h:341 RooCFunction3Binding.h:342 RooCFunction3Binding.h:343 RooCFunction3Binding.h:344 RooCFunction3Binding.h:345 RooCFunction3Binding.h:346 RooCFunction3Binding.h:347 RooCFunction3Binding.h:348 RooCFunction3Binding.h:349 RooCFunction3Binding.h:350 RooCFunction3Binding.h:351 RooCFunction3Binding.h:352 RooCFunction3Binding.h:353 RooCFunction3Binding.h:354 RooCFunction3Binding.h:355 RooCFunction3Binding.h:356 RooCFunction3Binding.h:357 RooCFunction3Binding.h:358 RooCFunction3Binding.h:359 RooCFunction3Binding.h:360 RooCFunction3Binding.h:361 RooCFunction3Binding.h:362 RooCFunction3Binding.h:363 RooCFunction3Binding.h:364 RooCFunction3Binding.h:365 RooCFunction3Binding.h:366 RooCFunction3Binding.h:367 RooCFunction3Binding.h:368 RooCFunction3Binding.h:369 RooCFunction3Binding.h:370 RooCFunction3Binding.h:371 RooCFunction3Binding.h:372 RooCFunction3Binding.h:373 RooCFunction3Binding.h:374