69 #define BUFFER_SIZE 64000 125 static char *strtok_r(
char *s1,
const char *s2,
char **lasts)
131 while(*s1 && strchr(s2, *s1))
136 while(*s1 && !strchr(s2, *s1))
175 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createFactory() ERROR: variable with name '" << name <<
"' already exists" << endl ;
202 const size_t tmpSize = strlen(stateNameList)+1;
203 char *tmp =
new char[tmpSize] ;
204 strlcpy(tmp,stateNameList,tmpSize) ;
206 char* tok = strtok_r(tmp,
",",&save) ;
208 char*
sep = strchr(tok,
'=') ;
211 Int_t id = atoi(sep+1) ;
217 tok = strtok_r(0,
",",&save) ;
243 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not found in factory alias table, nor in ROOT class table" << endl ;
252 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" does not inherit from RooAbsArg" << endl ;
268 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
269 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
272 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
277 if (!litmode && blevel==0 && ((*p)==
',')) {
279 _args.push_back(tok) ;
285 _args.push_back(tok) ;
290 if (ca.first.size()==0) {
291 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR no suitable constructor found for class " << className << endl ;
298 if (
_args.size()+2<ca.second ||
_args.size()+2>ca.first.size()) {
299 if (ca.second==ca.first.size()) {
300 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid, " << className
301 <<
" expects " << ca.first.size()-2 << endl ;
304 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" <<
_args.size() <<
") for class is invalid " << className
305 <<
" expect number between " << ca.second-2 <<
" and " << ca.first.size()-2 << endl ;
312 string cintExpr(
Form(
"new %s(\"%s\",\"%s\"",className,objName,objName)) ;
320 list<string>::iterator ti = ca.first.begin() ; ti++ ; ti++ ;
321 for (vector<string>::iterator ai =
_args.begin() ; ai !=
_args.end() ; ai++,ti++,i++) {
322 if ((*ti)==
"RooAbsReal&" || (*ti)==
"const RooAbsReal&") {
324 cintExpr +=
Form(
",RooFactoryWSTool::as_FUNC(%d)",i) ;
325 }
else if ((*ti)==
"RooAbsArg&" || (*ti)==
"const RooAbsArg&") {
327 cintExpr +=
Form(
",RooFactoryWSTool::as_ARG(%d)",i) ;
328 }
else if ((*ti)==
"RooRealVar&" || (*ti)==
"const RooRealVar&") {
330 cintExpr +=
Form(
",RooFactoryWSTool::as_VAR(%d)",i) ;
331 }
else if ((*ti)==
"RooAbsRealLValue&" || (*ti)==
"const RooAbsRealLValue&") {
333 cintExpr +=
Form(
",RooFactoryWSTool::as_VARLV(%d)",i) ;
334 }
else if ((*ti)==
"RooCategory&" || (*ti)==
"const RooCategory&") {
336 cintExpr +=
Form(
",RooFactoryWSTool::as_CAT(%d)",i) ;
337 }
else if ((*ti)==
"RooAbsCategory&" || (*ti)==
"const RooAbsCategory&") {
339 cintExpr +=
Form(
",RooFactoryWSTool::as_CATFUNC(%d)",i) ;
340 }
else if ((*ti)==
"RooAbsCategoryLValue&" || (*ti)==
"const RooAbsCategoryLValue&") {
342 cintExpr +=
Form(
",RooFactoryWSTool::as_CATLV(%d)",i) ;
343 }
else if ((*ti)==
"RooAbsPdf&" || (*ti)==
"const RooAbsPdf&") {
345 cintExpr +=
Form(
",RooFactoryWSTool::as_PDF(%d)",i) ;
346 }
else if ((*ti)==
"RooResolutionModel&" || (*ti)==
"const RooResolutionModel&") {
348 cintExpr +=
Form(
",RooFactoryWSTool::as_RMODEL(%d)",i) ;
349 }
else if ((*ti)==
"RooAbsData&" || (*ti)==
"const RooAbsData&") {
351 cintExpr +=
Form(
",RooFactoryWSTool::as_DATA(%d)",i) ;
352 }
else if ((*ti)==
"RooDataSet&" || (*ti)==
"const RooDataSet&") {
354 cintExpr +=
Form(
",RooFactoryWSTool::as_DSET(%d)",i) ;
355 }
else if ((*ti)==
"RooDataHist&" || (*ti)==
"const RooDataHist&") {
357 cintExpr +=
Form(
",RooFactoryWSTool::as_DHIST(%d)",i) ;
358 }
else if ((*ti)==
"const RooArgSet&") {
360 cintExpr +=
Form(
",RooFactoryWSTool::as_SET(%d)",i) ;
361 }
else if ((*ti)==
"const RooArgList&") {
363 cintExpr +=
Form(
",RooFactoryWSTool::as_LIST(%d)",i) ;
364 }
else if ((*ti)==
"const char*") {
366 cintExpr +=
Form(
",RooFactoryWSTool::as_STRING(%d)",i) ;
367 }
else if ((*ti)==
"Int_t" || (*ti)==
"int" || (*ti)==
"Bool_t" || (*ti)==
"bool") {
369 cintExpr +=
Form(
",RooFactoryWSTool::as_INT(%d)",i) ;
370 }
else if ((*ti)==
"Double_t") {
372 cintExpr +=
Form(
",RooFactoryWSTool::as_DOUBLE(%d)",i) ;
376 if (
_args[i].find(
Form(
"%s::",className)) != string::npos) {
377 qualvalue =
_args[i].c_str() ;
379 qualvalue =
Form(
"%s::%s",className,
_args[i].c_str()) ;
382 cintExpr +=
Form(
",(%s)%s",ti->c_str(),qualvalue.c_str()) ;
384 throw string(
Form(
"Supplied argument %s does not represent a valid state of enum %s",
_args[i].c_str(),ti->c_str())) ;
392 if (ti->find(
"const ")==0) {
393 btype = ti->c_str()+6 ;
397 if (btype.find(
"&")) {
398 btype.erase(btype.size()-1,btype.size()) ;
405 cintExpr +=
Form(
",(%s&)RooFactoryWSTool::as_OBJ(%d)",ti->c_str(),i) ;
407 throw string(
Form(
"Required argument with name %s of type '%s' is not in the workspace",
_args[i].c_str(),ti->c_str())) ;
412 }
catch (
string err) {
413 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR constructing " << className <<
"::" << objName <<
": " << err << endl ;
418 cxcoutD(
ObjectHandling) <<
"RooFactoryWSTool::createArg() Construct expression is " << cintExpr << endl ;
424 if (
string(className)==
"RooGenericPdf") {
426 }
else if (
string(className)==
"RooFormulaVar") {
436 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR in CINT constructor call to create object" << endl ;
448 return vector<string>() ;
469 char* tok = strtok_r(buf,
",",&save) ;
471 char* star=strchr(tok,
'*') ;
479 tok = strtok_r(0,
",",&save) ;
481 pdfList.
add(pdfList2) ;
483 }
catch (
string err) {
484 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooAddPdf: " << err << endl ;
511 char* tok = strtok_r(buf,
",",&save) ;
513 char* star=strchr(tok,
'*') ;
521 tok = strtok_r(0,
",",&save) ;
523 amplList.
add(amplList2) ;
525 }
catch (
string err) {
526 coutE(
ObjectHandling) <<
"RooFactoryWSTool::add(" << objName <<
") ERROR creating RooRealSumPdf: " << err << endl ;
546 string regPdfList=
"{" ;
550 char* tok = strtok_r(buf,
",",&save) ;
552 char *
sep = strchr(tok,
'|') ;
567 }
catch (
string err) {
568 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf Conditional argument: " << err << endl ;
575 if (regPdfList.size()>1) {
580 tok = strtok_r(0,
",",&save) ;
586 pdf =
new RooProdPdf(objName,objName,
asSET(regPdfList.c_str()),cmdList) ;
587 }
catch (
string err) {
588 coutE(
ObjectHandling) <<
"RooFactoryWSTool::prod(" << objName <<
") ERROR creating RooProdPdf input set of regular p.d.f.s: " << err << endl ;
610 map<string,RooAbsPdf*> theMap ;
615 char* tok = strtok_r(buf,
",",&save) ;
617 char* eq = strchr(tok,
'=') ;
619 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName
620 <<
" expect mapping token of form 'state=pdfName', but found '" << tok <<
"'" << endl ;
627 theMap[tok] = &
asPDF(eq+1) ;
628 }
catch (
string err ) {
629 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous: " << err << endl ;
633 tok = strtok_r(0,
",",&save) ;
641 }
catch (
string err) {
642 coutE(
ObjectHandling) <<
"RooFactoryWSTool::simul(" << objName <<
") ERROR creating RooSimultaneous::" << objName <<
" " << err << endl ;
667 char* tok = strtok_r(buf,
",",&save) ;
669 char* star=strchr(tok,
'*') ;
677 tok = strtok_r(0,
",",&save) ;
680 }
catch (
string err) {
681 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: " << err << endl ;
687 coutE(
ObjectHandling) <<
"RooFactoryWSTool::addfunc(" << objName <<
") ERROR creating RooAddition: syntax error: either all sum terms must be products or none" << endl ;
695 sum =
new RooAddition(objName,objName,sumlist1,sumlist2) ;
836 char* buf =
new char[strlen(expr)+1] ;
841 if (!isspace(*expr)) {
858 }
catch (
string error) {
859 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERROR in parsing: " << error << endl ;
865 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed" << endl ;
875 return out.size() ?
ws().
arg(out.c_str()) : 0 ;
894 if (
string(token).find(
"$Alias(")==0) {
920 const size_t bufBaseSize = strlen(token)+1;
921 char* buf_base =
new char[bufBaseSize] ;
922 char* buf = buf_base ;
923 strlcpy(buf,token,bufBaseSize) ;
926 list<string> singleExpr ;
933 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
934 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
937 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
941 if (!litmode && blevel==0 && ( (*p)==
'=' || (*p) ==
'|' || (*p) ==
'*')) {
942 separator.push_back(*p) ;
944 singleExpr.push_back(buf) ;
950 singleExpr.push_back(buf) ;
952 if (singleExpr.size()==1) {
959 list<char>::iterator ic = separator.begin() ;
960 for (list<string>::iterator ii = singleExpr.begin() ; ii!=singleExpr.end() ; ii++) {
962 if (ic != separator.end()) {
985 if (strlen(arg)==0) {
990 if (arg[0]==
'\'' || arg[0]==
'"') {
995 const size_t bufSize = strlen(arg)+1;
996 char* buf =
new char[bufSize] ;
997 strlcpy(buf,arg,bufSize) ;
1000 string func,prefix ;
1001 vector<string> args ;
1005 char* tmpx = strtok_r(buf,
"([",&save) ;
1006 func = tmpx ? tmpx :
"" ;
1007 char* p = strtok_r(0,
"",&save) ;
1022 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1023 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1026 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1032 if (!litmode && blevel==0 && ((*p)==
',')) {
1034 args.push_back(tok) ;
1043 if (p>bufptr && (*(p-1)==
')'||*(p-1)==
']')) {
1052 p = strtok_r(0,
"",&save) ;
1054 args.push_back(tmp) ;
1065 for(
const char* pp=arg ; *pp!=0 ; pp++) {
1066 if (*pp==
'(' || *pp==
'[' || *pp==
'{') {
1072 if (strstr(func.c_str(),
"::")) {
1077 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: Class::Instance must be followed by (...)" << endl ;
1080 }
else if (func[0]!=
'$'){
1084 }
else if (lb==
'(') {
1094 static Int_t globCounter = 0 ;
1096 autoname =
Form(
"gobj%d",globCounter) ;
1098 if (!
ws().arg(autoname.c_str())) {
1102 autoname =
Form(
"%s::%s",func.c_str(),autoname.c_str()) ;
1106 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: expect either Class(...) or Instance[...]" << endl ;
1114 coutE(
ObjectHandling) <<
"RooFactoryWSTool::processSingleExpression(" << arg <<
"): ERROR: Syntax error: $MetaClass must be followed by (...)" << endl ;
1134 const size_t bufSize = strlen(arg)+1;
1135 char* buf =
new char[bufSize] ;
1136 strlcpy(buf,arg,bufSize) ;
1138 vector<string> args ;
1149 if (*p==
'{' || *p==
'(' || *p==
'[') level++ ;
1150 if (*p==
'}' || *p==
')' || *p==
']') level-- ;
1156 if (level==0 && ((*p)==
',')) {
1158 args.push_back(tok) ;
1166 if (p>buf && *(p-1)==
'}') {
1169 args.push_back(tok) ;
1177 vector<string>::iterator iter = args.begin() ;
1179 while(iter!= args.end()) {
1180 if (strlen(ret.c_str())>1) ret +=
"," ;
1204 if (args.size()!=2) {
1205 coutE(
ObjectHandling) <<
"RooFactorWSTool::processAliasExpression() ERROR $Alias() takes exactly two arguments, " << args.size() <<
" args found" << endl ;
1225 map<string,string>::iterator item =
_typeAliases.find(className) ;
1229 className = item->second.c_str() ;
1242 coutE(
ObjectHandling) <<
"RooFactoryWSTool::createArg() ERROR class " << className <<
" not defined in ROOT class table" << endl ;
1259 for (vector<string>::iterator iter = args.begin() ; iter!=args.end() ; ++iter) {
1260 if (iter!=args.begin()) {
1287 string first = *(args.begin()) ;
1288 if (isdigit(first[0]) || first[0]==
'.' || first[0]==
'+' || first[0]==
'-') {
1291 vector<string>::iterator ai = args.begin() ;
1292 if (args.size()==1) {
1295 Double_t xinit = atof((ai)->c_str()) ;
1297 RooRealVar tmp(func.c_str(),func.c_str(),xinit) ;
1303 }
else if (args.size()==2) {
1306 Double_t xlo = atof((ai++)->c_str()) ;
1308 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1309 RooRealVar tmp(func.c_str(),func.c_str(),xlo,xhi) ;
1315 }
else if (args.size()==3) {
1318 Double_t xinit = atof((ai++)->c_str()) ;
1319 Double_t xlo = atof((ai++)->c_str()) ;
1321 cxcoutD(
ObjectHandling) <<
"CREATE variable " << func <<
" xinit = " << xinit <<
" xlo = " << xlo <<
" xhi = " << xhi << endl ;
1322 RooRealVar tmp(func.c_str(),func.c_str(),xinit,xlo,xhi) ;
1332 for (vector<string>::iterator ai = args.begin() ; ai!=args.end() ; ai++) {
1333 if (allStates.size()>0) {
1361 const char *className = strtok_r(buf,
":",&save) ;
1362 const char *instName = strtok_r(0,
":",&save) ;
1363 if (!className) className =
"";
1364 if (!instName) instName =
"" ;
1369 vector<string>::iterator iter = args.begin() ;
1370 vector<string> pargv ;
1372 while(iter!=args.end()) {
1373 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1378 pargv.push_back(tmp) ;
1384 for (map<string,IFace*>::iterator ii=
hooks().begin() ; ii!=
hooks().end() ; ii++) {
1386 if (
hooks().find(className) !=
hooks().end()) {
1388 return iface->
create(*
this, className,instName,pargv) ;
1393 return string(instName) ;
1405 vector<string>::iterator iter = args.begin() ;
1406 vector<string> pargv ;
1407 while(iter!=args.end()) {
1408 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1411 pargv.push_back(tmp) ;
1415 string ret = func+
"("+pargs+
")" ;
1427 const size_t bufSize = strlen(funcExpr)+1;
1428 char* buf =
new char[bufSize] ;
1429 strlcpy(buf,funcExpr,bufSize) ;
1430 char* bufptr = buf ;
1433 vector<string> args ;
1437 char* tmpx = strtok_r(buf,
"(",&save) ;
1438 func = tmpx ? tmpx :
"" ;
1439 char* p = strtok_r(0,
"",&save) ;
1453 if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
1454 if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
1457 if (*p==
'"' || *p==
'\'') litmode = !litmode ;
1463 if (!litmode && blevel==0 && ((*p)==
',')) {
1465 args.push_back(tok) ;
1474 if (p>bufptr && *(p-1)==
')') {
1483 p = strtok_r(0,
"",&save) ;
1485 args.push_back(tmp) ;
1504 Int_t nParentheses(0), nBracket(0), nAccolade(0) ;
1505 const char* ptr = arg ;
1507 if (*ptr==
'(') nParentheses++ ;
1508 if (*ptr==
')') nParentheses-- ;
1509 if (*ptr==
'[') nBracket++ ;
1510 if (*ptr==
']') nBracket-- ;
1511 if (*ptr==
'{') nAccolade++ ;
1512 if (*ptr==
'}') nAccolade-- ;
1515 if (nParentheses!=0) {
1516 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nParentheses>0?
"(":
")") <<
"' in expression" << endl ;
1520 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nBracket>0?
"[":
"]") <<
"' in expression" << endl ;
1524 coutE(
ObjectHandling) <<
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nAccolade>0?
"{":
"}") <<
"' in expression" << endl ;
1537 throw string(
Form(
"Need argument number %d, but only %d args are provided",idx,(
Int_t)
_of->
_args.size())) ;
1549 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1556 throw string(
Form(
"RooAbsArg named %s not found",arg)) ;
1569 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1575 throw string(
Form(
"RooAbsReal named %s not found",arg)) ;
1579 throw string(
Form(
"Object named %s is not of type RooAbsReal",arg)) ;
1592 if (arg[0]==
'.' || arg[0]==
'+' || arg[0] ==
'-' || isdigit(arg[0])) {
1593 throw string(
Form(
"Numeric literal provided for argument (%s), but lvalue is required",arg)) ;
1598 throw string(
Form(
"RooAbsRealLValue named %s not found",arg)) ;
1602 throw string(
Form(
"Object named %s is not of type RooAbsRealLValue",arg)) ;
1616 throw string(
Form(
"RooRealVar named %s not found",arg)) ;
1631 throw string(
Form(
"RooAbsPdf named %s not found",arg)) ;
1646 throw string(
Form(
"RooResolutionModel named %s not found",arg)) ;
1650 throw string(
Form(
"Object named %s is not of type RooResolutionModel",arg)) ;
1665 throw string(
Form(
"RooAbsCategory named %s not found",arg)) ;
1669 throw string(
Form(
"Object named %s is not of type RooAbsCategory",arg)) ;
1683 throw string(
Form(
"RooAbsCategoryLValue named %s not found",arg)) ;
1688 throw string(
Form(
"Object named %s is not of type RooAbsCategoryLValue",arg)) ;
1702 throw string(
Form(
"RooCategory named %s not found",arg)) ;
1733 char* tok = strtok_r(tmp,
",{}",&save) ;
1737 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1744 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1747 tok = strtok_r(0,
",{}",&save) ;
1765 char* tok = strtok_r(tmp,
",{}",&save) ;
1769 if (tok[0]==
'.' || tok[0]==
'+' || tok[0] ==
'-' || isdigit(tok[0])) {
1776 throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
1779 tok = strtok_r(0,
",{}",&save) ;
1794 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1808 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1812 throw string(
Form(
"Dataset named %s is not of type RooDataHist",arg)) ;
1825 throw string(
Form(
"RooAbsData named %s not found",arg)) ;
1829 throw string(
Form(
"Dataset named %s is not of type RooDataSet",arg)) ;
1842 throw string(
Form(
"Object named %s not found",arg)) ;
1854 static vector<string> cbuf(10) ;
1855 static unsigned int cbuf_idx = 0 ;
1858 if (arg==0 || strlen(arg)==0) {
1864 cbuf[cbuf_idx].clear() ;
1865 const char* p = arg+1 ;
1866 while(*p && (*p) !=
'"' && (*p) !=
'\'' ) {
1867 cbuf[cbuf_idx] += *(p++) ;
1869 const char* ret = cbuf[cbuf_idx].c_str() ;
1873 if (cbuf_idx==cbuf.size()) cbuf_idx=0 ;
1902 hooks()[typeName] = iface ;
1912 _hooks =
new map<string,IFace*> ;
1925 vector<string>::iterator iter = args.begin() ;
1926 vector<string> pargv ;
1927 while(iter!=args.end()) {
1928 if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
1931 pargv.push_back(tmp) ;
1936 string cl(typeName) ;
1942 }
else if (cl==
"RSUM") {
1947 }
else if (cl==
"ASUM") {
1952 }
else if (cl==
"PROD") {
1955 ft.
prod(instName,pargs) ;
1957 }
else if (cl==
"SIMUL") {
1960 if (pargv.size()>1) {
1961 ft.
simul(instName,pargv[0].c_str(),strchr(pargs,
',')+1) ;
1963 throw string(
Form(
"Need at least two arguments in call to SIMUL::%s, have %d: %s",instName,(
Int_t)pargv.size(),pargs)) ;
1966 }
else if (cl==
"EXPR") {
1969 if (args.size()<=2) {
1970 ft.
createArg(
"RooGenericPdf",instName,pargs) ;
1975 for (
UInt_t i=1 ; i<args.size() ; i++) {
1980 ft.
createArg(
"RooGenericPdf",instName,genargs) ;
1983 }
else if (cl==
"FCONV") {
1986 ft.
createArg(
"RooFFTConvPdf",instName,pargs) ;
1988 }
else if (cl==
"NCONV") {
1991 ft.
createArg(
"RooNumConvPdf",instName,pargs) ;
1993 }
else if (cl==
"sum") {
1998 }
else if (cl==
"prod") {
2003 }
else if (cl==
"expr") {
2006 if (args.size()<=2) {
2007 ft.
createArg(
"RooFormulaVar",instName,pargs) ;
2012 for (
UInt_t i=1 ; i<args.size() ; i++) {
2017 ft.
createArg(
"RooFormulaVar",instName,genargs) ;
2020 }
else if (cl==
"nconv") {
2023 ft.
createArg(
"RooNumConvolution",instName,pargs) ;
2025 }
else if (cl==
"nll") {
2031 }
else if (cl==
"chi2") {
2037 }
else if (cl==
"profile") {
2040 ft.
createArg(
"RooProfileLL",instName,pargs) ;
2042 }
else if (cl==
"dataobs") {
2052 }
else if (cl==
"int") {
2059 if (pargv.size()<2 || pargv.size()>3) {
2060 throw string(
Form(
"int::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2066 strlcpy(buf,pargv[1].c_str(),256) ;
2068 const char* intobs = strtok_r(buf,
"|",&save) ;
2069 if (!intobs) intobs=
"" ;
2071 const char* range = strtok_r(0,
"",&save) ;
2072 if (!range) range=
"" ;
2075 if (pargv.size()==2) {
2076 if (range && strlen(range)) {
2082 if (range && strlen(range)) {
2092 }
else if (cl==
"deriv") {
2096 if (pargv.size()<2 || pargv.size()>3) {
2097 throw string(
Form(
"deriv::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2103 if (pargv.size()==2) {
2109 derivative->
SetName(instName) ;
2112 }
else if (cl==
"cdf") {
2116 if (pargv.size()<2 || pargv.size()>3) {
2117 throw string(
Form(
"cdf::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2123 if (pargv.size()==2) {
2133 }
else if (cl==
"PROJ") {
2136 if (pargv.size()!=2) {
2137 throw string(
Form(
"PROJ::%s, requires 2 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
2142 projection->
SetName(instName) ;
2146 }
else if (cl==
"set") {
2151 return string(instName) ;
2156 throw string(
Form(
"RooFactoryWSTool::SpecialsIFace::create() ERROR: Unknown meta-type %s",typeName)) ;
2159 return string(instName) ;
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.
Bool_t isValidEnumValue(const char *typeName, const char *value)
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
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)
virtual TObject * clone(const char *newname=0) const =0
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.
double cdf(double *x, double *p)
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooCmdArg Silence(Bool_t flag=kTRUE)
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
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...
RooRealVar represents a fundamental (non-derived) real valued object.
std::string trueName(const char *typeDefName)
virtual void Add(TObject *arg)
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.
void SetName(const char *name)
Set the name of the TNamed.
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooCategory * cat(const char *name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found...
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 ...
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
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...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooAbsArg * fundArg(const char *name) const
Return fundamental (i.e.
double func(double *x, double *p)
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.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
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.
RooAbsArg * arg(const char *name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
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...
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
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...
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
The RooWorkspace is a persistable container for RooFit projects.
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 ...