My problem is the following: I want to define a TF1 from a TGraph. For this I define a double that evaluates the TGraph and returns its value. After, i use this double to create a TF1. Everything works well, except when I want to Draw the TF1, that I get a segmentation violation. Has somebody had this problem before? The TF1 is well computed and I can use if for calculations later, but the Draw option always gives problem. I write the piece of my code (The class is QGrav). Thank you very much for your help.
Double_t QGrav::transfunc2(Double_t *x, Double_t *par)
f2 = new TF1(“f2”, this, &QGrav::transfunc2, 0., 4.5, 1, “QGrav”,“transfunc2”);
TCanvas *function = new TCanvas();