Please provide the following information:
ROOT Version (e.g. 6.12/02): 6.06/01
Platform, compiler (e.g. CentOS 7.3, gcc6.2): gcc.x86_64
Hello.
I’m looking for some way to merge TF1 functions.
I made some functions in the different file and stored them into root file.
Then the TF1 files are called and merged into one TF1.
But the functions that I called are invalid.
What I want to do is simple.
Call functions a, b, c
And make [0]*a + [1]*b + [2]*c
Following is sample of my code
TFile* fin = new TFile(“fin.root”);
TF1* tf1S = (TF1*) fin->Get(“twoCB1S”);
TF1* tf2S = (TF1*) fin->Get(“twoCB2S”);
TF1* tf3S = (TF1*) fin->Get(“twoCB3S”);
TF1* tf1SC = (TF1*) tf1S->Clone(“tf1S”);
TF1* tf2SC = (TF1*) tf2S->Clone(“tf2S”);
TF1* tf3SC = (TF1*) tf3S->Clone(“tf3S”);
gROOT->GetListOfFunctions()->Add(tf1S);
gROOT->GetListOfFunctions()->Add(tf2S);
gROOT->GetListOfFunctions()->Add(tf3S);
TF1* fadd = new TF1(“fadd”, “[0](tf1S) + [1](tf2S) + [2]*(tf3S)”, 8, 14);