#include "TROOT.h" #include "TStyle.h" #include "TLatex.h" #include "TCanvas.h" #include "TAxis.h" #include "TH2.h" #include void setstyle(){ gROOT->SetStyle("Plain"); gStyle->SetTitleAlign(23); gStyle->SetTitleX(0.54); gStyle->SetTitleY(0.97); gStyle->SetTitleBorderSize(0); gStyle->SetTitleFillColor(0); gStyle->SetTitleColor(1); gStyle->SetLabelFont(132,"xyz"); gStyle->SetTitleFont(132,"xyz"); gStyle->SetTitleFont(132,""); gStyle->SetTextFont(132); gStyle->SetStatFont(132); gStyle->SetOptStat(0); gStyle->SetNdivisions(510,"xyz"); gStyle->SetNdivisions(505,"z"); gStyle->SetLabelSize(0.075,"xyz"); gStyle->SetTitleSize(0.075,"xyz"); gStyle->SetTitleSize(0.075,""); gStyle->SetPadTopMargin(0.15); gStyle->SetPadRightMargin(0.10); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.18); gStyle->SetOptLogz(0); } void plot_first2plus(){ setstyle(); TCanvas *c1 = new TCanvas("c1","c1",500,400); TH2D *h = new TH2D("h","2^{+}_{1} energies (MeV)",81,-1.,161.,56,-1.,111.); std::ifstream ifs("first2plus.dat"); Int_t n,z; Double_t e; while (ifs >> z >> n >> e) { h->Fill(n,z,e/1000.); } h->SetMaximum(4); h->GetXaxis()->SetTitle("Neutron number #it{N}"); h->GetYaxis()->SetTitle("Proton number #it{Z}"); h->GetXaxis()->CenterTitle(); h->GetYaxis()->CenterTitle(); h->Draw("colz"); TLatex Tl; Tl.SetTextAlign(12); Tl.SetNDC(); Tl.SetTextSize(0.075); Tl.DrawLatex(0.20,0.80,"#it{Z}: even"); Tl.DrawLatex(0.20,0.73,"#it{N}: even"); }