Beispiel #1
0
def draw_disclaimer():
    # disclaimer
    t = TLatex()
    t.SetNDC()
    t.SetTextSize(0.1)
    t.SetTextAlign(22)
    t.SetTextAngle(45)
    t.DrawText(0.5, 0.5, "FAKE VALUES")
Beispiel #2
0
def drawROIGeometry(geometry, is2016):

    outfn = "ROILayout%s.pdf" % ("2016" if is2016 else "2015")

    global box, c, h, leg

    gROOT.Reset()
    gStyle.SetOptStat(0)

    c = TCanvas('c', "MuCTPi Geometry %s" % "2016" if is2016 else "2015", 1400,
                950)
    c.Draw()

    #h = TH2F("h","Muon Geometry",10,-2.6,2.6,10,-6.4,6.4)
    h = TH2F("h", "Muon Geometry %s" % "2016" if is2016 else "2015", 10, -2.6,
             2.6, 10, -0.15, 6.4)
    h.SetXTitle("#eta")
    h.SetYTitle("#phi")
    h.Draw()

    box = TBox()
    box.SetFillStyle(0)
    box.SetLineColor(3)
    box.SetLineColor(3)

    text = TLatex()
    text.SetTextSize(0.005)
    text.SetTextFont(42)
    text.SetTextAlign(22)

    secLabel = TLatex()
    secLabel.SetTextSize(0.008)
    secLabel.SetTextFont(42)
    secLabel.SetTextAlign(22)

    leg = TLegend(0.7, 0.1, 0.9, 0.4)
    leg.SetEntrySeparation(0.05)
    leg.SetNColumns(2)

    #for MIOCT in geometry.getMIOCTs():
    for colorIndex, MioctID in enumerate(drawOrder):
        MIOCT = geometry.getMIOCT(MioctID)
        firstBox = True
        color = colorMap[colorIndex % len(colorMap)]
        #print "Using color ",color
        box.SetLineColor(color)
        box.SetLineWidth(1)

        for Sector in MIOCT.Sectors:
            ymin = 10
            ymax = -10
            for ROI in Sector.ROIs:
                c1_x = float(ROI["etamin"])
                c1_y = float(ROI["phimin"])
                c2_x = float(ROI["etamax"])
                c2_y = float(ROI["phimax"])
                ymin = min(ymin, c1_y)
                ymax = max(ymax, c2_y)
                #print "eta [%f - %f], phi [%f - %f]" % (c1_x,c2_x,c1_y,c2_y)
                b = box.DrawBox(c1_x, c1_y, c2_x, c2_y)
                text.DrawText((c1_x + c2_x) / 2, (c1_y + c2_y) / 2,
                              ROI["roiid"])
                if firstBox:
                    firstBox = False
                    leg.AddEntry(b, "Slot %s" % MIOCT["slot"], "l")
            if Sector["name"].startswith("B"):
                if int(Sector["name"][1:]) < 32:
                    xpos = -0.02
                    ypos = (ymin + ymax) / 2 - 0.05
                else:
                    xpos = 0.02
                    ypos = (ymin + ymax) / 2 + 0.03
                secLabel.DrawText(xpos, ypos, Sector["name"])

    leg.Draw()

    c.Update()
    c.SaveAs(outfn)