CMS 3D CMS Logo

Functions | Variables
CMS_lumi.h File Reference
#include "TPad.h"
#include "TLatex.h"
#include "TLine.h"
#include "TBox.h"
#include <iostream>

Go to the source code of this file.

Functions

void CMS_lumi (TPad *pad, int iPeriod=3, int iPosX=10)
 

Variables

TString cmsText = "CMS"
 
float cmsTextFont = 61
 
float cmsTextOffset = 0.1
 
float cmsTextSize = 0.75
 
bool drawLogo = false
 
float extraOverCmsTextSize = 0.76
 
TString extraText = "Preliminary"
 
float extraTextFont = 52
 
TString lumi_13TeV = "20.1 fb^{-1}"
 
TString lumi_7TeV = "5.1 fb^{-1}"
 
TString lumi_8TeV = "19.7 fb^{-1}"
 
TString lumi_sqrtS = ""
 
float lumiTextOffset = 0.2
 
float lumiTextSize = 0.6
 
float relExtraDY = 1.2
 
float relPosX = 0.045
 
float relPosY = 0.035
 
bool writeExtraText = false
 

Function Documentation

◆ CMS_lumi()

void CMS_lumi ( TPad *  pad,
int  iPeriod = 3,
int  iPosX = 10 
)

Definition at line 43 of file CMS_lumi.h.

43  {
44  bool outOfFrame = false;
45  if (iPosX / 10 == 0) {
46  outOfFrame = true;
47  }
48  int alignY_ = 3;
49  int alignX_ = 2;
50  if (iPosX / 10 == 0)
51  alignX_ = 1;
52  if (iPosX == 0)
53  alignX_ = 1;
54  if (iPosX == 0)
55  alignY_ = 1;
56  if (iPosX / 10 == 1)
57  alignX_ = 1;
58  if (iPosX / 10 == 2)
59  alignX_ = 2;
60  if (iPosX / 10 == 3)
61  alignX_ = 3;
62  //if( iPosX == 0 ) relPosX = 0.12;
63  int align_ = 10 * alignX_ + alignY_;
64 
65  float H = pad->GetWh();
66  float W = pad->GetWw();
67  float l = pad->GetLeftMargin();
68  float t = pad->GetTopMargin();
69  float r = pad->GetRightMargin();
70  float b = pad->GetBottomMargin();
71  // float e = 0.025;
72 
73  pad->cd();
74 
75  TString lumiText;
76  if (iPeriod == 1) {
77  lumiText += lumi_7TeV;
78  lumiText += " (7 TeV)";
79  } else if (iPeriod == 2) {
80  lumiText += lumi_8TeV;
81  lumiText += " (8 TeV)";
82  } else if (iPeriod == 3) {
83  lumiText = lumi_8TeV;
84  lumiText += " (8 TeV)";
85  lumiText += " + ";
86  lumiText += lumi_7TeV;
87  lumiText += " (7 TeV)";
88  } else if (iPeriod == 4) {
89  lumiText += lumi_13TeV;
90  lumiText += " (#sqrt{s} = 13 TeV)";
91  } else if (iPeriod == 7) {
92  if (outOfFrame)
93  lumiText += "#scale[0.85]{";
94  lumiText += lumi_13TeV;
95  lumiText += " (13 TeV)";
96  lumiText += " + ";
97  lumiText += lumi_8TeV;
98  lumiText += " (8 TeV)";
99  lumiText += " + ";
100  lumiText += lumi_7TeV;
101  lumiText += " (7 TeV)";
102  if (outOfFrame)
103  lumiText += "}";
104  } else if (iPeriod == 12) {
105  lumiText += "8 TeV";
106  } else if (iPeriod == 0) {
107  lumiText += lumi_sqrtS;
108  }
109 
110  std::cout << lumiText << std::endl;
111 
112  TLatex latex;
113  latex.SetNDC();
114  latex.SetTextAngle(0);
115  latex.SetTextColor(kBlack);
116 
117  float extraTextSize = extraOverCmsTextSize * cmsTextSize;
118 
119  latex.SetTextFont(42);
120  latex.SetTextAlign(31);
121  latex.SetTextSize(lumiTextSize * t);
122  latex.DrawLatex(1 - r, 1 - t + lumiTextOffset * t, lumiText);
123 
124  if (outOfFrame) {
125  latex.SetTextFont(cmsTextFont);
126  latex.SetTextAlign(11);
127  latex.SetTextSize(cmsTextSize * t);
128  latex.DrawLatex(l, 1 - t + lumiTextOffset * t, cmsText);
129  }
130 
131  pad->cd();
132 
133  float posX_ = 0;
134  if (iPosX % 10 <= 1) {
135  posX_ = l + relPosX * (1 - l - r);
136  } else if (iPosX % 10 == 2) {
137  posX_ = l + 0.5 * (1 - l - r);
138  } else if (iPosX % 10 == 3) {
139  posX_ = 1 - r - relPosX * (1 - l - r);
140  }
141  float posY_ = 1 - t - relPosY * (1 - t - b);
142  if (!outOfFrame) {
143  if (drawLogo) {
144  posX_ = l + 0.045 * (1 - l - r) * W / H;
145  posY_ = 1 - t - 0.045 * (1 - t - b);
146  float xl_0 = posX_;
147  float yl_0 = posY_ - 0.15;
148  float xl_1 = posX_ + 0.15 * H / W;
149  float yl_1 = posY_;
150  TPad* pad_logo = new TPad("logo", "logo", xl_0, yl_0, xl_1, yl_1);
151  pad_logo->Draw();
152  pad_logo->cd();
153  pad_logo->Modified();
154  pad->cd();
155  } else {
156  latex.SetTextFont(cmsTextFont);
157  latex.SetTextSize(cmsTextSize * t);
158  latex.SetTextAlign(align_);
159  latex.DrawLatex(posX_, posY_, cmsText);
160  if (writeExtraText) {
161  latex.SetTextFont(extraTextFont);
162  latex.SetTextAlign(align_);
163  latex.SetTextSize(extraTextSize * t);
164  latex.DrawLatex(posX_, posY_ - relExtraDY * cmsTextSize * t, extraText);
165  }
166  }
167  } else if (writeExtraText) {
168  if (iPosX == 0) {
169  posX_ = l + relPosX * (1 - l - r);
170  posY_ = 1 - t + lumiTextOffset * t;
171  }
172  latex.SetTextFont(extraTextFont);
173  latex.SetTextSize(extraTextSize * t);
174  latex.SetTextAlign(align_);
175  latex.DrawLatex(posX_, posY_, extraText);
176  }
177  return;
178 }

