void rootforum(){ # define n 5 TCanvas *c2 = new TCanvas("c2","c2",900,1400); c2->Divide(2,5); Double_t p_c[21],rr[21]; for (Int_t k=0;kSetMarkerColor(4); gr->SetMarkerStyle(22); gr->SetMarkerSize(0.8); // gr->Draw("AP"); gr->SetTitle(""); gr->GetYaxis()->SetRangeUser(0.9,1.1); gr->GetXaxis()->SetLimits(-8,8); gr->GetYaxis()->SetTitle("Data/MC"); gr->GetXaxis()->SetTitle("#deltap/p(%)"); gr->GetYaxis()->CenterTitle(); gr->GetXaxis()->CenterTitle(); TLine *b = new TLine(-8,1,8, 1); b->SetLineColor(kRed-3); b->SetLineStyle(8); b->SetLineWidth(2); // b->Draw(); #define nm 21 gr2 = new TGraph(nm,p_c,rr); gr2->SetMarkerColor(4); gr2->SetMarkerStyle(22); gr2->SetMarkerSize(0.8); gr2->SetTitle(""); gr2->GetYaxis()->SetRangeUser(0.9,1.1); gr2->GetXaxis()->SetLimits(-8,8); gr2->GetYaxis()->SetTitle("Data/MC"); gr2->GetXaxis()->SetTitle("#deltap/p(%)"); gr2->GetYaxis()->CenterTitle(); gr2->GetXaxis()->CenterTitle(); TLine *b2 = new TLine(-8,1,8, 1); b2->SetLineColor(kRed-3); b2->SetLineStyle(8); b2->SetLineWidth(2); if(k==0){c2->cd(1); gPad->SetGrid(); gr->GetYaxis()->SetRangeUser(0.8,1.8); gr->Draw("AP"); gr->SetTitle("E=4.612 GeV, Ep=4.2 GeV, #theta =16^{o} w/o #deltap correction"); b->Draw(); c2->cd(2); gPad->SetGrid(); gr2->GetYaxis()->SetRangeUser(0.8,1.8); gr2->Draw("AP"); gr2->SetTitle("E=4.612 GeV, Ep=4.2 GeV #theta =16^{o} w #deltap correction"); b2->Draw();} if(k==1){c2->cd(3); gPad->SetGrid(); gr->Draw("AP"); gr->SetTitle("E=4.612 GeV, Ep=3.696 GeV, #theta =16^{o} w/o #deltap correction"); b->Draw(); c2->cd(4); gPad->SetGrid(); gr2->Draw("AP"); gr2->SetTitle("E=4.612 GeV, Ep=3.696 GeV, #theta =16^{o} w #deltap correction"); b2->Draw();} if(k==2){c2->cd(5); gPad->SetGrid(); gr->Draw("AP"); gr->SetTitle("E=4.612 GeV, Ep=3.252 GeV, #theta =16^{o} w/o #deltap correction"); b->Draw(); c2->cd(6); gPad->SetGrid(); gr2->Draw("AP"); gr2->SetTitle("E=4.612 GeV, Ep=3.252 GeV, #theta =16^{o} w #deltap correction"); b2->Draw();} if(k==3){c2->cd(7); gPad->SetGrid(); gr->Draw("AP"); gr->SetTitle("E=4.612 GeV, Ep=2.862 GeV, #theta =16^{o} w/o #deltap correction"); b->Draw(); c2->cd(8); gPad->SetGrid(); gr2->Draw("AP"); gr2->SetTitle("E=4.612 GeV, Ep=2.862 GeV, #theta =16^{o} w #deltap correction"); b2->Draw();} if(k==4){c2->cd(9); gPad->SetGrid(); gr->Draw("AP"); gr->SetTitle("E=4.612 GeV, Ep=2.519 GeV, #theta =16^{o} w/o #deltap correction"); b->Draw(); c2->cd(10); gPad->SetGrid(); gr2->Draw("AP"); gr2->SetTitle("E=4.612 GeV, Ep=2.519 GeV, #theta =16^{o} w/o #deltap correction"); b2->Draw();} } gStyle->SetTitleW(0.8); gStyle->SetTitleH(0.08); c2->SaveAs("compare_dp.ps"); TImage *img = TImage::Create(); img->FromPad(c2); img->WriteImage("compare_dp.jpeg"); }