Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:34

0001 #include <TH1.h>
0002 #include <TPad.h>
0003 #include <TStyle.h>
0004 #include <string>
0005 
0006 // ROOT6 disabled assert. Well....
0007 #ifdef assert
0008 #undef assert
0009 #endif
0010 #define assert(exp)                                                                           \
0011 {                                                                                             \
0012   if (!(exp))                                                                                 \
0013   {                                                                                           \
0014     cout << "Assert (" << #exp << ") failed at " << __FILE__ << " line " << __LINE__ << endl; \
0015     exit(1);                                                                                  \
0016   }                                                                                           \
0017 }
0018 
0019 TH1 *htmp;
0020 
0021 void SetPadStyle(bool log = false){
0022     gPad->SetLeftMargin(0.10);
0023     if ( log ){
0024         gPad->SetRightMargin(0.12);
0025     }else{
0026         gPad->SetRightMargin(0.05);
0027     }
0028     gPad->SetTopMargin(0.07);
0029     gPad->SetBottomMargin(0.15);
0030 
0031     gStyle->SetLegendBorderSize(0);
0032     gStyle->SetLegendFillColor(0);
0033 
0034     return;
0035 }
0036 
0037 void SetHistoStyle(std::string xtitle="", std::string ytitle="", std::string ztitle="",float size_title=0.06, float size_label=0.055){
0038     htmp->SetTitleFont(62);
0039     htmp->GetYaxis()->SetLabelFont(62);
0040     htmp->GetYaxis()->SetTitleFont(62);
0041     htmp->GetYaxis()->SetTitleOffset(0.2);
0042     //htmp->GetYaxis()->SetLabelFont(102);
0043     //htmp->GetYaxis()->SetTitleFont(102);
0044     htmp->GetYaxis()->SetLabelSize(size_label);
0045     htmp->GetYaxis()->SetTitleSize(size_title);
0046     htmp->GetYaxis()->SetTitle(ytitle.c_str());
0047     htmp->GetYaxis()->SetNdivisions(9,5,0);
0048     htmp->GetXaxis()->SetLabelFont(62);
0049     htmp->GetXaxis()->SetTitleFont(62);
0050     //htmp->GetXaxis()->SetLabelFont(102);
0051     //htmp->GetXaxis()->SetTitleFont(102);
0052     htmp->GetXaxis()->SetLabelSize(size_label);
0053     htmp->GetXaxis()->SetTitleSize(size_title);
0054     htmp->GetXaxis()->SetTitle(xtitle.c_str());
0055     //htmp->GetXaxis()->SetNdivisions(505);
0056     htmp->GetXaxis()->SetNdivisions(9,2,0);
0057 
0058     htmp->GetZaxis()->SetLabelFont(62);
0059     htmp->GetZaxis()->SetTitleFont(62);
0060     htmp->GetZaxis()->SetTitleOffset(1.3);
0061     //htmp->GetZaxis()->SetLabelSize(20);
0062     //htmp->GetZaxis()->SetTitleSize(22);
0063     htmp->GetZaxis()->SetLabelSize(size_label);
0064     htmp->GetZaxis()->SetTitleSize(size_title);
0065     htmp->GetZaxis()->SetTitle(ztitle.c_str());
0066 
0067     return;
0068 }
0069