66 #define BUFFER_SIZE 64000 122 static char *strtok_r(
char *
s1,
const char *s2,
char **lasts)
128 while(*
s1 && strchr(s2, *
s1))
133 while(*
s1 && !strchr(s2, *
s1))
172 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createFactory() ERROR: variable with name '" << name <<
"' already exists" << endl ;
199 const size_t tmpSize = strlen(stateNameList)+1;
200 char *tmp =
new char[tmpSize] ;
201 strlcpy(tmp,stateNameList,tmpSize) ;
203 char* tok = strtok_r(tmp,
",",&save) ;
205 char*
sep = strchr(tok,
'=') ;
208 Int_t id = atoi(sep+1) ;
214 tok = strtok_r(0,
",",&save) ;
228 static bool isEnum(
const char* classname) {
230 ClassInfo_t* cls =
gInterpreter->ClassInfo_Factory(classname);
237 static bool isValidEnumValue(
const char* typeName,
const char* value) {
241 return enumType && enumType->GetConstant(value);
244 static pair<list<string>,
unsigned int> ctorArgs(
const char* classname,
UInt_t nMinArg) {
252 ClassInfo_t* cls =
gInterpreter->ClassInfo_Factory(classname);
253 MethodInfo_t* func =
gInterpreter->MethodInfo_Factory(cls);
266 if (
string(classname) !=
gInterpreter->MethodInfo_TypeName(func)) {
272 if (nargs==0 || nargs==
gInterpreter->MethodInfo_NDefaultArg(func)) {
276 MethodArgInfo_t* arg =
gInterpreter->MethodArgInfo_Factory(func);
279 const char* argTypeName =
gInterpreter->MethodArgInfo_TypeName(arg);
280 if (nreq<2 && ((
string(
"char*") != argTypeName
282 && string(
"const char*") != argTypeName)) {
285 ret.push_back(argTypeName) ;
286 if(!
gInterpreter->MethodArgInfo_DefaultValue(arg)) nreq++;
291 if (ret.size()<nMinArg) {
299 return pair<list<string>,
unsigned int>(ret,nreq);
314 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not found in factory alias table, nor in ROOT class table" << endl;
323 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" does not inherit from RooAbsArg" << endl;
330 size_t blevel = 0, end_tok, start_tok = 0;
331 bool litmode =
false;
332 for (end_tok = 0; end_tok < tmp.length(); end_tok++) {
334 if (tmp[end_tok]==
'{' || tmp[end_tok]==
'(' || tmp[end_tok]==
'[') blevel++;
335 if (tmp[end_tok]==
'}' || tmp[end_tok]==
')' || tmp[end_tok]==
']') blevel--;
338 if (tmp[end_tok]==
'"' || tmp[end_tok]==
'\'') litmode = !litmode;
343 if (litmode ==
false && blevel == 0 && tmp[end_tok] ==
',') {
344 _args.push_back(tmp.substr(start_tok, end_tok - start_tok));
345 start_tok = end_tok+1;
348 _args.push_back(tmp.substr(start_tok, end_tok));
351 pair<list<string>,
unsigned int> ca = ctorArgs(className,
_args.size()+2) ;
352 if (ca.first.size()==0) {
353 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR no suitable constructor found for class " << className << endl ;
360 if (
_args.size()+2<ca.second ||
_args.size()+2>ca.first.size()) {
361 if (ca.second==ca.first.size()) {
362 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid, " << className
363 <<
" expects " << ca.first.size()-2 << endl ;
366 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid " << className
367 <<
" expect number between " << ca.second-2 <<
" and " << ca.first.size()-2 << endl ;
374 string cintExpr(
Form(
"new %s(\"%s\",\"%s\"",className,objName,objName)) ;
382 list<string>::iterator ti = ca.first.begin() ; ++ti ; ++ti ;
383 for (vector<string>::iterator ai =
_args.begin() ; ai !=
_args.end() ; ++ai,++ti,++i) {
384 if ((*ti)==
"RooAbsReal&" || (*ti)==
"const RooAbsReal&") {
386 cintExpr +=
Form(
",RooFactoryWSTool::as_FUNC(%d)",i) ;
387 }
else if ((*ti)==
"RooAbsArg&" || (*ti)==
"const RooAbsArg&") {
389 cintExpr +=
Form(
",RooFactoryWSTool::as_ARG(%d)",i) ;
390 }
else if ((*ti)==
"RooRealVar&" || (*ti)==
"const RooRealVar&") {
392 cintExpr +=
Form(
",RooFactoryWSTool::as_VAR(%d)",i) ;
393 }
else if ((*ti)==
"RooAbsRealLValue&" || (*ti)==
"const RooAbsRealLValue&") {
395 cintExpr +=
Form(
",RooFactoryWSTool::as_VARLV(%d)",i) ;
396 }
else if ((*ti)==
"RooCategory&" || (*ti)==
"const RooCategory&") {
398 cintExpr +=
Form(
",RooFactoryWSTool::as_CAT(%d)",i) ;
399 }
else if ((*ti)==
"RooAbsCategory&" || (*ti)==
"const RooAbsCategory&") {
401 cintExpr +=
Form(
",RooFactoryWSTool::as_CATFUNC(%d)",i) ;
402 }
else if ((*ti)==
"RooAbsCategoryLValue&" || (*ti)==
"const RooAbsCategoryLValue&") {
404 cintExpr +=
Form(
",RooFactoryWSTool::as_CATLV(%d)",i) ;
405 }
else if ((*ti)==
"RooAbsPdf&" || (*ti)==
"const RooAbsPdf&") {
407 cintExpr +=
Form(
",RooFactoryWSTool::as_PDF(%d)",i) ;
408 }
else if ((*ti)==
"RooResolutionModel&" || (*ti)==
"const RooResolutionModel&") {
410 cintExpr +=
Form(
",RooFactoryWSTool::as_RMODEL(%d)",i) ;
411 }
else if ((*ti)==
"RooAbsData&" || (*ti)==
"const RooAbsData&") {
413 cintExpr +=
Form(
",RooFactoryWSTool::as_DATA(%d)",i) ;
414 }
else if ((*ti)==
"RooDataSet&" || (*ti)==
"const RooDataSet&") {
416 cintExpr +=
Form(
",RooFactoryWSTool::as_DSET(%d)",i) ;
417 }
else if ((*ti)==
"RooDataHist&" || (*ti)==
"const RooDataHist&") {
419 cintExpr +=
Form(
",RooFactoryWSTool::as_DHIST(%d)",i) ;
420 }
else if ((*ti)==
"const RooArgSet&") {
422 cintExpr +=
Form(
",RooFactoryWSTool::as_SET(%d)",i) ;
423 }
else if ((*ti)==
"const RooArgList&") {
425 cintExpr +=
Form(
",RooFactoryWSTool::as_LIST(%d)",i) ;
426 }
else if ((*ti)==
"const char*") {
428 cintExpr +=
Form(
",RooFactoryWSTool::as_STRING(%d)",i) ;
429 }
else if ((*ti)==
"Int_t" || (*ti)==
"int" || (*ti)==
"Bool_t" || (*ti)==
"bool") {
431 cintExpr +=
Form(
",RooFactoryWSTool::as_INT(%d)",i) ;
432 }
else if ((*ti)==
"Double_t") {
434 cintExpr +=
Form(
",RooFactoryWSTool::as_DOUBLE(%d)",i) ;
435 }
else if (isEnum(ti->c_str())) {
438 if (
_args[i].find(
Form(
"%s::",className)) != string::npos) {
439 qualvalue =
_args[i].c_str() ;
441 qualvalue =
Form(
"%s::%s",className,
_args[i].c_str()) ;
443 if (isValidEnumValue(ti->c_str(),qualvalue.c_str())) {
444 cintExpr +=
Form(
",(%s)%s",ti->c_str(),qualvalue.c_str()) ;
446 throw string(
Form(
"Supplied argument %s does not represent a valid state of enum %s",
_args[i].c_str(),ti->c_str())) ;
454 if (ti->find(
"const ")==0) {
455 btype = ti->c_str()+6 ;
459 if (btype.find(
"&")) {
460 btype.erase(btype.size()-1,btype.size()) ;
467 cintExpr +=
Form(
",(%s&)RooFactoryWSTool::as_OBJ(%d)",ti->c_str(),i) ;
469 throw string(
Form(
"Required argument with name %s of type '%s' is not in the workspace",
_args[i].c_str(),ti->c_str())) ;
474 }
catch (
const string &err) {
475 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR constructing " << className <<
"::" << objName <<
": " << err << endl ;
480 cxcoutD(
ObjectHandling) <<
"RooFactoryWSTool::createArg() Construct expression is " << cintExpr << endl ;
486 if (
string(className)==
"RooGenericPdf") {
488 }
else if (
string(className)==
"RooFormulaVar") {
498 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR in CINT constructor call to create object" << endl ;
519 char* tok = strtok_r(buf,
",",&save) ;
521 char* star=strchr(tok,
'*') ;
529 tok = strtok_r(0,
",",&save) ;
531 pdfList.
add(pdfList2) ;
533 }
catch (
const string &err) {
534 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooAddPdf: " << err << endl ;
561 char* tok = strtok_r(buf,
",",&save) ;
563 char* star=strchr(tok,
'*') ;
571 tok = strtok_r(0,
",",&save) ;
573 amplList.
add(amplList2) ;
575 }
catch (
const string &err) {
576 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooRealSumPdf: " << err << endl ;
596 string regPdfList=
"{" ;
600 char* tok = strtok_r(buf,
",",&save) ;
602 char *
sep = strchr(tok,
'|') ;
617 }
catch (
const string &err) {
618 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf Conditional argument: " << err << endl ;
625 if (regPdfList.size()>1) {
630 tok = strtok_r(0,
",",&save) ;
636 pdf =
new RooProdPdf(objName,objName,
asSET(regPdfList.c_str()),cmdList) ;
637 }
catch (
const string &err) {
638 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf input set of regular p.d.f.s: " << err << endl ;
660 map<string,RooAbsPdf*> theMap ;
665 char* tok = strtok_r(buf,
",",&save) ;
667 char* eq = strchr(tok,
'=') ;
669 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName
670 <<
" expect mapping token of form 'state=pdfName', but found '" << tok <<
"'" << endl ;
677 theMap[tok] = &
asPDF(eq+1) ;
678 }
catch (
const string &err ) {
679 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous: " << err << endl ;
683 tok = strtok_r(0,
",",&save) ;
691 }
catch (
const string &err) {
692 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName <<
" " << err << endl ;
717 char* tok = strtok_r(buf,
",",&save) ;
719 char* star=strchr(tok,
'*') ;
727 tok = strtok_r(0,
",",&save) ;
730 }
catch (
const string &err) {
731 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: " << err << endl ;
737 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: syntax error: either all sum terms must be products or none" << endl ;
745 sum =
new RooAddition(objName,objName,sumlist1,sumlist2) ;
886 char* buf =
new char[strlen(expr)+1] ;
891 if (!isspace(*expr)) {
908 }
catch (
const string &error) {
909 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERROR in parsing: " << error << endl ;
915 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed" << endl ;
925 return out.size() ?
ws().
arg(out.c_str()) : 0 ;
944 if (
string(token).find(
"$Alias(")==0) {
970 const size_t bufBaseSize = strlen(token)+1;
971 char* buf_base =
new char[bufBaseSize] ;
972 char* buf = buf_base ;
973 strlcpy(buf,token,bufBaseSize) ;
976 list<string> singleExpr ;
977 list<char> separator ;
983 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
984 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
987 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
991 if (!litmode && blevel==0 && ( (*p)==
'=' || (*p) ==
'|' || (*p) ==
'*')) {
992 separator.push_back(*p) ;
994 singleExpr.push_back(buf) ;
1000 singleExpr.push_back(buf) ;
1002 if (singleExpr.size()==1) {
1009 list<char>::iterator ic = separator.begin() ;
1010 for (list<string>::iterator ii = singleExpr.begin() ; ii!=singleExpr.end() ; ++ii) {
1012 if (ic != separator.end()) {
1035 if (strlen(arg)==0) {
1040 if (arg[0]==
'\'' || arg[0]==
'"') {
1041 return string(arg) ;
1045 const size_t bufSize = strlen(arg)+1;
1046 char* buf =
new char[bufSize] ;
1047 strlcpy(buf,arg,bufSize) ;
1048 char* bufptr = buf ;
1050 string func,prefix ;
1051 vector<string> args ;
1055 char* tmpx = strtok_r(buf,
"([",&save) ;
1056 func = tmpx ? tmpx :
"" ;
1057 char* p = strtok_r(0,
"",&save) ;
1072 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1073 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1076 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1082 if (!litmode && blevel==0 && ((*p)==
',')) {
1084 args.push_back(tok) ;
1093 if (p>bufptr && (*(p-1)==
')'||*(p-1)==
']')) {
1102 p = strtok_r(0,
"",&save) ;
1104 args.push_back(tmp) ;
1115 for(
const char* pp=arg ; *pp!=0 ; pp++) {
1116 if (*pp==
'(' || *pp==
'[' || *pp==
'{') {
1122 if (strstr(func.c_str(),
"::")) {
1127 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: Class::Instance must be followed by (...)" << endl ;
1130 }
else if (func[0]!=
'$'){
1134 }
else if (lb==
'(') {
1144 static Int_t globCounter = 0 ;
1146 autoname =
Form(
"gobj%d",globCounter) ;
1148 if (!
ws().arg(autoname.c_str())) {
1152 autoname =
Form(
"%s::%s",func.c_str(),autoname.c_str()) ;
1156 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: expect either Class(...) or Instance[...]" << endl ;
1164 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: $MetaClass must be followed by (...)" << endl ;
1184 const size_t bufSize = strlen(arg)+1;
1185 char* buf =
new char[bufSize] ;
1186 strlcpy(buf,arg,bufSize) ;
1188 vector<string> args ;
1199 if (*p==
'{' || *p==
'(' || *p==
'[') level++ ;
1200 if (*p==
'}' || *p==
')' || *p==
']') level-- ;
1206 if (level==0 && ((*p)==
',')) {
1208 args.push_back(tok) ;
1216 if (p>buf && *(p-1)==
'}') {
1219 args.push_back(tok) ;
1227 vector<string>::iterator iter = args.begin() ;
1229 while(iter!= args.end()) {
1230 if (strlen(ret.c_str())>1) ret +=
"," ;
1254 if (args.size()!=2) {
1255 coutE(
ObjectHandling) <<
"RooFactorWSTool::processAliasExpression() ERROR $Alias() takes exactly two arguments, " << args.size() <<
" args found" << endl ;
1275 map<string,string>::iterator item =
_typeAliases.find(className) ;
1279 className = item->second.c_str() ;
1292 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not defined in ROOT class table" << endl ;
1309 for (vector<string>::iterator iter = args.begin() ; iter!=args.end() ; ++iter) {
1310 if (iter!=args.begin()) {
1337 string first = *(args.begin()) ;
1338 if (isdigit(first[0]) || first[0]==
'.' || first[0]==
'+' || first[0]==
'-') {
1341 vector<string>::iterator ai = args.begin() ;
1342 if (args.size()==1) {
1345 Double_t xinit = atof((ai)->c_str()) ;
1347 RooRealVar tmp(func.c_str(),func.c_str(),xinit) ;
1353 }
else if (args.size()==2) {
1356 Double_t xlo = atof((ai++)->c_str()) ;
1358 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1359 RooRealVar tmp(func.c_str(),func.c_str(),xlo,xhi) ;
1365 }
else if (args.size()==3) {
1368 Double_t xinit = atof((ai++)->c_str()) ;
1369 Double_t xlo = atof((ai++)->c_str()) ;
1371 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xinit = " << xinit <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1372 RooRealVar tmp(func.c_str(),func.c_str(),xinit,xlo,xhi) ;
1382 for (vector<string>::iterator ai = args.begin() ; ai!=args.end() ; ++ai) {
1383 if (allStates.size()>0) {
1411 const char *className = strtok_r(buf,
":",&save) ;
1412 const char *instName = strtok_r(0,
":",&save) ;
1413 if (!className) className =
"";
1414 if (!instName) instName =
"" ;
1419 vector<string>::iterator iter = args.begin() ;
1420 vector<string> pargv ;
1422 while(iter!=args.end()) {
1423 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1428 pargv.push_back(tmp) ;
1434 for (map<string,IFace*>::iterator ii=
hooks().begin() ; ii!=
hooks().end() ; ++ii) {
1436 if (
hooks().find(className) !=
hooks().end()) {
1438 return iface->
create(*
this, className,instName,pargv) ;
1443 return string(instName) ;
1455 vector<string>::iterator iter = args.begin() ;
1456 vector<string> pargv ;
1457 while(iter!=args.end()) {
1458 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1461 pargv.push_back(tmp) ;
1465 string ret = func+
"("+pargs+
")" ;
1477 const size_t bufSize = strlen(funcExpr)+1;
1478 char* buf =
new char[bufSize] ;
1479 strlcpy(buf,funcExpr,bufSize) ;
1480 char* bufptr = buf ;
1483 vector<string> args ;
1487 char* tmpx = strtok_r(buf,
"(",&save) ;
1488 func = tmpx ? tmpx :
"" ;
1489 char* p = strtok_r(0,
"",&save) ;
1503 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1504 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1507 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1513 if (!litmode && blevel==0 && ((*p)==
',')) {
1515 args.push_back(tok) ;
1524 if (p>bufptr && *(p-1)==
')') {
1533 p = strtok_r(0,
"",&save) ;
1535 args.push_back(tmp) ;
1554 Int_t nParentheses(0), nBracket(0), nAccolade(0) ;
1555 const char* ptr = arg ;
1557 if (*ptr==
'(') nParentheses++ ;
1558 if (*ptr==
')') nParentheses-- ;
1559 if (*ptr==
'[') nBracket++ ;
1560 if (*ptr==
']') nBracket-- ;
1561 if (*ptr==
'{') nAccolade++ ;
1562 if (*ptr==
'}') nAccolade-- ;
1565 if (nParentheses!=0) {
1566 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nParentheses>0?
"(":
")") <<
"' in expression" << endl ;
1570 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nBracket>0?
"[":
"]") <<
"' in expression" << endl ;
1574 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nAccolade>0?
"{":
"}") <<
"' in expression" << endl ;
1587 throw string(
Form(
"Need argument number %d, but only %d args are provided",idx,(
Int_t)
_of->
_args.size())) ;
1599 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1606 throw string(
Form(
"RooAbsArg named %s not found",arg)) ;
1619 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1625 throw string(
Form(
"RooAbsReal named %s not found",arg)) ;
1629 throw string(
Form(
"Object named %s is not of type RooAbsReal",arg)) ;
1642 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1643 throw string(
Form(
"Numeric literal provided for argument (%s), but lvalue is required",arg)) ;
1648 throw string(
Form(
"RooAbsRealLValue named %s not found",arg)) ;
1652 throw string(
Form(
"Object named %s is not of type RooAbsRealLValue",arg)) ;
1666 throw string(
Form(
"RooRealVar named %s not found",arg)) ;
1681 throw string(
Form(
"RooAbsPdf named %s not found",arg)) ;
1696 throw string(
Form(
"RooResolutionModel named %s not found",arg)) ;
1700 throw string(
Form(
"Object named %s is not of type RooResolutionModel",arg)) ;
1715 throw string(
Form(
"RooAbsCategory named %s not found",arg)) ;
1719 throw string(
Form(
"Object named %s is not of type RooAbsCategory",arg)) ;
1733 throw string(
Form(
"RooAbsCategoryLValue named %s not found",arg)) ;
1738 throw string(
Form(
"Object named %s is not of type RooAbsCategoryLValue",arg)) ;
1752 throw string(
Form(
"RooCategory named %s not found",arg)) ;
1783 char* tok = strtok_r(tmp,
",{}",&save) ;
1788 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1790 }
else if (tok[0] ==
'\'') {
1791 tok[strlen(tok) - 1] = 0;
1799 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1802 tok = strtok_r(0,
",{}",&save) ;
1820 char* tok = strtok_r(tmp,
",{}",&save) ;
1824 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1826 }
else if (tok[0] ==
'\'') {
1827 tok[strlen(tok) - 1] = 0;
1835 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1838 tok = strtok_r(0,
",{}",&save) ;
1853 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1867 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1871 throw string(
Form(
"Dataset named %s is not of type RooDataHist",arg)) ;
1884 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1888 throw string(
Form(
"Dataset named %s is not of type RooDataSet",arg)) ;
1901 throw string(
Form(
"Object named %s not found",arg)) ;
1913 static vector<string> cbuf(10) ;
1914 static unsigned int cbuf_idx = 0 ;
1917 if (arg==0 || strlen(arg)==0) {
1923 cbuf[cbuf_idx].clear() ;
1924 const char* p = arg+1 ;
1925 while(*p && (*p) !=
'"' && (*p) !=
'\'' ) {
1926 cbuf[cbuf_idx] += *(p++) ;
1928 const char* ret = cbuf[cbuf_idx].c_str() ;
1932 if (cbuf_idx==cbuf.size()) cbuf_idx=0 ;
1961 hooks()[typeName] = iface ;
1971 _hooks =
new map<string,IFace*> ;
1984 vector<string>::iterator iter = args.begin() ;
1985 vector<string> pargv ;
1986 while(iter!=args.end()) {
1987 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1990 pargv.push_back(tmp) ;
1995 string cl(typeName) ;
2001 }
else if (cl==
"RSUM") {
2006 }
else if (cl==
"ASUM") {
2011 }
else if (cl==
"PROD") {
2014 ft.
prod(instName,pargs) ;
2016 }
else if (cl==
"SIMUL") {
2019 if (pargv.size()>1) {
2020 ft.
simul(instName,pargv[0].c_str(),strchr(pargs,
',')+1) ;
2022 throw string(
Form(
"Need at least two arguments in call to SIMUL::%s, have %d: %s",instName,(
Int_t)pargv.size(),pargs)) ;
2025 }
else if (cl==
"EXPR") {
2028 if (args.size()<=2) {
2029 ft.
createArg(
"RooGenericPdf",instName,pargs) ;
2034 for (
UInt_t i=1 ; i<args.size() ; i++) {
2039 ft.
createArg(
"RooGenericPdf",instName,genargs) ;
2042 }
else if (cl==
"FCONV") {
2045 ft.
createArg(
"RooFFTConvPdf",instName,pargs) ;
2047 }
else if (cl==
"NCONV") {
2050 ft.
createArg(
"RooNumConvPdf",instName,pargs) ;
2052 }
else if (cl==
"sum") {
2057 }
else if (cl==
"prod") {
2062 }
else if (cl==
"expr") {
2065 if (args.size()<=2) {
2066 ft.
createArg(
"RooFormulaVar",instName,pargs) ;
2071 for (
UInt_t i=1 ; i<args.size() ; i++) {
2076 ft.
createArg(
"RooFormulaVar",instName,genargs) ;
2079 }
else if (cl==
"nconv") {
2082 ft.
createArg(
"RooNumConvolution",instName,pargs) ;
2084 }
else if (cl==
"nll") {
2090 }
else if (cl==
"chi2") {
2096 }
else if (cl==
"profile") {
2099 ft.
createArg(
"RooProfileLL",instName,pargs) ;
2101 }
else if (cl==
"dataobs") {
2111 }
else if (cl==
"int") {
2118 if (pargv.size()<2 || pargv.size()>3) {
2119 throw string(
Form(
"int::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2125 strlcpy(buf,pargv[1].c_str(),256) ;
2127 const char* intobs = strtok_r(buf,
"|",&save) ;
2128 if (!intobs) intobs=
"" ;
2130 const char* range = strtok_r(0,
"",&save) ;
2131 if (!range) range=
"" ;
2134 if (pargv.size()==2) {
2135 if (range && strlen(range)) {
2141 if (range && strlen(range)) {
2151 }
else if (cl==
"deriv") {
2155 if (pargv.size()<2 || pargv.size()>3) {
2156 throw string(
Form(
"deriv::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2162 if (pargv.size()==2) {
2168 derivative->
SetName(instName) ;
2171 }
else if (cl==
"cdf") {
2175 if (pargv.size()<2 || pargv.size()>3) {
2176 throw string(
Form(
"cdf::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2182 if (pargv.size()==2) {
2192 }
else if (cl==
"PROJ") {
2195 if (pargv.size()!=2) {
2196 throw string(
Form(
"PROJ::%s, requires 2 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2201 projection->
SetName(instName) ;
2205 }
else if (cl==
"set") {
2210 return string(instName) ;
2215 throw string(
Form(
"RooFactoryWSTool::SpecialsIFace::create() ERROR: Unknown meta-type %s",typeName)) ;
2218 return string(instName) ;
virtual TObject * clone(const char *newname=0) const =0
virtual const char * GetName() const
Returns name of object.
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
static long int sum(long int i)
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Bool_t cancelTransaction()
Cancel an ongoing import transaction.
RooCmdArg NormSet(const RooArgSet &nset)
RooCmdArg Conditional(const RooArgSet &pdfSet, const RooArgSet &depSet, Bool_t depsAreCond=kFALSE)
RooAbsArg * fundArg(const char *name) const
Return fundamental (i.e.
RooAbsArg * arg(const char *name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
Class RooRealSumPdf implements a PDF constructed from a sum of functions:
RooAbsReal * createCdf(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Create a cumulative distribution function of this p.d.f in terms of the observables listed in iset...
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
RooDataSet is a container class to hold N-dimensional binned data.
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)
Add a column with the values of the given (function) argument to this dataset.
Bool_t startTransaction()
Open an import transaction operations.
RooCmdArg Silence(Bool_t flag=kTRUE)
virtual RooAbsPdf * createProjection(const RooArgSet &iset)
Return a p.d.f that represent a projection of this p.d.f integrated over given observables.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
RooCategory * cat(const char *name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found...
RooRealVar represents a fundamental (non-derived) real valued object.
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
virtual void Add(TObject *arg)
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create an object that represents the integral of the function over one or more observables listed in ...
Class RooNLLVar implements a a -log(likelihood) calculation from a dataset and a PDF.
Bool_t defineSet(const char *name, const RooArgSet &aset, Bool_t importMissing=kFALSE)
Define a named RooArgSet with given constituents.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void SetName(const char *name)
Set the name of the TNamed.
char * Form(const char *fmt,...)
The ROOT global object gROOT contains a list of all defined classes.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
RooDataSet is a container class to hold unbinned data.
RooCategory represents a fundamental (non-derived) discrete value object.
RooProduct a RooAbsReal implementation that represent the product of a given set of other RooAbsReal ...
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements...
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
static constexpr double s
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Mother of all ROOT objects.
Bool_t commitTransaction()
typedef void((*Func_t)())
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
RooConstVar & RooConst(Double_t val)
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
const RooArgSet * set(const char *name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
Bool_t defineType(const char *label)
Define a state with given name, the lowest available positive integer is assigned as index...
RooAddition calculates the sum of a set of RooAbsReal terms, or when constructed with two sets...
RooDerivative * derivative(RooRealVar &obs, Int_t order=1, Double_t eps=0.001)
Return function representing first, second or third order derivative of this function.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooStringVar implements a string values RooAbsArg.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
The RooWorkspace is a persistable container for RooFit projects.