67#define BUFFER_SIZE 64000
152 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createFactory() ERROR: variable with name '" <<
name <<
"' already exists" << endl ;
179 const size_t tmpSize = strlen(stateNameList)+1;
180 char *tmp =
new char[tmpSize] ;
181 strlcpy(tmp,stateNameList,tmpSize) ;
185 char*
sep = strchr(tok,
'=') ;
208 static bool isEnum(
const char* classname) {
210 ClassInfo_t* cls =
gInterpreter->ClassInfo_Factory(classname);
217 static bool isValidEnumValue(
const char* enumName,
const char* enumConstantName) {
220 if (!enumName)
return false;
223 if (!enumName)
return false;
226 if (theEnum->GetConstant(enumConstantName))
return true;
228 auto tmp = strstr(enumConstantName,
"::");
230 auto enumConstantNameNoScope = tmp+2;
231 if (theEnum->GetConstant(enumConstantNameNoScope))
return true;
237 static pair<list<string>,
unsigned int> ctorArgs(
const char* classname,
UInt_t nMinArg) {
245 ClassInfo_t* cls =
gInterpreter->ClassInfo_Factory(classname);
246 MethodInfo_t* func =
gInterpreter->MethodInfo_Factory(cls);
259 if (
string(classname) !=
gInterpreter->MethodInfo_TypeName(func)) {
265 if (nargs==0 || nargs==
gInterpreter->MethodInfo_NDefaultArg(func)) {
269 MethodArgInfo_t* arg =
gInterpreter->MethodArgInfo_Factory(func);
272 const char* argTypeName =
gInterpreter->MethodArgInfo_TypeName(arg);
273 if (nreq<2 && ((
string(
"char*") != argTypeName
275 &&
string(
"const char*") != argTypeName)) {
278 ret.push_back(argTypeName) ;
279 if(!
gInterpreter->MethodArgInfo_DefaultValue(arg)) nreq++;
284 if (ret.size()<nMinArg) {
292 return pair<list<string>,
unsigned int>(ret,nreq);
307 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not found in factory alias table, nor in ROOT class table" << endl;
316 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" does not inherit from RooAbsArg" << endl;
323 size_t blevel = 0, end_tok, start_tok = 0;
324 bool litmode =
false;
325 for (end_tok = 0; end_tok < tmp.length(); end_tok++) {
327 if (tmp[end_tok]==
'{' || tmp[end_tok]==
'(' || tmp[end_tok]==
'[') blevel++;
328 if (tmp[end_tok]==
'}' || tmp[end_tok]==
')' || tmp[end_tok]==
']') blevel--;
331 if (tmp[end_tok]==
'"' || tmp[end_tok]==
'\'') litmode = !litmode;
336 if (litmode ==
false && blevel == 0 && tmp[end_tok] ==
',') {
337 _args.push_back(tmp.substr(start_tok, end_tok - start_tok));
338 start_tok = end_tok+1;
341 _args.push_back(tmp.substr(start_tok, end_tok));
344 pair<list<string>,
unsigned int> ca = ctorArgs(className,
_args.size()+2) ;
345 if (ca.first.size()==0) {
346 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR no suitable constructor found for class " << className << endl ;
353 if (
_args.size()+2<ca.second ||
_args.size()+2>ca.first.size()) {
354 if (ca.second==ca.first.size()) {
355 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid, " << className
356 <<
" expects " << ca.first.size()-2 << endl ;
359 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid " << className
360 <<
" expect number between " << ca.second-2 <<
" and " << ca.first.size()-2 << endl ;
367 string cintExpr(
Form(
"new %s(\"%s\",\"%s\"",className,objName,objName)) ;
375 list<string>::iterator ti = ca.first.begin() ; ++ti ; ++ti ;
376 for (vector<string>::iterator ai =
_args.begin() ; ai !=
_args.end() ; ++ai,++ti,++i) {
377 if ((*ti)==
"RooAbsReal&" || (*ti)==
"const RooAbsReal&") {
379 cintExpr +=
Form(
",RooFactoryWSTool::as_FUNC(%d)",i) ;
380 }
else if ((*ti)==
"RooAbsArg&" || (*ti)==
"const RooAbsArg&") {
382 cintExpr +=
Form(
",RooFactoryWSTool::as_ARG(%d)",i) ;
383 }
else if ((*ti)==
"RooRealVar&" || (*ti)==
"const RooRealVar&") {
385 cintExpr +=
Form(
",RooFactoryWSTool::as_VAR(%d)",i) ;
386 }
else if ((*ti)==
"RooAbsRealLValue&" || (*ti)==
"const RooAbsRealLValue&") {
388 cintExpr +=
Form(
",RooFactoryWSTool::as_VARLV(%d)",i) ;
389 }
else if ((*ti)==
"RooCategory&" || (*ti)==
"const RooCategory&") {
391 cintExpr +=
Form(
",RooFactoryWSTool::as_CAT(%d)",i) ;
392 }
else if ((*ti)==
"RooAbsCategory&" || (*ti)==
"const RooAbsCategory&") {
394 cintExpr +=
Form(
",RooFactoryWSTool::as_CATFUNC(%d)",i) ;
395 }
else if ((*ti)==
"RooAbsCategoryLValue&" || (*ti)==
"const RooAbsCategoryLValue&") {
397 cintExpr +=
Form(
",RooFactoryWSTool::as_CATLV(%d)",i) ;
398 }
else if ((*ti)==
"RooAbsPdf&" || (*ti)==
"const RooAbsPdf&") {
400 cintExpr +=
Form(
",RooFactoryWSTool::as_PDF(%d)",i) ;
401 }
else if ((*ti)==
"RooResolutionModel&" || (*ti)==
"const RooResolutionModel&") {
403 cintExpr +=
Form(
",RooFactoryWSTool::as_RMODEL(%d)",i) ;
404 }
else if ((*ti)==
"RooAbsData&" || (*ti)==
"const RooAbsData&") {
406 cintExpr +=
Form(
",RooFactoryWSTool::as_DATA(%d)",i) ;
407 }
else if ((*ti)==
"RooDataSet&" || (*ti)==
"const RooDataSet&") {
409 cintExpr +=
Form(
",RooFactoryWSTool::as_DSET(%d)",i) ;
410 }
else if ((*ti)==
"RooDataHist&" || (*ti)==
"const RooDataHist&") {
412 cintExpr +=
Form(
",RooFactoryWSTool::as_DHIST(%d)",i) ;
413 }
else if ((*ti)==
"const RooArgSet&") {
415 cintExpr +=
Form(
",RooFactoryWSTool::as_SET(%d)",i) ;
416 }
else if ((*ti)==
"const RooArgList&") {
418 cintExpr +=
Form(
",RooFactoryWSTool::as_LIST(%d)",i) ;
419 }
else if ((*ti)==
"const char*") {
421 cintExpr +=
Form(
",RooFactoryWSTool::as_STRING(%d)",i) ;
422 }
else if ((*ti)==
"Int_t" || (*ti)==
"int" || (*ti)==
"Bool_t" || (*ti)==
"bool") {
424 cintExpr +=
Form(
",RooFactoryWSTool::as_INT(%d)",i) ;
425 }
else if ((*ti)==
"Double_t") {
427 cintExpr +=
Form(
",RooFactoryWSTool::as_DOUBLE(%d)",i) ;
428 }
else if (isEnum(ti->c_str())) {
431 if (
_args[i].find(
Form(
"%s::",className)) != string::npos) {
432 qualvalue =
_args[i].c_str() ;
434 qualvalue =
Form(
"%s::%s",className,
_args[i].c_str()) ;
436 if (isValidEnumValue(ti->c_str(),qualvalue.c_str())) {
437 cintExpr +=
Form(
",(%s)%s",ti->c_str(),qualvalue.c_str()) ;
439 throw string(
Form(
"Supplied argument %s does not represent a valid state of enum %s",
_args[i].c_str(),ti->c_str())) ;
447 if (ti->find(
"const ")==0) {
448 btype = ti->c_str()+6 ;
452 if (btype.find(
"&")) {
453 btype.erase(btype.size()-1,btype.size()) ;
460 cintExpr +=
Form(
",(%s&)RooFactoryWSTool::as_OBJ(%d)",ti->c_str(),i) ;
462 throw string(
Form(
"Required argument with name %s of type '%s' is not in the workspace",
_args[i].c_str(),ti->c_str())) ;
467 }
catch (
const string &err) {
468 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR constructing " << className <<
"::" << objName <<
": " << err << endl ;
473 cxcoutD(
ObjectHandling) <<
"RooFactoryWSTool::createArg() Construct expression is " << cintExpr << endl ;
479 if (
string(className)==
"RooGenericPdf") {
481 }
else if (
string(className)==
"RooFormulaVar") {
491 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR in CINT constructor call to create object" << endl ;
514 char* star=strchr(tok,
'*') ;
524 pdfList.
add(pdfList2) ;
526 }
catch (
const string &err) {
527 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooAddPdf: " << err << endl ;
556 char* star=strchr(tok,
'*') ;
566 amplList.
add(amplList2) ;
568 }
catch (
const string &err) {
569 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooRealSumPdf: " << err << endl ;
589 string regPdfList=
"{" ;
595 char *
sep = strchr(tok,
'|') ;
610 }
catch (
const string &err) {
611 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf Conditional argument: " << err << endl ;
618 if (regPdfList.size()>1) {
629 pdf =
new RooProdPdf(objName,objName,
asSET(regPdfList.c_str()),cmdList) ;
630 }
catch (
const string &err) {
631 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf input set of regular p.d.f.s: " << err << endl ;
653 map<string,RooAbsPdf*> theMap ;
660 char* eq = strchr(tok,
'=') ;
662 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName
663 <<
" expect mapping token of form 'state=pdfName', but found '" << tok <<
"'" << endl ;
670 theMap[tok] = &
asPDF(eq+1) ;
671 }
catch (
const string &err ) {
672 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous: " << err << endl ;
684 }
catch (
const string &err) {
685 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName <<
" " << err << endl ;
712 char* star=strchr(tok,
'*') ;
723 }
catch (
const string &err) {
724 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: " << err << endl ;
730 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: syntax error: either all sum terms must be products or none" << endl ;
743 sum->setStringAttribute(
"factory_tag",
Form(
"sum::%s(%s)",objName,specList)) ;
859 char* buf =
new char[strlen(expr)+1] ;
864 if (!isspace(*expr)) {
881 }
catch (
const string &error) {
882 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERROR in parsing: " << error << endl ;
888 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed" << endl ;
898 return out.size() ?
ws().
arg(out.c_str()) : 0 ;
917 if (
string(token).find(
"$Alias(")==0) {
943 const size_t bufBaseSize = strlen(token)+1;
944 char* buf_base =
new char[bufBaseSize] ;
945 char* buf = buf_base ;
946 strlcpy(buf,token,bufBaseSize) ;
949 list<string> singleExpr ;
956 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
957 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
960 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
964 if (!litmode && blevel==0 && ( (*p)==
'=' || (*p) ==
'|' || (*p) ==
'*')) {
967 singleExpr.push_back(buf) ;
973 singleExpr.push_back(buf) ;
975 if (singleExpr.size()==1) {
982 list<char>::iterator ic =
separator.begin() ;
983 for (list<string>::iterator ii = singleExpr.begin() ; ii!=singleExpr.end() ; ++ii) {
1008 if (strlen(arg)==0) {
1013 if (arg[0]==
'\'' || arg[0]==
'"') {
1014 return string(arg) ;
1018 const size_t bufSize = strlen(arg)+1;
1019 char* buf =
new char[bufSize] ;
1020 strlcpy(buf,arg,bufSize) ;
1021 char* bufptr = buf ;
1023 string func,prefix ;
1024 vector<string> args ;
1029 func = tmpx ? tmpx :
"" ;
1045 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1046 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1049 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1055 if (!litmode && blevel==0 && ((*p)==
',')) {
1057 args.push_back(tok) ;
1066 if (p>bufptr && (*(p-1)==
')'||*(p-1)==
']')) {
1077 args.push_back(tmp) ;
1088 for(
const char* pp=arg ; *pp!=0 ; pp++) {
1089 if (*pp==
'(' || *pp==
'[' || *pp==
'{') {
1095 if (strstr(func.c_str(),
"::")) {
1100 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: Class::Instance must be followed by (...)" << endl ;
1103 }
else if (func[0]!=
'$'){
1107 }
else if (lb==
'(') {
1117 static Int_t globCounter = 0 ;
1119 autoname =
Form(
"gobj%d",globCounter) ;
1121 if (!
ws().arg(autoname.c_str())) {
1125 autoname =
Form(
"%s::%s",func.c_str(),autoname.c_str()) ;
1129 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: expect either Class(...) or Instance[...]" << endl ;
1137 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: $MetaClass must be followed by (...)" << endl ;
1157 const size_t bufSize = strlen(arg)+1;
1158 char* buf =
new char[bufSize] ;
1159 strlcpy(buf,arg,bufSize) ;
1161 vector<string> args ;
1172 if (*p==
'{' || *p==
'(' || *p==
'[') level++ ;
1173 if (*p==
'}' || *p==
')' || *p==
']') level-- ;
1179 if (level==0 && ((*p)==
',')) {
1181 args.push_back(tok) ;
1189 if (p>buf && *(p-1)==
'}') {
1192 args.push_back(tok) ;
1200 vector<string>::iterator iter = args.begin() ;
1202 while(iter!= args.end()) {
1203 if (strlen(ret.c_str())>1) ret +=
"," ;
1227 if (args.size()!=2) {
1228 coutE(
ObjectHandling) <<
"RooFactorWSTool::processAliasExpression() ERROR $Alias() takes exactly two arguments, " << args.size() <<
" args found" << endl ;
1248 map<string,string>::iterator item =
_typeAliases.find(className) ;
1252 className = item->second.c_str() ;
1265 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not defined in ROOT class table" << endl ;
1282 for (vector<string>::iterator iter = args.begin() ; iter!=args.end() ; ++iter) {
1283 if (iter!=args.begin()) {
1310 string first = *(args.begin()) ;
1314 vector<string>::iterator ai = args.begin() ;
1315 if (args.size()==1) {
1318 Double_t xinit = atof((ai)->c_str()) ;
1320 RooRealVar tmp(func.c_str(),func.c_str(),xinit) ;
1326 }
else if (args.size()==2) {
1329 Double_t xlo = atof((ai++)->c_str()) ;
1331 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1332 RooRealVar tmp(func.c_str(),func.c_str(),xlo,xhi) ;
1338 }
else if (args.size()==3) {
1341 Double_t xinit = atof((ai++)->c_str()) ;
1342 Double_t xlo = atof((ai++)->c_str()) ;
1344 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xinit = " << xinit <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1345 RooRealVar tmp(func.c_str(),func.c_str(),xinit,xlo,xhi) ;
1355 for (vector<string>::iterator ai = args.begin() ; ai!=args.end() ; ++ai) {
1356 if (allStates.size()>0) {
1384 const char *className =
R__STRTOK_R(buf,
":",&save) ;
1386 if (!className) className =
"";
1387 if (!instName) instName =
"" ;
1392 vector<string>::iterator iter = args.begin() ;
1393 vector<string> pargv ;
1395 while(iter!=args.end()) {
1396 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1401 pargv.push_back(tmp) ;
1407 for (map<string,IFace*>::iterator ii=
hooks().begin() ; ii!=
hooks().end() ; ++ii) {
1409 if (
hooks().find(className) !=
hooks().end()) {
1411 return iface->
create(*
this, className,instName,pargv) ;
1416 return string(instName) ;
1428 vector<string>::iterator iter = args.begin() ;
1429 vector<string> pargv ;
1430 while(iter!=args.end()) {
1431 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1434 pargv.push_back(tmp) ;
1438 string ret = func+
"("+pargs+
")" ;
1450 const size_t bufSize = strlen(funcExpr)+1;
1451 char* buf =
new char[bufSize] ;
1452 strlcpy(buf,funcExpr,bufSize) ;
1453 char* bufptr = buf ;
1456 vector<string> args ;
1461 func = tmpx ? tmpx :
"" ;
1476 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1477 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1480 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1486 if (!litmode && blevel==0 && ((*p)==
',')) {
1488 args.push_back(tok) ;
1497 if (p>bufptr && *(p-1)==
')') {
1508 args.push_back(tmp) ;
1527 Int_t nParentheses(0), nBracket(0), nAccolade(0) ;
1528 const char* ptr = arg ;
1530 if (*ptr==
'(') nParentheses++ ;
1531 if (*ptr==
')') nParentheses-- ;
1532 if (*ptr==
'[') nBracket++ ;
1533 if (*ptr==
']') nBracket-- ;
1534 if (*ptr==
'{') nAccolade++ ;
1535 if (*ptr==
'}') nAccolade-- ;
1538 if (nParentheses!=0) {
1539 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nParentheses>0?
"(":
")") <<
"' in expression" << endl ;
1543 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nBracket>0?
"[":
"]") <<
"' in expression" << endl ;
1547 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nAccolade>0?
"{":
"}") <<
"' in expression" << endl ;
1560 throw string(
Form(
"Need argument number %d, but only %d args are provided",idx,(
Int_t)
_of->
_args.size())) ;
1572 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1579 throw string(
Form(
"RooAbsArg named %s not found",arg)) ;
1592 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1598 throw string(
Form(
"RooAbsReal named %s not found",arg)) ;
1602 throw string(
Form(
"Object named %s is not of type RooAbsReal",arg)) ;
1615 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1616 throw string(
Form(
"Numeric literal provided for argument (%s), but lvalue is required",arg)) ;
1621 throw string(
Form(
"RooAbsRealLValue named %s not found",arg)) ;
1625 throw string(
Form(
"Object named %s is not of type RooAbsRealLValue",arg)) ;
1639 throw string(
Form(
"RooRealVar named %s not found",arg)) ;
1654 throw string(
Form(
"RooAbsPdf named %s not found",arg)) ;
1669 throw string(
Form(
"RooResolutionModel named %s not found",arg)) ;
1673 throw string(
Form(
"Object named %s is not of type RooResolutionModel",arg)) ;
1688 throw string(
Form(
"RooAbsCategory named %s not found",arg)) ;
1692 throw string(
Form(
"Object named %s is not of type RooAbsCategory",arg)) ;
1706 throw string(
Form(
"RooAbsCategoryLValue named %s not found",arg)) ;
1711 throw string(
Form(
"Object named %s is not of type RooAbsCategoryLValue",arg)) ;
1725 throw string(
Form(
"RooCategory named %s not found",arg)) ;
1761 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1763 }
else if (tok[0] ==
'\'') {
1764 tok[strlen(tok) - 1] = 0;
1772 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1797 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1799 }
else if (tok[0] ==
'\'') {
1800 tok[strlen(tok) - 1] = 0;
1808 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1826 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1840 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1844 throw string(
Form(
"Dataset named %s is not of type RooDataHist",arg)) ;
1857 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1861 throw string(
Form(
"Dataset named %s is not of type RooDataSet",arg)) ;
1874 throw string(
Form(
"Object named %s not found",arg)) ;
1886 static vector<string> cbuf(10) ;
1887 static unsigned int cbuf_idx = 0 ;
1890 if (arg==0 || strlen(arg)==0) {
1896 cbuf[cbuf_idx].clear() ;
1897 const char* p = arg+1 ;
1898 while(*p && (*p) !=
'"' && (*p) !=
'\'' ) {
1899 cbuf[cbuf_idx] += *(p++) ;
1901 const char* ret = cbuf[cbuf_idx].c_str() ;
1905 if (cbuf_idx==cbuf.size()) cbuf_idx=0 ;
1934 hooks()[typeName] = iface ;
1944 _hooks =
new map<string,IFace*> ;
1957 vector<string>::iterator iter = args.begin() ;
1958 vector<string> pargv ;
1959 while(iter!=args.end()) {
1960 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1963 pargv.push_back(tmp) ;
1968 string cl(typeName) ;
1974 }
else if (cl==
"RSUM") {
1979 }
else if (cl==
"ASUM") {
1984 }
else if (cl==
"PROD") {
1987 ft.
prod(instName,pargs) ;
1989 }
else if (cl==
"SIMUL") {
1992 if (pargv.size()>1) {
1993 ft.
simul(instName,pargv[0].c_str(),strchr(pargs,
',')+1) ;
1995 throw string(
Form(
"Need at least two arguments in call to SIMUL::%s, have %d: %s",instName,(
Int_t)pargv.size(),pargs)) ;
1998 }
else if (cl==
"EXPR") {
2001 if (args.size()<=2) {
2002 ft.
createArg(
"RooGenericPdf",instName,pargs) ;
2007 for (
UInt_t i=1 ; i<args.size() ; i++) {
2012 ft.
createArg(
"RooGenericPdf",instName,genargs) ;
2015 }
else if (cl==
"FCONV") {
2018 ft.
createArg(
"RooFFTConvPdf",instName,pargs) ;
2020 }
else if (cl==
"NCONV") {
2023 ft.
createArg(
"RooNumConvPdf",instName,pargs) ;
2025 }
else if (cl==
"sum") {
2030 }
else if (cl==
"prod") {
2035 }
else if (cl==
"expr") {
2038 if (args.size()<=2) {
2039 ft.
createArg(
"RooFormulaVar",instName,pargs) ;
2044 for (
UInt_t i=1 ; i<args.size() ; i++) {
2049 ft.
createArg(
"RooFormulaVar",instName,genargs) ;
2052 }
else if (cl==
"nconv") {
2055 ft.
createArg(
"RooNumConvolution",instName,pargs) ;
2057 }
else if (cl==
"nll") {
2063 }
else if (cl==
"chi2") {
2069 }
else if (cl==
"profile") {
2072 ft.
createArg(
"RooProfileLL",instName,pargs) ;
2074 }
else if (cl==
"dataobs") {
2084 }
else if (cl==
"int") {
2091 if (pargv.size()<2 || pargv.size()>3) {
2092 throw string(
Form(
"int::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2098 strlcpy(buf,pargv[1].c_str(),256) ;
2101 if (!intobs) intobs=
"" ;
2104 if (!range) range=
"" ;
2107 if (pargv.size()==2) {
2108 if (range && strlen(range)) {
2114 if (range && strlen(range)) {
2124 }
else if (cl==
"deriv") {
2128 if (pargv.size()<2 || pargv.size()>3) {
2129 throw string(
Form(
"deriv::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2135 if (pargv.size()==2) {
2141 derivative->
SetName(instName) ;
2144 }
else if (cl==
"cdf") {
2148 if (pargv.size()<2 || pargv.size()>3) {
2149 throw string(
Form(
"cdf::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2155 if (pargv.size()==2) {
2165 }
else if (cl==
"PROJ") {
2168 if (pargv.size()!=2) {
2169 throw string(
Form(
"PROJ::%s, requires 2 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2174 projection->
SetName(instName) ;
2178 }
else if (cl==
"set") {
2183 return string(instName) ;
2188 throw string(
Form(
"RooFactoryWSTool::SpecialsIFace::create() ERROR: Unknown meta-type %s",typeName)) ;
2191 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 base class for objects that represent a discrete value with a finite number of ...
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 is an object to represent discrete states.
bool defineType(const std::string &label)
Define a state with given name.
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 -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 variable that can be changed from the outside.
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooStringVar is a RooAbsArg implementing string values.
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".
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)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static constexpr double s
static long int sum(long int i)