66#define BUFFER_SIZE 64000
151 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createFactory() ERROR: variable with name '" <<
name <<
"' already exists" << endl ;
178 const size_t tmpSize = strlen(stateNameList)+1;
179 char *tmp =
new char[tmpSize] ;
180 strlcpy(tmp,stateNameList,tmpSize) ;
184 char*
sep = strchr(tok,
'=') ;
207 static bool isEnum(
const char* classname) {
209 ClassInfo_t* cls =
gInterpreter->ClassInfo_Factory(classname);
216 static bool isValidEnumValue(
const char* enumName,
const char* enumConstantName) {
219 if (!enumName)
return false;
222 if (!enumName)
return false;
225 if (theEnum->GetConstant(enumConstantName))
return true;
227 auto tmp = strstr(enumConstantName,
"::");
229 auto enumConstantNameNoScope = tmp+2;
230 if (theEnum->GetConstant(enumConstantNameNoScope))
return true;
236 static pair<list<string>,
unsigned int> ctorArgs(
const char* classname,
UInt_t nMinArg) {
244 ClassInfo_t* cls =
gInterpreter->ClassInfo_Factory(classname);
245 MethodInfo_t* func =
gInterpreter->MethodInfo_Factory(cls);
258 if (
string(classname) !=
gInterpreter->MethodInfo_TypeName(func)) {
264 if (nargs==0 || nargs==
gInterpreter->MethodInfo_NDefaultArg(func)) {
268 MethodArgInfo_t* arg =
gInterpreter->MethodArgInfo_Factory(func);
271 const char* argTypeName =
gInterpreter->MethodArgInfo_TypeName(arg);
272 if (nreq<2 && ((
string(
"char*") != argTypeName
274 &&
string(
"const char*") != argTypeName)) {
277 ret.push_back(argTypeName) ;
278 if(!
gInterpreter->MethodArgInfo_DefaultValue(arg)) nreq++;
283 if (ret.size()<nMinArg) {
291 return pair<list<string>,
unsigned int>(ret,nreq);
306 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not found in factory alias table, nor in ROOT class table" << endl;
315 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" does not inherit from RooAbsArg" << endl;
322 size_t blevel = 0, end_tok, start_tok = 0;
323 bool litmode =
false;
324 for (end_tok = 0; end_tok < tmp.length(); end_tok++) {
326 if (tmp[end_tok]==
'{' || tmp[end_tok]==
'(' || tmp[end_tok]==
'[') blevel++;
327 if (tmp[end_tok]==
'}' || tmp[end_tok]==
')' || tmp[end_tok]==
']') blevel--;
330 if (tmp[end_tok]==
'"' || tmp[end_tok]==
'\'') litmode = !litmode;
335 if (litmode ==
false && blevel == 0 && tmp[end_tok] ==
',') {
336 _args.push_back(tmp.substr(start_tok, end_tok - start_tok));
337 start_tok = end_tok+1;
340 _args.push_back(tmp.substr(start_tok, end_tok));
343 pair<list<string>,
unsigned int> ca = ctorArgs(className,
_args.size()+2) ;
344 if (ca.first.size()==0) {
345 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR no suitable constructor found for class " << className << endl ;
352 if (
_args.size()+2<ca.second ||
_args.size()+2>ca.first.size()) {
353 if (ca.second==ca.first.size()) {
354 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid, " << className
355 <<
" expects " << ca.first.size()-2 << endl ;
358 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid " << className
359 <<
" expect number between " << ca.second-2 <<
" and " << ca.first.size()-2 << endl ;
366 string cintExpr(
Form(
"new %s(\"%s\",\"%s\"",className,objName,objName)) ;
374 list<string>::iterator ti = ca.first.begin() ; ++ti ; ++ti ;
375 for (vector<string>::iterator ai =
_args.begin() ; ai !=
_args.end() ; ++ai,++ti,++i) {
376 if ((*ti)==
"RooAbsReal&" || (*ti)==
"const RooAbsReal&") {
378 cintExpr +=
Form(
",RooFactoryWSTool::as_FUNC(%d)",i) ;
379 }
else if ((*ti)==
"RooAbsArg&" || (*ti)==
"const RooAbsArg&") {
381 cintExpr +=
Form(
",RooFactoryWSTool::as_ARG(%d)",i) ;
382 }
else if ((*ti)==
"RooRealVar&" || (*ti)==
"const RooRealVar&") {
384 cintExpr +=
Form(
",RooFactoryWSTool::as_VAR(%d)",i) ;
385 }
else if ((*ti)==
"RooAbsRealLValue&" || (*ti)==
"const RooAbsRealLValue&") {
387 cintExpr +=
Form(
",RooFactoryWSTool::as_VARLV(%d)",i) ;
388 }
else if ((*ti)==
"RooCategory&" || (*ti)==
"const RooCategory&") {
390 cintExpr +=
Form(
",RooFactoryWSTool::as_CAT(%d)",i) ;
391 }
else if ((*ti)==
"RooAbsCategory&" || (*ti)==
"const RooAbsCategory&") {
393 cintExpr +=
Form(
",RooFactoryWSTool::as_CATFUNC(%d)",i) ;
394 }
else if ((*ti)==
"RooAbsCategoryLValue&" || (*ti)==
"const RooAbsCategoryLValue&") {
396 cintExpr +=
Form(
",RooFactoryWSTool::as_CATLV(%d)",i) ;
397 }
else if ((*ti)==
"RooAbsPdf&" || (*ti)==
"const RooAbsPdf&") {
399 cintExpr +=
Form(
",RooFactoryWSTool::as_PDF(%d)",i) ;
400 }
else if ((*ti)==
"RooResolutionModel&" || (*ti)==
"const RooResolutionModel&") {
402 cintExpr +=
Form(
",RooFactoryWSTool::as_RMODEL(%d)",i) ;
403 }
else if ((*ti)==
"RooAbsData&" || (*ti)==
"const RooAbsData&") {
405 cintExpr +=
Form(
",RooFactoryWSTool::as_DATA(%d)",i) ;
406 }
else if ((*ti)==
"RooDataSet&" || (*ti)==
"const RooDataSet&") {
408 cintExpr +=
Form(
",RooFactoryWSTool::as_DSET(%d)",i) ;
409 }
else if ((*ti)==
"RooDataHist&" || (*ti)==
"const RooDataHist&") {
411 cintExpr +=
Form(
",RooFactoryWSTool::as_DHIST(%d)",i) ;
412 }
else if ((*ti)==
"const RooArgSet&") {
414 cintExpr +=
Form(
",RooFactoryWSTool::as_SET(%d)",i) ;
415 }
else if ((*ti)==
"const RooArgList&") {
417 cintExpr +=
Form(
",RooFactoryWSTool::as_LIST(%d)",i) ;
418 }
else if ((*ti)==
"const char*") {
420 cintExpr +=
Form(
",RooFactoryWSTool::as_STRING(%d)",i) ;
421 }
else if ((*ti)==
"Int_t" || (*ti)==
"int" || (*ti)==
"Bool_t" || (*ti)==
"bool") {
423 cintExpr +=
Form(
",RooFactoryWSTool::as_INT(%d)",i) ;
424 }
else if ((*ti)==
"Double_t") {
426 cintExpr +=
Form(
",RooFactoryWSTool::as_DOUBLE(%d)",i) ;
427 }
else if (isEnum(ti->c_str())) {
430 if (
_args[i].find(
Form(
"%s::",className)) != string::npos) {
431 qualvalue =
_args[i].c_str() ;
433 qualvalue =
Form(
"%s::%s",className,
_args[i].c_str()) ;
435 if (isValidEnumValue(ti->c_str(),qualvalue.c_str())) {
436 cintExpr +=
Form(
",(%s)%s",ti->c_str(),qualvalue.c_str()) ;
438 throw string(
Form(
"Supplied argument %s does not represent a valid state of enum %s",
_args[i].c_str(),ti->c_str())) ;
446 if (ti->find(
"const ")==0) {
447 btype = ti->c_str()+6 ;
451 if (btype.find(
"&")) {
452 btype.erase(btype.size()-1,btype.size()) ;
459 cintExpr +=
Form(
",(%s&)RooFactoryWSTool::as_OBJ(%d)",ti->c_str(),i) ;
461 throw string(
Form(
"Required argument with name %s of type '%s' is not in the workspace",
_args[i].c_str(),ti->c_str())) ;
466 }
catch (
const string &err) {
467 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR constructing " << className <<
"::" << objName <<
": " << err << endl ;
472 cxcoutD(
ObjectHandling) <<
"RooFactoryWSTool::createArg() Construct expression is " << cintExpr << endl ;
478 if (
string(className)==
"RooGenericPdf") {
480 }
else if (
string(className)==
"RooFormulaVar") {
490 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR in CINT constructor call to create object" << endl ;
513 char* star=strchr(tok,
'*') ;
523 pdfList.
add(pdfList2) ;
525 }
catch (
const string &err) {
526 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooAddPdf: " << err << endl ;
555 char* star=strchr(tok,
'*') ;
565 amplList.
add(amplList2) ;
567 }
catch (
const string &err) {
568 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooRealSumPdf: " << err << endl ;
588 string regPdfList=
"{" ;
594 char *
sep = strchr(tok,
'|') ;
609 }
catch (
const string &err) {
610 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf Conditional argument: " << err << endl ;
617 if (regPdfList.size()>1) {
628 pdf =
new RooProdPdf(objName,objName,
asSET(regPdfList.c_str()),cmdList) ;
629 }
catch (
const string &err) {
630 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf input set of regular p.d.f.s: " << err << endl ;
652 map<string,RooAbsPdf*> theMap ;
659 char* eq = strchr(tok,
'=') ;
661 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName
662 <<
" expect mapping token of form 'state=pdfName', but found '" << tok <<
"'" << endl ;
669 theMap[tok] = &
asPDF(eq+1) ;
670 }
catch (
const string &err ) {
671 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous: " << err << endl ;
683 }
catch (
const string &err) {
684 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName <<
" " << err << endl ;
711 char* star=strchr(tok,
'*') ;
722 }
catch (
const string &err) {
723 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: " << err << endl ;
729 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: syntax error: either all sum terms must be products or none" << endl ;
742 sum->setStringAttribute(
"factory_tag",
Form(
"sum::%s(%s)",objName,specList)) ;
878 char* buf =
new char[strlen(expr)+1] ;
883 if (!isspace(*expr)) {
900 }
catch (
const string &error) {
901 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERROR in parsing: " << error << endl ;
907 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed" << endl ;
917 return out.size() ?
ws().
arg(out.c_str()) : 0 ;
936 if (
string(token).find(
"$Alias(")==0) {
962 const size_t bufBaseSize = strlen(token)+1;
963 char* buf_base =
new char[bufBaseSize] ;
964 char* buf = buf_base ;
965 strlcpy(buf,token,bufBaseSize) ;
968 list<string> singleExpr ;
969 list<char> separator ;
975 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
976 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
979 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
983 if (!litmode && blevel==0 && ( (*p)==
'=' || (*p) ==
'|' || (*p) ==
'*')) {
984 separator.push_back(*p) ;
986 singleExpr.push_back(buf) ;
992 singleExpr.push_back(buf) ;
994 if (singleExpr.size()==1) {
1001 list<char>::iterator ic = separator.begin() ;
1002 for (list<string>::iterator ii = singleExpr.begin() ; ii!=singleExpr.end() ; ++ii) {
1004 if (ic != separator.end()) {
1027 if (strlen(arg)==0) {
1032 if (arg[0]==
'\'' || arg[0]==
'"') {
1033 return string(arg) ;
1037 const size_t bufSize = strlen(arg)+1;
1038 char* buf =
new char[bufSize] ;
1039 strlcpy(buf,arg,bufSize) ;
1040 char* bufptr = buf ;
1042 string func,prefix ;
1043 vector<string> args ;
1048 func = tmpx ? tmpx :
"" ;
1064 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1065 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1068 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1074 if (!litmode && blevel==0 && ((*p)==
',')) {
1076 args.push_back(tok) ;
1085 if (p>bufptr && (*(p-1)==
')'||*(p-1)==
']')) {
1096 args.push_back(tmp) ;
1107 for(
const char* pp=arg ; *pp!=0 ; pp++) {
1108 if (*pp==
'(' || *pp==
'[' || *pp==
'{') {
1114 if (strstr(func.c_str(),
"::")) {
1119 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: Class::Instance must be followed by (...)" << endl ;
1122 }
else if (func[0]!=
'$'){
1126 }
else if (lb==
'(') {
1136 static Int_t globCounter = 0 ;
1138 autoname =
Form(
"gobj%d",globCounter) ;
1140 if (!
ws().arg(autoname.c_str())) {
1144 autoname =
Form(
"%s::%s",func.c_str(),autoname.c_str()) ;
1148 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: expect either Class(...) or Instance[...]" << endl ;
1156 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: $MetaClass must be followed by (...)" << endl ;
1176 const size_t bufSize = strlen(arg)+1;
1177 char* buf =
new char[bufSize] ;
1178 strlcpy(buf,arg,bufSize) ;
1180 vector<string> args ;
1191 if (*p==
'{' || *p==
'(' || *p==
'[') level++ ;
1192 if (*p==
'}' || *p==
')' || *p==
']') level-- ;
1198 if (level==0 && ((*p)==
',')) {
1200 args.push_back(tok) ;
1208 if (p>buf && *(p-1)==
'}') {
1211 args.push_back(tok) ;
1219 vector<string>::iterator iter = args.begin() ;
1221 while(iter!= args.end()) {
1222 if (strlen(ret.c_str())>1) ret +=
"," ;
1246 if (args.size()!=2) {
1247 coutE(
ObjectHandling) <<
"RooFactorWSTool::processAliasExpression() ERROR $Alias() takes exactly two arguments, " << args.size() <<
" args found" << endl ;
1267 map<string,string>::iterator item =
_typeAliases.find(className) ;
1271 className = item->second.c_str() ;
1284 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not defined in ROOT class table" << endl ;
1301 for (vector<string>::iterator iter = args.begin() ; iter!=args.end() ; ++iter) {
1302 if (iter!=args.begin()) {
1329 string first = *(args.begin()) ;
1333 vector<string>::iterator ai = args.begin() ;
1334 if (args.size()==1) {
1337 Double_t xinit = atof((ai)->c_str()) ;
1339 RooRealVar tmp(func.c_str(),func.c_str(),xinit) ;
1345 }
else if (args.size()==2) {
1348 Double_t xlo = atof((ai++)->c_str()) ;
1350 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1351 RooRealVar tmp(func.c_str(),func.c_str(),xlo,xhi) ;
1357 }
else if (args.size()==3) {
1360 Double_t xinit = atof((ai++)->c_str()) ;
1361 Double_t xlo = atof((ai++)->c_str()) ;
1363 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xinit = " << xinit <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1364 RooRealVar tmp(func.c_str(),func.c_str(),xinit,xlo,xhi) ;
1374 for (vector<string>::iterator ai = args.begin() ; ai!=args.end() ; ++ai) {
1375 if (allStates.size()>0) {
1403 const char *className =
R__STRTOK_R(buf,
":",&save) ;
1405 if (!className) className =
"";
1406 if (!instName) instName =
"" ;
1411 vector<string>::iterator iter = args.begin() ;
1412 vector<string> pargv ;
1414 while(iter!=args.end()) {
1415 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1420 pargv.push_back(tmp) ;
1426 for (map<string,IFace*>::iterator ii=
hooks().begin() ; ii!=
hooks().end() ; ++ii) {
1428 if (
hooks().find(className) !=
hooks().end()) {
1430 return iface->
create(*
this, className,instName,pargv) ;
1435 return string(instName) ;
1447 vector<string>::iterator iter = args.begin() ;
1448 vector<string> pargv ;
1449 while(iter!=args.end()) {
1450 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1453 pargv.push_back(tmp) ;
1457 string ret = func+
"("+pargs+
")" ;
1469 const size_t bufSize = strlen(funcExpr)+1;
1470 char* buf =
new char[bufSize] ;
1471 strlcpy(buf,funcExpr,bufSize) ;
1472 char* bufptr = buf ;
1475 vector<string> args ;
1480 func = tmpx ? tmpx :
"" ;
1495 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1496 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1499 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1505 if (!litmode && blevel==0 && ((*p)==
',')) {
1507 args.push_back(tok) ;
1516 if (p>bufptr && *(p-1)==
')') {
1527 args.push_back(tmp) ;
1546 Int_t nParentheses(0), nBracket(0), nAccolade(0) ;
1547 const char* ptr = arg ;
1549 if (*ptr==
'(') nParentheses++ ;
1550 if (*ptr==
')') nParentheses-- ;
1551 if (*ptr==
'[') nBracket++ ;
1552 if (*ptr==
']') nBracket-- ;
1553 if (*ptr==
'{') nAccolade++ ;
1554 if (*ptr==
'}') nAccolade-- ;
1557 if (nParentheses!=0) {
1558 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nParentheses>0?
"(":
")") <<
"' in expression" << endl ;
1562 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nBracket>0?
"[":
"]") <<
"' in expression" << endl ;
1566 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nAccolade>0?
"{":
"}") <<
"' in expression" << endl ;
1579 throw string(
Form(
"Need argument number %d, but only %d args are provided",idx,(
Int_t)
_of->
_args.size())) ;
1591 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1598 throw string(
Form(
"RooAbsArg named %s not found",arg)) ;
1611 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1617 throw string(
Form(
"RooAbsReal named %s not found",arg)) ;
1621 throw string(
Form(
"Object named %s is not of type RooAbsReal",arg)) ;
1634 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1635 throw string(
Form(
"Numeric literal provided for argument (%s), but lvalue is required",arg)) ;
1640 throw string(
Form(
"RooAbsRealLValue named %s not found",arg)) ;
1644 throw string(
Form(
"Object named %s is not of type RooAbsRealLValue",arg)) ;
1658 throw string(
Form(
"RooRealVar named %s not found",arg)) ;
1673 throw string(
Form(
"RooAbsPdf named %s not found",arg)) ;
1688 throw string(
Form(
"RooResolutionModel named %s not found",arg)) ;
1692 throw string(
Form(
"Object named %s is not of type RooResolutionModel",arg)) ;
1707 throw string(
Form(
"RooAbsCategory named %s not found",arg)) ;
1711 throw string(
Form(
"Object named %s is not of type RooAbsCategory",arg)) ;
1725 throw string(
Form(
"RooAbsCategoryLValue named %s not found",arg)) ;
1730 throw string(
Form(
"Object named %s is not of type RooAbsCategoryLValue",arg)) ;
1744 throw string(
Form(
"RooCategory named %s not found",arg)) ;
1780 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1782 }
else if (tok[0] ==
'\'') {
1783 tok[strlen(tok) - 1] = 0;
1791 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1816 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1818 }
else if (tok[0] ==
'\'') {
1819 tok[strlen(tok) - 1] = 0;
1827 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1845 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1859 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1863 throw string(
Form(
"Dataset named %s is not of type RooDataHist",arg)) ;
1876 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1880 throw string(
Form(
"Dataset named %s is not of type RooDataSet",arg)) ;
1893 throw string(
Form(
"Object named %s not found",arg)) ;
1905 static vector<string> cbuf(10) ;
1906 static unsigned int cbuf_idx = 0 ;
1909 if (arg==0 || strlen(arg)==0) {
1915 cbuf[cbuf_idx].clear() ;
1916 const char* p = arg+1 ;
1917 while(*p && (*p) !=
'"' && (*p) !=
'\'' ) {
1918 cbuf[cbuf_idx] += *(p++) ;
1920 const char* ret = cbuf[cbuf_idx].c_str() ;
1924 if (cbuf_idx==cbuf.size()) cbuf_idx=0 ;
1953 hooks()[typeName] = iface ;
1963 _hooks =
new map<string,IFace*> ;
1976 vector<string>::iterator iter = args.begin() ;
1977 vector<string> pargv ;
1978 while(iter!=args.end()) {
1979 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1982 pargv.push_back(tmp) ;
1987 string cl(typeName) ;
1993 }
else if (cl==
"RSUM") {
1998 }
else if (cl==
"ASUM") {
2003 }
else if (cl==
"PROD") {
2006 ft.
prod(instName,pargs) ;
2008 }
else if (cl==
"SIMUL") {
2011 if (pargv.size()>1) {
2012 ft.
simul(instName,pargv[0].c_str(),strchr(pargs,
',')+1) ;
2014 throw string(
Form(
"Need at least two arguments in call to SIMUL::%s, have %d: %s",instName,(
Int_t)pargv.size(),pargs)) ;
2017 }
else if (cl==
"EXPR") {
2020 if (args.size()<=2) {
2021 ft.
createArg(
"RooGenericPdf",instName,pargs) ;
2026 for (
UInt_t i=1 ; i<args.size() ; i++) {
2031 ft.
createArg(
"RooGenericPdf",instName,genargs) ;
2034 }
else if (cl==
"FCONV") {
2037 ft.
createArg(
"RooFFTConvPdf",instName,pargs) ;
2039 }
else if (cl==
"NCONV") {
2042 ft.
createArg(
"RooNumConvPdf",instName,pargs) ;
2044 }
else if (cl==
"sum") {
2049 }
else if (cl==
"prod") {
2054 }
else if (cl==
"expr") {
2057 if (args.size()<=2) {
2058 ft.
createArg(
"RooFormulaVar",instName,pargs) ;
2063 for (
UInt_t i=1 ; i<args.size() ; i++) {
2068 ft.
createArg(
"RooFormulaVar",instName,genargs) ;
2071 }
else if (cl==
"nconv") {
2074 ft.
createArg(
"RooNumConvolution",instName,pargs) ;
2076 }
else if (cl==
"nll") {
2082 }
else if (cl==
"chi2") {
2088 }
else if (cl==
"profile") {
2091 ft.
createArg(
"RooProfileLL",instName,pargs) ;
2093 }
else if (cl==
"dataobs") {
2103 }
else if (cl==
"int") {
2110 if (pargv.size()<2 || pargv.size()>3) {
2111 throw string(
Form(
"int::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2117 strlcpy(buf,pargv[1].c_str(),256) ;
2120 if (!intobs) intobs=
"" ;
2123 if (!range) range=
"" ;
2126 if (pargv.size()==2) {
2127 if (range && strlen(range)) {
2133 if (range && strlen(range)) {
2143 }
else if (cl==
"deriv") {
2147 if (pargv.size()<2 || pargv.size()>3) {
2148 throw string(
Form(
"deriv::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2154 if (pargv.size()==2) {
2160 derivative->
SetName(instName) ;
2163 }
else if (cl==
"cdf") {
2167 if (pargv.size()<2 || pargv.size()>3) {
2168 throw string(
Form(
"cdf::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2174 if (pargv.size()==2) {
2184 }
else if (cl==
"PROJ") {
2187 if (pargv.size()!=2) {
2188 throw string(
Form(
"PROJ::%s, requires 2 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2193 projection->
SetName(instName) ;
2197 }
else if (cl==
"set") {
2202 return string(instName) ;
2207 throw string(
Form(
"RooFactoryWSTool::SpecialsIFace::create() ERROR: Unknown meta-type %s",typeName)) ;
2210 return string(instName) ;
char * R__STRTOK_R(char *str, const char *delim, char **saveptr)
char * Form(const char *fmt,...)
typedef void((*Func_t)())
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
virtual TObject * clone(const char *newname=0) const =0
void SetName(const char *name)
Set the name of the TNamed.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
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.
virtual RooAbsPdf * createProjection(const RooArgSet &iset)
Return a p.d.f that represent a projection of this p.d.f integrated over given observables.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
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.
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 ...
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
RooAddition calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory represents a fundamental (non-derived) discrete value object.
Bool_t defineType(const char *label)
Define a state with given name, the lowest available positive integer is assigned as index.
Class RooChi2Var implements a simple chi^2 calculation from a binned dataset and a PDF.
The RooDataHist is a container class to hold N-dimensional binned data.
RooDataSet is a container class to hold unbinned data.
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,...
virtual void Add(TObject *arg)
Class RooNLLVar implements a a -log(likelihood) calculation from a dataset and a PDF.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
A RooProduct represents the product of a given set of RooAbsReal objects.
The class RooRealSumPdf implements a PDF constructed from a sum of functions:
RooRealVar represents a fundamental (non-derived) real valued object.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooStringVar implements a string values RooAbsArg.
The RooWorkspace is a persistable container for RooFit projects.
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
RooAbsArg * fundArg(const char *name) const
Return fundamental (i.e.
Bool_t commitTransaction()
Bool_t startTransaction()
Open an import transaction operations.
RooCategory * cat(const char *name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found.
RooAbsArg * arg(const char *name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
Bool_t defineSet(const char *name, const RooArgSet &aset, Bool_t importMissing=kFALSE)
Define a named RooArgSet with given constituents.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
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.
Bool_t cancelTransaction()
Cancel an ongoing import transaction.
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...
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
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.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Template specialisation used in RooAbsArg:
RooCmdArg NormSet(const RooArgSet &nset)
RooCmdArg Silence(Bool_t flag=kTRUE)
RooConstVar & RooConst(Double_t val)
RooCmdArg Conditional(const RooArgSet &pdfSet, const RooArgSet &depSet, Bool_t depsAreCond=kFALSE)
static constexpr double s
static long int sum(long int i)