Functions saved in different root files

How can I create a function that is some combination of two functions saved in two different files?

TFile* f1 = new TFile("./f1.root");
TFile* f2 = new TFile("./f2.root");

TF1* g1 = f1->Get(“funct1”);
TF1* g2 = f2->Get(“funct2”);

then for example I do I sum them ?

TF1* g = new TF1(“g”,“g1+g2”) doesn’t work…

hi, try this:

TF1* g1 = (TF1*)f1->Get(“funct1”);
TF1* g2 = (TF1*)f2->Get(“funct2”);

TF1* g = new TF1(“g”,“funct1+funct2”)

Hi,

even with only

TF1* g = new TF1(“g”,“funct1”);

does not work for me.