#include #include #include #include double Polynomial(double *x, double *p) { double pt = x[0]; double r1 = p[0]; double r2 = p[1]; double r3 = p[2]; return ((r1 / pt) + r2 + (r3 * pt)); } void Resolution() { double pt[] = {6.01,7.22,8.3,9.5,11.13,13.2,15.7,18.8,22.8,27.8,33.8,40.7,47.5,56,65.7,74,83,94,114.8,257,790}; double sigma_p[] = {0.023855,0.022431,0.021708,0.021371,0.0211805,0.0210424,0.020941,0.02085,0.020890,0.0210337,0.021544,0.022563,0.0236712,0.025083,0.026661,0.028172,0.029741,0.031934,0.035853,0.058032,0.16492}; double ptErr[21] = {0}; double sigma_pErr[21] = {8.22532e-5,7.29242e-5,6.51599e-5,4.76926e-5,3.41133e-5,2.63541e-5,2.03043e-5,1.47595e-5,1.04184e-5, 7.39753e-6, 5.66419e-6,5.14417e-6,6.71955e-6,1.19958e-5,1.95962e-5,2.97351e-5,3.90926e-5,4.34482e-5,5.3202e-5,8.55124e-5,0.000510072}; TCanvas *c1 = new TCanvas("c1", "Canvas Title", 900, 700); auto graph = new TGraphErrors(21, pt, sigma_p, ptErr, sigma_pErr); auto fitDSCB = new TF1("fitDSCB", Polynomial,6,800, 3); graph->Fit(fitDSCB, "S"); //Uncalib : double pt2[] = {6.01,7.22,8.3,9.5,11.13,13.2,15.7,18.8,22.8,27.8,33.8,40.7,47.5,56,65.7,74,83,94,114.8,257,790}; double sigma_p2[] = {0.0216551,0.020257,0.0194537,0.0190534,0.0188387,0.0187114,0.018608,0.0184781,0.0185055,0.0186022,0.019064,0.020050,0.021087,0.022381,0.023809,0.025173,0.026504,0.028425,0.031944,0.051236,0.137146}; double sigma_Err_2[21] = {8.04709e-05,7.07991e-05,6.24584e-05,4.5208e-05,3.2037e-05,2.45764e-05,1.88858e-05,1.36431e-05,9.61233e-06, 6.81246e-06,5.21191e-06,4.74022e-06,6.2046e-06,1.10945e-05,1.81462e-05,2.75359e-05,3.62246e-05,4.02906e-05,4.92003e-05,7.87072e-05,0.000448358}; auto graph2 = new TGraphErrors(21, pt2, sigma_p2, ptErr, sigma_Err_2); auto fitDSCB2 = new TF1("fitDSCB2", Polynomial,6,800, 3); graph2->Fit(fitDSCB2, "S"); graph2->SetMarkerStyle(20); graph2->SetMarkerColor(6); graph->SetMarkerStyle(20); graph->SetMarkerColor(4); c1->SetLogx(); c1->SetLogy(); graph->GetYaxis()->SetRangeUser(0.01, 1.0); graph2->GetYaxis()->SetRangeUser(0.01, 1.0); graph2->GetYaxis()->SetTitleSize(0.02); graph2->GetYaxis()->SetLabelSize(0.03); gStyle->SetOptFit(1); fitDSCB->SetLineColor(kGreen); fitDSCB2->SetLineColor(kRed); graph2->Draw("AP"); graph->Draw("P"); // Draw fits fitDSCB2->Draw("SAME"); fitDSCB->Draw("SAME");