Please provide the following information:
ROOT Version (e.g. 6.12/02): 6.06/01
Platform, compiler (e.g. CentOS 7.3, gcc6.2): gcc6.4
Hello.
I would like to call complex functions from other file and merge them.
So I made some external function and called it at the main function.
But there is an issue about arguments.
So could somebody please solve this problem?
Following is sample of my code
Double_t MyFunc(Double_t* x, Double_t* p, TF1* f1, TF1* f2, TF1* f3)
{
return p[0]*f1->Eval(x[0]) + p[1]*f2->Eval(x[0]) + p[3]*f3->Eval(x[0]);
}
main()
{
TFile * fin = new TFile(“file.root”);
TF1 * tf1S = (TF1 *) fin->Get(“func1”);
TF1 * tf2S = (TF1 *) fin->Get(“func2”);
TF1 * tf3S = (TF1 *) fin->Get(“func3”);
TF1 * tf1SC = (TF1 *) tf1S->Clone(“tf1SC”);
TF1 * tf2SC = (TF1 *) tf2S->Clone(“tf2SC”);
TF1 * tf3SC = (TF1 *) tf3S->Clone(“tf3SC”);
gROOT->GetListOfFunctions()->Add(tf1SC);
gROOT->GetListOfFunctions()->Add(tf2SC);
gROOT->GetListOfFunctions()->Add(tf3SC);
TF1 * fadd = new TF1(“fadd”, MyFunc(tf1SC, tf2SC, tf3SC), 0, 10);
}
This code does not work due to the arguments of the MyFunc.
How can I solve this?
Thank you.