This code works:
TF1 *f1 = new TF1(“myfunc”,“TMath::Gaus(x,0,2)”,-5,5);
f1->Draw();
TF1 *f1t = new TF1(“myfunc”,“TMath::Gaus(x,0,5)”,-5,5);
f1t->Draw(“SAME”);
BUT this code doesn’t :
TF1 *f1 = new TF1(“myfunc”,Gfunction1,-5,5,2);
f1->SetParameters(2,0);
f1->Draw();
TF1 *f2 = new TF1(“myfunc”,Gfunction2,-5,5,2);
f2->SetParameters(5,0);
f2->Draw(“SAME”);
with some functions like these:
Double_t Gfunction1(Double_t *x, Double_t *para)
{
Double_t x1 =x[0];
Double_t gf1 = 1/(TMath::Sqrt(2TMath::Pi())para[0]) * TMath::Exp(-0.5((x1-para[1])/para[0])((x1-para[1])/para[0]));
return gf1;
}
Double_t Gfunction2(Double_t *x, Double_t *parb)
{
Double_t x2 =x[0];
Double_t gf2 = 1/(TMath::Sqrt(2TMath::Pi())parb[0]) * TMath::Exp(-0.5((x2-parb[1])/parb[0])((x2-parb[1])/parb[0]));
return gf2;
}
This really drives me nuts !! Please help !