void plot_res(){ gROOT->Reset(); gROOT->SetStyle("Plain"); gROOT->ForceStyle(); gStyle->SetOptStat(0); gStyle->SetOptFit(000); gStyle->SetTitleX(0.1f); gStyle->SetTitleW(0.8f); gStyle->SetTextSize(1.5); gStyle->SetTitleFont(132,"xy"); gStyle->SetLabelFont(132,"xy"); // gStyle->SetLabelFont(62,"xy"); // gStyle->SetLabelSize(0.073,"xy"); // gStyle->SetTitleSize(0.086,"xy"); gStyle->SetLabelSize(0.055,"xy"); gStyle->SetTitleSize(0.065,"xy"); gStyle->SetTitleOffset(1.0,"x"); gStyle->SetTitleOffset(0.8,"y"); // double x[11] = {0.25, 0.75, 1.25, 1.75, 3.25, 4.25, 5.25, 6.26, 7.25, 8.25, 9.25}; // double res[11]={0.416, 0.348, 0.326, 0.237, 0.206, 0.184, 0.172, 0.162, 0.156, 0.149, 0.143}; // double eres[11]={3e-3, 6.9e-3, 7.5e-3, 2.8e-3, 1.6e-3, 2.6e-3, 3.4e-3, 5e-3, 7.4e-3, 8.6e-3, 1.1e-2}; double x[11] = {0.75, 1.25, 1.75, 2.25, 3.25, 4.25, 5.25, 6.26, 7.25, 8.25, 9.25}; double res[11] = {0.357, 0.322, 0.279, 0.24, 0.206, 0.184, 0.172, 0.162, 0.156, 0.149, 0.143}; double eres[11] = {6.9e-3, 4.4e-3, 3.0e-3, 2.e-3, 1.6e-3, 2.6e-3, 3.4e-3, 5e-3, 7.4e-3, 8.6e-3, 1.1e-2}; double ex[11]; memset(ex,0,sizeof(ex)); for(int ii = 0; ii < 11;ii++){ res[ii] = res[ii]/1.03; eres[ii] = eres[ii]/10.; } TCanvas *c1 = new TCanvas("c1","Test",200,10, 600, 400); gPad->SetBottomMargin(0.15); gPad->SetTopMargin(0.05); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.05); TF1 *f1 = new TF1("f1","sqrt([0]*[0]/x + [1]*[1])",0.75, 9.); TGraphErrors *gr = new TGraphErrors(11,x,res,ex,eres); f1->SetLineColor(2); f1->SetLineWidth(2); gr->SetMaximum(0.4); gr->Fit(f1,"","",0.75,10.); gr->SetMarkerStyle(20); gr->SetMarkerSize(1.2); gr->SetMarkerColor(4); gr->GetXaxis()->SetTitle("Energy (GeV)"); gr->GetYaxis()->SetTitle("#sigma_{t} (ns)"); gr->SetTitle(""); gr->Draw("AP"); TLatex *text = new TLatex(4, 0.3, "#sigma_{t} (ns) = #frac{0.32 }{#sqrt{E}} #otimes 0.09 "); // TLatex Tl; // Tl.SetTextAlign(12); // Tl.SetTextSize(0.04); // Tl.DrawLatex(4, 0.3, "#sigma_{t} (ns) = #frac{0.32 ns}{#sqrt{E}} #otimes 0.09 ns "); text -> SetTextFont(132); text->SetTextSize(0.07); text->Draw(); }