// Reads the points from a file and produces a simple graph. int read_graph_txt_MC_data(){ auto c=new TCanvas(); c->SetGridy(); // Read MC from txt file TGraphErrors TGraphErrors graph1("./mean_variation_MC.txt","%lg %lg %lg %lg"); // * means not select this column of data graph1.SetTitle("MC;" "#gamma Energy (GeV);" "#mu of pi0_M_Prefit"); graph1.SetLineWidth(2); graph1.SetLineColor(4); graph1.SetMarkerStyle(20); graph1.SetMarkerColor(kBlue); // graph2.SetDrawOption("P"); // graph1.GetXaxis()->SetRangeUser(0, 2.5); // graph1.GetYaxis()->SetRangeUser(0.13, 0.14); graph1.GetXaxis()->CenterTitle(); graph1.GetYaxis()->CenterTitle(); graph1.GetXaxis()->SetTitleSize(0.04); graph1.GetYaxis()->SetTitleSize(0.04); // graph2.DrawClone("AP"); // Print the data pount graph1.Print(); cout<< "================================================"<< endl; // Read data from txt file TGraphErrors TGraphErrors graph2("./mean_variation_data.txt","%lg %lg %lg %lg"); // * means not select this column of data graph2.SetTitle("Data;" "#gamma Energy (GeV);" "#mu of pi0_M_Prefit"); graph2.SetLineWidth(2); graph2.SetLineColor(2); graph2.SetMarkerStyle(20); graph2.SetMarkerColor(kRed); // graph1.SetDrawOption("P"); // graph2.GetXaxis()->SetRangeUser(0, 2.5); // graph2.GetYaxis()->SetRangeUser(0.13, 0.14); graph2.GetXaxis()->CenterTitle(); graph2.GetYaxis()->CenterTitle(); graph2.GetXaxis()->SetTitleSize(0.04); graph2.GetYaxis()->SetTitleSize(0.04); // graph1.DrawClone("AP"); // Print the data pount graph2.Print(); cout<< "================================================"<< endl; // MultiGraph TMultiGraph (mg); mg.Add(&graph1); //, "L" mg.Add(&graph2); mg.GetXaxis()->SetTitle("#gamma Energy (GeV)"); mg.GetYaxis()->SetTitle("#sigma of M(#pi^{0})"); mg.GetXaxis()->CenterTitle(); mg.GetYaxis()->CenterTitle(); // mg.GetXaxis()->SetRangeUser(0, 2.5); mg.GetHistogram()->GetXaxis()->SetRangeUser(0.,2.5); mg.GetYaxis()->SetRangeUser(0.13, 0.14); //mean mg.GetXaxis()->SetTitleSize(0.04); mg.GetYaxis()->SetTitleSize(0.04); mg.GetYaxis()->SetNdivisions(5); mg.DrawClone("AP"); c->Update(); c->GetFrame()->SetBorderSize(12); c->Modified(); // c->SetLogy(); // c->SetLogx(); c->BuildLegend(); return 0; }