68 #define BUFFER_SIZE 64000  
   74 map<string,RooFactoryWSTool::IFace*>* RooFactoryWSTool::_hooks=0 ;
 
  124 static char *strtok_r(
char *s1, 
const char *s2, 
char **lasts)
 
  130   while(*s1 && strchr(s2, *s1))
 
  135   while(*s1 && !strchr(s2, *s1))
 
  174     coutE(
ObjectHandling) << 
"RooFactoryWSTool::createFactory() ERROR: variable with name '" << name << 
"' already exists" << endl ;
 
  201      const size_t tmpSize = strlen(stateNameList)+1;
 
  202     char *tmp = 
new char[tmpSize] ;
 
  203     strlcpy(tmp,stateNameList,tmpSize) ;
 
  205     char* tok = strtok_r(tmp,
",",&save) ;
 
  207       char* 
sep = strchr(tok,
'=') ;
 
  210    Int_t id = atoi(sep+1) ;
 
  216       tok = strtok_r(0,
",",&save) ;
 
  242     coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR class " << className << 
" not found in factory alias table, nor in ROOT class table" << endl ;
 
  251     coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR class " << className << 
" does not inherit from RooAbsArg" << endl ;
 
  267     if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
 
  268     if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
 
  271     if (*p==
'"' || *p==
'\'') litmode = !litmode ;
 
  276     if (!litmode && blevel==0 && ((*p)==
',')) {
 
  278       _args.push_back(tok) ;
 
  284   _args.push_back(tok) ;
 
  289   if (ca.first.size()==0) {
 
  290     coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR no suitable constructor found for class " << className << endl ;
 
  297   if (
_args.size()+2<ca.second || 
_args.size()+2>ca.first.size()) {
 
  298     if (ca.second==ca.first.size()) {
 
  299       coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" << 
_args.size() << 
") for class is invalid, " << className 
 
  300              << 
" expects " << ca.first.size()-2 << endl ;
 
  303       coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR number of arguments provided (" << 
_args.size() << 
") for class is invalid " << className 
 
  304              << 
" expect number between " << ca.second-2 << 
" and " << ca.first.size()-2 << endl ;
 
  311   string cintExpr(
Form(
"new %s(\"%s\",\"%s\"",className,objName,objName)) ;
 
  319     list<string>::iterator ti = ca.first.begin() ; ti++ ; ti++ ;
 
  320     for (vector<string>::iterator ai = 
_args.begin() ; ai != 
_args.end() ; ai++,ti++,i++) {
 
  321       if ((*ti)==
"RooAbsReal&" || (*ti)==
"const RooAbsReal&") {
 
  323    cintExpr += 
Form(
",RooFactoryWSTool::as_FUNC(%d)",i) ;
 
  324       } 
else if ((*ti)==
"RooAbsArg&" || (*ti)==
"const RooAbsArg&") {
 
  326    cintExpr += 
Form(
",RooFactoryWSTool::as_ARG(%d)",i) ;
 
  327       } 
else if ((*ti)==
"RooRealVar&" || (*ti)==
"const RooRealVar&") {
 
  329    cintExpr += 
Form(
",RooFactoryWSTool::as_VAR(%d)",i) ;
 
  330       } 
else if ((*ti)==
"RooAbsRealLValue&" || (*ti)==
"const RooAbsRealLValue&") {
 
  332    cintExpr += 
Form(
",RooFactoryWSTool::as_VARLV(%d)",i) ;
 
  333       } 
else if ((*ti)==
"RooCategory&" || (*ti)==
"const RooCategory&") {
 
  335    cintExpr += 
Form(
",RooFactoryWSTool::as_CAT(%d)",i) ;
 
  336       } 
else if ((*ti)==
"RooAbsCategory&" || (*ti)==
"const RooAbsCategory&") {
 
  338    cintExpr += 
Form(
",RooFactoryWSTool::as_CATFUNC(%d)",i) ;
 
  339       } 
else if ((*ti)==
"RooAbsCategoryLValue&" || (*ti)==
"const RooAbsCategoryLValue&") {
 
  341    cintExpr += 
Form(
",RooFactoryWSTool::as_CATLV(%d)",i) ;
 
  342       } 
else if ((*ti)==
"RooAbsPdf&" || (*ti)==
"const RooAbsPdf&") {
 
  344    cintExpr += 
Form(
",RooFactoryWSTool::as_PDF(%d)",i) ;
 
  345       } 
else if ((*ti)==
"RooResolutionModel&" || (*ti)==
"const RooResolutionModel&") {
 
  347    cintExpr += 
Form(
",RooFactoryWSTool::as_RMODEL(%d)",i) ;
 
  348       } 
else if ((*ti)==
"RooAbsData&" || (*ti)==
"const RooAbsData&") {
 
  350    cintExpr += 
Form(
",RooFactoryWSTool::as_DATA(%d)",i) ;
 
  351       } 
else if ((*ti)==
"RooDataSet&" || (*ti)==
"const RooDataSet&") {
 
  353    cintExpr += 
Form(
",RooFactoryWSTool::as_DSET(%d)",i) ;
 
  354       } 
else if ((*ti)==
"RooDataHist&" || (*ti)==
"const RooDataHist&") {
 
  356    cintExpr += 
Form(
",RooFactoryWSTool::as_DHIST(%d)",i) ;
 
  357       } 
else if ((*ti)==
"const RooArgSet&") {
 
  359    cintExpr += 
Form(
",RooFactoryWSTool::as_SET(%d)",i) ;
 
  360       } 
else if ((*ti)==
"const RooArgList&") {
 
  362    cintExpr += 
Form(
",RooFactoryWSTool::as_LIST(%d)",i) ;
 
  363       } 
else if ((*ti)==
"const char*") {
 
  365    cintExpr += 
Form(
",RooFactoryWSTool::as_STRING(%d)",i) ; 
 
  366       } 
else if ((*ti)==
"Int_t" || (*ti)==
"int" || (*ti)==
"Bool_t" || (*ti)==
"bool") {
 
  368    cintExpr += 
Form(
",RooFactoryWSTool::as_INT(%d)",i) ; 
 
  369       } 
else if ((*ti)==
"Double_t") {
 
  371    cintExpr += 
Form(
",RooFactoryWSTool::as_DOUBLE(%d)",i) ; 
 
  375    if (
_args[i].find(
Form(
"%s::",className)) != string::npos) {          
 
  376      qualvalue = 
_args[i].c_str() ;
 
  378      qualvalue =  
Form(
"%s::%s",className,
_args[i].c_str()) ;      
 
  381      cintExpr += 
Form(
",(%s)%s",ti->c_str(),qualvalue.c_str()) ;
 
  383      throw string(
Form(
"Supplied argument %s does not represent a valid state of enum %s",
_args[i].c_str(),ti->c_str())) ;
 
  391    if (ti->find(
"const ")==0) {
 
  392      btype = ti->c_str()+6 ;
 
  396    if (btype.find(
"&")) {
 
  397      btype.erase(btype.size()-1,btype.size()) ;
 
  404      cintExpr += 
Form(
",(%s&)RooFactoryWSTool::as_OBJ(%d)",ti->c_str(),i) ;
 
  406      throw string(
Form(
"Required argument with name %s of type '%s' is not in the workspace",
_args[i].c_str(),ti->c_str())) ;
 
  411   } 
catch (
string err) {
 
  412     coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR constructing " << className << 
"::" << objName << 
": " << err << endl ;
 
  417   cxcoutD(
ObjectHandling) << 
"RooFactoryWSTool::createArg() Construct expression is " << cintExpr << endl ;
 
  423     if (
string(className)==
"RooGenericPdf") {
 
  425     } 
else if (
string(className)==
"RooFormulaVar") {
 
  435     coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR in CINT constructor call to create object" << endl ;
 
  447   return vector<string>() ;
 
  468     char* tok = strtok_r(buf,
",",&save) ;
 
  470       char* star=strchr(tok,
'*') ;
 
  478       tok = strtok_r(0,
",",&save) ;
 
  480     pdfList.
add(pdfList2) ;
 
  482   } 
catch (
string err) {
 
  483     coutE(
ObjectHandling) << 
"RooFactoryWSTool::add(" << objName << 
") ERROR creating RooAddPdf: " << err << endl ;    
 
  510     char* tok = strtok_r(buf,
",",&save) ;
 
  512       char* star=strchr(tok,
'*') ;
 
  520       tok = strtok_r(0,
",",&save) ;
 
  522     amplList.
add(amplList2) ;
 
  524   } 
catch (
string err) {
 
  525     coutE(
ObjectHandling) << 
"RooFactoryWSTool::add(" << objName << 
") ERROR creating RooRealSumPdf: " << err << endl ;    
 
  545   string regPdfList=
"{" ;
 
  549   char* tok = strtok_r(buf,
",",&save) ;
 
  551     char *
sep = strchr(tok,
'|') ;
 
  566       } 
catch (
string err) {
 
  567    coutE(
ObjectHandling) << 
"RooFactoryWSTool::prod(" << objName << 
") ERROR creating RooProdPdf Conditional argument: " << err << endl ;
 
  574       if (regPdfList.size()>1) {
 
  579     tok = strtok_r(0,
",",&save) ;
 
  585     pdf = 
new RooProdPdf(objName,objName,
asSET(regPdfList.c_str()),cmdList) ;
 
  586   } 
catch (
string err) {
 
  587     coutE(
ObjectHandling) << 
"RooFactoryWSTool::prod(" << objName << 
") ERROR creating RooProdPdf input set of regular p.d.f.s: " << err << endl ;
 
  609   map<string,RooAbsPdf*> theMap ;
 
  614   char* tok = strtok_r(buf,
",",&save) ;
 
  616     char* eq = strchr(tok,
'=') ;
 
  618       coutE(
ObjectHandling) << 
"RooFactoryWSTool::simul(" << objName << 
") ERROR creating RooSimultaneous::" << objName 
 
  619              << 
" expect mapping token of form 'state=pdfName', but found '" << tok << 
"'" << endl ;
 
  626    theMap[tok] = &
asPDF(eq+1) ;
 
  627       } 
catch ( 
string err ) {
 
  628    coutE(
ObjectHandling) << 
"RooFactoryWSTool::simul(" << objName << 
") ERROR creating RooSimultaneous: " << err << endl ;
 
  632     tok = strtok_r(0,
",",&save) ;
 
  640   } 
catch (
string err) {
 
  641     coutE(
ObjectHandling) << 
"RooFactoryWSTool::simul(" << objName << 
") ERROR creating RooSimultaneous::" << objName << 
" " << err << endl ;
 
  666     char* tok = strtok_r(buf,
",",&save) ;
 
  668       char* star=strchr(tok,
'*') ;
 
  676       tok = strtok_r(0,
",",&save) ;
 
  679   } 
catch (
string err) {
 
  680     coutE(
ObjectHandling) << 
"RooFactoryWSTool::addfunc(" << objName << 
") ERROR creating RooAddition: " << err << endl ;
 
  686     coutE(
ObjectHandling) << 
"RooFactoryWSTool::addfunc(" << objName << 
") ERROR creating RooAddition: syntax error: either all sum terms must be products or none" << endl ;
 
  694     sum = 
new RooAddition(objName,objName,sumlist1,sumlist2) ;
 
  835   char* buf = 
new char[strlen(expr)+1] ;
 
  840     if (!isspace(*expr)) {
 
  857   } 
catch (
string error) {
 
  858     coutE(
ObjectHandling) << 
"RooFactoryWSTool::processExpression() ERROR in parsing: " << error << endl ;
 
  864     coutE(
ObjectHandling) << 
"RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed" << endl ;
 
  874   return out.size() ? 
ws().
arg(out.c_str()) : 0 ;
 
  893   if (
string(token).find(
"$Alias(")==0) {
 
  919    const size_t bufBaseSize = strlen(token)+1;
 
  920   char* buf_base = 
new char[bufBaseSize] ;
 
  921   char* buf = buf_base ;
 
  922   strlcpy(buf,token,bufBaseSize) ;
 
  925   list<string> singleExpr ;
 
  932     if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
 
  933     if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
 
  936     if (*p==
'"' || *p==
'\'') litmode = !litmode ;
 
  940     if (!litmode && blevel==0 && ( (*p)==
'=' || (*p) == 
'|' || (*p) == 
'*')) {
 
  941       separator.push_back(*p) ;
 
  943       singleExpr.push_back(buf) ;
 
  949     singleExpr.push_back(buf) ;
 
  951   if (singleExpr.size()==1) {    
 
  958   list<char>::iterator ic = separator.begin() ;
 
  959   for (list<string>::iterator ii = singleExpr.begin() ; ii!=singleExpr.end() ; ii++) {
 
  961     if (ic != separator.end()) {
 
  984   if (strlen(arg)==0) {
 
  989   if (arg[0]==
'\'' || arg[0]==
'"') {
 
  994   const size_t bufSize = strlen(arg)+1;
 
  995   char* buf = 
new char[bufSize] ;
 
  996   strlcpy(buf,arg,bufSize) ;
 
 1000   vector<string> args ;
 
 1004   char* tmpx = strtok_r(buf,
"([",&save) ;
 
 1005   func = tmpx ? tmpx : 
"" ;
 
 1006   char* p = strtok_r(0,
"",&save) ;
 
 1021     if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
 
 1022     if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
 
 1025     if (*p==
'"' || *p==
'\'') litmode = !litmode ;
 
 1031     if (!litmode && blevel==0 && ((*p)==
',')) {
 
 1033       args.push_back(tok) ;
 
 1042   if (p>bufptr && (*(p-1)==
')'||*(p-1)==
']')) {
 
 1051   p = strtok_r(0,
"",&save) ;
 
 1053   args.push_back(tmp) ;
 
 1064   for(
const char* pp=arg ; *pp!=0 ; pp++) {
 
 1065     if (*pp==
'(' || *pp==
'[' || *pp==
'{') {
 
 1071   if (strstr(func.c_str(),
"::")) {
 
 1076       coutE(
ObjectHandling) << 
"RooFactoryWSTool::processSingleExpression(" << arg << 
"): ERROR: Syntax error: Class::Instance must be followed by (...)" << endl ;
 
 1079   } 
else if (func[0]!=
'$'){    
 
 1083     } 
else if (lb==
'(') {
 
 1093    static Int_t globCounter = 0 ;
 
 1095      autoname = 
Form(
"gobj%d",globCounter) ;
 
 1097      if (!
ws().arg(autoname.c_str())) {
 
 1101    autoname = 
Form(
"%s::%s",func.c_str(),autoname.c_str()) ;
 
 1105       coutE(
ObjectHandling) << 
"RooFactoryWSTool::processSingleExpression(" << arg << 
"): ERROR: Syntax error: expect either Class(...) or Instance[...]" << endl ;
 
 1113       coutE(
ObjectHandling) << 
"RooFactoryWSTool::processSingleExpression(" << arg << 
"): ERROR: Syntax error: $MetaClass must be followed by (...)" << endl ;
 
 1133   const size_t bufSize = strlen(arg)+1;
 
 1134   char* buf = 
new char[bufSize] ;
 
 1135   strlcpy(buf,arg,bufSize) ;
 
 1137   vector<string> args ;
 
 1148     if (*p==
'{' || *p==
'(' || *p==
'[') level++ ;
 
 1149     if (*p==
'}' || *p==
')' || *p==
']') level-- ;
 
 1155     if (level==0 && ((*p)==
',')) {
 
 1157       args.push_back(tok) ;
 
 1165   if (p>buf && *(p-1)==
'}') {
 
 1168   args.push_back(tok) ;
 
 1176   vector<string>::iterator 
iter = args.begin() ;
 
 1178   while(iter!= args.end()) {
 
 1179     if (strlen(ret.c_str())>1) ret += 
"," ;
 
 1203   if (args.size()!=2) {
 
 1204     coutE(
ObjectHandling) << 
"RooFactorWSTool::processAliasExpression() ERROR $Alias() takes exactly two arguments, " << args.size() << 
" args found" << endl ;
 
 1224     map<string,string>::iterator item = 
_typeAliases.find(className) ;
 
 1228       className = item->second.c_str() ;
 
 1241       coutE(
ObjectHandling) << 
"RooFactoryWSTool::createArg() ERROR class " << className << 
" not defined in ROOT class table" << endl ;
 
 1258   for (vector<string>::iterator 
iter = args.begin() ; 
iter!=args.end() ; ++
iter) {
 
 1259     if (
iter!=args.begin()) {
 
 1286   string first = *(args.begin()) ;
 
 1287   if (isdigit(first[0]) || first[0]==
'.' || first[0]==
'+' || first[0]==
'-') {
 
 1290     vector<string>::iterator ai = args.begin() ;
 
 1291     if (args.size()==1) {
 
 1294       Double_t xinit = atof((ai)->c_str()) ;
 
 1296       RooRealVar tmp(func.c_str(),func.c_str(),xinit) ;
 
 1302     } 
else if (args.size()==2) {
 
 1305       Double_t xlo = atof((ai++)->c_str()) ;
 
 1307       cxcoutD(
ObjectHandling) << 
"CREATE variable " << func << 
" xlo = " << xlo << 
" xhi = " << xhi << endl ;
 
 1308       RooRealVar tmp(func.c_str(),func.c_str(),xlo,xhi) ;
 
 1314     } 
else if (args.size()==3) {
 
 1317       Double_t xinit = atof((ai++)->c_str()) ;
 
 1318       Double_t xlo = atof((ai++)->c_str()) ;
 
 1320       cxcoutD(
ObjectHandling) << 
"CREATE variable " << func << 
" xinit = " << xinit << 
" xlo = " << xlo << 
" xhi = " << xhi << endl ;
 
 1321       RooRealVar tmp(func.c_str(),func.c_str(),xinit,xlo,xhi) ;
 
 1331     for (vector<string>::iterator ai = args.begin() ; ai!=args.end() ; ai++) {
 
 1332       if (allStates.size()>0) {
 
 1360   const char *className = strtok_r(buf,
":",&save) ;
 
 1361   const char *instName = strtok_r(0,
":",&save) ;
 
 1362   if (!className) className = 
"";
 
 1363   if (!instName) instName = 
"" ;
 
 1368   vector<string>::iterator 
iter = args.begin() ;
 
 1369   vector<string> pargv ;
 
 1371   while(iter!=args.end()) {
 
 1372     if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
 
 1377     pargv.push_back(tmp) ;
 
 1383   for (map<string,IFace*>::iterator ii=
hooks().begin() ; ii!=
hooks().end() ; ii++) {
 
 1385   if (
hooks().find(className) != 
hooks().end()) {
 
 1387     return iface->
create(*
this, className,instName,pargv) ;
 
 1392   return string(instName) ;
 
 1404   vector<string>::iterator 
iter = args.begin() ;
 
 1405   vector<string> pargv ;
 
 1406   while(iter!=args.end()) {
 
 1407     if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
 
 1410     pargv.push_back(tmp) ;
 
 1414   string ret = func+
"("+pargs+
")" ;  
 
 1426   const size_t bufSize = strlen(funcExpr)+1;
 
 1427   char* buf = 
new char[bufSize] ;
 
 1428   strlcpy(buf,funcExpr,bufSize) ;
 
 1429   char* bufptr = buf ;
 
 1432   vector<string> args ;
 
 1436   char* tmpx = strtok_r(buf,
"(",&save) ;  
 
 1437   func = tmpx ? tmpx : 
"" ;
 
 1438   char* p = strtok_r(0,
"",&save) ;
 
 1452     if (*p==
'{' || *p==
'(' || *p==
'[') blevel++ ;
 
 1453     if (*p==
'}' || *p==
')' || *p==
']') blevel-- ;
 
 1456     if (*p==
'"' || *p==
'\'') litmode = !litmode ;
 
 1462     if (!litmode && blevel==0 && ((*p)==
',')) {
 
 1464       args.push_back(tok) ;
 
 1473   if (p>bufptr && *(p-1)==
')') {
 
 1482   p = strtok_r(0,
"",&save) ;
 
 1484   args.push_back(tmp) ;
 
 1503   Int_t nParentheses(0), nBracket(0), nAccolade(0) ;
 
 1504   const char* ptr = arg ;
 
 1506     if (*ptr==
'(') nParentheses++ ;
 
 1507     if (*ptr==
')') nParentheses-- ;
 
 1508     if (*ptr==
'[') nBracket++ ;
 
 1509     if (*ptr==
']') nBracket-- ;
 
 1510     if (*ptr==
'{') nAccolade++ ;
 
 1511     if (*ptr==
'}') nAccolade-- ;
 
 1514   if (nParentheses!=0) {
 
 1515     coutE(
ObjectHandling) << 
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nParentheses>0?
"(":
")") << 
"' in expression" << endl ;
 
 1519     coutE(
ObjectHandling) << 
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nBracket>0?
"[":
"]") << 
"' in expression" << endl ;
 
 1523     coutE(
ObjectHandling) << 
"RooFactoryWSTool::checkSyntax ERROR non-matching '" << (nAccolade>0?
"{":
"}") << 
"' in expression" << endl ;
 
 1536     throw string(
Form(
"Need argument number %d, but only %d args are provided",idx,(
Int_t)
_of->
_args.size())) ;
 
 1548   if (arg[0]==
'.' || arg[0]==
'+' || arg[0] == 
'-' || isdigit(arg[0])) {
 
 1555     throw string(
Form(
"RooAbsArg named %s not found",arg)) ;
 
 1568   if (arg[0]==
'.' || arg[0]==
'+' || arg[0] == 
'-' || isdigit(arg[0])) {
 
 1574     throw string(
Form(
"RooAbsReal named %s not found",arg)) ;
 
 1578     throw string(
Form(
"Object named %s is not of type RooAbsReal",arg)) ;
 
 1591   if (arg[0]==
'.' || arg[0]==
'+' || arg[0] == 
'-' || isdigit(arg[0])) {
 
 1592     throw string(
Form(
"Numeric literal provided for argument (%s), but lvalue is required",arg)) ;
 
 1597     throw string(
Form(
"RooAbsRealLValue named %s not found",arg)) ;
 
 1601     throw string(
Form(
"Object named %s is not of type RooAbsRealLValue",arg)) ;
 
 1615     throw string(
Form(
"RooRealVar named %s not found",arg)) ;
 
 1630     throw string(
Form(
"RooAbsPdf named %s not found",arg)) ;
 
 1645     throw string(
Form(
"RooResolutionModel named %s not found",arg)) ;
 
 1649     throw string(
Form(
"Object named %s is not of type RooResolutionModel",arg)) ;
 
 1664     throw string(
Form(
"RooAbsCategory named %s not found",arg)) ;
 
 1668     throw string(
Form(
"Object named %s is not of type RooAbsCategory",arg)) ;
 
 1682     throw string(
Form(
"RooAbsCategoryLValue named %s not found",arg)) ;
 
 1687     throw string(
Form(
"Object named %s is not of type RooAbsCategoryLValue",arg)) ;
 
 1701     throw string(
Form(
"RooCategory named %s not found",arg)) ;
 
 1732   char* tok = strtok_r(tmp,
",{}",&save) ;
 
 1736     if (tok[0]==
'.' || tok[0]==
'+' || tok[0] == 
'-' || isdigit(tok[0])) {
 
 1743    throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
 
 1746     tok = strtok_r(0,
",{}",&save) ;
 
 1764   char* tok = strtok_r(tmp,
",{}",&save) ;
 
 1768     if (tok[0]==
'.' || tok[0]==
'+' || tok[0] == 
'-' || isdigit(tok[0])) {
 
 1775    throw string(
Form(
"RooAbsArg named %s not found",tok)) ;
 
 1778     tok = strtok_r(0,
",{}",&save) ;
 
 1793       throw string(
Form(
"RooAbsData named %s not found",arg)) ;    
 
 1807     throw string(
Form(
"RooAbsData named %s not found",arg)) ;    
 
 1811     throw string(
Form(
"Dataset named %s is not of type RooDataHist",arg)) ;    
 
 1824     throw string(
Form(
"RooAbsData named %s not found",arg)) ;    
 
 1828     throw string(
Form(
"Dataset named %s is not of type RooDataSet",arg)) ;    
 
 1841     throw string(
Form(
"Object named %s not found",arg)) ;    
 
 1853   static vector<string> cbuf(10) ;
 
 1854   static unsigned int cbuf_idx = 0 ;
 
 1857   if (arg==0 || strlen(arg)==0) {
 
 1863   cbuf[cbuf_idx].clear() ;
 
 1864   const char* p = arg+1 ;
 
 1865   while(*p && (*p) != 
'"' && (*p) !=
'\'' ) {
 
 1866     cbuf[cbuf_idx] += *(p++) ;
 
 1868   const char* ret = cbuf[cbuf_idx].c_str() ;
 
 1872   if (cbuf_idx==cbuf.size()) cbuf_idx=0 ;
 
 1901   hooks()[typeName] = iface ;
 
 1911   _hooks = 
new map<string,IFace*> ;
 
 1924   vector<string>::iterator 
iter = args.begin() ;
 
 1925   vector<string> pargv ;
 
 1926   while(iter!=args.end()) {
 
 1927     if (strlen(pargs)>0) strlcat(pargs,
",",
BUFFER_SIZE) ;
 
 1930     pargv.push_back(tmp) ;
 
 1935   string cl(typeName) ;
 
 1941   } 
else if (cl==
"RSUM") {
 
 1946   } 
else if (cl==
"ASUM") {
 
 1951   } 
else if (cl==
"PROD") {
 
 1954     ft.
prod(instName,pargs) ;
 
 1956   } 
else if (cl==
"SIMUL") {
 
 1959     if (pargv.size()>1) {
 
 1960       ft.
simul(instName,pargv[0].c_str(),strchr(pargs,
',')+1) ;
 
 1962       throw string(
Form(
"Need at least two arguments in call to SIMUL::%s, have %d: %s",instName,(
Int_t)pargv.size(),pargs)) ;
 
 1965   } 
else if (cl==
"EXPR") {
 
 1968     if (args.size()<=2) {
 
 1969       ft.
createArg(
"RooGenericPdf",instName,pargs) ;
 
 1974       for (
UInt_t i=1 ; i<args.size() ; i++) {
 
 1979       ft.
createArg(
"RooGenericPdf",instName,genargs) ;
 
 1982   } 
else if (cl==
"FCONV") {
 
 1985     ft.
createArg(
"RooFFTConvPdf",instName,pargs) ;
 
 1987   } 
else if (cl==
"NCONV") {
 
 1990     ft.
createArg(
"RooNumConvPdf",instName,pargs) ;
 
 1992   } 
else if (cl==
"sum") {
 
 1997   } 
else if (cl==
"prod") {
 
 2002   } 
else if (cl==
"expr") {
 
 2005     if (args.size()<=2) {
 
 2006       ft.
createArg(
"RooFormulaVar",instName,pargs) ;
 
 2011       for (
UInt_t i=1 ; i<args.size() ; i++) {
 
 2016       ft.
createArg(
"RooFormulaVar",instName,genargs) ;
 
 2019   } 
else if (cl==
"nconv") {
 
 2022     ft.
createArg(
"RooNumConvolution",instName,pargs) ;
 
 2024   } 
else if (cl==
"nll") {
 
 2030   } 
else if (cl==
"chi2") {
 
 2036   } 
else if (cl==
"profile") {
 
 2039     ft.
createArg(
"RooProfileLL",instName,pargs) ;
 
 2041   } 
else if (cl==
"dataobs") {
 
 2051   } 
else if (cl==
"int") {    
 
 2058     if (pargv.size()<2 || pargv.size()>3) {
 
 2059       throw string(
Form(
"int::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
 
 2065     strlcpy(buf,pargv[1].c_str(),256) ;
 
 2067     const char* intobs = strtok_r(buf,
"|",&save) ;
 
 2068     if (!intobs) intobs=
"" ;
 
 2070     const char* range = strtok_r(0,
"",&save) ;
 
 2071     if (!range) range=
"" ;
 
 2074     if (pargv.size()==2) {
 
 2075       if (range && strlen(range)) {
 
 2081       if (range && strlen(range)) {
 
 2091   } 
else if (cl==
"deriv") {
 
 2095     if (pargv.size()<2 || pargv.size()>3) {
 
 2096       throw string(
Form(
"deriv::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
 
 2102     if (pargv.size()==2) {
 
 2108     derivative->
SetName(instName) ;
 
 2111   } 
else if (cl==
"cdf") {
 
 2115     if (pargv.size()<2 || pargv.size()>3) {
 
 2116       throw string(
Form(
"cdf::%s, requires 2 or 3 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
 
 2122     if (pargv.size()==2) {
 
 2132   } 
else if (cl==
"PROJ") {
 
 2135     if (pargv.size()!=2) {
 
 2136       throw string(
Form(
"PROJ::%s, requires 2 arguments, have %d arguments",instName,(
Int_t)pargv.size())) ;
 
 2141     projection->
SetName(instName) ;
 
 2145   } 
else if (cl==
"set") {
 
 2150       return string(instName) ;
 
 2155     throw string(
Form(
"RooFactoryWSTool::SpecialsIFace::create() ERROR: Unknown meta-type %s",typeName)) ;
 
 2158   return string(instName) ;    
 
virtual TObject * clone(const char *newname=0) const =0
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)
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)
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)
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. 
std::map< std::string, std::string >::const_iterator iter
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. 
std::string trueName(const char *typeDefName)
virtual void Add(TObject *arg)
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)
Change (i.e. 
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. 
RooCategory * cat(const char *name) const 
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found...
RooRealVar * var(const char *name) const 
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
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)
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. 
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". 
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...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set. 
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 ...