#ifndef __CINT__ #include #include #include #include #include #include #include #include #include "TSystem.h" #include "TFile.h" #include "TProfile.h" #include "TChain.h" #include "TH1F.h" #include "TH1D.h" #include "TH2F.h" #include "TF1.h" #include "TGaxis.h" #include "TRandom.h" #include "TNtuple.h" #include "TCanvas.h" #include "TPolyLine.h" #include "TLine.h" #include "TArrow.h" #include "TStyle.h" #include "TGraphErrors.h" #include "TGraph.h" #include "TBranch.h" #include "TLegend.h" #include "TLatex.h" #include "TEllipse.h" #include "TMarker.h" #endif using namespace std; void vertical(){ double TARGET_Errors_X = sqrt(pow(3.2,2)/12); double TARGET_Errors_Y = sqrt(pow(3.2,2)/12); vector vec_xx; vec_xx.clear(); vector vec_yy; vec_yy.clear(); vector vec_ex; vec_ex.clear(); vector vec_ey; vec_ey.clear(); for(unsigned int i=0; i<10; i++){ vec_xx.push_back(1.55); vec_ex.push_back(TARGET_Errors_X); vec_ey.push_back(TARGET_Errors_Y); } vec_yy.push_back(26.35); vec_yy.push_back(23.25); vec_yy.push_back(20.15); vec_yy.push_back(17.05); vec_yy.push_back(13.95); vec_yy.push_back(10.85); vec_yy.push_back(7.75); vec_yy.push_back(4.65); vec_yy.push_back(1.55); vec_yy.push_back(-1.55); float R_TARGET = 29.0; TEllipse *ell_Target = new TEllipse(0, 0, R_TARGET, 0); TH2F *h_NULL = new TH2F("NULL", "NULL", 100,-50,50,100,-50,50); TCanvas *c1 = new TCanvas("c1","c1",200,10,700,700); int bar_number; double ChiS; double ChiS_rotate; int ndf; int ndf_rotate; double a_fit, b_fit; double a_fit_rotate, b_fit_rotate; double sum = 0; vector barn; barn.clear(); vector Y_expected; Y_expected.clear(); TGraph *graph = new TGraphErrors(vec_xx.size(),&vec_xx[0],&vec_yy[0], &vec_ex[0],&vec_ey[0]); TF1 *func_fit = new TF1("gr", "pol1"); graph->SetMarkerColor(4); graph->SetMarkerStyle(21); graph->SetMarkerSize(0.8); graph->GetYaxis()->SetTitle("Y title"); graph->GetXaxis()->SetLimits(-50.,50.); graph->GetYaxis()->SetRangeUser(-50.,50.); graph->Fit("gr",""); func_fit = graph->GetFunction("gr"); func_fit->SetLineWidth(2); func_fit->SetLineColor(2); a_fit = func_fit->GetParameter(1); b_fit = func_fit->GetParameter(0); ChiS = func_fit->GetChisquare(); ndf = func_fit->GetNDF(); char ChiS_string[30]; char ndf_string[30]; sprintf(ChiS_string,"#chi^{2} = %3.2f", ChiS); sprintf(ndf_string,"NdF = %3i", ndf); TLatex *tex_ChiS; tex_ChiS = new TLatex(-45.,43.,ChiS_string); tex_ChiS->SetTextSize(0.05); tex_ChiS->SetLineWidth(2); TLatex *tex_ndf; tex_ndf = new TLatex(-45.,35.,ndf_string); tex_ndf->SetTextSize(0.05); tex_ndf->SetLineWidth(2); c1->cd(); h_NULL->Draw(); ell_Target->Draw("same"); graph->Draw("sameP"); tex_ChiS->Draw("same"); tex_ndf->Draw("same"); }