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_{0}', 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_{0}', 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_{0}', 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', -3.2, 3.2, -5.0, 5.0,
'x/X_{0}', 0, -1., -1., 0, 1))
25 plots.setdefault(
'l_vs_eta_vs_phi',
Plot_params(1030,
'#eta',
'#varphi', -3.2, 3.2, -5.0, 5.0,
'x/#lambda_{0}', 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_{0}', 1, 0., 1., 0, 0))
29 plots.setdefault(
'l_vs_z_vs_R',
Plot_params(1060,
'z [mm]',
'R [mm]', 0., 1400., -3500., 3500.,
'1/#lambda_{0}', 1, 0.001, 0.9, 1, 0))
30 plots.setdefault(
'l_vs_z_vs_R_geocomp',
Plot_params(1060,
'z [mm]',
'R [mm]', 0., 1400., -3500., 3500.,
'1/#lambda_{0}', 1, 0.001, 0.9, 0, 0))
33 plots.setdefault(
'x_over_l_vs_eta',
Plot_params(10,
'#eta',
'(#frac{x}{X_{0}})/(#frac{x}{#lambda_{0}})', 0., 0., 0., 0.,
'', 0, -1, -1, 0, 0))
35 plots.setdefault(
'x_over_l_vs_phi',
Plot_params(20,
'#varphi [rad]',
'(#frac{x}{X_{0}})/(#frac{x}{#lambda_{0}})', 0., 0., 0., 0.,
'', 0, -1, -1, 0, 0))
38 _LABELS2COMPS = {
'BeamPipe':
'BEAM',
40 'Pixel': [
'PixelBarrel',
'PixelForwardZplus',
'PixelForwardZminus'],
41 'PixBar':
'PixelBarrel',
42 'PixFwd': [
'PixelForwardZplus',
'PixelForwardZminus',
'PixelForward'],
43 'PixFwdMinus':
'PixelForwardZminus',
44 'PixFwdPlus':
'PixelForwardZplus',
50 'InnerServices': [
'TIBTIDServicesF',
'TIBTIDServicesB'],
51 'TkStrct': [
'TrackerOuterCylinder',
'TrackerBulkhead'],
52 'Phase2PixelBarrel':
'Phase2PixelBarrel',
53 'Phase2OTBarrel':
'Phase2OTBarrel',
54 'Phase2PixelEndcap':
'Phase2PixelEndcap',
55 'Phase2OTForward':
'Phase2OTForward'}
64 COMPOUNDS = OrderedDict()
65 COMPOUNDS[
"Tracker"] = [
"Tracker"]
66 COMPOUNDS[
"TrackerSum"] = [
"TIB",
"TIDF",
"TIDB",
67 "BeamPipe",
"InnerServices",
70 "PixBar",
"PixFwdPlus",
"PixFwdMinus"]
71 COMPOUNDS[
"TrackerSumPhaseII"] = [
"BeamPipe",
73 "Phase2OTBarrel",
"Phase2OTForward",
75 COMPOUNDS[
"Pixel"] = [
"PixBar",
"PixFwdMinus",
"PixFwdPlus"]
76 COMPOUNDS[
"Strip"] = [
"TIB",
"TIDF",
"TIDB",
"InnerServices",
"TOB",
"TEC"]
77 COMPOUNDS[
"InnerTracker"] = [
"TIB",
"TIDF",
"TIDB",
"InnerServices"]
81 DETECTORS = OrderedDict()
82 DETECTORS[
"BeamPipe"] = kGray+2
83 DETECTORS[
"InnerServices"] = kGreen+2
84 DETECTORS[
"PixBar"] = kAzure-5
85 DETECTORS[
"Phase1PixelBarrel"] = kAzure-5
86 DETECTORS[
"Phase2PixelBarrel"] = kAzure-5
87 DETECTORS[
"PixFwdPlus"] = kAzure-9
88 DETECTORS[
"PixFwdMinus"] = kAzure-9
89 DETECTORS[
"Phase2PixelEndcap"] = kAzure-9
90 DETECTORS[
"Phase2OTBarrel"] = kMagenta-2
91 DETECTORS[
"Phase2OTForward"] = kOrange-2
92 DETECTORS[
"TIB"] = kMagenta-6
93 DETECTORS[
"TIDF"] = kMagenta+2
94 DETECTORS[
"TIDB"] = kMagenta+2
95 DETECTORS[
"TOB"] = kOrange+10
96 DETECTORS[
"TEC"] = kOrange-2
106 sDETS = OrderedDict()
109 sDETS[
"TIB"] = kGreen
110 sDETS[
"TID"] = kYellow
111 sDETS[
"TOB"] = kOrange
119 hist_label_to_num = OrderedDict()
120 hist_label_to_num[
'SUM'] = [0, kGreen+1,
'Total']
121 hist_label_to_num[
'SUP'] = [100, 13,
'Support']
122 hist_label_to_num[
'SEN'] = [200, 27,
'Sensitive']
123 hist_label_to_num[
'CAB'] = [300, 46,
'Cables']
124 hist_label_to_num[
'COL'] = [400, 38,
'Cooling']
125 hist_label_to_num[
'ELE'] = [500, 30,
'Electronics']
126 hist_label_to_num[
'OTH'] = [600, 42,
'Other']
127 hist_label_to_num[
'AIR'] = [700, 29,
'Air']
130 """Function to setup a TDR-like style""" 132 tdrStyle = TStyle(
"tdrStyle",
"Style for P-TDR")
135 tdrStyle.SetCanvasBorderMode(0)
136 tdrStyle.SetCanvasColor(kWhite)
137 tdrStyle.SetCanvasDefH(600)
138 tdrStyle.SetCanvasDefW(600)
139 tdrStyle.SetCanvasDefX(0)
140 tdrStyle.SetCanvasDefY(0)
143 tdrStyle.SetPadBorderMode(0)
144 tdrStyle.SetPadColor(kWhite)
145 tdrStyle.SetPadGridX(
False)
146 tdrStyle.SetPadGridY(
False)
147 tdrStyle.SetGridColor(kWhite)
148 tdrStyle.SetGridStyle(3)
149 tdrStyle.SetGridWidth(1)
150 tdrStyle.SetPadTickX(
True)
151 tdrStyle.SetPadTickY(
True)
154 tdrStyle.SetFrameBorderMode(0)
155 tdrStyle.SetFrameBorderSize(1)
156 tdrStyle.SetFrameFillColor(0)
157 tdrStyle.SetFrameFillStyle(0)
158 tdrStyle.SetFrameLineColor(1)
159 tdrStyle.SetFrameLineStyle(1)
160 tdrStyle.SetFrameLineWidth(0)
163 tdrStyle.SetHistLineColor(1)
164 tdrStyle.SetHistLineStyle(0)
165 tdrStyle.SetHistLineWidth(1)
166 tdrStyle.SetEndErrorSize(1)
168 tdrStyle.SetMarkerStyle(20)
171 tdrStyle.SetOptFit(0)
172 tdrStyle.SetFitFormat(
"5.4g")
173 tdrStyle.SetFuncColor(2)
174 tdrStyle.SetFuncStyle(1)
175 tdrStyle.SetFuncWidth(1)
178 tdrStyle.SetOptDate(0)
181 tdrStyle.SetOptFile(0)
182 tdrStyle.SetOptStat(0);
183 tdrStyle.SetStatColor(kWhite)
184 tdrStyle.SetStatFont(42)
185 tdrStyle.SetStatFontSize(0.025)
186 tdrStyle.SetStatTextColor(1)
187 tdrStyle.SetStatFormat(
"6.4g")
188 tdrStyle.SetStatBorderSize(1)
189 tdrStyle.SetStatH(0.1)
190 tdrStyle.SetStatW(0.15)
193 tdrStyle.SetPadTopMargin(0.05)
194 tdrStyle.SetPadBottomMargin(0.1)
195 tdrStyle.SetPadLeftMargin(0.12)
196 tdrStyle.SetPadRightMargin(0.05)
199 tdrStyle.SetOptTitle(1)
200 tdrStyle.SetTitleFont(42)
201 tdrStyle.SetTitleColor(1)
202 tdrStyle.SetTitleTextColor(1)
203 tdrStyle.SetTitleFillColor(10)
204 tdrStyle.SetTitleFontSize(0.0525)
205 tdrStyle.SetTitleH(0);
206 tdrStyle.SetTitleW(0);
207 tdrStyle.SetTitleX(0.5);
208 tdrStyle.SetTitleY(1.0);
209 tdrStyle.SetTitleStyle(1001);
210 tdrStyle.SetTitleBorderSize(0);
211 tdrStyle.SetTitleAlign(23)
214 tdrStyle.SetTitleColor(1,
"XYZ")
215 tdrStyle.SetTitleFont(42,
"XYZ")
216 tdrStyle.SetTitleSize(0.05,
"XY")
217 tdrStyle.SetTitleSize(0.035,
"Z")
218 tdrStyle.SetTitleXOffset(1.0)
219 tdrStyle.SetTitleYOffset(1.0)
222 tdrStyle.SetLabelColor(1,
"XYZ")
223 tdrStyle.SetLabelFont(42,
"XYZ")
224 tdrStyle.SetLabelOffset(5e-3,
"XYZ")
225 tdrStyle.SetLabelSize(0.03,
"XYZ")
228 tdrStyle.SetAxisColor(1,
"XYZ")
229 tdrStyle.SetStripDecimals(kTRUE)
230 tdrStyle.SetTickLength(0.03,
"XYZ")
231 tdrStyle.SetNdivisions(510,
"XYZ")
232 tdrStyle.SetPadTickX(1)
233 tdrStyle.SetPadTickY(1)
236 tdrStyle.SetOptLogx(0)
237 tdrStyle.SetOptLogy(0)
238 tdrStyle.SetOptLogz(0)
241 tdrStyle.SetLegendBorderSize(0)
244 tdrStyle.SetPaperSize(20.,20.)
249 """Function to draw the eta. 251 Function to draw the eta references on top of an already existing 252 TCanvas. The lines and labels drawn are collected inside a list and 253 the list is returned to the user to extend the live of the objects 254 contained, otherwise no lines and labels will be drawn, since they 255 will be garbage-collected as soon as this function returns. 260 etas = [ 0.2*i
for i
in range(-17,18) ]
268 th = 2*atan(
exp(-ieta))
272 lineh = TLine(-20.,0.,20.,0.)
274 linev = TLine(0.,-10.,0.,10.)
276 keep_alive.append(lineh)
277 keep_alive.append(linev)
281 if ieta>-1.6
and ieta<1.6:
292 x2 = x1+lineL*
cos(th)
293 y2 = y1+lineL*
sin(th)
297 line1 = TLine(x1,y1,x2,y2)
299 keep_alive.append(line1)
301 text =
"%3.1f" % ieta
302 t1 = TLatex(xt, yt,
'%s' % (
'#eta = 0' if ieta == 0
else text))
304 t1.SetTextAlign(talign)
306 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)