70 #define BUFFER_SIZE 64000 126 static char *strtok_r(
char *s1,
const char *s2,
char **lasts)
132 while(*s1 && strchr(s2, *s1))
137 while(*s1 && !strchr(s2, *s1))
176 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createFactory() ERROR: variable with name '" << name <<
"' already exists" << endl ;
203 const size_t tmpSize = strlen(stateNameList)+1;
204 char *tmp =
new char[tmpSize] ;
205 strlcpy(tmp,stateNameList,tmpSize) ;
207 char* tok = strtok_r(tmp,
",",&save) ;
209 char*
sep = strchr(tok,
'=') ;
212 Int_t id = atoi(sep+1) ;
218 tok = strtok_r(0,
",",&save) ;
244 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not found in factory alias table, nor in ROOT class table" << endl ;
253 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" does not inherit from RooAbsArg" << endl ;
269 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
270 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
273 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
278 if (!litmode && blevel==0 && ((*p)==
',')) {
280 _args.push_back(tok) ;
286 _args.push_back(tok) ;
291 if (ca.first.size()==0) {
292 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR no suitable constructor found for class " << className << endl ;
299 if (
_args.size()+2<ca.second ||
_args.size()+2>ca.first.size()) {
300 if (ca.second==ca.first.size()) {
301 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid, " << className
302 <<
" expects " << ca.first.size()-2 << endl ;
305 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid " << className
306 <<
" expect number between " << ca.second-2 <<
" and " << ca.first.size()-2 << endl ;
313 string cintExpr(
Form(
"new %s(\"%s\",\"%s\"",className,objName,objName)) ;
321 list<string>::iterator ti = ca.first.begin() ; ti++ ; ti++ ;
322 for (vector<string>::iterator ai =
_args.begin() ; ai !=
_args.end() ; ai++,ti++,i++) {
323 if ((*ti)==
"RooAbsReal&" || (*ti)==
"const RooAbsReal&") {
325 cintExpr +=
Form(
",RooFactoryWSTool::as_FUNC(%d)",i) ;
326 }
else if ((*ti)==
"RooAbsArg&" || (*ti)==
"const RooAbsArg&") {
328 cintExpr +=
Form(
",RooFactoryWSTool::as_ARG(%d)",i) ;
329 }
else if ((*ti)==
"RooRealVar&" || (*ti)==
"const RooRealVar&") {
331 cintExpr +=
Form(
",RooFactoryWSTool::as_VAR(%d)",i) ;
332 }
else if ((*ti)==
"RooAbsRealLValue&" || (*ti)==
"const RooAbsRealLValue&") {
334 cintExpr +=
Form(
",RooFactoryWSTool::as_VARLV(%d)",i) ;
335 }
else if ((*ti)==
"RooCategory&" || (*ti)==
"const RooCategory&") {
337 cintExpr +=
Form(
",RooFactoryWSTool::as_CAT(%d)",i) ;
338 }
else if ((*ti)==
"RooAbsCategory&" || (*ti)==
"const RooAbsCategory&") {
340 cintExpr +=
Form(
",RooFactoryWSTool::as_CATFUNC(%d)",i) ;
341 }
else if ((*ti)==
"RooAbsCategoryLValue&" || (*ti)==
"const RooAbsCategoryLValue&") {
343 cintExpr +=
Form(
",RooFactoryWSTool::as_CATLV(%d)",i) ;
344 }
else if ((*ti)==
"RooAbsPdf&" || (*ti)==
"const RooAbsPdf&") {
346 cintExpr +=
Form(
",RooFactoryWSTool::as_PDF(%d)",i) ;
347 }
else if ((*ti)==
"RooResolutionModel&" || (*ti)==
"const RooResolutionModel&") {
349 cintExpr +=
Form(
",RooFactoryWSTool::as_RMODEL(%d)",i) ;
350 }
else if ((*ti)==
"RooAbsData&" || (*ti)==
"const RooAbsData&") {
352 cintExpr +=
Form(
",RooFactoryWSTool::as_DATA(%d)",i) ;
353 }
else if ((*ti)==
"RooDataSet&" || (*ti)==
"const RooDataSet&") {
355 cintExpr +=
Form(
",RooFactoryWSTool::as_DSET(%d)",i) ;
356 }
else if ((*ti)==
"RooDataHist&" || (*ti)==
"const RooDataHist&") {
358 cintExpr +=
Form(
",RooFactoryWSTool::as_DHIST(%d)",i) ;
359 }
else if ((*ti)==
"const RooArgSet&") {
361 cintExpr +=
Form(
",RooFactoryWSTool::as_SET(%d)",i) ;
362 }
else if ((*ti)==
"const RooArgList&") {
364 cintExpr +=
Form(
",RooFactoryWSTool::as_LIST(%d)",i) ;
365 }
else if ((*ti)==
"const char*") {
367 cintExpr +=
Form(
",RooFactoryWSTool::as_STRING(%d)",i) ;
368 }
else if ((*ti)==
"Int_t" || (*ti)==
"int" || (*ti)==
"Bool_t" || (*ti)==
"bool") {
370 cintExpr +=
Form(
",RooFactoryWSTool::as_INT(%d)",i) ;
371 }
else if ((*ti)==
"Double_t") {
373 cintExpr +=
Form(
",RooFactoryWSTool::as_DOUBLE(%d)",i) ;
377 if (
_args[i].find(
Form(
"%s::",className)) != string::npos) {
378 qualvalue =
_args[i].c_str() ;
380 qualvalue =
Form(
"%s::%s",className,
_args[i].c_str()) ;
383 cintExpr +=
Form(
",(%s)%s",ti->c_str(),qualvalue.c_str()) ;
385 throw string(
Form(
"Supplied argument %s does not represent a valid state of enum %s",
_args[i].c_str(),ti->c_str())) ;
393 if (ti->find(
"const ")==0) {
394 btype = ti->c_str()+6 ;
398 if (btype.find(
"&")) {
399 btype.erase(btype.size()-1,btype.size()) ;
406 cintExpr +=
Form(
",(%s&)RooFactoryWSTool::as_OBJ(%d)",ti->c_str(),i) ;
408 throw string(
Form(
"Required argument with name %s of type '%s' is not in the workspace",
_args[i].c_str(),ti->c_str())) ;
413 }
catch (
string err) {
414 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR constructing " << className <<
"::" << objName <<
": " << err << endl ;
419 cxcoutD(
ObjectHandling) <<
"RooFactoryWSTool::createArg() Construct expression is " << cintExpr << endl ;
425 if (
string(className)==
"RooGenericPdf") {
427 }
else if (
string(className)==
"RooFormulaVar") {
437 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR in CINT constructor call to create object" << endl ;
449 return vector<string>() ;
470 char* tok = strtok_r(buf,
",",&save) ;
472 char* star=strchr(tok,
'*') ;
480 tok = strtok_r(0,
",",&save) ;
482 pdfList.
add(pdfList2) ;
484 }
catch (
string err) {
485 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooAddPdf: " << err << endl ;
512 char* tok = strtok_r(buf,
",",&save) ;
514 char* star=strchr(tok,
'*') ;
522 tok = strtok_r(0,
",",&save) ;
524 amplList.
add(amplList2) ;
526 }
catch (
string err) {
527 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooRealSumPdf: " << err << endl ;
547 string regPdfList=
"{" ;
551 char* tok = strtok_r(buf,
",",&save) ;
553 char *
sep = strchr(tok,
'|') ;
568 }
catch (
string err) {
569 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf Conditional argument: " << err << endl ;
576 if (regPdfList.size()>1) {
581 tok = strtok_r(0,
",",&save) ;
587 pdf =
new RooProdPdf(objName,objName,
asSET(regPdfList.c_str()),cmdList) ;
588 }
catch (
string err) {
589 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf input set of regular p.d.f.s: " << err << endl ;
611 map<string,RooAbsPdf*> theMap ;
616 char* tok = strtok_r(buf,
",",&save) ;
618 char* eq = strchr(tok,
'=') ;
620 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName
621 <<
" expect mapping token of form 'state=pdfName', but found '" << tok <<
"'" << endl ;
628 theMap[tok] = &
asPDF(eq+1) ;
629 }
catch (
string err ) {
630 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous: " << err << endl ;
634 tok = strtok_r(0,
",",&save) ;
642 }
catch (
string err) {
643 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName <<
" " << err << endl ;
668 char* tok = strtok_r(buf,
",",&save) ;
670 char* star=strchr(tok,
'*') ;
678 tok = strtok_r(0,
",",&save) ;
681 }
catch (
string err) {
682 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: " << err << endl ;
688 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: syntax error: either all sum terms must be products or none" << endl ;
696 sum =
new RooAddition(objName,objName,sumlist1,sumlist2) ;
837 char* buf =
new char[strlen(expr)+1] ;
842 if (!isspace(*expr)) {
859 }
catch (
string error) {
860 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERROR in parsing: " << error << endl ;
866 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed" << endl ;
876 return out.size() ?
ws().
arg(out.c_str()) : 0 ;
895 if (
string(token).find(
"$Alias(")==0) {
921 const size_t bufBaseSize = strlen(token)+1;
922 char* buf_base =
new char[bufBaseSize] ;
923 char* buf = buf_base ;
924 strlcpy(buf,token,bufBaseSize) ;
927 list<string> singleExpr ;
928 list<char> separator ;
934 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
935 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
938 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
942 if (!litmode && blevel==0 && ( (*p)==
'=' || (*p) ==
'|' || (*p) ==
'*')) {
943 separator.push_back(*p) ;
945 singleExpr.push_back(buf) ;
951 singleExpr.push_back(buf) ;
953 if (singleExpr.size()==1) {
960 list<char>::iterator ic = separator.begin() ;
961 for (list<string>::iterator ii = singleExpr.begin() ; ii!=singleExpr.end() ; ii++) {
963 if (ic != separator.end()) {
986 if (strlen(arg)==0) {
991 if (arg[0]==
'\'' || arg[0]==
'"') {
996 const size_t bufSize = strlen(arg)+1;
997 char* buf =
new char[bufSize] ;
998 strlcpy(buf,arg,bufSize) ;
1001 string func,prefix ;
1002 vector<string> args ;
1006 char* tmpx = strtok_r(buf,
"([",&save) ;
1007 func = tmpx ? tmpx :
"" ;
1008 char* p = strtok_r(0,
"",&save) ;
1023 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1024 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1027 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1033 if (!litmode && blevel==0 && ((*p)==
',')) {
1035 args.push_back(tok) ;
1044 if (p>bufptr && (*(p-1)==
')'||*(p-1)==
']')) {
1053 p = strtok_r(0,
"",&save) ;
1055 args.push_back(tmp) ;
1066 for(
const char* pp=arg ; *pp!=0 ; pp++) {
1067 if (*pp==
'(' || *pp==
'[' || *pp==
'{') {
1073 if (strstr(func.c_str(),
"::")) {
1078 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: Class::Instance must be followed by (...)" << endl ;
1081 }
else if (func[0]!=
'$'){
1085 }
else if (lb==
'(') {
1095 static Int_t globCounter = 0 ;
1097 autoname =
Form(
"gobj%d",globCounter) ;
1099 if (!
ws().arg(autoname.c_str())) {
1103 autoname =
Form(
"%s::%s",func.c_str(),autoname.c_str()) ;
1107 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: expect either Class(...) or Instance[...]" << endl ;
1115 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: $MetaClass must be followed by (...)" << endl ;
1135 const size_t bufSize = strlen(arg)+1;
1136 char* buf =
new char[bufSize] ;
1137 strlcpy(buf,arg,bufSize) ;
1139 vector<string> args ;
1150 if (*p==
'{' || *p==
'(' || *p==
'[') level++ ;
1151 if (*p==
'}' || *p==
')' || *p==
']') level-- ;
1157 if (level==0 && ((*p)==
',')) {
1159 args.push_back(tok) ;
1167 if (p>buf && *(p-1)==
'}') {
1170 args.push_back(tok) ;
1178 vector<string>::iterator iter = args.begin() ;
1180 while(iter!= args.end()) {
1181 if (strlen(ret.c_str())>1) ret +=
"," ;
1205 if (args.size()!=2) {
1206 coutE(
ObjectHandling) <<
"RooFactorWSTool::processAliasExpression() ERROR $Alias() takes exactly two arguments, " << args.size() <<
" args found" << endl ;
1226 map<string,string>::iterator item =
_typeAliases.find(className) ;
1230 className = item->second.c_str() ;
1243 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not defined in ROOT class table" << endl ;
1260 for (vector<string>::iterator iter = args.begin() ; iter!=args.end() ; ++iter) {
1261 if (iter!=args.begin()) {
1288 string first = *(args.begin()) ;
1289 if (isdigit(first[0]) || first[0]==
'.' || first[0]==
'+' || first[0]==
'-') {
1292 vector<string>::iterator ai = args.begin() ;
1293 if (args.size()==1) {
1296 Double_t xinit = atof((ai)->c_str()) ;
1298 RooRealVar tmp(func.c_str(),func.c_str(),xinit) ;
1304 }
else if (args.size()==2) {
1307 Double_t xlo = atof((ai++)->c_str()) ;
1309 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1310 RooRealVar tmp(func.c_str(),func.c_str(),xlo,xhi) ;
1316 }
else if (args.size()==3) {
1319 Double_t xinit = atof((ai++)->c_str()) ;
1320 Double_t xlo = atof((ai++)->c_str()) ;
1322 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xinit = " << xinit <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1323 RooRealVar tmp(func.c_str(),func.c_str(),xinit,xlo,xhi) ;
1333 for (vector<string>::iterator ai = args.begin() ; ai!=args.end() ; ai++) {
1334 if (allStates.size()>0) {
1362 const char *className = strtok_r(buf,
":",&save) ;
1363 const char *instName = strtok_r(0,
":",&save) ;
1364 if (!className) className =
"";
1365 if (!instName) instName =
"" ;
1370 vector<string>::iterator iter = args.begin() ;
1371 vector<string> pargv ;
1373 while(iter!=args.end()) {
1374 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1379 pargv.push_back(tmp) ;
1385 for (map<string,IFace*>::iterator ii=
hooks().begin() ; ii!=
hooks().end() ; ii++) {
1387 if (
hooks().find(className) !=
hooks().end()) {
1389 return iface->
create(*
this, className,instName,pargv) ;
1394 return string(instName) ;
1406 vector<string>::iterator iter = args.begin() ;
1407 vector<string> pargv ;
1408 while(iter!=args.end()) {
1409 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1412 pargv.push_back(tmp) ;
1416 string ret = func+
"("+pargs+
")" ;
1428 const size_t bufSize = strlen(funcExpr)+1;
1429 char* buf =
new char[bufSize] ;
1430 strlcpy(buf,funcExpr,bufSize) ;
1431 char* bufptr = buf ;
1434 vector<string> args ;
1438 char* tmpx = strtok_r(buf,
"(",&save) ;
1439 func = tmpx ? tmpx :
"" ;
1440 char* p = strtok_r(0,
"",&save) ;
1454 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1455 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1458 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1464 if (!litmode && blevel==0 && ((*p)==
',')) {
1466 args.push_back(tok) ;
1475 if (p>bufptr && *(p-1)==
')') {
1484 p = strtok_r(0,
"",&save) ;
1486 args.push_back(tmp) ;
1505 Int_t nParentheses(0), nBracket(0), nAccolade(0) ;
1506 const char* ptr = arg ;
1508 if (*ptr==
'(') nParentheses++ ;
1509 if (*ptr==
')') nParentheses-- ;
1510 if (*ptr==
'[') nBracket++ ;
1511 if (*ptr==
']') nBracket-- ;
1512 if (*ptr==
'{') nAccolade++ ;
1513 if (*ptr==
'}') nAccolade-- ;
1516 if (nParentheses!=0) {
1517 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nParentheses>0?
"(":
")") <<
"' in expression" << endl ;
1521 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nBracket>0?
"[":
"]") <<
"' in expression" << endl ;
1525 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nAccolade>0?
"{":
"}") <<
"' in expression" << endl ;
1538 throw string(
Form(
"Need argument number %d, but only %d args are provided",idx,(
Int_t)
_of->
_args.size())) ;
1550 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1557 throw string(
Form(
"RooAbsArg named %s not found",arg)) ;
1570 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1576 throw string(
Form(
"RooAbsReal named %s not found",arg)) ;
1580 throw string(
Form(
"Object named %s is not of type RooAbsReal",arg)) ;
1593 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1594 throw string(
Form(
"Numeric literal provided for argument (%s), but lvalue is required",arg)) ;
1599 throw string(
Form(
"RooAbsRealLValue named %s not found",arg)) ;
1603 throw string(
Form(
"Object named %s is not of type RooAbsRealLValue",arg)) ;
1617 throw string(
Form(
"RooRealVar named %s not found",arg)) ;
1632 throw string(
Form(
"RooAbsPdf named %s not found",arg)) ;
1647 throw string(
Form(
"RooResolutionModel named %s not found",arg)) ;
1651 throw string(
Form(
"Object named %s is not of type RooResolutionModel",arg)) ;
1666 throw string(
Form(
"RooAbsCategory named %s not found",arg)) ;
1670 throw string(
Form(
"Object named %s is not of type RooAbsCategory",arg)) ;
1684 throw string(
Form(
"RooAbsCategoryLValue named %s not found",arg)) ;
1689 throw string(
Form(
"Object named %s is not of type RooAbsCategoryLValue",arg)) ;
1703 throw string(
Form(
"RooCategory named %s not found",arg)) ;
1734 char* tok = strtok_r(tmp,
",{}",&save) ;
1739 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1741 }
else if (tok[0] ==
'\'') {
1742 tok[strlen(tok) - 1] = 0;
1750 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1753 tok = strtok_r(0,
",{}",&save) ;
1771 char* tok = strtok_r(tmp,
",{}",&save) ;
1775 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1777 }
else if (tok[0] ==
'\'') {
1778 tok[strlen(tok) - 1] = 0;
1786 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1789 tok = strtok_r(0,
",{}",&save) ;
1804 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1818 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1822 throw string(
Form(
"Dataset named %s is not of type RooDataHist",arg)) ;
1835 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1839 throw string(
Form(
"Dataset named %s is not of type RooDataSet",arg)) ;
1852 throw string(
Form(
"Object named %s not found",arg)) ;
1864 static vector<string> cbuf(10) ;
1865 static unsigned int cbuf_idx = 0 ;
1868 if (arg==0 || strlen(arg)==0) {
1874 cbuf[cbuf_idx].clear() ;
1875 const char* p = arg+1 ;
1876 while(*p && (*p) !=
'"' && (*p) !=
'\'' ) {
1877 cbuf[cbuf_idx] += *(p++) ;
1879 const char* ret = cbuf[cbuf_idx].c_str() ;
1883 if (cbuf_idx==cbuf.size()) cbuf_idx=0 ;
1912 hooks()[typeName] = iface ;
1922 _hooks =
new map<string,IFace*> ;
1935 vector<string>::iterator iter = args.begin() ;
1936 vector<string> pargv ;
1937 while(iter!=args.end()) {
1938 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1941 pargv.push_back(tmp) ;
1946 string cl(typeName) ;
1952 }
else if (cl==
"RSUM") {
1957 }
else if (cl==
"ASUM") {
1962 }
else if (cl==
"PROD") {
1965 ft.
prod(instName,pargs) ;
1967 }
else if (cl==
"SIMUL") {
1970 if (pargv.size()>1) {
1971 ft.
simul(instName,pargv[0].c_str(),strchr(pargs,
',')+1) ;
1973 throw string(
Form(
"Need at least two arguments in call to SIMUL::%s, have %d: %s",instName,(
Int_t)pargv.size(),pargs)) ;
1976 }
else if (cl==
"EXPR") {
1979 if (args.size()<=2) {
1980 ft.
createArg(
"RooGenericPdf",instName,pargs) ;
1985 for (
UInt_t i=1 ; i<args.size() ; i++) {
1990 ft.
createArg(
"RooGenericPdf",instName,genargs) ;
1993 }
else if (cl==
"FCONV") {
1996 ft.
createArg(
"RooFFTConvPdf",instName,pargs) ;
1998 }
else if (cl==
"NCONV") {
2001 ft.
createArg(
"RooNumConvPdf",instName,pargs) ;
2003 }
else if (cl==
"sum") {
2008 }
else if (cl==
"prod") {
2013 }
else if (cl==
"expr") {
2016 if (args.size()<=2) {
2017 ft.
createArg(
"RooFormulaVar",instName,pargs) ;
2022 for (
UInt_t i=1 ; i<args.size() ; i++) {
2027 ft.
createArg(
"RooFormulaVar",instName,genargs) ;
2030 }
else if (cl==
"nconv") {
2033 ft.
createArg(
"RooNumConvolution",instName,pargs) ;
2035 }
else if (cl==
"nll") {
2041 }
else if (cl==
"chi2") {
2047 }
else if (cl==
"profile") {
2050 ft.
createArg(
"RooProfileLL",instName,pargs) ;
2052 }
else if (cl==
"dataobs") {
2062 }
else if (cl==
"int") {
2069 if (pargv.size()<2 || pargv.size()>3) {
2070 throw string(
Form(
"int::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2076 strlcpy(buf,pargv[1].c_str(),256) ;
2078 const char* intobs = strtok_r(buf,
"|",&save) ;
2079 if (!intobs) intobs=
"" ;
2081 const char* range = strtok_r(0,
"",&save) ;
2082 if (!range) range=
"" ;
2085 if (pargv.size()==2) {
2086 if (range && strlen(range)) {
2092 if (range && strlen(range)) {
2102 }
else if (cl==
"deriv") {
2106 if (pargv.size()<2 || pargv.size()>3) {
2107 throw string(
Form(
"deriv::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2113 if (pargv.size()==2) {
2119 derivative->
SetName(instName) ;
2122 }
else if (cl==
"cdf") {
2126 if (pargv.size()<2 || pargv.size()>3) {
2127 throw string(
Form(
"cdf::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2133 if (pargv.size()==2) {
2143 }
else if (cl==
"PROJ") {
2146 if (pargv.size()!=2) {
2147 throw string(
Form(
"PROJ::%s, requires 2 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2152 projection->
SetName(instName) ;
2156 }
else if (cl==
"set") {
2161 return string(instName) ;
2166 throw string(
Form(
"RooFactoryWSTool::SpecialsIFace::create() ERROR: Unknown meta-type %s",typeName)) ;
2169 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...
Bool_t isValidEnumValue(const char *typeName, const char *value)
Bool_t isEnum(const char *typeName)
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'.
std::pair< std::list< std::string >, unsigned int > ctorArgs(const char *classname, UInt_t nMinArgs=0)
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.
std::string trueName(const char *typeDefName)
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)())
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.