Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Style.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Style.h
1 #include <TH1.h>
2 #include <TPad.h>
3 #include <TStyle.h>
4 #include <string>
5 
6 // ROOT6 disabled assert. Well....
7 #ifdef assert
8 #undef assert
9 #endif
10 #define assert(exp) \
11 { \
12  if (!(exp)) \
13  { \
14  cout << "Assert (" << #exp << ") failed at " << __FILE__ << " line " << __LINE__ << endl; \
15  exit(1); \
16  } \
17 }
18 
19 TH1 *htmp;
20 
21 void SetPadStyle(bool log = false){
22  gPad->SetLeftMargin(0.10);
23  if ( log ){
24  gPad->SetRightMargin(0.12);
25  }else{
26  gPad->SetRightMargin(0.05);
27  }
28  gPad->SetTopMargin(0.07);
29  gPad->SetBottomMargin(0.15);
30 
31  gStyle->SetLegendBorderSize(0);
32  gStyle->SetLegendFillColor(0);
33 
34  return;
35 }
36 
37 void SetHistoStyle(std::string xtitle="", std::string ytitle="", std::string ztitle="",float size_title=0.06, float size_label=0.055){
38  htmp->SetTitleFont(62);
39  htmp->GetYaxis()->SetLabelFont(62);
40  htmp->GetYaxis()->SetTitleFont(62);
41  htmp->GetYaxis()->SetTitleOffset(0.2);
42  //htmp->GetYaxis()->SetLabelFont(102);
43  //htmp->GetYaxis()->SetTitleFont(102);
44  htmp->GetYaxis()->SetLabelSize(size_label);
45  htmp->GetYaxis()->SetTitleSize(size_title);
46  htmp->GetYaxis()->SetTitle(ytitle.c_str());
47  htmp->GetYaxis()->SetNdivisions(9,5,0);
48  htmp->GetXaxis()->SetLabelFont(62);
49  htmp->GetXaxis()->SetTitleFont(62);
50  //htmp->GetXaxis()->SetLabelFont(102);
51  //htmp->GetXaxis()->SetTitleFont(102);
52  htmp->GetXaxis()->SetLabelSize(size_label);
53  htmp->GetXaxis()->SetTitleSize(size_title);
54  htmp->GetXaxis()->SetTitle(xtitle.c_str());
55  //htmp->GetXaxis()->SetNdivisions(505);
56  htmp->GetXaxis()->SetNdivisions(9,2,0);
57 
58  htmp->GetZaxis()->SetLabelFont(62);
59  htmp->GetZaxis()->SetTitleFont(62);
60  htmp->GetZaxis()->SetTitleOffset(1.3);
61  //htmp->GetZaxis()->SetLabelSize(20);
62  //htmp->GetZaxis()->SetTitleSize(22);
63  htmp->GetZaxis()->SetLabelSize(size_label);
64  htmp->GetZaxis()->SetTitleSize(size_title);
65  htmp->GetZaxis()->SetTitle(ztitle.c_str());
66 
67  return;
68 }
69