CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_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

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

Definition at line 44 of file CMS_lumi.h.

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

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

Variable Documentation

TString cmsText = "CMS"

Definition at line 14 of file CMS_lumi.h.

Referenced by CMS_lumi().

float cmsTextFont = 61

Definition at line 15 of file CMS_lumi.h.

Referenced by CMS_lumi().

float cmsTextOffset = 0.1

Definition at line 26 of file CMS_lumi.h.

float cmsTextSize = 0.75

Definition at line 25 of file CMS_lumi.h.

Referenced by CMS_lumi().

bool drawLogo = false

Definition at line 40 of file CMS_lumi.h.

Referenced by CMS_lumi().

float extraOverCmsTextSize = 0.76

Definition at line 33 of file CMS_lumi.h.

Referenced by CMS_lumi().

TString extraText = "Preliminary"

Definition at line 18 of file CMS_lumi.h.

Referenced by CMS_lumi().

float extraTextFont = 52

Definition at line 19 of file CMS_lumi.h.

Referenced by CMS_lumi().

TString lumi_0p9TeV = ""

Definition at line 38 of file CMS_lumi.h.

Referenced by CMS_lumi().

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

Definition at line 35 of file CMS_lumi.h.

Referenced by CMS_lumi().

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

Definition at line 37 of file CMS_lumi.h.

Referenced by CMS_lumi().

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

Definition at line 36 of file CMS_lumi.h.

Referenced by CMS_lumi().

TString lumi_sqrtS = ""

Definition at line 39 of file CMS_lumi.h.

Referenced by CMS_lumi().

float lumiTextOffset = 0.2

Definition at line 24 of file CMS_lumi.h.

Referenced by CMS_lumi().

float lumiTextSize = 0.6

Definition at line 23 of file CMS_lumi.h.

Referenced by CMS_lumi().

float relExtraDY = 1.2

Definition at line 30 of file CMS_lumi.h.

Referenced by CMS_lumi().

float relPosX = 0.045

Definition at line 28 of file CMS_lumi.h.

Referenced by CMS_lumi().

float relPosY = 0.035

Definition at line 29 of file CMS_lumi.h.

Referenced by CMS_lumi().

bool writeExtraText = false

Definition at line 17 of file CMS_lumi.h.

Referenced by CMS_lumi().