void mass2() { gStyle->SetTitleFontSize(.12); gStyle->SetTitleYOffset(0.85); gStyle->SetTitleXOffset(1.0); auto c1 = new TCanvas("c1","multigraph",1000,800); c1->SetLogy(); std::ifstream filein1("9B_gs_40MeV.txt"); std::ifstream filein2("9Be_elas_40Mev.txt"); //std::ifstream filein12("12Cfit.txt"); vector grX1; vector grY1; vector grYE1; vector grX2; vector grY2; vector grYE2; auto mg = new TMultiGraph(); Double_t a, b, c; int n1=0; while (filein1 >> a >> b >> c) { grX1.push_back(a); grY1.push_back(b); grYE1.push_back(c); n1++; } int n2=0; while (filein2 >> a >> b >> c) { grX2.push_back(a); grY2.push_back(b); grYE2.push_back(c); n2++; } TGraphErrors * Gr1= new TGraphErrors(n1, &grX1[0], &grY1[0], 0, &grYE1[0]); Gr1->SetMarkerColor(kBlue); Gr1->SetMarkerSize(1.2); Gr1->SetMarkerStyle(21); mg->Add(Gr1); TGraphErrors * Gr2= new TGraphErrors(n2, &grX2[0], &grY2[0], 0, &grYE2[0]); Gr2->SetMarkerColor(kRed); Gr2->SetMarkerSize(1.2); Gr2->SetMarkerStyle(21); mg->Add(Gr2); mg->Draw("ap"); mg->GetHistogram()->SetMaximum(1000); mg->GetHistogram()->SetMinimum(0.01); mg->GetXaxis()->SetLimits(0.1,140); mg->GetXaxis()->SetLabelFont(42); mg->GetXaxis()->SetLabelSize(0.04); mg->GetXaxis()->SetTitleOffset(1); mg->GetXaxis()->SetTitleFont(42); mg->GetYaxis()->SetTitle(""); mg->GetYaxis()->CenterTitle(true); mg->GetYaxis()->SetLabelFont(42); mg->GetYaxis()->SetLabelSize(0.04); gStyle->SetEndErrorSize(3); // Gr1->GetXaxis()->SetTitle("dS"); TLegend *leg = new TLegend(); //leg->SetHeader("The Legend Title"); leg->SetBorderSize(0); leg->AddEntry("Gr1","{}^{9}Be({}^{3}He,{}^{3}He){}^{9}Be, g.s","EP"); leg->SetMarkerColor(kBlue); leg->AddEntry("Gr2","{}^{9}Be({}^{3}He,t){}^{9}B, g.s","EP"); leg->Draw(); c1->SaveAs("9B_40MeV.pdf"); //canv->SaveAs("he4.C"); }