33#include <unordered_map>
35using std::map, std::pair, std::make_pair, std::list, std::max, std::string;
38#pragma optimize("",off)
49 ss << std::setprecision(std::numeric_limits<double>::max_digits10) << val;
276static std::unordered_map<std::string, void *>
gClingFunctions = std::unordered_map<std::string, void * >();
283 for (
int i = 0; i <
nobjects; ++i) {
301 const static std::set<char>
ops {
'+',
'^',
'-',
'/',
'*',
'<',
'>',
'|',
'&',
'!',
'=',
'?',
'%'};
309 char brackets[] = {
')',
'(',
'{',
'}'};
333 if ( (formula[i] ==
'e' || formula[i] ==
'E') && (i > 0 && i < formula.
Length()-1) ) {
335 if ( (
isdigit(formula[i-1]) || formula[i-1] ==
'.') && (
isdigit(formula[i+1]) || formula[i+1] ==
'+' || formula[i+1] ==
'-' ) )
345 if ( (formula[i] ==
'x' || formula[i] ==
'X') && (i > 0 && i < formula.
Length()-1) && formula[i-1] ==
'0') {
348 static char hex_values[12] = {
'a',
'A',
'b',
'B',
'c',
'C',
'd',
'D',
'e',
'E',
'f',
'F'};
368 if (pos == 0 || pos == formula.
Length()-1)
return false;
369 for (
int i = pos-1; i >=0; i--) {
370 if (formula[i] ==
']' )
return false;
371 if (formula[i] ==
'[' ) {
379 for (
int i = pos+1; i < formula.
Length(); i++) {
380 if (formula[i] ==
']' )
return true;
421 for (
int i = 0; i < formula.
Length(); i++) {
424 if (
isalpha(formula[i]) || formula[i] ==
'{' || formula[i] ==
'[') {
428 || (formula[i] ==
'{' && formula[
j] ==
'}'));
440 }
else if (
isalpha(formula[i])) {
443 i +=
name.Length() - 1;
470 for (
auto const &
specialName : {
"x",
"y",
"z",
"t"}){
484 gROOT->GetListOfFunctions()->Remove(
this);
496 fClingInput(formula),fFormula(formula)
505#ifndef R__HAS_VECCORE
526 gROOT->GetListOfFunctions()->Remove(old);
528 Error(
"TFormula",
"The name %s is reserved as a TFormula variable name.\n",
name);
530 gROOT->GetListOfFunctions()->Add(
this);
542 fClingInput(formula),fFormula(formula)
555 for (
int i = 0; i <
npar; ++i) {
574 gROOT->GetListOfFunctions()->Remove(old);
576 Error(
"TFormula",
"The name %s is reserved as a TFormula variable name.\n",
name);
578 gROOT->GetListOfFunctions()->Add(
this);
583 Error(
"TFormula",
"Syntax error in building the lambda expression %s", formula );
588 TNamed(formula.GetName(),formula.GetTitle())
590 formula.TFormula::Copy(*
this);
596 gROOT->GetListOfFunctions()->Remove(old);
599 Error(
"TFormula",
"The name %s is reserved as a TFormula variable name.\n",formula.
GetName());
601 gROOT->GetListOfFunctions()->Add(
this);
612 rhs.TFormula::Copy(*
this);
670 if (formula.
IsNull() )
return -1;
682 return (
ret) ? 0 : 1;
692 return (
ret) ? 0 : 1;
721 for (
int i = 0; i <
nLinParts; ++i)
delete fnew.fLinearParts[i];
722 fnew.fLinearParts.clear();
751 bool ret =
fnew.InitLambdaExpression(
fnew.fFormula);
754 fnew.fReadyToExecute =
true;
757 Error(
"TFormula",
"Syntax error in building the lambda expression %s",
fFormula.
Data() );
758 fnew.fReadyToExecute =
false;
765 fnew.fMethod.reset(
m);
810static std::unique_ptr<TMethodCall>
813 std::unique_ptr<TMethodCall>
814 Method = std::make_unique<TMethodCall>();
839 if (!Method->IsValid()) {
840 Error(
"prepareMethod",
841 "Can't compile function %s prototype with arguments %s",
FuncName,
850 if (!
method)
return nullptr;
854 Error(
"prepareFuncPtr",
"Callfunc retuned from Cling is not valid");
861 Error(
"prepareFuncPtr",
"Compiled function pointer is null");
936 { {
"sin",
"TMath::Sin" },
937 {
"cos",
"TMath::Cos" }, {
"exp",
"TMath::Exp"}, {
"log",
"TMath::Log"}, {
"log10",
"TMath::Log10"},
938 {
"tan",
"TMath::Tan"}, {
"sinh",
"TMath::SinH"}, {
"cosh",
"TMath::CosH"},
939 {
"tanh",
"TMath::TanH"}, {
"asin",
"TMath::ASin"}, {
"acos",
"TMath::ACos"},
940 {
"atan",
"TMath::ATan"}, {
"atan2",
"TMath::ATan2"}, {
"sqrt",
"TMath::Sqrt"},
941 {
"ceil",
"TMath::Ceil"}, {
"floor",
"TMath::Floor"}, {
"pow",
"TMath::Power"},
942 {
"binomial",
"TMath::Binomial"},{
"abs",
"TMath::Abs"},
943 {
"min",
"TMath::Min"},{
"max",
"TMath::Max"},{
"sign",
"TMath::Sign" },
948 for (
int i = 0; i < 9; ++i)
951 for (
const auto &var :
defvars) {
952 int pos =
fVars.size();
985 { {
"sin",
"vecCore::math::Sin" },
986 {
"cos",
"vecCore::math::Cos" }, {
"exp",
"vecCore::math::Exp"}, {
"log",
"vecCore::math::Log"}, {
"log10",
"vecCore::math::Log10"},
987 {
"tan",
"vecCore::math::Tan"},
989 {
"asin",
"vecCore::math::ASin"},
990 {
"acos",
"TMath::Pi()/2-vecCore::math::ASin"},
991 {
"atan",
"vecCore::math::ATan"},
992 {
"atan2",
"vecCore::math::ATan2"}, {
"sqrt",
"vecCore::math::Sqrt"},
993 {
"ceil",
"vecCore::math::Ceil"}, {
"floor",
"vecCore::math::Floor"}, {
"pow",
"vecCore::math::Pow"},
994 {
"cbrt",
"vecCore::math::Cbrt"},{
"abs",
"vecCore::math::Abs"},
995 {
"min",
"vecCore::math::Min"},{
"max",
"vecCore::math::Max"},{
"sign",
"vecCore::math::Sign" }
1034 Int_t degree = 1, counter = 0;
1049 std::vector<TString>
tokens;
1050 std::stringstream
ss(args.
Data());
1052 while (std::getline(
ss, token,
',')) {
1070 for (
size_t i = 1; i <
tokens.size(); i++) {
1115 variable = formula(tmp + 1,
polPos - (tmp + 1));
1125 }
else if (i == 1) {
1133 for (
Int_t i = 1; i <= degree; i++) {
1160 Error(
"HandlePolN",
"Error handling polynomial function - expression is %s - trying to replace %s with %s ",
1165 if (formula == pattern) {
1216 formula.
ReplaceAll(
"xylandau",
"landau[x,y]");
1270 std::vector<TString> variables;
1280 variables.resize(dim);
1288 dim =
varList.CountChar(
',') + 1;
1289 variables.resize(dim);
1312 Error(
"PreProcessFormula",
"Dimension of function %s is detected to be of dimension %d and is not "
1313 "compatible with existing pre-defined function which has dim %d",
1350 Error(
"PreprocessFormula",
"%d dimension function %s has no normalized form.", it->first.second,
1354 for (
int i = 0; i <
body.Length(); ++i) {
1355 if (
body[i] ==
'{') {
1359 TString variable = variables[num];
1363 i += variable.
Length() - 1;
1364 }
else if (
body[i] ==
'[') {
1367 while (tmp <
body.Length() &&
body[tmp] !=
']') {
1423 Error(
"HandleParamRanges",
"End parameter (%d) <= start parameter (%d) in parameter range",
endCnt,
startCnt);
1447 std::map<std::pair<TString, Int_t>, std::pair<TString, TString>>
parFunctions;
1455 if (formula[i] ==
'[') {
1456 while (formula[i] !=
']')
1461 if (formula[i] ==
'\"') {
1464 while (formula[i] !=
'\"');
1494 for (k =
j + 1;
depth >= 1 && k < formula.
Length(); k++) {
1495 if (formula[k] ==
',' &&
depth == 1) {
1498 }
else if (formula[k] ==
'(')
1500 else if (formula[k] ==
')')
1514 TF1 *
f1 =
dynamic_cast<TF1 *
>(obj);
1529 ndim =
f->GetNdim();
1530 npar =
f->GetNpar();
1559 Error(
"HandleFunctionArguments",
"Square brackets not matching in formula %s",
1574 Error(
"HandleFunctionArguments",
"Number of dimensions %d greater than 4. Cannot parse formula.", ndim);
1639 Warning(
"HandleFunctionArguments",
1640 "Argument %d is not a parameter. Cannot assume variables are implicit.",
argNr);
1647 for (
int dim = 0; dim < ndim; dim++) {
1707 Warning(
"HandleFunctionArguments",
"Unable to make replacement. Number of parameters doesn't work : "
1708 "%d arguments, %d dimensions, %d parameters",
1735 if (formula[temp] ==
')') {
1738 while (
depth != 0 && temp > 0) {
1739 if (formula[temp] ==
')')
1741 if (formula[temp] ==
'(')
1764 if (temp >= formula.
Length()) {
1765 Error(
"HandleExponentiation",
"Invalid position of operator ^");
1768 if (formula[temp] ==
'(') {
1772 if (formula[temp] ==
')')
1774 if (formula[temp] ==
'(')
1781 if (formula[temp] ==
'-' || formula[temp] ==
'+')
1793 if (temp < formula.
Length() && formula[temp] ==
'(')
1795 if (temp < formula.
Length() && formula[temp] ==
')') {
1828 if(formula.
Length() == 0)
return;
1830 if(terms.size() <= 1)
return;
1845 auto termName = std::string(
"__linear") + std::to_string(
iTerm+1);
1847 std::stringstream
ss;
1934 if (formula[i] ==
'[') {
1938 while (i < formula.
Length() && formula[i] !=
']') {
1939 param.
Append(formula[i++]);
1950 for (
int idx = 0; idx <=
paramIndex; ++idx) {
1980 if (formula[i] ==
'\"') {
1984 }
while (formula[i] !=
'\"');
2010 if (formula[i] ==
':' && ((i + 1) < formula.
Length())) {
2011 if (formula[i + 1] ==
':') {
2020 name.Append(formula[i++]);
2023 if (formula[i] ==
'(') {
2025 if (formula[i] ==
')') {
2033 switch (formula[i]) {
2034 case '(':
depth++;
break;
2035 case ')':
depth--;
break;
2043 body.Append(formula[i++]);
2067 TF1 *
f1 =
dynamic_cast<TF1 *
>(obj);
2179 if (
fun.IsFuncCall()) {
2197 if (
i2 < formula.
Length() && formula[
i2] !=
'(') {
2211#ifdef TFORMULA_CHECK_FUNCTIONS
2213 if (
fun.fName.Contains(
"::"))
2216 std::string
name(
fun.fName.Data());
2230 (
fun.GetNargs() <=
p->GetNargs() &&
fun.GetNargs() >=
p->GetNargs() -
p->GetNargsOpt())) {
2244 if (
f &&
fun.GetNargs() <=
f->GetNargs() &&
fun.GetNargs() >=
f->GetNargs() -
f->GetNargsOpt()) {
2252 Info(
"TFormula",
"Could not find %s function with %d argument(s)",
fun.GetName(),
fun.GetNargs());
2275 map<TString, TFormulaVariable>::iterator
varsIt =
fVars.find(
fun.GetName());
2285 int varDim = (*varsIt).second.fArrayPos;
2291 if (
v.second.fArrayPos <
varDim && !
v.second.fFound) {
2293 v.second.fFound =
true;
2474 for (list<TFormulaFunction>::iterator it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
2476 if (!it->fFound && !it->IsFuncCall()) {
2478 if (it->GetNargs() == 0)
2479 Error(
"ProcessFormula",
"\"%s\" has not been matched in the formula expression", it->GetName());
2481 Error(
"ProcessFormula",
"Could not find %s function with %d argument(s)", it->GetName(), it->GetNargs());
2495 if (!
itvar->second.fFound) {
2511 make_pair(make_pair(
"gaus", 1), make_pair(
"[0]*exp(-0.5*(({V0}-[1])/[2])*(({V0}-[1])/[2]))",
2512 "[0]*exp(-0.5*(({V0}-[1])/[2])*(({V0}-[1])/[2]))/(sqrt(2*pi)*[2])")));
2513 functions.insert(make_pair(make_pair(
"landau", 1), make_pair(
"[0]*TMath::Landau({V0},[1],[2],false)",
2514 "[0]*TMath::Landau({V0},[1],[2],true)")));
2515 functions.insert(make_pair(make_pair(
"expo", 1), make_pair(
"exp([0]+[1]*{V0})",
"")));
2517 make_pair(make_pair(
"crystalball", 1), make_pair(
"[0]*ROOT::Math::crystalball_function({V0},[3],[4],[2],[1])",
2518 "[0]*ROOT::Math::crystalball_pdf({V0},[3],[4],[2],[1])")));
2520 make_pair(make_pair(
"breitwigner", 1), make_pair(
"[0]*ROOT::Math::breitwigner_pdf({V0},[2],[1])",
2521 "[0]*ROOT::Math::breitwigner_pdf({V0},[2],[4],[1])")));
2523 functions.insert(make_pair(make_pair(
"cheb0", 1), make_pair(
"ROOT::Math::Chebyshev0({V0},[0])",
"")));
2524 functions.insert(make_pair(make_pair(
"cheb1", 1), make_pair(
"ROOT::Math::Chebyshev1({V0},[0],[1])",
"")));
2525 functions.insert(make_pair(make_pair(
"cheb2", 1), make_pair(
"ROOT::Math::Chebyshev2({V0},[0],[1],[2])",
"")));
2526 functions.insert(make_pair(make_pair(
"cheb3", 1), make_pair(
"ROOT::Math::Chebyshev3({V0},[0],[1],[2],[3])",
"")));
2528 make_pair(make_pair(
"cheb4", 1), make_pair(
"ROOT::Math::Chebyshev4({V0},[0],[1],[2],[3],[4])",
"")));
2530 make_pair(make_pair(
"cheb5", 1), make_pair(
"ROOT::Math::Chebyshev5({V0},[0],[1],[2],[3],[4],[5])",
"")));
2532 make_pair(make_pair(
"cheb6", 1), make_pair(
"ROOT::Math::Chebyshev6({V0},[0],[1],[2],[3],[4],[5],[6])",
"")));
2534 make_pair(make_pair(
"cheb7", 1), make_pair(
"ROOT::Math::Chebyshev7({V0},[0],[1],[2],[3],[4],[5],[6],[7])",
"")));
2535 functions.insert(make_pair(make_pair(
"cheb8", 1),
2536 make_pair(
"ROOT::Math::Chebyshev8({V0},[0],[1],[2],[3],[4],[5],[6],[7],[8])",
"")));
2537 functions.insert(make_pair(make_pair(
"cheb9", 1),
2538 make_pair(
"ROOT::Math::Chebyshev9({V0},[0],[1],[2],[3],[4],[5],[6],[7],[8],[9])",
"")));
2540 make_pair(make_pair(
"cheb10", 1),
2541 make_pair(
"ROOT::Math::Chebyshev10({V0},[0],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10])",
"")));
2544 make_pair(make_pair(
"gaus", 2), make_pair(
"[0]*exp(-0.5*(({V0}-[1])/[2])^2 - 0.5*(({V1}-[3])/[4])^2)",
"")));
2546 make_pair(make_pair(
"landau", 2),
2547 make_pair(
"[0]*TMath::Landau({V0},[1],[2],false)*TMath::Landau({V1},[3],[4],false)",
"")));
2548 functions.insert(make_pair(make_pair(
"expo", 2), make_pair(
"exp([0]+[1]*{V0})",
"exp([0]+[1]*{V0}+[2]*{V1})")));
2551 make_pair(make_pair(
"gaus", 3), make_pair(
"[0]*exp(-0.5*(({V0}-[1])/[2])^2 - 0.5*(({V1}-[3])/[4])^2 - 0.5*(({V2}-[5])/[6])^2)",
"")));
2554 make_pair(make_pair(
"bigaus", 2), make_pair(
"[0]*ROOT::Math::bigaussian_pdf({V0},{V1},[2],[4],[5],[1],[3])",
2555 "[0]*ROOT::Math::bigaussian_pdf({V0},{V1},[2],[4],[5],[1],[3])")));
2648 Error(
"GetLinearPart",
"Formula %s has only %d linear parts - requested %d",
GetName(),
n,i);
2708 if (
fFuncs.size() > 100) {
2733 Error(
"SetName",
"The name \'%s\' is reserved as a TFormula variable name.\n"
2734 "\tThis function will not be renamed.",
2765 fVars[
v.first].fValue =
v.second;
2768 Error(
"SetVariables",
"Variable %s is not defined.",
v.first.Data());
2780 Error(
"GetVariable",
"Variable %s is not defined.",
name);
2783 return nameIt->second.fValue;
2793 Error(
"GetVarNumber",
"Variable %s is not defined.",
name);
2796 return nameIt->second.fArrayPos;
2807 for (
auto &
v :
fVars) {
2808 if (
v.second.fArrayPos ==
ivar)
return v.first;
2810 Error(
"GetVarName",
"Variable with index %d not found !!",
ivar);
2821 Error(
"SetVariable",
"Variable %s is not defined.",
name.Data());
2879 Warning(
"inserting parameter %s at pos %d when vector size is %d \n",
name.Data(), pos,
2889 for (
auto it =
ret.first; it !=
fParams.end(); ++it) {
2927 Error(
"GetParameter",
"Parameter %s is not defined.",
name);
2942 Error(
"GetParameter",
"wrong index used - use GetParameter(name)");
2955 if (
p.second == ipar)
return p.first.Data();
2957 Error(
"GetParName",
"Parameter with index %d not found !!",ipar);
2990 Error(
"SetParameter",
"Parameter %s is not defined.",
name.Data());
2997 for (map<TString, TFormulaVariable>::iterator it =
fParams.begin(); it !=
fParams.end(); ++it) {
2998 if (!it->second.fFound) {
3021 Error(
"SetParameters",
"Parameter %s is not defined",
p.first.Data());
3029 for (map<TString, TFormulaVariable>::iterator it =
fParams.begin(); it !=
fParams.end(); ++it) {
3030 if (!it->second.fFound) {
3084 Error(
"SetParName",
"Wrong Parameter index %d ",ipar);
3090 if (it.second == ipar) {
3098 Error(
"SetParName",
"Parameter %d is not existing.",ipar);
3111 if (!formula.
IsNull() ) {
3113 for(list<TFormulaFunction>::iterator it =
fFuncs.begin(); it !=
fFuncs.end(); ++it)
3115 if (
oldName == it->GetName()) {
3122 Error(
"SetParName",
"Parameter %s is not defined.",
oldName.Data());
3127 newName.ReplaceAll(
" ",
"\\s");
3138#ifdef R__HAS_VECCORE
3140 Info(
"SetVectorized",
"Cannot vectorized a function of zero dimension");
3145 Error(
"SetVectorized",
"Cannot set vectorized to %d -- Formula is missing",
vectorized);
3163 Warning(
"SetVectorized",
"Cannot set vectorized -- try building with option -Dbuiltin_veccore=On");
3173#ifdef R__HAS_VECCORE
3177 return vecCore::Get(
ret, 0 );
3184 Info(
"EvalPar",
"Function is vectorized - converting Double_t into ROOT::Double_v and back");
3188 std::array<ROOT::Double_v, maxDim> xvec;
3189 for (
int i = 0; i <
fNdim; i++)
3193 return vecCore::Get(
ans, 0);
3196 std::vector<ROOT::Double_v> xvec(
fNdim);
3197 for (
int i = 0; i <
fNdim; i++)
3201 return vecCore::Get(
ans, 0);
3206 Error(
"EvalPar",
"Formula is vectorized (even though VECCORE is disabled!)");
3214 return gInterpreter->GetFunction(
nullptr, Name.c_str());
3218#ifdef ROOT_SUPPORT_CLAD
3221 gInterpreter->Declare(
"#include <Math/CladDerivator.h>\n#pragma clad OFF");
3234 "#pragma clad ON\n" +
3247 std::unique_ptr<TMethodCall>
3270 (*FuncPtr)(
nullptr, 2, args,
nullptr);
3281 (*FuncPtr)(
nullptr, 3, args,
nullptr);
3304 (
"clad::gradient(" + std::string(
fClingName.
Data()) +
", \"p\");");
3324 Error(
"GradientPar",
"Could not initialize the formula!");
3329 Error(
"GradientPar",
"Could not generate a gradient for the formula %s!",
3336 "The size of gradient result is %zu but %d is required. Resizing.",
3370 std::string
indexes = (
fNpar - 1 == 0) ?
"0" : std::string(
"0:")
3371 + std::to_string(
fNpar - 1);
3390 Error(
"HessianPar",
"Could not initialize the formula!");
3395 Error(
"HessianPar",
"Could not generate a hessian for the formula %s!",
3402 "The size of hessian result is %zu but %d is required. Resizing.",
3416#ifdef R__HAS_VECCORE
3426 return DoEvalVec(
x, params);
3429 return DoEval(
nullptr, params);
3434 Info(
"EvalPar",
"Function is not vectorized - converting ROOT::Double_v into Double_t and back");
3436 const int vecSize = vecCore::VectorSize<ROOT::Double_v>();
3439 for (
int i = 0; i <
vecSize; i++)
3444 for (
int i = 0; i <
vecSize; i++)
3461 Error(
"Eval",
"Formula is invalid and not ready to execute ");
3462 for (
auto it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
3465 printf(
"%s is unknown.\n",
fun.GetName());
3481 Error(
"DoEval",
"Formula has error and it is not properly initialized ");
3490 double *
v =
const_cast<double*
>(
x);
3491 double *
p = (params) ?
const_cast<double*
>(params) :
const_cast<double*
>(
fClingParameters.data());
3498 double * vars = (
x) ?
const_cast<double*
>(
x) :
const_cast<double*
>(
fClingVariables.data());
3501 (*fFuncPtr)(
nullptr, 1, args, &
result);
3503 double *pars = (params) ?
const_cast<double *
>(params) :
const_cast<double *
>(
fClingParameters.data());
3505 (*fFuncPtr)(
nullptr, 2, args, &
result);
3512#ifdef R__HAS_VECCORE
3516 Error(
"Eval",
"Formula is invalid and not ready to execute ");
3517 for (
auto it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
3520 printf(
"%s is unknown.\n",
fun.GetName());
3536 Error(
"DoEval",
"Formula has error and it is not properly initialized ");
3548 (*fFuncPtr)(0, 1, args, &
result);
3550 double *pars = (params) ?
const_cast<double *
>(params) :
const_cast<double *
>(
fClingParameters.data());
3552 (*fFuncPtr)(0, 2, args, &
result);
3569 Info(
"ReInitializeEvalMethod",
"compile now lambda expression function using Cling");
3576 if (!
fLazyInitialization)
Warning(
"ReInitializeEvalMethod",
"Formula is NOT properly initialized - try calling again TFormula::PrepareEvalMethod");
3635 std::size_t found =
clingFunc.find(
"return");
3637 if (found == std::string::npos ||
found2 == std::string::npos) {
3638 Error(
"GetExpFormula",
"Invalid Cling expression - return default formula expression");
3652 Error(
"GetExpFormula",
"Parameters not found - invalid expression - return default cling formula");
3658 std::stringstream
ss;
3677 Error(
"GetExpFormula",
"Parameter names not found - invalid expression - return default formula");
3681 std::stringstream
ss;
3690 Warning(
"GetExpFormula",
"Invalid option - return default formula expression");
3695 std::unique_ptr<TInterpreterValue>
v =
gInterpreter->MakeInterpreterValue();
3696 std::string s(
"(void (&)(Double_t const *, Double_t *, Double_t *)) ");
3699 return v->ToString();
3703 std::unique_ptr<TInterpreterValue>
v =
gInterpreter->MakeInterpreterValue();
3705 return v->ToString();
3714 printf(
" Formula expression: \n");
3723 printf(
"List of Variables: \n");
3730 printf(
"List of Parameters: \n");
3735 for (
int ipar = 0; ipar <
fNpar ; ++ipar) {
3739 printf(
"Expression passed to Cling:\n");
3742 printf(
"Generated Gradient:\n");
3747 printf(
"Generated Hessian:\n");
3754 Warning(
"Print",
"Formula is not ready to execute. Missing parameters/variables");
3755 for (list<TFormulaFunction>::const_iterator it =
fFuncs.begin(); it !=
fFuncs.end(); ++it) {
3758 printf(
"%s is unknown.\n",
fun.GetName());
3781 if (
b.IsReading() ) {
3798 Error(
"Streamer",
"Old formula read from file is NOT valid");
3852 Error(
"Streamer",
"number of parameters computed (%d) is not same as the stored parameters (%d)",
fNpar,
int(
parValues.size()) );
3855 if (
v > 11 &&
fNdim != ndim) {
3856 Error(
"Streamer",
"number of dimension computed (%d) is not same as the stored value (%d)",
fNdim, ndim );
3875 Warning(
"Streamer",
"number of parameters list found (%zu) is not same as the stored one (%zu) - use re-created list",
fParams.size(),
paramMap.size()) ;
3891 gROOT->GetListOfFunctions()->Add(
this);
3894 Error(
"Streamer",
"Formula read from file is NOT ready to execute");
3902 Error(
"Streamer",
"Reading version %d is not supported",
v);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
short Version_t
Class version identifier (short)
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
const char Option_t
Option string (const char)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void GetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Stores the parameters of the given function into pars.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
R__EXTERN TInterpreter * gCling
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
R__EXTERN TVirtualMutex * gROOTMutex
#define R__LOCKGUARD(mutex)
const_iterator begin() const
const_iterator end() const
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
const TList * GetListOfAllPublicMethods(Bool_t load=kTRUE)
Returns a list of all public methods of this class and its base classes.
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.
virtual TFormula * GetFormula()
Global functions class (global functions are obtained from CINT).
virtual Longptr_t ProcessLine(const char *line, EErrorCode *error=nullptr)=0
virtual Bool_t Declare(const char *code)=0
virtual Bool_t CallFunc_IsValid(CallFunc_t *) const
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *) const
Method or function calling interface.
Each ROOT class (see TClass) has a linked list of methods.
The TNamed class is the base class for all named ROOT classes.
void Copy(TObject &named) const override
Copy this to obj.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Regular expression class.
TString & Insert(Ssiz_t pos, const char *s)
Int_t Atoi() const
Return integer value of string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void ToUpper()
Change string to upper case.
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
constexpr Double_t G()
Gravitational constant in: .
constexpr Double_t C()
Velocity of light in .
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754.
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
constexpr Double_t K()
Boltzmann's constant in : .
constexpr Double_t Sqrt2()
constexpr Double_t E()
Base of natural log: .
constexpr Double_t Sigma()
Stefan-Boltzmann constant in : .
constexpr Double_t H()
Planck's constant in : .
constexpr Double_t LogE()
Base-10 log of e (to convert ln to log)
constexpr Double_t Ln10()
Natural log of 10 (to convert log to ln)
constexpr Double_t EulerGamma()
Euler-Mascheroni Constant.
constexpr Double_t R()
Universal gas constant ( ) in
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Double_t Infinity()
Returns an infinity as defined by the IEEE standard.
void(* Generic_t)(void *, int, void **, void *)