23 #include "TPaveText.h" 50 if( era ==
CRUZET15 )
str =
"0T cosmic ray data 2015";
51 else if( era ==
CRAFT15 )
str =
"3.8T cosmic ray data 2015";
52 else if( era ==
COLL0T15 )
str =
"0T collision data 2015";
109 static TLegend*
legend(
const int nEntries,
const double relWidth=0.5) {
112 static TLegend*
legend(TString
position,
const int nEntries,
const double relWidth=0.5) {
118 TLegend* leg =
nullptr;
134 static TLegend*
legendTL(
const int nEntries,
const double relWidth=0.5) {
135 return legend(nEntries,relWidth,
true,
true);
137 static TLegend*
legendTR(
const int nEntries,
const double relWidth=0.5) {
138 return legend(nEntries,relWidth,
false,
true);
140 static TLegend*
legendBL(
const int nEntries,
const double relWidth=0.5) {
141 return legend(nEntries,relWidth,
true,
false);
143 static TLegend*
legendBR(
const int nEntries,
const double relWidth=0.5) {
144 return legend(nEntries,relWidth,
false,
false);
152 static TPaveText*
label(
const int nEntries,
const double relWidth=0.5) {
153 return labelTR(nEntries,relWidth);
156 static TPaveText*
label(TString
position,
const int nEntries,
const double relWidth=0.5) {
162 TPaveText*
label =
nullptr;
179 static TPaveText*
labelTL(
const int nEntries,
const double relWidth=0.5) {
180 return label(nEntries,relWidth,
true,
true);
182 static TPaveText*
labelTR(
const int nEntries,
const double relWidth=0.5) {
183 return label(nEntries,relWidth,
false,
true);
185 static TPaveText*
labelBL(
const int nEntries,
const double relWidth=0.5) {
186 return label(nEntries,relWidth,
true,
false);
188 static TPaveText*
labelBR(
const int nEntries,
const double relWidth=0.5) {
189 return label(nEntries,relWidth,
false,
false);
205 static TString
applyCMS(
const TString& txt);
206 static TPaveText*
title(
const TString& txt);
207 static TPaveText*
righttitle(
const TString& txt);
220 static TLegend*
legend(
const int nEntries,
const double relWidth,
const bool left,
const bool top);
221 static TPaveText*
label(
const int nEntries,
const double relWidth,
const bool leftt,
const bool top);
237 x0 = gStyle->GetPadLeftMargin()+
margin_;
238 x1 = x0 + relWidth*(1.-gStyle->GetPadLeftMargin()-gStyle->GetPadRightMargin()-2.*
margin_);
244 x0 = 1.-gStyle->GetPadRightMargin()-
margin_-relWidth*(1.-gStyle->GetPadLeftMargin()-gStyle->GetPadRightMargin()-2.*
margin_);
245 x1 = 1.-gStyle->GetPadRightMargin()-
margin_;
251 y1 = 1.-gStyle->GetPadTopMargin()-
margin_;
258 y1 = gStyle->GetPadBottomMargin()+
margin_;
264 TLegend*
TkAlStyle::legend(
const int nEntries,
const double relWidth,
const bool left,
const bool top) {
275 TLegend* leg =
new TLegend(x0,y0,
x1,
y1);
276 leg->SetBorderSize(0);
277 leg->SetFillColor(0);
278 leg->SetFillStyle(0);
279 leg->SetTextFont(42);
288 TPaveText*
TkAlStyle::label(
const int nEntries,
const double relWidth,
const bool left,
const bool top) {
298 TPaveText*
label =
new TPaveText(x0,y0,
x1,
y1,
"NDC");
299 label->SetBorderSize(0);
300 label->SetFillColor(0);
301 label->SetFillStyle(0);
302 label->SetTextFont(42);
303 label->SetTextAlign(12);
305 label->SetMargin(0.);
316 TString newtxt = txt;
317 newtxt.ReplaceAll(
"#CMS{",
"#scale[1.4]{#font[61]{CMS}} #font[52]{");
318 newtxt.ReplaceAll(
"#noCMS{",
"#font[52]{");
319 newtxt.ReplaceAll(
"#CMS",
"#scale[1.4]{#font[61]{CMS}}");
326 double x0 = gStyle->GetPadLeftMargin();
327 double x1 = 1.-gStyle->GetPadRightMargin();
328 double y0 = 1.-gStyle->GetPadTopMargin();
330 if (txt.Contains(
"#CMS")) y0 += .02;
331 TPaveText* theTitle =
new TPaveText(x0,y0,
x1,
y1,
"NDC");
332 theTitle->SetBorderSize(0);
333 theTitle->SetFillColor(10);
334 theTitle->SetFillStyle(0);
335 theTitle->SetTextFont(42);
336 theTitle->SetTextAlign(13);
337 theTitle->SetTextSize(0.038);
338 theTitle->SetMargin(0.);
348 double x0 = gStyle->GetPadLeftMargin();
349 double x1 = 1.-gStyle->GetPadRightMargin();
350 double y0 = 1.-gStyle->GetPadTopMargin();
352 TPaveText* theTitle =
new TPaveText(x0,y0,
x1,
y1,
"NDC");
353 theTitle->SetBorderSize(0);
354 theTitle->SetFillColor(10);
355 theTitle->SetFillStyle(0);
356 theTitle->SetTextFont(42);
357 theTitle->SetTextAlign(33);
358 theTitle->SetTextSize(0.038);
359 theTitle->SetMargin(0.);
360 theTitle->AddText(newtxt);
370 std::cout <<
"Status not set yet! Can't draw the title!" << std::endl;
372 txt =
"#noCMS{Simulation}";
374 txt =
"#CMS{Preliminary}";
378 txt =
"#CMS{Simulation}";
380 txt =
"#CMS{(unpublished)}";
408 std::cout <<
"Error: you are trying to use a custom title, but you don't provide it" << std::endl;
410 std::cout <<
"Error: you provide a custom title, but you don't indicate CUSTOM status. Your title will not be used." << std::endl;
416 gStyle->SetErrorX(0);
419 gStyle->SetCanvasBorderMode(0);
420 gStyle->SetCanvasColor(kWhite);
421 gStyle->SetCanvasDefH(800);
422 gStyle->SetCanvasDefW(800);
423 gStyle->SetCanvasDefX(0);
424 gStyle->SetCanvasDefY(0);
427 gStyle->SetFrameBorderMode(0);
428 gStyle->SetFrameBorderSize(10);
429 gStyle->SetFrameFillColor(kBlack);
430 gStyle->SetFrameFillStyle(0);
431 gStyle->SetFrameLineColor(kBlack);
432 gStyle->SetFrameLineStyle(0);
433 gStyle->SetFrameLineWidth(2);
434 gStyle->SetLineWidth(3);
437 gStyle->SetPadBorderMode(0);
438 gStyle->SetPadColor(kWhite);
439 gStyle->SetPadGridX(
false);
440 gStyle->SetPadGridY(
false);
441 gStyle->SetGridColor(0);
442 gStyle->SetGridStyle(3);
443 gStyle->SetGridWidth(1);
446 gStyle->SetPadTopMargin(0.08);
447 gStyle->SetPadBottomMargin(0.13);
448 gStyle->SetPadLeftMargin(0.16);
449 gStyle->SetPadRightMargin(0.05);
452 gStyle->SetHistLineColor(kBlack);
453 gStyle->SetHistLineStyle(0);
454 gStyle->SetHistLineWidth(3);
455 gStyle->SetMarkerSize(0.8);
456 gStyle->SetEndErrorSize(4);
457 gStyle->SetHatchesLineWidth(1);
460 gStyle->SetOptStat(0);
463 gStyle->SetAxisColor(1,
"XYZ");
464 gStyle->SetTickLength(0.03,
"XYZ");
465 gStyle->SetNdivisions(510,
"XYZ");
466 gStyle->SetPadTickX(1);
467 gStyle->SetPadTickY(1);
468 gStyle->SetStripDecimals(kFALSE);
471 gStyle->SetTitleColor(1,
"XYZ");
472 gStyle->SetLabelColor(1,
"XYZ");
473 gStyle->SetLabelFont(42,
"XYZ");
474 gStyle->SetLabelOffset(0.007,
"XYZ");
475 gStyle->SetLabelSize(0.04,
"XYZ");
476 gStyle->SetTitleFont(42,
"XYZ");
477 gStyle->SetTitleSize(0.047,
"XYZ");
478 gStyle->SetTitleXOffset(1.2);
479 gStyle->SetTitleYOffset(1.5);
482 gStyle->SetLegendBorderSize(0);
static TString customTitle_
static void setYCoordinatesB(const int nEntries, double &y0, double &y1)
static TString applyCMS(const TString &txt)
static TPaveText * customTitle(const TString &txt)
static TPaveText * label(TString position, const int nEntries, const double relWidth=0.5)
static PublicationStatus status()
static TString customRightTitle_
static TPaveText * standardRightTitle()
static double lineHeight_
static void drawStandardTitle(const Era era)
static void set(const PublicationStatus status, const Era era=NONE, const TString customTitle="", const TString customRightTitle="")
static TPaveText * title(const TString &txt)
static void setYCoordinatesT(const int nEntries, double &y0, double &y1)
static PublicationStatus publicationStatus_
static void drawStandardTitle()
TString toTString(const PublicationStatus status)
static TPaveText * standardTitle()
static TString legendheader
static TPaveText * standardRightTitle(const Era era)
static TPaveText * customRightTitle(const TString &txt)
static void setXCoordinatesL(const double relWidth, double &x0, double &x1)
static TPaveText * labelBR(const int nEntries, const double relWidth=0.5)
static TLegend * legendBR(const int nEntries, const double relWidth=0.5)
static double lineHeight()
static TPaveText * righttitle(const TString &txt)
static TPaveText * labelBL(const int nEntries, const double relWidth=0.5)
static TPaveText * labelTR(const int nEntries, const double relWidth=0.5)
static TString legendoptions
static TLegend * legendBL(const int nEntries, const double relWidth=0.5)
static TString rightheader(const Era era)
static TLegend * legendTR(const int nEntries, const double relWidth=0.5)
static TPaveText * label(const int nEntries, const double relWidth=0.5)
static int position[264][3]
static TLegend * legend(TString position, const int nEntries, const double relWidth=0.5)
static void setXCoordinatesR(const double relWidth, double &x0, double &x1)
static TPaveText * labelTL(const int nEntries, const double relWidth=0.5)
static TLegend * legend(const int nEntries, const double relWidth=0.5)
static TLegend * legendTL(const int nEntries, const double relWidth=0.5)
static TPaveText * standardTitle(PublicationStatus status)
static TString header(const PublicationStatus status)