void makeFunctions(){ gROOT->LoadMacro("myfunctions.C"); // //very simple TF1 and TF2 examples // // Load user-defined functions // TF1 *f1 = new TF1("func1D",func1D,0,10,2); f1->SetParameters(2,1); TCanvas *c1 = new TCanvas("c1","TF1 example",200,10,600,400); //can be directly called as a C++ function; cout << "the value of f1(1.) is:" << f1(1.)<< endl; f1->Draw(); TF2 *f2 = new TF2("func2Dname",func2D,-3,3,-3,3,3); f2->SetParameters(100,0,1); TCanvas *c2 = new TCanvas("c2","TF2 example",200,10,600,400); cout << "the value of f2(1.,2.) is:" << func2Dname(1.,2.)<< endl; f2->Draw("surf"); TFile *file = new TFile("functions.root","recreate"); f2->Write(); f1->Write(); file->Close(); }