References b, cmsText, cmsTextFont, cmsTextSize, gather_cfg::cout, drawLogo, extraOverCmsTextSize, extraText, extraTextFont, class-composition::H, cmsLHEtoEOSManager::l, lumi_13TeV, lumi_7TeV, lumi_8TeV, lumi_sqrtS, lumiTextOffset, lumiTextSize, alignCSCRings::r, relExtraDY, relPosX, relPosY, OrderedSet::t, and writeExtraText.

Variable Documentation

◆ cmsText

TString cmsText = "CMS"

Definition at line 14 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ cmsTextFont

float cmsTextFont = 61

Definition at line 15 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ cmsTextOffset

float cmsTextOffset = 0.1

Definition at line 26 of file CMS_lumi.h.

◆ cmsTextSize

float cmsTextSize = 0.75

Definition at line 25 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ drawLogo

bool drawLogo = false

Definition at line 39 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ extraOverCmsTextSize

float extraOverCmsTextSize = 0.76

Definition at line 33 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ extraText

TString extraText = "Preliminary"

Definition at line 18 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ extraTextFont

float extraTextFont = 52

Definition at line 19 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumi_13TeV

TString lumi_13TeV = "20.1 fb^{-1}"

Definition at line 35 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumi_7TeV

TString lumi_7TeV = "5.1 fb^{-1}"

Definition at line 37 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumi_8TeV

TString lumi_8TeV = "19.7 fb^{-1}"

Definition at line 36 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumi_sqrtS

TString lumi_sqrtS = ""

Definition at line 38 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumiTextOffset

float lumiTextOffset = 0.2

Definition at line 24 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumiTextSize

float lumiTextSize = 0.6

Definition at line 23 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ relExtraDY

float relExtraDY = 1.2

Definition at line 30 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ relPosX

float relPosX = 0.045

Definition at line 28 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ relPosY

float relPosY = 0.035

Definition at line 29 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ writeExtraText

bool writeExtraText = false

Definition at line 17 of file CMS_lumi.h.

Referenced by CMS_lumi().

class-composition.H
H
Definition: class-composition.py:31
lumiTextSize
float lumiTextSize
Definition: CMS_lumi.h:23
extraText
TString extraText
Definition: CMS_lumi.h:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
relPosY
float relPosY
Definition: CMS_lumi.h:29
relPosX
float relPosX
Definition: CMS_lumi.h:28
cmsText
TString cmsText
Definition: CMS_lumi.h:14
lumi_7TeV
TString lumi_7TeV
Definition: CMS_lumi.h:37
lumi_8TeV
TString lumi_8TeV
Definition: CMS_lumi.h:36
OrderedSet.t
t
Definition: OrderedSet.py:90
b
double b
Definition: hdecay.h:118
writeExtraText
bool writeExtraText
Definition: CMS_lumi.h:17
lumi_sqrtS
TString lumi_sqrtS
Definition: CMS_lumi.h:38
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
cmsTextSize
float cmsTextSize
Definition: CMS_lumi.h:25
alignCSCRings.r
r
Definition: alignCSCRings.py:93
relExtraDY
float relExtraDY
Definition: CMS_lumi.h:30
extraOverCmsTextSize
float extraOverCmsTextSize
Definition: CMS_lumi.h:33
drawLogo
bool drawLogo
Definition: CMS_lumi.h:39
lumi_13TeV
TString lumi_13TeV
Definition: CMS_lumi.h:35
extraTextFont
float extraTextFont
Definition: CMS_lumi.h:19
cmsTextFont
float cmsTextFont
Definition: CMS_lumi.h:15
lumiTextOffset
float lumiTextOffset
Definition: CMS_lumi.h:24