void SetAxisLabels(TH1& hist, char* xtitle, char* ytitle="", double xoffset=1.1, double yoffset=1.4) { TAxis* x = hist.GetXaxis(); TAxis* y = hist.GetYaxis(); x->SetTitle(xtitle); x->SetTitleSize(0.06); x->SetLabelSize(0.05); x->SetTitleOffset(xoffset); x->SetNdivisions(505); y->SetTitle(ytitle); y->SetTitleSize(0.06); y->SetLabelSize(0.05); y->SetTitleOffset(yoffset); y->SetNoExponent(); hist.SetLineWidth(2); hist.SetMarkerStyle(20); std::stringstream str; str << "Events / " << (int) lumi << " pb^{-1} "; std::string defYtitle = str.str(); if(ytitle=="") y->SetTitle( defYtitle.c_str() ); }