Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:14:46

0001 
0002 #ifndef SetOKStyle_C
0003 #define SetOKStyle_C
0004 
0005 
0006 void
0007 SetOKStyle()
0008 {
0009   TStyle* OKStyle = new TStyle("OKStyle", "OK Default Style");
0010 
0011   // Colors
0012 
0013   //set the background color to white
0014   OKStyle->SetFillColor(10);
0015   OKStyle->SetFrameFillColor(kWhite);
0016   OKStyle->SetFrameFillStyle(0);
0017   OKStyle->SetFillStyle(0);
0018   OKStyle->SetCanvasColor(kWhite);
0019   OKStyle->SetPadColor(kWhite);
0020   OKStyle->SetTitleFillColor(0);
0021   OKStyle->SetStatColor(kWhite);
0022 
0023   // Get rid of drop shadow on legends
0024   // This doesn't seem to work.  Call SetBorderSize(1) directly on your TLegends
0025   OKStyle->SetLegendBorderSize(1);
0026 
0027   //don't put a colored frame around the plots
0028   OKStyle->SetFrameBorderMode(0);
0029   OKStyle->SetCanvasBorderMode(0);
0030   OKStyle->SetPadBorderMode(0);
0031 
0032   //use the primary color palette
0033   OKStyle->SetPalette(1, 0);
0034 
0035   //set the default line color for a histogram to be black
0036   OKStyle->SetHistLineColor(kBlack);
0037 
0038   //set the default line color for a fit function to be red
0039   OKStyle->SetFuncColor(kBlue);
0040 
0041   //make the axis labels black
0042   OKStyle->SetLabelColor(kBlack, "xyz");
0043 
0044   //set the default title color to be black
0045   OKStyle->SetTitleColor(kBlack);
0046 
0047   //set the margins
0048   OKStyle->SetPadBottomMargin(0.15);
0049   OKStyle->SetPadLeftMargin(0.1);
0050   OKStyle->SetPadTopMargin(0.075);
0051   OKStyle->SetPadRightMargin(0.1);
0052 
0053   //set axis label and title text sizes
0054   OKStyle->SetLabelSize(0.035, "xyz");
0055   OKStyle->SetTitleSize(0.05, "xyz");
0056   OKStyle->SetTitleOffset(0.9, "xyz");
0057   OKStyle->SetStatFontSize(0.035);
0058   OKStyle->SetTextSize(0.05);
0059   OKStyle->SetTitleBorderSize(0);
0060   OKStyle->SetTitleStyle(0);
0061 
0062   OKStyle->SetLegendBorderSize(0);
0063 
0064   //set line widths
0065   OKStyle->SetHistLineWidth(1);
0066   OKStyle->SetFrameLineWidth(2);
0067   OKStyle->SetFuncWidth(2);
0068 
0069   // Misc
0070 
0071   //align the titles to be centered
0072   //OKStyle->SetTextAlign(22);
0073 
0074   //turn off xy grids
0075   OKStyle->SetPadGridX(1);
0076   OKStyle->SetPadGridY(1);
0077 
0078   //set the tick mark style
0079   OKStyle->SetPadTickX(1);
0080   OKStyle->SetPadTickY(1);
0081 
0082   //don't show the fit parameters in a box
0083   OKStyle->SetOptFit(0);
0084 
0085   //set the default stats shown
0086   OKStyle->SetOptStat(1);
0087 
0088   //marker settings
0089 //  OKStyle->SetMarkerStyle(8);
0090 //  OKStyle->SetMarkerSize(0.7);
0091 
0092   // Fonts
0093   OKStyle->SetStatFont(42);
0094   OKStyle->SetLabelFont(42, "xyz");
0095   OKStyle->SetTitleFont(42, "xyz");
0096   OKStyle->SetTextFont(42);
0097 
0098   // Set the paper size for output
0099   OKStyle->SetPaperSize(TStyle::kUSLetter);
0100 
0101 
0102 //  // color palette - manually define 'kBird' palette only available in ROOT 6
0103 //  Int_t alpha = 0;
0104 //  Double_t stops[9] = { 0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000};
0105 //  Double_t red[9]   = { 0.2082, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764};
0106 //  Double_t green[9] = { 0.1664, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832};
0107 //  Double_t blue[9]  = { 0.5293, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539};
0108 //  TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
0109 
0110   //done
0111   OKStyle->cd();
0112 
0113   cout << "Using Jin's Style" << endl;
0114 }
0115 
0116 #endif