12 #if __cplusplus >= 201103L 13 #define ROOT_CPLUSPLUS11 1 30 #include <unordered_map> 44 #pragma optimize("",off) 158 static std::unordered_map<std::string, void *>
gClingFunctions = std::unordered_map<std::string, void * >();
164 char ops[] = {
'+',
'^',
'-',
'/',
'*',
'<',
'>',
'|',
'&',
'!',
'=',
'?'};
165 Int_t opsLen =
sizeof(ops)/
sizeof(
char);
166 for(
Int_t i = 0; i < opsLen; ++i)
176 char brackets[] = {
')',
'(',
'{',
'}'};
177 Int_t bracketsLen =
sizeof(brackets)/
sizeof(
char);
178 for(
Int_t i = 0; i < bracketsLen; ++i)
187 return !IsBracket(c) && !IsOperator(c) && c !=
',' && c !=
' ';
193 return name ==
"x" || name ==
"z" || name ==
"y" || name ==
"t";
200 if ( (formula[i] ==
'e' || formula[i] ==
'E') && (i > 0 && i < formula.Length()-1) ) {
202 if ( (isdigit(formula[i-1]) || formula[i-1] ==
'.') && ( isdigit(formula[i+1]) || formula[i+1] ==
'+' || formula[i+1] ==
'-' ) )
212 if ( (formula[i] ==
'x' || formula[i] ==
'X') && (i > 0 && i < formula.Length()-1) && formula[i-1] ==
'0') {
213 if (isdigit(formula[i+1]) )
215 static char hex_values[12] = {
'a',
'A',
'b',
'B',
'c',
'C',
'd',
'D',
'e',
'E',
'f',
'F'};
216 for (
int jjj = 0; jjj < 12; ++jjj) {
217 if (formula[i+1] == hex_values[jjj])
234 Bool_t foundOpenParenthesis =
false;
235 if (pos == 0 || pos == formula.Length()-1)
return false;
236 for (
int i = pos-1; i >=0; i--) {
237 if (formula[i] ==
']' )
return false;
238 if (formula[i] ==
'[' ) {
239 foundOpenParenthesis =
true;
243 if (!foundOpenParenthesis )
return false;
246 for (
int i = pos+1; i < formula.Length(); i++) {
247 if (formula[i] ==
']' )
return true;
260 TRegexp numericPattern(
"p?[0-9]+");
263 int patternStart = numericPattern.
Index(a, len);
264 bool aNumeric = (patternStart == 0 && *len == a.Length());
266 patternStart = numericPattern.
Index(b, len);
267 bool bNumeric = (patternStart == 0 && *len == b.Length());
271 if (aNumeric && !bNumeric)
273 else if (!aNumeric && bNumeric)
275 else if (!aNumeric && !bNumeric)
278 int aInt = (a[0] ==
'p') ? TString(
a(1, a.Length())).Atoi() : a.Atoi();
279 int bInt = (b[0] ==
'p') ? TString(
b(1, b.Length())).Atoi() : b.Atoi();
290 for (
int i = 0; i < formula.Length(); i++) {
293 if (isalpha(formula[i]) || formula[i] ==
'{' || formula[i] ==
'[') {
296 j < formula.Length() && (IsFunctionNameChar(formula[j])
297 || (formula[i] ==
'{' && formula[j] ==
'}'));
300 TString
name = (TString)formula(i, j - i);
305 if (substitutions.find(name) != substitutions.end()) {
306 formula.Replace(i, name.Length(),
"(" + substitutions[
name] +
")");
307 i += substitutions[
name].Length() + 2 - 1;
309 }
else if (isalpha(formula[i])) {
312 i += name.Length() - 1;
324 fReadyToExecute =
false;
325 fClingInitialized =
false;
326 fAllParametersSetted =
false;
333 fLambdaPtr =
nullptr;
338 if (strlen(name)!=1)
return false;
339 for (
auto const & specialName : {
"x",
"y",
"z",
"t"}){
340 if (strcmp(name,specialName)==0)
return true;
353 gROOT->GetListOfFunctions()->Remove(
this);
359 int nLinParts = fLinearParts.size();
361 for (
int i = 0; i < nLinParts; ++i)
delete fLinearParts[i];
368 fClingInput(formula),fFormula(formula)
379 #ifndef R__HAS_VECCORE 386 if (addToGlobList &&
gROOT) {
389 old =
dynamic_cast<TFormula*
> (
gROOT->GetListOfFunctions()->FindObject(name) );
391 gROOT->GetListOfFunctions()->Remove(old);
393 Error(
"TFormula",
"The name %s is reserved as a TFormula variable name.\n",name);
395 gROOT->GetListOfFunctions()->Add(
this);
427 for (
int i = 0; i < npar; ++i) {
431 assert (
fNpar == npar);
441 if (addToGlobList &&
gROOT) {
444 old =
dynamic_cast<TFormula*
> (
gROOT->GetListOfFunctions()->FindObject(name) );
446 gROOT->GetListOfFunctions()->Remove(old);
448 Error(
"TFormula",
"The name %s is reserved as a TFormula variable name.\n",name);
450 gROOT->GetListOfFunctions()->Add(
this);
455 Error(
"TFormula",
"Syntax error in building the lambda expression %s", formula );
468 gROOT->GetListOfFunctions()->Remove(old);
471 Error(
"TFormula",
"The name %s is reserved as a TFormula variable name.\n",formula.
GetName());
473 gROOT->GetListOfFunctions()->Add(
this);
493 std::string lambdaExpression = formula;
499 auto funcit = gClingFunctions.find(lambdaExpression);
500 if (funcit != gClingFunctions.end() ) {
512 auto hasher = gClingFunctions.hash_function();
513 TString lambdaName =
TString::Format(
"lambda__id%zu", hasher(lambdaExpression) );
517 TString lineExpr =
TString::Format(
"std::function<double(double*,double*)> %s = %s ;",lambdaName.Data(), lambdaExpression.c_str() );
522 gClingFunctions.insert ( std::make_pair ( lambdaExpression,
fLambdaPtr) );
538 TString formula = expression;
539 if (formula.IsNull() ) {
541 if (formula.IsNull() ) formula =
GetTitle();
544 if (formula.IsNull() )
return -1;
556 return (ret) ? 0 : 1;
566 return (ret) ? 0 : 1;
595 for (
int i = 0; i < nLinParts; ++i)
delete fnew.
fLinearParts[i];
602 for (
int i = 0; i < nLinParts; ++i) {
606 linearOld->
Copy(*linearNew);
629 Error(
"TFormula",
"Syntax error in building the lambda expression %s",
fFormula.Data() );
674 for (
int i = 0; i < nLinParts; ++i)
delete fLinearParts[i];
692 TString prototypeArguments =
"";
693 if (hasVariables || hasParameters) {
695 prototypeArguments.Append(
"ROOT::Double_v*");
697 prototypeArguments.Append(
"Double_t*");
700 prototypeArguments.Append(
",");
703 prototypeArguments.Append(
"Double_t*");
708 Error(
"Eval",
"Can't find %s function prototype with arguments %s",
fClingName.Data(),
709 prototypeArguments.Data());
759 const TString defvars[] = {
"x",
"y",
"z",
"t"};
760 const pair<TString, Double_t> defconsts[] = {{
"pi",
TMath::Pi()},
778 const pair<TString,TString> funShortcuts[] =
779 { {
"sin",
"TMath::Sin" },
780 {
"cos",
"TMath::Cos" }, {
"exp",
"TMath::Exp"}, {
"log",
"TMath::Log"}, {
"log10",
"TMath::Log10"},
781 {
"tan",
"TMath::Tan"}, {
"sinh",
"TMath::SinH"}, {
"cosh",
"TMath::CosH"},
782 {
"tanh",
"TMath::TanH"}, {
"asin",
"TMath::ASin"}, {
"acos",
"TMath::ACos"},
783 {
"atan",
"TMath::ATan"}, {
"atan2",
"TMath::ATan2"}, {
"sqrt",
"TMath::Sqrt"},
784 {
"ceil",
"TMath::Ceil"}, {
"floor",
"TMath::Floor"}, {
"pow",
"TMath::Power"},
785 {
"binomial",
"TMath::Binomial"},{
"abs",
"TMath::Abs"},
786 {
"min",
"TMath::Min"},{
"max",
"TMath::Max"},{
"sign",
"TMath::Sign" },
790 std::vector<TString> defvars2(10);
791 for (
int i = 0; i < 9; ++i)
794 for (
auto var : defvars) {
795 int pos =
fVars.size();
808 for (
auto con : defconsts) {
809 fConsts[con.first] = con.second;
814 for (
auto fun : funShortcuts) {
826 #ifdef R__HAS_VECCORE 827 const pair<TString,TString> vecFunShortcuts[] =
828 { {
"sin",
"vecCore::math::Sin" },
829 {
"cos",
"vecCore::math::Cos" }, {
"exp",
"vecCore::math::Exp"}, {
"log",
"vecCore::math::Log"}, {
"log10",
"vecCore::math::Log10"},
830 {
"tan",
"vecCore::math::Tan"},
832 {
"asin",
"vecCore::math::ASin"},
833 {
"acos",
"TMath::Pi()/2-vecCore::math::ASin"},
834 {
"atan",
"vecCore::math::ATan"},
835 {
"atan2",
"vecCore::math::ATan2"}, {
"sqrt",
"vecCore::math::Sqrt"},
836 {
"ceil",
"vecCore::math::Ceil"}, {
"floor",
"vecCore::math::Floor"}, {
"pow",
"vecCore::math::Pow"},
837 {
"cbrt",
"vecCore::math::Cbrt"},{
"abs",
"vecCore::math::Abs"},
838 {
"min",
"vecCore::math::Min"},{
"max",
"vecCore::math::Max"},{
"sign",
"vecCore::math::Sign" }
842 for (
auto fun : vecFunShortcuts) {
859 Int_t polPos = formula.Index(
"pol");
862 Bool_t defaultVariable =
false;
864 Int_t openingBracketPos = formula.Index(
'(', polPos);
865 Bool_t defaultCounter = openingBracketPos ==
kNPOS;
866 Bool_t defaultDegree =
true;
869 if (!defaultCounter) {
872 sdegree = formula(polPos + 3, openingBracketPos - polPos - 3);
873 if (!sdegree.IsDigit())
874 defaultCounter =
true;
876 if (!defaultCounter) {
877 degree = sdegree.Atoi();
878 counter = TString(formula(openingBracketPos + 1, formula.Index(
')', polPos) - openingBracketPos)).Atoi();
880 Int_t temp = polPos + 3;
881 while (temp < formula.Length() && isdigit(formula[temp])) {
882 defaultDegree =
false;
885 degree = TString(formula(polPos + 3, temp - polPos - 3)).Atoi();
890 if (polPos - 1 < 0 || !
IsFunctionNameChar(formula[polPos - 1]) || formula[polPos - 1] ==
':') {
892 defaultVariable =
true;
894 Int_t tmp = polPos - 1;
898 variable = formula(tmp + 1, polPos - (tmp + 1));
900 Int_t param = counter + 1;
902 while (tmp <= degree) {
904 replacement.Append(
TString::Format(
"+[%d]*%s^%d", param, variable.Data(), tmp));
906 replacement.Append(
TString::Format(
"+[%d]*%s", param, variable.Data()));
912 replacement.Insert(0,
'(');
913 replacement.Append(
')');
916 if (defaultCounter && !defaultDegree) {
917 pattern =
TString::Format(
"%spol%d", (defaultVariable ?
"" : variable.Data()), degree);
918 }
else if (defaultCounter && defaultDegree) {
919 pattern =
TString::Format(
"%spol", (defaultVariable ?
"" : variable.Data()));
921 pattern =
TString::Format(
"%spol%d(%d)", (defaultVariable ?
"" : variable.Data()), degree, counter);
924 if (!formula.Contains(pattern)) {
925 Error(
"HandlePolN",
"Error handling polynomial function - expression is %s - trying to replace %s with %s ",
926 formula.Data(), pattern.Data(), replacement.Data());
929 if (formula == pattern) {
934 formula.ReplaceAll(pattern, replacement);
935 polPos = formula.Index(
"pol");
961 map< pair<TString,Int_t> ,pair<TString,TString> > functions;
964 map<TString,Int_t> functionsNumbers;
965 functionsNumbers[
"gaus"] = 100;
966 functionsNumbers[
"bigaus"] = 102;
967 functionsNumbers[
"landau"] = 400;
968 functionsNumbers[
"expo"] = 200;
969 functionsNumbers[
"crystalball"] = 500;
972 formula.ReplaceAll(
"xygaus",
"gaus[x,y]");
973 formula.ReplaceAll(
"xgaus",
"gaus[x]");
974 formula.ReplaceAll(
"ygaus",
"gaus[y]");
975 formula.ReplaceAll(
"zgaus",
"gaus[z]");
976 formula.ReplaceAll(
"xexpo",
"expo[x]");
977 formula.ReplaceAll(
"yexpo",
"expo[y]");
978 formula.ReplaceAll(
"zexpo",
"expo[z]");
979 formula.ReplaceAll(
"xylandau",
"landau[x,y]");
980 formula.ReplaceAll(
"xyexpo",
"expo[x,y]");
982 const char * defaultVariableNames[] = {
"x",
"y",
"z"};
984 for (map<pair<TString, Int_t>, pair<TString, TString>>::iterator it = functions.begin(); it != functions.end();
987 TString funName = it->first.first;
988 Int_t funDim = it->first.second;
989 Int_t funPos = formula.Index(funName);
995 Int_t lastFunPos = funPos + funName.Length();
998 Int_t iposBefore = funPos - 1;
1001 if (iposBefore >= 0) {
1002 assert(iposBefore < formula.Length());
1003 if (isalpha(formula[iposBefore])) {
1006 funPos = formula.Index(funName, lastFunPos);
1011 Bool_t isNormalized =
false;
1012 if (lastFunPos < formula.Length()) {
1014 isNormalized = (formula[lastFunPos] ==
'n');
1017 if (lastFunPos < formula.Length()) {
1018 char c = formula[lastFunPos];
1021 if (isalnum(c) || (!
IsOperator(c) && c !=
'(' && c !=
')' && c !=
'[' && c !=
']')) {
1023 funPos = formula.Index(funName, lastFunPos);
1034 TString varList =
"";
1035 Bool_t defaultVariables =
false;
1038 Int_t openingBracketPos = funPos + funName.Length() + (isNormalized ? 1 : 0);
1040 if (openingBracketPos > formula.Length() || formula[openingBracketPos] !=
'[') {
1042 variables.resize(dim);
1043 for (
Int_t idim = 0; idim < dim; ++idim)
1044 variables[idim] = defaultVariableNames[idim];
1045 defaultVariables =
true;
1048 closingBracketPos = formula.Index(
']', openingBracketPos);
1049 varList = formula(openingBracketPos + 1, closingBracketPos - openingBracketPos - 1);
1050 dim = varList.CountChar(
',') + 1;
1051 variables.resize(dim);
1053 TString varName =
"";
1054 for (
Int_t i = 0; i < varList.Length(); ++i) {
1056 varName.Append(varList[i]);
1058 if (varList[i] ==
',') {
1059 variables[Nvar] = varName;
1066 variables[Nvar] = varName;
1071 if (dim != funDim) {
1072 pair<TString, Int_t> key = make_pair(funName, dim);
1073 if (functions.find(key) == functions.end()) {
1074 Error(
"PreProcessFormula",
"Dimension of function %s is detected to be of dimension %d and is not " 1075 "compatible with existing pre-defined function which has dim %d",
1076 funName.Data(), dim, funDim);
1080 funPos = formula.Index(funName, lastFunPos);
1085 Int_t openingParenthesisPos = (closingBracketPos ==
kNPOS) ? openingBracketPos : closingBracketPos + 1;
1086 bool defaultCounter = (openingParenthesisPos > formula.Length() || formula[openingParenthesisPos] !=
'(');
1091 if (defaultCounter) {
1097 TRegexp counterPattern(
"([0-9]+)");
1099 if (counterPattern.
Index(formula, len, openingParenthesisPos) == -1) {
1100 funPos = formula.Index(funName, funPos + 1);
1104 TString(formula(openingParenthesisPos + 1, formula.Index(
')', funPos) - openingParenthesisPos - 1))
1110 TString body = (isNormalized ? it->second.second : it->second.first);
1111 if (isNormalized && body ==
"") {
1112 Error(
"PreprocessFormula",
"%d dimension function %s has no normalized form.", it->first.second,
1116 for (
int i = 0; i < body.Length(); ++i) {
1117 if (body[i] ==
'{') {
1120 Int_t num = TString(body(i, body.Index(
'}', i) - i)).Atoi();
1121 TString variable = variables[num];
1124 body.Replace(i, pattern.Length(), variable, variable.Length());
1125 i += variable.Length() - 1;
1126 }
else if (body[i] ==
'[') {
1129 while (tmp < body.Length() && body[tmp] !=
']') {
1132 Int_t num = TString(body(i + 1, tmp - 1 - i)).Atoi();
1136 body.Replace(i + 1, tmp - 1 - i, replacement, replacement.Length());
1137 i += replacement.Length() + 1;
1141 if (defaultCounter && defaultVariables) {
1142 pattern =
TString::Format(
"%s%s", funName.Data(), (isNormalized ?
"n" :
""));
1144 if (!defaultCounter && defaultVariables) {
1145 pattern =
TString::Format(
"%s%s(%d)", funName.Data(), (isNormalized ?
"n" :
""), counter);
1147 if (defaultCounter && !defaultVariables) {
1148 pattern =
TString::Format(
"%s%s[%s]", funName.Data(), (isNormalized ?
"n" :
""), varList.Data());
1150 if (!defaultCounter && !defaultVariables) {
1152 TString::Format(
"%s%s[%s](%d)", funName.Data(), (isNormalized ?
"n" :
""), varList.Data(), counter);
1154 TString replacement = body;
1157 if (
fNumber == 0 && formula.Length() <= (pattern.Length() - funPos) + 1) {
1158 fNumber = functionsNumbers[funName] + 10 * (dim - 1);
1163 formula.Replace(funPos, pattern.Length(), replacement, replacement.Length());
1165 funPos = formula.Index(funName);
1175 TRegexp rangePattern(
"\\[[0-9]+\\.\\.[0-9]+\\]");
1178 while ((matchIdx = rangePattern.
Index(formula, len, matchIdx)) != -1) {
1179 int startIdx = matchIdx + 1;
1180 int endIdx = formula.Index(
"..", startIdx) + 2;
1181 int startCnt = TString(formula(startIdx, formula.Length())).Atoi();
1182 int endCnt = TString(formula(endIdx, formula.Length())).Atoi();
1184 if (endCnt <= startCnt)
1185 Error(
"HandleParamRanges",
"End parameter (%d) <= start parameter (%d) in parameter range", endCnt, startCnt);
1187 TString newString =
"[";
1188 for (
int cnt = startCnt;
cnt < endCnt;
cnt++)
1193 formula.Replace(matchIdx, formula.Index(
"]", matchIdx) + 1 - matchIdx, newString);
1195 matchIdx += newString.Length();
1209 std::map<std::pair<TString, Int_t>, std::pair<TString, TString>> parFunctions;
1213 for (
Int_t i = 0; i < formula.Length(); ++i) {
1217 if (formula[i] ==
'[') {
1218 while (formula[i] !=
']')
1223 if (formula[i] ==
'\"') {
1226 while (formula[i] !=
'\"');
1234 while (!
IsOperator(formula[i]) && i < formula.Length())
1240 if (isalpha(formula[i]) && !
IsOperator(formula[i])) {
1246 TString
name = (TString)formula(i, j - i);
1253 std::vector<int> argSeparators;
1254 argSeparators.push_back(j);
1256 for (k = j + 1; depth >= 1 && k < formula.Length(); k++) {
1257 if (formula[k] ==
',' && depth == 1) {
1259 argSeparators.push_back(k);
1260 }
else if (formula[k] ==
'(')
1262 else if (formula[k] ==
')')
1265 argSeparators.push_back(k - 1);
1271 obj =
gROOT->GetListOfFunctions()->FindObject(name);
1276 TF1 *
f1 =
dynamic_cast<TF1 *
>(obj);
1284 bool nameRecognized = (f != NULL);
1289 TString replacementFormula;
1297 for (
auto keyval : parFunctions) {
1299 pair<TString, Int_t> name_ndim = keyval.first;
1301 pair<TString, TString> formulaPair = keyval.second;
1304 if (name == name_ndim.first)
1305 replacementFormula = formulaPair.first;
1306 else if (name == name_ndim.first +
"n" && formulaPair.second !=
"")
1307 replacementFormula = formulaPair.second;
1312 ndim = name_ndim.second;
1317 while ((idx = replacementFormula.Index(
'[', idx)) !=
kNPOS) {
1318 npar = max(npar, 1 + TString(replacementFormula(idx + 1, replacementFormula.Length())).Atoi());
1319 idx = replacementFormula.Index(
']', idx);
1321 Error(
"HandleFunctionArguments",
"Square brackets not matching in formula %s",
1322 (
const char *)replacementFormula);
1329 if (nArguments == ndim + npar || nArguments == npar || nArguments == ndim) {
1330 nameRecognized =
true;
1335 if (nameRecognized && ndim > 4)
1336 Error(
"HandleFunctionArguments",
"Number of dimensions %d greater than 4. Cannot parse formula.", ndim);
1339 if (nameRecognized && j < formula.Length() && formula[j] ==
'(') {
1344 map<TString, TString> argSubstitutions;
1346 const char *defaultVariableNames[] = {
"x",
"y",
"z",
"t"};
1349 bool canReplace =
false;
1350 if (nArguments == ndim + npar) {
1352 for (
int argNr = 0; argNr < nArguments; argNr++) {
1356 TString(formula(argSeparators[argNr] + 1, argSeparators[argNr + 1] - argSeparators[argNr] - 1));
1363 argSubstitutions[oldName] = newName;
1366 argSubstitutions[defaultVariableNames[argNr]] = newName;
1369 int parNr = argNr - ndim;
1372 argSubstitutions[oldName] = newName;
1375 if (f && oldName == newName)
1381 }
else if (nArguments == npar) {
1386 bool varsImplicit =
true;
1387 for (
int argNr = 0; argNr < nArguments && varsImplicit; argNr++) {
1388 int openIdx = argSeparators[argNr] + 1;
1389 int closeIdx = argSeparators[argNr + 1] - 1;
1392 if (formula[openIdx] !=
'[' || formula[closeIdx] !=
']' || closeIdx <= openIdx + 1)
1393 varsImplicit =
false;
1396 for (
int idx = openIdx + 1; idx < closeIdx && varsImplicit; idx++)
1398 varsImplicit =
false;
1401 Warning(
"HandleFunctionArguments",
1402 "Argument %d is not a parameter. Cannot assume variables are implicit.", argNr);
1409 for (
int dim = 0; dim < ndim; dim++) {
1410 argSubstitutions[
TString::Format(
"{V%d}", dim)] = defaultVariableNames[dim];
1414 for (
int argNr = 0; argNr < nArguments; argNr++) {
1418 TString(formula(argSeparators[argNr] + 1, argSeparators[argNr + 1] - argSeparators[argNr] - 1));
1422 argSubstitutions[oldName] = newName;
1425 if (f && oldName == newName)
1432 if (!canReplace && nArguments == ndim) {
1436 for (
int argNr = 0; argNr < nArguments; argNr++) {
1439 TString(formula(argSeparators[argNr] + 1, argSeparators[argNr + 1] - argSeparators[argNr] - 1));
1443 argSubstitutions[oldName] = newName;
1446 argSubstitutions[defaultVariableNames[argNr]] = newName;
1451 for (
int parNr = 0; parNr < npar; parNr++)
1465 formula.Replace(i, k - i, replacementFormula);
1466 i += replacementFormula.Length() - 1;
1469 Warning(
"HandleFunctionArguments",
"Unable to make replacement. Number of parameters doesn't work : " 1470 "%d arguments, %d dimensions, %d parameters",
1471 nArguments, ndim, npar);
1490 Int_t caretPos = formula.Last(
'^');
1493 TString right, left;
1494 Int_t temp = caretPos;
1497 if (formula[temp] ==
')') {
1500 while (depth != 0 && temp > 0) {
1501 if (formula[temp] ==
')')
1503 if (formula[temp] ==
'(')
1518 assert(temp + 1 >= 0);
1519 Int_t leftPos = temp + 1;
1520 left = formula(leftPos, caretPos - leftPos);
1526 if (temp >= formula.Length()) {
1527 Error(
"HandleExponentiation",
"Invalid position of operator ^");
1530 if (formula[temp] ==
'(') {
1533 while (depth != 0 && temp < formula.Length()) {
1534 if (formula[temp] ==
')')
1536 if (formula[temp] ==
'(')
1543 if (formula[temp] ==
'-' || formula[temp] ==
'+')
1549 while (temp < formula.Length() && ((depth > 0) || !
IsOperator(formula[temp]))) {
1555 if (temp < formula.Length() && formula[temp] ==
'(')
1557 if (temp < formula.Length() && formula[temp] ==
')') {
1565 right = formula(caretPos + 1, (temp - 1) - caretPos);
1568 TString pattern =
TString::Format(
"%s^%s", left.Data(), right.Data());
1569 TString replacement =
TString::Format(
"pow(%s,%s)", left.Data(), right.Data());
1573 formula.Replace(leftPos, pattern.Length(), replacement, replacement.Length());
1575 caretPos = formula.Last(
'^');
1585 Int_t linPos = formula.Index(
"@");
1586 if (linPos ==
kNPOS )
return;
1587 Int_t nofLinParts = formula.CountChar((
int)
'@');
1588 assert(nofLinParts > 0);
1599 while (temp >= 0 && formula[temp] !=
'@') {
1602 left = formula(temp + 1, linPos - (temp + 1));
1605 while (temp < formula.Length() && formula[temp] !=
'@') {
1608 TString right = formula(linPos + 1, temp - (linPos + 1));
1612 TString replacement =
1613 (first) ?
TString::Format(
"([%d]*(%s))+([%d]*(%s))", Nlinear, left.Data(), Nlinear + 1, right.Data())
1615 Nlinear += (first) ? 2 : 1;
1617 formula.ReplaceAll(pattern, replacement);
1625 linPos = formula.Index(
"@");
1639 formula.ReplaceAll(
"**",
"^");
1640 formula.ReplaceAll(
"++",
"@");
1641 formula.ReplaceAll(
" ",
"");
1651 formula.ReplaceAll(
"--",
"- -");
1652 formula.ReplaceAll(
"++",
"+ +");
1705 for (
Int_t i = 0; i < formula.Length(); ++i) {
1709 if (formula[i] ==
'[') {
1713 while (i < formula.Length() && formula[i] !=
']') {
1714 param.Append(formula[i++]);
1719 int paramIndex = -1;
1720 if (param.IsDigit()) {
1721 paramIndex = param.Atoi();
1722 param.Insert(0,
'p');
1725 for (
int idx = 0; idx <= paramIndex; ++idx) {
1733 Int_t oldParamLength = param.Length();
1734 param.ReplaceAll(
"\\s",
" ");
1736 i -= param.Length() - oldParamLength;
1748 formula.Replace(tmp, i - tmp, replacement, replacement.Length());
1754 if (formula[i] ==
'\"') {
1758 }
while (formula[i] !=
'\"');
1767 while (!
IsOperator(formula[i]) && i < formula.Length()) {
1776 if (isalpha(formula[i]) &&
1784 if (formula[i] ==
':' && ((i + 1) < formula.Length())) {
1785 if (formula[i + 1] ==
':') {
1794 name.Append(formula[i++]);
1797 if (formula[i] ==
'(') {
1799 if (formula[i] ==
')') {
1806 while (depth != 0 && i < formula.Length()) {
1807 switch (formula[i]) {
1808 case '(': depth++;
break;
1809 case ')': depth--;
break;
1817 body.Append(formula[i++]);
1820 Int_t originalBodyLen = body.Length();
1822 formula.Replace(i - originalBodyLen, originalBodyLen, body, body.Length());
1823 i += body.Length() - originalBodyLen;
1834 obj =
gROOT->GetListOfFunctions()->FindObject(name);
1839 TF1 *
f1 =
dynamic_cast<TF1 *
>(obj);
1862 std::vector<TString> newNames;
1865 newNames.resize(f->
GetNpar());
1867 for (
int jpar = f->
GetNpar() - 1; jpar >= 0; --jpar) {
1870 if (pj[0] ==
'p' && TString(pj(1, pj.Length())).IsDigit()) {
1875 replacementFormula.ReplaceAll(oldName, newName);
1876 newNames[jpar] = newName;
1886 for (
int jpar = 0; jpar < f->
GetNpar(); ++jpar) {
1887 if (nparOffset > 0) {
1889 assert((
int)newNames.size() == f->
GetNpar());
1896 replacementFormula.Insert(0,
'(');
1897 replacementFormula.Insert(replacementFormula.Length(),
')');
1898 formula.Replace(i - name.Length(), name.Length(), replacementFormula, replacementFormula.Length());
1900 i += replacementFormula.Length() - name.Length();
1912 formula.Replace(i - name.Length(), name.Length(), replacement, replacement.Length());
1944 for (list<TFormulaFunction>::iterator funcsIt =
fFuncs.begin(); funcsIt !=
fFuncs.end(); ++funcsIt) {
1954 TString shortcut = it->first;
1955 TString full = it->second;
1959 Ssiz_t index = formula.Index(shortcut, 0);
1960 while (index !=
kNPOS) {
1963 Ssiz_t i2 = index + shortcut.Length();
1964 if ((index > 0) && (isalpha(formula[index - 1]) || formula[index - 1] ==
':')) {
1965 index = formula.Index(shortcut, i2);
1968 if (i2 < formula.Length() && formula[i2] !=
'(') {
1969 index = formula.Index(shortcut, i2);
1973 formula.Replace(index, shortcut.Length(), full);
1974 Ssiz_t inext = index + full.Length();
1975 index = formula.Index(shortcut, inext);
1979 if (fun.
fName.Contains(
"::"))
1983 size_t index =
name.rfind(
"::");
1984 assert(index != std::string::npos);
1985 TString className = fun.
fName(0, fun.
fName(0, index).Length());
1986 TString functionName = fun.
fName(index + 2, fun.
fName.Length());
1992 TIter next(methodList);
1994 while ((p = (
TMethod *)next())) {
1995 if (strcmp(p->
GetName(), functionName.Data()) == 0 &&
2018 Info(
"TFormula",
"Could not find %s function with %d argument(s)", fun.
GetName(), fun.
GetNargs());
2035 formula.ReplaceAll(pattern, replacement);
2040 map<TString, TFormulaVariable>::iterator varsIt =
fVars.find(fun.
GetName());
2041 if (varsIt !=
fVars.end()) {
2043 TString
name = (*varsIt).second.GetName();
2044 Double_t value = (*varsIt).second.fValue;
2047 if (!
fVars[name].fFound) {
2050 int varDim = (*varsIt).second.fArrayPos;
2051 if (varDim >=
fNdim) {
2056 if (
v.second.fArrayPos < varDim && !
v.second.fFound) {
2058 v.second.fFound =
true;
2065 TString replacement =
TString::Format(
"x[%d]", (*varsIt).second.fArrayPos);
2066 formula.ReplaceAll(pattern, replacement);
2076 TString funname = fun.
GetName();
2077 if (funname.Contains(
"x[") && funname.Contains(
"]")) {
2078 TString sdigit = funname(2, funname.Index(
"]"));
2079 int digit = sdigit.Atoi();
2080 if (digit >=
fNdim) {
2083 for (
int j = 0; j <
fNdim; ++j) {
2087 fVars[vname].fFound =
true;
2096 formula.ReplaceAll(pattern, funname);
2102 if (paramsIt !=
fParams.end()) {
2106 if (formula.Index(pattern) !=
kNPOS) {
2110 formula.ReplaceAll(pattern, replacement);
2119 map<TString, Double_t>::iterator constIt =
fConsts.find(fun.
GetName());
2120 if (constIt !=
fConsts.end()) {
2123 formula.ReplaceAll(pattern, value);
2139 if (!hasParameters) {
2152 Bool_t inputIntoCling = (formula.Length() > 0);
2153 if (inputIntoCling) {
2156 std::string inputFormula(formula.Data());
2160 std::string inputFormulaVecFlag = inputFormula;
2162 inputFormulaVecFlag +=
" (vectorized)";
2164 TString argType =
fVectorized ?
"ROOT::Double_v" :
"Double_t";
2167 TString argumentsPrototype =
TString::Format(
"%s%s%s", ( (hasVariables || hasParameters) ? (argType +
" *x").Data() :
""),
2168 (hasParameters ?
"," :
""), (hasParameters ?
"Double_t *p" :
""));
2180 auto funcit = gClingFunctions.find(inputFormulaVecFlag);
2182 if (funcit != gClingFunctions.end()) {
2185 inputIntoCling =
false;
2191 auto hasher = gClingFunctions.hash_function();
2195 argumentsPrototype.Data(), inputFormula.c_str());
2214 if (inputIntoCling) {
2220 gClingFunctions.insert(std::make_pair(inputFormulaVecFlag, (
void *)
fFuncPtr));
2233 Bool_t allFunctorsMatched =
true;
2234 for (list<TFormulaFunction>::iterator it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
2236 allFunctorsMatched =
false;
2237 if (it->GetNargs() == 0)
2238 Error(
"ProcessFormula",
"\"%s\" has not been matched in the formula expression", it->GetName());
2240 Error(
"ProcessFormula",
"Could not find %s function with %d argument(s)", it->GetName(), it->GetNargs());
2243 if (!allFunctorsMatched) {
2251 auto itvar =
fVars.begin();
2254 if (!itvar->second.fFound) {
2256 itvar =
fVars.erase(itvar);
2259 }
while (itvar !=
fVars.end());
2270 make_pair(make_pair(
"gaus", 1), make_pair(
"[0]*exp(-0.5*(({V0}-[1])/[2])*(({V0}-[1])/[2]))",
2271 "[0]*exp(-0.5*(({V0}-[1])/[2])*(({V0}-[1])/[2]))/(sqrt(2*pi)*[2])")));
2272 functions.insert(make_pair(make_pair(
"landau", 1), make_pair(
"[0]*TMath::Landau({V0},[1],[2],false)",
2273 "[0]*TMath::Landau({V0},[1],[2],true)")));
2274 functions.insert(make_pair(make_pair(
"expo", 1), make_pair(
"exp([0]+[1]*{V0})",
"")));
2276 make_pair(make_pair(
"crystalball", 1), make_pair(
"[0]*ROOT::Math::crystalball_function({V0},[3],[4],[2],[1])",
2277 "[0]*ROOT::Math::crystalball_pdf({V0},[3],[4],[2],[1])")));
2279 make_pair(make_pair(
"breitwigner", 1), make_pair(
"[0]*ROOT::Math::breitwigner_pdf({V0},[2],[1])",
2280 "[0]*ROOT::Math::breitwigner_pdf({V0},[2],[4],[1])")));
2282 functions.insert(make_pair(make_pair(
"cheb0", 1), make_pair(
"ROOT::Math::Chebyshev0({V0},[0])",
"")));
2283 functions.insert(make_pair(make_pair(
"cheb1", 1), make_pair(
"ROOT::Math::Chebyshev1({V0},[0],[1])",
"")));
2284 functions.insert(make_pair(make_pair(
"cheb2", 1), make_pair(
"ROOT::Math::Chebyshev2({V0},[0],[1],[2])",
"")));
2285 functions.insert(make_pair(make_pair(
"cheb3", 1), make_pair(
"ROOT::Math::Chebyshev3({V0},[0],[1],[2],[3])",
"")));
2287 make_pair(make_pair(
"cheb4", 1), make_pair(
"ROOT::Math::Chebyshev4({V0},[0],[1],[2],[3],[4])",
"")));
2289 make_pair(make_pair(
"cheb5", 1), make_pair(
"ROOT::Math::Chebyshev5({V0},[0],[1],[2],[3],[4],[5])",
"")));
2291 make_pair(make_pair(
"cheb6", 1), make_pair(
"ROOT::Math::Chebyshev6({V0},[0],[1],[2],[3],[4],[5],[6])",
"")));
2293 make_pair(make_pair(
"cheb7", 1), make_pair(
"ROOT::Math::Chebyshev7({V0},[0],[1],[2],[3],[4],[5],[6],[7])",
"")));
2294 functions.insert(make_pair(make_pair(
"cheb8", 1),
2295 make_pair(
"ROOT::Math::Chebyshev8({V0},[0],[1],[2],[3],[4],[5],[6],[7],[8])",
"")));
2296 functions.insert(make_pair(make_pair(
"cheb9", 1),
2297 make_pair(
"ROOT::Math::Chebyshev9({V0},[0],[1],[2],[3],[4],[5],[6],[7],[8],[9])",
"")));
2299 make_pair(make_pair(
"cheb10", 1),
2300 make_pair(
"ROOT::Math::Chebyshev10({V0},[0],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10])",
"")));
2303 make_pair(make_pair(
"gaus", 2), make_pair(
"[0]*exp(-0.5*(({V0}-[1])/[2])^2 - 0.5*(({V1}-[3])/[4])^2)",
"")));
2305 make_pair(make_pair(
"landau", 2),
2306 make_pair(
"[0]*TMath::Landau({V0},[1],[2],false)*TMath::Landau({V1},[3],[4],false)",
"")));
2307 functions.insert(make_pair(make_pair(
"expo", 2), make_pair(
"exp([0]+[1]*{V0})",
"exp([0]+[1]*{V0}+[2]*{V1})")));
2310 make_pair(make_pair(
"bigaus", 2), make_pair(
"[0]*ROOT::Math::bigaussian_pdf({V0},{V1},[2],[4],[5],[1],[3])",
2311 "[0]*ROOT::Math::bigaussian_pdf({V0},{V1},[2],[4],[5],[1],[3])")));
2393 if (i < 0 || i >= n ) {
2394 Error(
"GetLinearPart",
"Formula %s has only %d linear parts - requested %d",
GetName(),n,i);
2440 Bool_t anyNewVar =
false;
2441 for (
Int_t i = 0; i < size; ++i) {
2443 const TString &vname = vars[i];
2453 Int_t multiplier = 2;
2454 if (
fFuncs.size() > 100) {
2467 if (anyNewVar && !
fFormula.IsNull()) {
2479 Error(
"SetName",
"The name \'%s\' is reserved as a TFormula variable name.\n" 2480 "\tThis function will not be renamed.",
2485 auto listOfFunctions =
gROOT->GetListOfFunctions();
2486 TObject* thisAsFunctionInList =
nullptr;
2488 if (listOfFunctions){
2489 thisAsFunctionInList = listOfFunctions->
FindObject(
this);
2490 if (thisAsFunctionInList) listOfFunctions->Remove(thisAsFunctionInList);
2493 if (thisAsFunctionInList) listOfFunctions->Add(thisAsFunctionInList);
2507 for(
Int_t i = 0; i < size; ++i)
2509 pair<TString, Double_t>
v = vars[i];
2511 fVars[v.first].fValue = v.second;
2514 Error(
"SetVariables",
"Variable %s is not defined.", v.first.Data());
2524 TString sname(name);
2526 Error(
"GetVariable",
"Variable %s is not defined.", sname.Data());
2529 return fVars.find(sname)->second.fValue;
2537 TString sname(name);
2539 Error(
"GetVarNumber",
"Variable %s is not defined.", sname.Data());
2542 return fVars.find(sname)->second.fArrayPos;
2550 if (ivar < 0 || ivar >=
fNdim)
return "";
2553 for (
auto &
v :
fVars) {
2554 if (
v.second.fArrayPos == ivar)
return v.first;
2556 Error(
"GetVarName",
"Variable with index %d not found !!",ivar);
2567 Error(
"SetVariable",
"Variable %s is not defined.", name.Data());
2606 auto ret =
fParams.insert(std::make_pair(name, pos));
2612 if (ret.first ==
fParams.begin())
2615 auto previous = (ret.first);
2617 pos = previous->second + 1;
2625 Warning(
"inserting parameter %s at pos %d when vector size is %d \n", name.Data(), pos,
2635 for (
auto it = ret.first; it !=
fParams.end(); ++it) {
2645 if (processFormula) {
2673 Error(
"GetParameter",
"Parameter %s is not defined.",name);
2688 Error(
"GetParameter",
"wrong index used - use GetParameter(name)");
2697 if (ipar < 0 || ipar >=
fNpar)
return "";
2701 if (p.second == ipar)
return p.first.Data();
2703 Error(
"GetParName",
"Parameter with index %d not found !!",ipar);
2736 Error(
"SetParameter",
"Parameter %s is not defined.", name.Data());
2743 for (map<TString, TFormulaVariable>::iterator it = fParams.begin(); it != fParams.end(); ++it) {
2744 if (!it->second.fFound) {
2763 for(
Int_t i = 0 ; i < size ; ++i)
2765 pair<TString, Double_t> p = params[i];
2767 Error(
"SetParameters",
"Parameter %s is not defined", p.first.Data());
2770 fParams[p.first].fValue = p.second;
2771 fParams[p.first].fFound =
true;
2775 for (map<TString, TFormulaVariable>::iterator it =
fParams.begin(); it !=
fParams.end(); ++it) {
2776 if (!it->second.fFound) {
2787 if(!params || size < 0 || size >
fNpar)
return;
2790 Warning(
"SetParameters",
"size is not same of cling parameter size %d - %d",size,
int(
fClingParameters.size()) );
2791 for (
Int_t i = 0; i < size; ++i) {
2839 if (param < 0 || param >=
fNpar)
return;
2848 const char *name4,
const char *name5,
const char *name6,
const char *name7,
2849 const char *name8,
const char *name9,
const char *name10)
2879 if (ipar < 0 || ipar >
fNpar) {
2880 Error(
"SetParName",
"Wrong Parameter index %d ",ipar);
2886 if (it.second == ipar) {
2888 fParams.erase(oldName);
2889 fParams.insert(std::make_pair(name, ipar) );
2893 if (oldName.IsNull() ) {
2894 Error(
"SetParName",
"Parameter %d is not existing.",ipar);
2907 if (!formula.IsNull() ) {
2909 for(list<TFormulaFunction>::iterator it =
fFuncs.begin(); it !=
fFuncs.end(); ++it)
2911 if (oldName == it->GetName()) {
2918 Error(
"SetParName",
"Parameter %s is not defined.", oldName.Data());
2922 TString newName =
name;
2923 newName.ReplaceAll(
" ",
"\\s");
2926 formula.ReplaceAll(pattern, replacement);
2934 #ifdef R__HAS_VECCORE 2936 Info(
"SetVectorized",
"Cannot vectorized a function of zero dimension");
2941 Error(
"SetVectorized",
"Cannot set vectorized to %d -- Formula is missing", vectorized);
2961 Warning(
"SetVectorized",
"Cannot set vectorized -- try building with option -Dbuiltin_veccore=On");
2969 return DoEval(x, params);
2971 #ifdef R__HAS_VECCORE 2973 if (
fNdim == 0 || !x) {
2975 return vecCore::Get( ret, 0 );
2982 Info(
"EvalPar",
"Function is vectorized - converting Double_t into ROOT::Double_v and back");
2985 const int maxDim = 4;
2986 std::array<ROOT::Double_v, maxDim> xvec;
2987 for (
int i = 0; i <
fNdim; i++)
2991 return vecCore::Get(ans, 0);
2994 std::vector<ROOT::Double_v> xvec(
fNdim);
2995 for (
int i = 0; i <
fNdim; i++)
2999 return vecCore::Get(ans, 0);
3004 Error(
"EvalPar",
"Formula is vectorized (even though VECCORE is disabled!)");
3010 #ifdef R__HAS_VECCORE 3020 return DoEvalVec(
x, params);
3023 return DoEval(
nullptr, params);
3028 Info(
"EvalPar",
"Function is not vectorized - converting ROOT::Double_v into Double_t and back");
3030 const int vecSize = vecCore::VectorSize<ROOT::Double_v>();
3031 std::vector<Double_t> xscalars(vecSize*
fNdim);
3033 for (
int i = 0; i < vecSize; i++)
3034 for (
int j = 0; j <
fNdim; j++)
3035 xscalars[i*fNdim+j] = vecCore::Get(
x[j],i);
3038 for (
int i = 0; i < vecSize; i++)
3039 vecCore::Set(answers, i,
DoEval(&xscalars[i*fNdim], params));
3050 double xxx[4] = {
x,
y,
z,t};
3059 double xxx[3] = {
x,
y,z};
3068 double xxx[2] = {
x,y};
3091 Error(
"Eval",
"Formula is invalid and not ready to execute ");
3092 for (
auto it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
3095 printf(
"%s is unknown.\n", fun.
GetName());
3102 std::function<double(double *, double *)> & fptr = * ( (std::function<double(double *, double *)> *)
fLambdaPtr);
3105 double *
v =
const_cast<double*
>(
x);
3106 double * p = (params) ? const_cast<double*>(params) :
const_cast<double*
>(
fClingParameters.data());
3111 Error(
"DoEval",
"Formula is invalid or not properly initialized - try calling TFormula::Compile");
3113 #ifdef EVAL_IS_NOT_CONST 3124 double * vars = (
x) ? const_cast<double*>(x) :
const_cast<double*
>(
fClingVariables.data());
3127 (*fFuncPtr)(0, 1, args, &result);
3129 double *pars = (params) ? const_cast<double *>(params) :
const_cast<double *
>(
fClingParameters.data());
3131 (*fFuncPtr)(0, 2, args, &result);
3138 #ifdef R__HAS_VECCORE 3142 Error(
"Eval",
"Formula is invalid and not ready to execute ");
3143 for (
auto it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
3146 printf(
"%s is unknown.\n", fun.
GetName());
3154 Error(
"DoEvalVec",
"Formula is invalid or not properly initialized - try calling TFormula::Compile");
3157 #ifdef EVAL_IS_NOT_CONST 3172 (*fFuncPtr)(0, 1, args, &result);
3174 double *pars = (params) ? const_cast<double *>(params) :
const_cast<double *
>(
fClingParameters.data());
3176 (*fFuncPtr)(0, 2, args, &result);
3180 #endif // R__HAS_VECCORE 3191 TString opt(option);
3200 if (opt.Contains(
"CLING") ) {
3202 std::size_t found = clingFunc.find(
"return");
3203 std::size_t found2 = clingFunc.rfind(
";");
3204 if (found == std::string::npos || found2 == std::string::npos) {
3205 Error(
"GetExpFormula",
"Invalid Cling expression - return default formula expression");
3208 TString clingFormula =
fClingInput(found+7,found2-found-7);
3210 if (!opt.Contains(
"P"))
return clingFormula;
3213 while (i < clingFormula.Length()-2 ) {
3215 if (clingFormula[i] ==
'p' && clingFormula[i+1] ==
'[' && isdigit(clingFormula[i+2]) ) {
3217 while ( isdigit(clingFormula[j]) ) { j++;}
3218 if (clingFormula[j] !=
']') {
3219 Error(
"GetExpFormula",
"Parameters not found - invalid expression - return default cling formula");
3220 return clingFormula;
3222 TString parNumbName = clingFormula(i+2,j-i-2);
3223 int parNumber = parNumbName.Atoi();
3224 assert(parNumber <
fNpar);
3226 clingFormula.Replace(i,j-i+1, replacement );
3227 i += replacement.Length();
3231 return clingFormula;
3233 if (opt.Contains(
"P") ) {
3237 while (i < expFormula.Length()-2 ) {
3239 if (expFormula[i] ==
'[') {
3241 while ( expFormula[j] !=
']' ) { j++;}
3242 if (expFormula[j] !=
']') {
3243 Error(
"GetExpFormula",
"Parameter names not found - invalid expression - return default formula");
3246 TString parName = expFormula(i+1,j-i-1);
3248 expFormula.Replace(i,j-i+1, replacement );
3249 i += replacement.Length();
3255 Warning(
"GetExpFormula",
"Invalid option - return default formula expression");
3265 printf(
" Formula expression: \n");
3266 printf(
"\t%s \n",
fFormula.Data() );
3267 TString opt(option);
3272 if (opt.Contains(
"V") ) {
3274 printf(
"List of Variables: \n");
3276 for (
int ivar = 0; ivar <
fNdim ; ++ivar) {
3281 printf(
"List of Parameters: \n");
3286 for (
int ipar = 0; ipar <
fNpar ; ++ipar) {
3290 printf(
"Expression passed to Cling:\n");
3295 Warning(
"Print",
"Formula is not ready to execute. Missing parameters/variables");
3296 for (list<TFormulaFunction>::const_iterator it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
3299 printf(
"%s is unknown.\n", fun.
GetName());
3320 void TFormula::Streamer(
TBuffer &
b)
3326 if (v <= 8 && v > 3 && v != 6) {
3339 Error(
"Streamer",
"Old formula read from file is NOT valid");
3385 if (
fNpar != (
int) parValues.size() ) {
3386 Error(
"Streamer",
"number of parameters computed (%d) is not same as the stored parameters (%d)",
fNpar,
int(parValues.size()) );
3398 assert(
fNpar == (
int) parValues.size() );
3401 if (
fParams.size() != paramMap.size() ) {
3402 Warning(
"Streamer",
"number of parameters list found (%zu) is not same as the stored one (%zu) - use re-created list",
fParams.size(),paramMap.size()) ;
3418 gROOT->GetListOfFunctions()->Add(
this);
3421 Error(
"Streamer",
"Formula read from file is NOT ready to execute");
3429 Error(
"Streamer",
"Reading version %d is not supported",v);
virtual const char * GetName() const
Returns name of object.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Double_t Floor(Double_t x)
virtual TFormula * GetFormula()
static double p3(double t, double a, double b, double c, double d)
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *) const
constexpr Double_t Sqrt2()
CallFunc_t * GetCallFunc() const
virtual void SetName(const char *name)
Set the name of the TNamed.
Buffer base class used for serializing objects.
Regular expression class.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
R__EXTERN TVirtualMutex * gROOTMutex
const TList * GetListOfAllPublicMethods(Bool_t load=kTRUE)
Returns a list of all public methods of this class and its base classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
constexpr Double_t Ln10()
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
Double_t Log10(Double_t x)
virtual Bool_t Declare(const char *code)=0
static double p2(double t, double a, double b, double c)
void(* Generic_t)(void *, int, void **, void *)
Method or function calling interface.
virtual void Delete(Option_t *option="")
Delete this object.
Int_t GetNargs() const
Number of function arguments.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
The ROOT global object gROOT contains a list of all defined classes.
static double p1(double t, double a, double b)
Bool_t IsValid() const
Return true if the method call has been properly initialized and is usable.
void InitWithPrototype(TClass *cl, const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Initialize the method invocation environment.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
static constexpr double degree
Ssiz_t Index(const TString &str, Ssiz_t *len, Ssiz_t start=0) const
Find the first occurrence of the regexp in string and return the position, or -1 if there is no match...
#define R__LOCKGUARD(mutex)
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.
Mother of all ROOT objects.
constexpr Double_t EulerGamma()
you should not use this method at all Int_t Int_t z
Global functions class (global functions are obtained from CINT).
virtual void Copy(TObject &named) const
Copy this to obj.
Short_t Max(Short_t a, Short_t b)
Each ROOT class (see TClass) has a linked list of methods.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
constexpr Double_t LogE()
constexpr Double_t Sigma()
R__EXTERN TInterpreter * gCling
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
void variables(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variables", Bool_t isRegression=kFALSE, Bool_t useTMVAStyle=kTRUE)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual const char * GetTitle() const
Returns title of object.