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_0p9TeV = ""
 
TString lumi_13p6TeV = ""
 
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 writeExraLumi = false
 
bool writeExtraText = false
 

Function Documentation

◆ CMS_lumi()

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

Definition at line 46 of file CMS_lumi.h.

References b, cmsText, cmsTextFont, cmsTextSize, gather_cfg::cout, drawLogo, extraOverCmsTextSize, extraText, extraTextFont, data-class-funcs::H, MainPageGenerator::l, lumi_0p9TeV, lumi_13p6TeV, lumi_13TeV, lumi_7TeV, lumi_8TeV, lumi_sqrtS, lumiTextOffset, lumiTextSize, alignCSCRings::r, relExtraDY, relPosX, relPosY, submitPVValidationJobs::t, writeExraLumi, and writeExtraText.

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

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 42 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_0p9TeV

TString lumi_0p9TeV = ""

Definition at line 38 of file CMS_lumi.h.

Referenced by CMS_lumi().

◆ lumi_13p6TeV

TString lumi_13p6TeV = ""

Definition at line 39 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 40 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(), and Trend::~Trend().

◆ 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().

◆ writeExraLumi

bool writeExraLumi = false

Definition at line 41 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().