189 if colorBy<ETACODE
or colorBy>IPHI:
192 global box, c, h, leg
197 c = TCanvas(
'c',
"MuCTPi to Topo Geometry",1400,950)
200 h =
TH2F(
"h",
"Muon Topo Geometry %i" % (2016
if is2016
else 2015),10,-2.6,2.6,10,-0.15,6.4)
212 leg = TLegend(0.9,0.1,0.98,0.9)
214 leg = TLegend(0.8,0.1,0.9,0.35)
220 for MioctID
in drawOrder:
222 MIOCT = geometry.getMIOCT(MioctID)
225 for cellIdx,TopoCell
in enumerate(MIOCT.Decode.TopoCells):
228 code =
int(TopoCell[
"etacode"],16)
229 elif colorBy==PHICODE:
230 code =
int(TopoCell[
"phicode"],16)
232 code = abs(
int(TopoCell[
"ieta"]))
234 code =
int(TopoCell[
"iphi"])
236 raise RuntimeError(
"Don't know how to color the eta-phi map (%r)" % colorBy)
237 color = colorMap2[code % len(colorMap2)]
238 fillStyle = fillStyleMap2[code % 4]
239 box.SetLineColor(color)
240 box.SetFillColor(color)
242 circle.SetLineColor(color)
243 circle.SetFillColor(color)
246 c1_x =
float(TopoCell[
"etamin"])
247 c1_y =
float(TopoCell[
"phimin"])
249 c2_x =
float(TopoCell[
"etamax"])
250 c2_y =
float(TopoCell[
"phimax"])
252 c_x =
float(TopoCell[
"ieta"])
253 c_y =
float(TopoCell[
"iphi"])
259 box.SetFillStyle(fillStyle)
260 b = box.DrawBox(c1_x,c1_y,c2_x,c2_y)
262 box.DrawBox(c1_x,c1_y,c2_x,c2_y)
264 circle.DrawArc(c_x/10.,c_y/10.,0.02)
267 if code
not in codeInLegend:
268 codeInLegend += [code]
270 leg.AddEntry(b,
"etacode %i" % code,
"lf")
271 elif colorBy==PHICODE:
272 leg.AddEntry(b,
"phicode %i" % code,
"f")
274 leg.AddEntry(b,
"|ieta| %i" % code,
"f")
276 leg.AddEntry(b,
"iphi %i" % code,
"f")
283 elif colorBy==PHICODE:
291 c.SaveAs(
"TopoLayout%s%s.pdf" % (
"2016" if is2016
else "2015", ext))