Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:11:16

0001 #pragma once
0002 
0003 int GetSphenixColor()
0004 {
0005   // RGB = (62, 136, 209)
0006   Int_t color_index = TColor::GetFreeColorIndex();
0007   TColor* my_color = new TColor(color_index,
0008                                 62.0 / 255.0,
0009                                 136.0 / 255.0,
0010                                 209.0 / 255.0);
0011 
0012   return color_index;  // my_color->GetColor();
0013 }
0014 
0015 void WritesPhenix(int mode = 0, double pos_x = 0.2, double pos_y = 0.96, double text_size = 0.04)
0016 {
0017   TLatex* tex = new TLatex();
0018   tex->SetTextSize(text_size);
0019 
0020   if (mode == 0)
0021     tex->DrawLatexNDC(pos_x, pos_y, "#it{#bf{sPHENIX}} Internal");
0022   else if (mode == 1)
0023     tex->DrawLatexNDC(pos_x, pos_y, "#it{#bf{sPHENIX}} Preliminary");
0024   else if (mode == 2)
0025     tex->DrawLatexNDC(pos_x, pos_y, "#it{#bf{sPHENIX}} Work in Progress");
0026   else if (mode == 3)
0027     tex->DrawLatexNDC(pos_x, pos_y, "#it{#bf{sPHENIX}} Performance");
0028   else if (mode == 4)
0029     tex->DrawLatexNDC(pos_x, pos_y, "#it{#bf{sPHENIX}} Simulation Performance");
0030 
0031   delete tex;
0032 };
0033 
0034 void WriteRunCondition(double pos_x = 0.2, double pos_y = 0.675, bool is_mc = false, double text_size = 0.04, bool is_single_line=false )
0035 {
0036   TLatex* tex = new TLatex();
0037   tex->SetTextSize(text_size);
0038 
0039   if (is_mc == false)
0040   {
0041     if( is_single_line == false )
0042     {
0043       tex->DrawLatexNDC(pos_x, pos_y, "p^{#uparrow}+p^{#uparrow} Run2024 #sqrt{s} = 200 GeV");
0044     }
0045     else
0046     {
0047       tex->DrawLatexNDC(pos_x, pos_y, "p^{#uparrow}+p^{#uparrow} Run2024");
0048       tex->DrawLatexNDC(pos_x - 0.01, pos_y - 0.05, "#sqrt{s} = 200 GeV");
0049     }
0050   }
0051   else
0052     tex->DrawLatexNDC(pos_x, pos_y, "Simulation");
0053 
0054   delete tex;
0055 }
0056 
0057 void WriteDate(double pos_x = 0.775, double pos_y = 0.955, double text_size = 0.04, string fixed_date = "" )
0058 {
0059   TLatex* tex = new TLatex();
0060   tex->SetTextSize(text_size);
0061 
0062   TDatime now;
0063   int year = now.GetYear();
0064   int month = now.GetMonth();
0065   int day = now.GetDay();
0066   stringstream message;
0067   message << month << "/" << day << "/" << year;
0068 
0069   if( fixed_date == "" )
0070     tex->DrawLatexNDC(pos_x, pos_y, message.str().c_str());
0071   else
0072     tex->DrawLatexNDC(pos_x, pos_y, fixed_date.c_str());
0073 
0074   delete tex;
0075 };
0076 
0077 void HistSetting(TH1D* hist, int color)
0078 {
0079   hist->SetLineColor(color);
0080   hist->SetFillColorAlpha(color, 0.1);
0081 }