-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMS_lumi.C
163 lines (152 loc) · 3.62 KB
/
CMS_lumi.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#include "CMS_lumi.h"
#include <iostream>
void
CMS_lumi( TPad* pad, int iPeriod, int iPosX )
{
bool outOfFrame = false;
if( iPosX/10==0 )
{
outOfFrame = true;
}
int alignY_=3;
int alignX_=2;
if( iPosX/10==0 ) alignX_=1;
if( iPosX==0 ) alignX_=1;
if( iPosX==0 ) alignY_=1;
if( iPosX/10==1 ) alignX_=1;
if( iPosX/10==2 ) alignX_=2;
if( iPosX/10==3 ) alignX_=3;
if( iPosX == 0 ) relPosX = 0.14;
int align_ = 10*alignX_ + alignY_;
float H = pad->GetWh();
float W = pad->GetWw();
float l = pad->GetLeftMargin();
float t = pad->GetTopMargin();
float r = pad->GetRightMargin();
float b = pad->GetBottomMargin();
// float e = 0.025;
pad->cd();
TString lumiText;
if( iPeriod==1 )
{
lumiText += lumi_7TeV;
lumiText += " (7 TeV)";
}
else if ( iPeriod==2 )
{
lumiText += lumi_8TeV;
lumiText += " (8 TeV)";
}
else if( iPeriod==3 )
{
lumiText = lumi_8TeV;
lumiText += " (8 TeV)";
lumiText += " + ";
lumiText += lumi_7TeV;
lumiText += " (7 TeV)";
}
else if ( iPeriod==4 )
{
lumiText += lumi_13TeV;
lumiText += " (13 TeV)";
}
else if ( iPeriod==7 )
{
if( outOfFrame ) lumiText += "#scale[0.85]{";
lumiText += lumi_13TeV;
lumiText += " (13 TeV)";
lumiText += " + ";
lumiText += lumi_8TeV;
lumiText += " (8 TeV)";
lumiText += " + ";
lumiText += lumi_7TeV;
lumiText += " (7 TeV)";
if( outOfFrame) lumiText += "}";
}
else if ( iPeriod==12 )
{
lumiText += "8 TeV";
}
else if ( iPeriod==0 )
{
lumiText += lumi_sqrtS;
}
std::cout << lumiText << endl;
TLatex latex;
latex.SetNDC();
latex.SetTextAngle(0);
latex.SetTextColor(kBlack);
float extraTextSize = extraOverCmsTextSize*cmsTextSize;
latex.SetTextFont(42);
latex.SetTextAlign(31);
latex.SetTextSize(lumiTextSize*t);
latex.DrawLatex(1-r,1-t+lumiTextOffset*t,lumiText);
if( outOfFrame )
{
latex.SetTextFont(cmsTextFont);
latex.SetTextAlign(11);
latex.SetTextSize(cmsTextSize*t);
latex.DrawLatex(l,1-t+lumiTextOffset*t,cmsText);
}
pad->cd();
float posX_=0;
if( iPosX%10<=1 )
{
posX_ = l + relPosX*(1-l-r);
}
else if( iPosX%10==2 )
{
posX_ = l + 0.5*(1-l-r);
}
else if( iPosX%10==3 )
{
posX_ = 1-r - relPosX*(1-l-r);
}
float posY_ = 1-t - relPosY*(1-t-b);
if( !outOfFrame )
{
if( drawLogo )
{
posX_ = l + 0.045*(1-l-r)*W/H;
posY_ = 1-t - 0.045*(1-t-b);
float xl_0 = posX_;
float yl_0 = posY_ - 0.15;
float xl_1 = posX_ + 0.15*H/W;
float yl_1 = posY_;
TASImage* CMS_logo = new TASImage("CMS-BW-label.png");
TPad* pad_logo = new TPad("logo","logo", xl_0, yl_0, xl_1, yl_1 );
pad_logo->Draw();
pad_logo->cd();
CMS_logo->Draw("X");
pad_logo->Modified();
pad->cd();
}
else
{
latex.SetTextFont(cmsTextFont);
latex.SetTextSize(cmsTextSize*t);
latex.SetTextAlign(align_);
latex.DrawLatex(posX_, posY_, cmsText);
if( writeExtraText )
{
latex.SetTextFont(extraTextFont);
latex.SetTextAlign(align_);
latex.SetTextSize(extraTextSize*t);
latex.DrawLatex(posX_, posY_- relExtraDY*cmsTextSize*t, extraText);
}
}
}
else if( writeExtraText )
{
if( iPosX==0)
{
posX_ = l + relPosX*(1-l-r);
posY_ = 1-t+lumiTextOffset*t;
}
latex.SetTextFont(extraTextFont);
latex.SetTextSize(extraTextSize*t);
latex.SetTextAlign(align_);
latex.DrawLatex(posX_, posY_, extraText);
}
return;
}