1 from ROOT
import TStyle, kWhite, kTRUE
2 from ROOT
import kGray, kAzure, kMagenta, kOrange, kWhite
3 from ROOT
import kRed, kBlue, kGreen, kPink, kYellow
4 from ROOT
import TLine, TLatex
6 from collections
import namedtuple, OrderedDict
7 from math
import sin, cos, tan, atan, exp, pi
9 Plot_params = namedtuple(
'Params',
11 'abscissa',
'ordinate',
14 'quotaName',
'iDrawEta',
15 'histoMin',
'histoMax',
18 plots.setdefault(
'x_vs_eta',
Plot_params(10,
'#eta',
'x/X_{0}', 0.0, 2.575, -4.0, 4.0,
'', 0, 0., 0., 0, 1))
19 plots.setdefault(
'x_vs_phi',
Plot_params(20,
'#varphi [rad]',
'x/X_{0}', 0.0, 6.2, -4.0, 4.0,
'', 0, 0., 0., 0, 1))
20 plots.setdefault(
'x_vs_R',
Plot_params(40,
'R [cm]',
'x/X_{0}', 0.0, 70.0, 0.0, 1200.0,
'', 0, 0., 0., 0, 1))
21 plots.setdefault(
'l_vs_eta',
Plot_params(1010,
'#eta',
'x/#lambda_{I}', 0.0, 0.73, -4.0, 4.0,
'', 0, 0., 0., 0, 1))
22 plots.setdefault(
'l_vs_phi',
Plot_params(1020,
'#varphi [rad]',
'x/#lambda_{I}', 0.0, 1.2, -4.0, 4.0,
'', 0, 0., 0., 0, 1))
23 plots.setdefault(
'l_vs_R',
Plot_params(1040,
'#R [cm]',
'x/#lambda_{I}', 0.0, 7.5, 0.0, 1200.0,
'', 0, 0., 0., 0, 1))
24 plots.setdefault(
'x_vs_eta_vs_phi',
Plot_params(30,
'#eta',
'#varphi', 0., 0., 0., 0.,
'x/X_{0}', 0, -1., -1., 0, 1))
25 plots.setdefault(
'l_vs_eta_vs_phi',
Plot_params(1030,
'#eta',
'#varphi', 0., 0., 0., 0.,
'x/#lambda_{I}', 0, -1, -1, 0, 1))
26 plots.setdefault(
'x_vs_z_vs_Rsum',
Plot_params(50,
'z [mm]',
'R [mm]', 0., 0., 0., 0.,
'#Sigmax/X_{0}', 1, 0., 2.5, 0, 0))
27 plots.setdefault(
'x_vs_z_vs_R',
Plot_params(60,
'z [mm]',
'R [mm]', 0., 0., 0., 0.,
'1/X_{0}', 1, 0.00001, 0.01, 1, 0))
28 plots.setdefault(
'l_vs_z_vs_Rsum',
Plot_params(1050,
'z [mm]',
'R [mm]', 0., 0., 0., 0.,
'#Sigmax/#lambda_{I}', 1, 0., 1., 0, 0))
29 plots.setdefault(
'l_vs_z_vs_R',
Plot_params(1060,
'z [mm]',
'R [mm]', 0., 0., 0., 0.,
'1/#lambda_{I}', 1, 0.001, 0.9, 1, 0))
30 plots.setdefault(
'x_over_l_vs_eta',
Plot_params(10,
'#eta',
'(x/X_{0})/(x/#lambda_{I})', 0., 0., 0., 0.,
'', 0, -1, -1, 0, 0))
31 plots.setdefault(
'x_over_l_vs_phi',
Plot_params(20,
'#varphi [rad]',
'(x/X_{0})/(x/#lambda_{I})', 0., 0., 0., 0.,
'', 0, -1, -1, 0, 0))
34 _LABELS2COMPS = {
'BeamPipe':
'BEAM',
36 'Pixel': [
'PixelBarrel',
'PixelForwardZplus',
'PixelForwardZminus'],
37 'PixBar':
'PixelBarrel',
38 'PixFwd': [
'PixelForwardZplus',
'PixelForwardZminus',
'PixelForward'],
39 'PixFwdMinus':
'PixelForwardZminus',
40 'PixFwdPlus':
'PixelForwardZplus',
46 'InnerServices': [
'TIBTIDServicesF',
'TIBTIDServicesB'],
47 'TkStrct': [
'TrackerOuterCylinder',
'TrackerBulkhead'],
48 'Phase2PixelBarrel':
'Phase2PixelBarrel',
49 'Phase2OTBarrel':
'Phase2OTBarrel',
50 'Phase2PixelEndcap':
'Phase2PixelEndcap',
51 'Phase2OTForward':
'Phase2OTForward'}
60 COMPOUNDS = OrderedDict()
61 COMPOUNDS[
"Tracker"] = [
"Tracker"]
62 COMPOUNDS[
"TrackerSum"] = [
"TIB",
"TIDF",
"TIDB",
63 "BeamPipe",
"InnerServices",
66 "PixBar",
"PixFwdPlus",
"PixFwdMinus"]
67 COMPOUNDS[
"TrackerSumPhaseII"] = [
"BeamPipe",
69 "Phase2OTBarrel",
"Phase2OTForward",
71 COMPOUNDS[
"Pixel"] = [
"PixBar",
"PixFwdMinus",
"PixFwdPlus"]
72 COMPOUNDS[
"Strip"] = [
"TIB",
"TIDF",
"TIDB",
"InnerServices",
"TOB",
"TEC"]
73 COMPOUNDS[
"InnerTracker"] = [
"TIB",
"TIDF",
"TIDB",
"InnerServices"]
77 DETECTORS = OrderedDict()
78 DETECTORS[
"BeamPipe"] = kGray+2
79 DETECTORS[
"InnerServices"] = kGreen+2
80 DETECTORS[
"PixBar"] = kAzure-5
81 DETECTORS[
"Phase1PixelBarrel"] = kAzure-5
82 DETECTORS[
"Phase2PixelBarrel"] = kAzure-5
83 DETECTORS[
"PixFwdPlus"] = kAzure-9
84 DETECTORS[
"PixFwdMinus"] = kAzure-9
85 DETECTORS[
"Phase2PixelEndcap"] = kAzure-9
86 DETECTORS[
"Phase2OTBarrel"] = kMagenta-2
87 DETECTORS[
"Phase2OTForward"] = kOrange-2
88 DETECTORS[
"TIB"] = kMagenta-6
89 DETECTORS[
"TIDF"] = kMagenta+2
90 DETECTORS[
"TIDB"] = kMagenta+2
91 DETECTORS[
"TOB"] = kOrange+10
92 DETECTORS[
"TEC"] = kOrange-2
102 sDETS = OrderedDict()
105 sDETS[
"TIB"] = kGreen
106 sDETS[
"TID"] = kYellow
107 sDETS[
"TOB"] = kOrange
115 hist_label_to_num = OrderedDict()
116 hist_label_to_num[
'SUP'] = [100, 13,
'Support']
117 hist_label_to_num[
'SEN'] = [200, 27,
'Sensitive']
118 hist_label_to_num[
'CAB'] = [300, 46,
'Cables']
119 hist_label_to_num[
'COL'] = [400, 38,
'Cooling']
120 hist_label_to_num[
'ELE'] = [500, 30,
'Electronics']
121 hist_label_to_num[
'OTH'] = [600, 42,
'Other']
122 hist_label_to_num[
'AIR'] = [700, 29,
'Air']
125 """Function to setup a TDR-like style""" 127 tdrStyle = TStyle(
"tdrStyle",
"Style for P-TDR")
130 tdrStyle.SetCanvasBorderMode(0)
131 tdrStyle.SetCanvasColor(kWhite)
132 tdrStyle.SetCanvasDefH(600)
133 tdrStyle.SetCanvasDefW(600)
134 tdrStyle.SetCanvasDefX(0)
135 tdrStyle.SetCanvasDefY(0)
138 tdrStyle.SetPadBorderMode(0)
139 tdrStyle.SetPadColor(kWhite)
140 tdrStyle.SetPadGridX(
False)
141 tdrStyle.SetPadGridY(
False)
142 tdrStyle.SetGridColor(0)
143 tdrStyle.SetGridStyle(3)
144 tdrStyle.SetGridWidth(1)
147 tdrStyle.SetFrameBorderMode(0)
148 tdrStyle.SetFrameBorderSize(1)
149 tdrStyle.SetFrameFillColor(0)
150 tdrStyle.SetFrameFillStyle(0)
151 tdrStyle.SetFrameLineColor(1)
152 tdrStyle.SetFrameLineStyle(1)
153 tdrStyle.SetFrameLineWidth(1)
156 tdrStyle.SetHistLineColor(1)
157 tdrStyle.SetHistLineStyle(0)
158 tdrStyle.SetHistLineWidth(1)
159 tdrStyle.SetEndErrorSize(2)
160 tdrStyle.SetErrorX(0.)
161 tdrStyle.SetMarkerStyle(20)
164 tdrStyle.SetOptFit(1)
165 tdrStyle.SetFitFormat(
"5.4g")
166 tdrStyle.SetFuncColor(2)
167 tdrStyle.SetFuncStyle(1)
168 tdrStyle.SetFuncWidth(1)
171 tdrStyle.SetOptDate(0)
174 tdrStyle.SetOptFile(0)
175 tdrStyle.SetOptStat(0);
176 tdrStyle.SetStatColor(kWhite)
177 tdrStyle.SetStatFont(42)
178 tdrStyle.SetStatFontSize(0.025)
179 tdrStyle.SetStatTextColor(1)
180 tdrStyle.SetStatFormat(
"6.4g")
181 tdrStyle.SetStatBorderSize(1)
182 tdrStyle.SetStatH(0.1)
183 tdrStyle.SetStatW(0.15)
186 tdrStyle.SetPadTopMargin(0.05)
187 tdrStyle.SetPadBottomMargin(0.13)
188 tdrStyle.SetPadLeftMargin(0.16)
189 tdrStyle.SetPadRightMargin(0.02)
192 tdrStyle.SetOptTitle(0)
193 tdrStyle.SetTitleFont(42)
194 tdrStyle.SetTitleColor(1)
195 tdrStyle.SetTitleTextColor(1)
196 tdrStyle.SetTitleFillColor(10)
197 tdrStyle.SetTitleFontSize(0.05)
200 tdrStyle.SetTitleColor(1,
"XYZ")
201 tdrStyle.SetTitleFont(42,
"XYZ")
202 tdrStyle.SetTitleSize(0.06,
"XYZ")
203 tdrStyle.SetTitleXOffset(0.9)
204 tdrStyle.SetTitleYOffset(1.25)
207 tdrStyle.SetLabelColor(1,
"XYZ")
208 tdrStyle.SetLabelFont(42,
"XYZ")
209 tdrStyle.SetLabelOffset(0.007,
"XYZ")
210 tdrStyle.SetLabelSize(0.05,
"XYZ")
213 tdrStyle.SetAxisColor(1,
"XYZ")
214 tdrStyle.SetStripDecimals(kTRUE)
215 tdrStyle.SetTickLength(0.03,
"XYZ")
216 tdrStyle.SetNdivisions(510,
"XYZ")
217 tdrStyle.SetPadTickX(1)
218 tdrStyle.SetPadTickY(1)
221 tdrStyle.SetOptLogx(0)
222 tdrStyle.SetOptLogy(0)
223 tdrStyle.SetOptLogz(0)
226 tdrStyle.SetPaperSize(20.,20.)
231 """Function to draw the eta. 233 Function to draw the eta references on top of an already existing 234 TCanvas. The lines and labels drawn are collected inside a list and 235 the list is returned to the user to extend the live of the objects 236 contained, otherwise no lines and labels will be drawn, since they 237 will be garbage-collected as soon as this function returns. 242 etas = [-3.4, -3.0, -2.8, -2.6, -2.4, -2.2,
243 -2.0, -1.8, -1.6, -1.4, -1.2, -1., -0.8, -0.6, -0.4, -0.2, 0., 0.2,
244 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.6, 1.8, 2., 2.2, 2.4, 2.6, 2.8, 3.0,
253 th = 2*atan(
exp(-ieta))
257 lineh = TLine(-20.,0.,20.,0.)
259 linev = TLine(0.,-10.,0.,10.)
261 keep_alive.append(lineh)
262 keep_alive.append(linev)
266 if ieta>-1.6
and ieta<1.6:
277 x2 = x1+lineL*
cos(th)
278 y2 = y1+lineL*
sin(th)
282 line1 = TLine(x1,y1,x2,y2)
284 keep_alive.append(line1)
286 text =
"%3.1f" % ieta
287 t1 = TLatex(xt, yt,
'%s' % (
'#eta = 0' if ieta == 0
else text))
289 t1.SetTextAlign(talign)
291 keep_alive.append(t1)
Sin< T >::type sin(const T &t)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)