Hello,
I am unable to get the title of my TF1 graph to show up. It comes up as “myfunction.” Here is my source code…
#include <iostream>
using namespace std;
void main()
{
TCanvas *c1 = new TCanvas("c1", "br");
TF1 *f1 = new TF1("Differential Cross Section of Compton Scattering for 5MeV Photons",myfunction,0,10,3);
f1->SetParameters(0.0794, 9.769, 5.0);
f1->SetParNames("electron radius squared","Incident Photon Energy/Rest Mass Energy of Electron", "Incident Photon Energy");
gPad -> SetLogy();
f1->Draw();
f1->GetHistogram()->GetYaxis()->SetTitle("d#sigma/dE_{k}(barns/MeV)");
f1->GetHistogram()->GetXaxis()->SetTitle("Kinetic Energy of Ejected Electron = E_{k}(MeV)");
c1->Modified();
}
Double_t myfunction(Double_t *x, Double_t *par)
{
const Double_t pi = TMath::Pi();
Float_t y = x[0];
Double_t f = (pi*par[0])/(par[1]*par[2])*(2-(2*y)/(par[1]*(par[2]-y))+(y*y)/((par[1]*par[1])*(par[2]-y)*(par[2]-y))+(y*y/(par[2]*(par[2]-y))));
return f;
}