Esempio n. 1
0
def prepare_canvas(c, channels, pad_label=None, x_label=None, y_label=None):
    pads = dict()
    # for axis labels
    c.Divide(1, 1, 0.03, 0.03)
    c.cd(1).Divide(*divide_square(len(channels)))
    for i, chans in enumerate(channels):
        ncol, nrow = divide_square(len(chans))
        c.cd(1).cd(i + 1).Divide(nrow, ncol, 0., 0.)
        # share y axis in the sub-group
        ymax = 0
        for j, ch in enumerate(chans):
            pads[ch] = c.cd(1).cd(i + 1).cd(j + 1)
    # labels
    c.cd(0)
    htext, vtext = TText(), TText()
    htext.SetTextSize(0.03)
    htext.SetTextAlign(22)
    vtext.SetTextSize(0.03)
    vtext.SetTextAlign(22)
    vtext.SetTextAngle(90)

    if pad_label:
        htext.DrawText(0.5, 0.982, pad_label)
    if x_label:
        htext.DrawText(0.5, 0.015, x_label)
    if y_label:
        vtext.DrawText(0.015, 0.5, y_label)
    return pads
Esempio n. 2
0
    def plotNSamples(cls, npatterns, etBins, etaBins, outname='nPatterns.pdf'):
        """Plot number of samples per bin"""
        logger = Logger.getModuleLogger("PlotNSamples")
        from ROOT import TCanvas, gROOT, kTRUE, kFALSE, TH2I, TText
        gROOT.SetBatch(kTRUE)
        c1 = TCanvas("plot_patterns_signal", "a", 0, 0, 800, 400)
        c1.Draw()
        shape = [len(etBins) - 1, len(etaBins) - 1]
        histo1 = TH2I(
            "text_stats",
            "#color[4]{Signal}/#color[2]{Background} available statistics",
            shape[0], 0, shape[0], shape[1], 0, shape[1])
        #histo1 = TH2I("text_stats", "Signal/Background available statistics", shape[0], 0, shape[0], shape[1], 0, shape[1])
        histo1.SetStats(kFALSE)
        histo1.Draw("TEXT")
        histo1.SetXTitle("E_{T}")
        histo1.SetYTitle("#eta")
        histo1.GetXaxis().SetTitleSize(0.04)
        histo1.GetYaxis().SetTitleSize(0.04)
        histo1.GetXaxis().SetLabelSize(0.04)
        histo1.GetYaxis().SetLabelSize(0.04)
        histo1.GetXaxis().SetTickSize(0)
        histo1.GetYaxis().SetTickSize(0)
        ttest = TText()
        ttest.SetTextAlign(22)
        for etBin in range(shape[0]):
            for etaBin in range(shape[1]):
                key = 'et%d_eta%d' % (etBin, etaBin)
                ttest.SetTextColor(4)
                ttest.DrawText(.5 + etBin, .75 + etaBin,
                               's: ' + str(npatterns['sgnPattern_' + key]))

                ttest.SetTextColor(2)
                ttest.DrawText(.5 + etBin, .25 + etaBin,
                               'b: ' + str(npatterns['bkgPattern_' + key]))

                try:
                    histo1.GetYaxis().SetBinLabel(
                        etaBin + 1, '#bf{%d} : %.2f->%.2f' %
                        (etaBin, etaBins[etaBin], etaBins[etaBin + 1]))
                except Exception:
                    logger.error("Couldn't retrieve eta bin %d bounderies.",
                                 etaBin)
                    histo1.GetYaxis().SetBinLabel(etaBin + 1, str(etaBin))
                try:
                    histo1.GetXaxis().SetBinLabel(
                        etBin + 1, '#bf{%d} : %d->%d [GeV]' %
                        (etBin, etBins[etBin], etBins[etBin + 1]))
                except Exception:
                    logger.error("Couldn't retrieve et bin %d bounderies.",
                                 etBin)
                    histo1.GetXaxis().SetBinLabel(etBin + 1, str(etaBin))
        c1.SetGrid()
        c1.Update()
        c1.SaveAs(outname)
Esempio n. 3
0
arrow.Draw()
line.DrawLine( 7, 8.5, 7, 8.0 )
line.DrawLine( 7, 8.0, 10.6, 8 )
arrow.DrawArrow( 10.6,8, 10.6, 8.4, 0.01, '|>' )
line.DrawLine( 10.6, 11, 10.6, 11.5 )
line.DrawLine( 10.6, 11.5, 14.6, 11.5 )
arrow.DrawArrow( 14.6, 11.5, 14.6, 11.1, 0.01, '|>' )
line.DrawLine( 14.6, 8.5, 14.6, 8.0 )
line.DrawLine( 14.6, 8.0, 16, 8 )
ldot.DrawLine( 16, 8, 19, 8 )
vert = TText( 1.5, 9.75, 'File' )
vert.SetTextAlign( 21 )
vert.SetTextAngle( 90 )
vert.SetTextSize( 0.025 )
vert.Draw()
vert.DrawText(  2.0, 9.75, 'Header' )
vert.DrawText(  2.9, 9.75, 'Logical Record' )
vert.DrawText(  3.2, 9.75, 'Header' )
vert.DrawText(  7.3, 9.75, 'Logical Record' )
vert.DrawText(  7.6, 9.75, 'Header' )
vert.DrawText( 10.9, 9.75, 'Logical Record' )
vert.DrawText( 11.2, 9.75, 'Header' )
vert.DrawText( 14.9, 9.75, 'Logical Record' )
vert.DrawText( 15.2, 9.75, 'Header' )
hori = TText( 4.75, 10, 'Object' )
hori.SetTextAlign( 22 )
hori.SetTextSize( 0.035 )
hori.Draw()
hori.DrawText( 4.75, 9.5, 'Data' )
hori.DrawText( 9.2, 10, 'Deleted' )
hori.DrawText( 9.2, 9.5, 'Object' )
Esempio n. 4
0
def main():

    cc.cd()
    cc.SetBorderMode(0)
    cc.SetFixedAspectRatio(1)
    cc.FeedbackMode(1)

    gStyle.SetOptStat(0)
    gStyle.SetGridStyle(0)
    gStyle.SetGridColor(18)

    nbinsX = 0
    for ix in range(len(SECTORSPERREGION)):
        nbinsX += SECTORSPERREGION[ix]
    hh = TH2D('hh', ';Strip;Sector', STRIPSPERSECTOR, 0, STRIPSPERSECTOR,
              nbinsX, 0, nbinsX)
    setupHists([hh])
    hh.Draw('COLZ')

    gPad.SetLogz()
    gPad.SetLeftMargin(0.09)
    gPad.SetRightMargin(0.11)

    tt2 = TPaveText(240, 43, 500, 45)
    ttime = TPaveText(100, -5.5, 412, -3)
    setupPaveTexts([tt2, ttime])
    tt2.SetTextSize(0.03)

    lll = TLine()
    lll.SetLineColor(15)
    y1 = SECTORSPERREGION[0]
    y2 = SECTORSPERREGION[0] + SECTORSPERREGION[1]
    lll.DrawLine(0, y1, STRIPSPERSECTOR, y1)
    lll.DrawLine(0, y2, STRIPSPERSECTOR, y2)

    tt = TText()
    tt.SetTextColor(1)
    tt.SetTextAngle(90)
    tt.SetTextSize(0.04)
    tt.DrawText(532, 22, 'Hz')
    tt.SetTextSize(0.06)
    tt.SetTextAngle(0)
    tt.SetTextColor(1)
    tt.DrawTextNDC(0.1, 0.93, 'SVT Scalers')

    tt.SetTextSize(0.03)
    tt.DrawText(-42, 4, 'R1')
    tt.DrawText(-42, 16, 'R2')
    tt.DrawText(-42, 32, 'R3')

    cc.cd()
    for xx in [ttime, tt2]:
        xx.Draw()
    cc.cd()

    gPad.SetEditable(0)

    while True:

        iy = 0
        for ch in SVT.chans:
            loadPV(ch)
            ch = ch.vals
            data = ch['PVVAL']
            time2 = ch['PVTIMEVAL']

            if time2 > 10:
                print 'More than 10 seconds since message:  ' + ch['PVNAME']
                for ii in range(512):
                    data[ii] = 0

            if iy < SECTORSPERREGION[0]:
                region = 1
                sector = iy
            elif iy < SECTORSPERREGION[0] + SECTORSPERREGION[1]:
                region = 2
                sector = iy - SECTORSPERREGION[0]
            else:
                region = 3
                sector = iy - SECTORSPERREGION[0] - SECTORSPERREGION[1]

            if data == None or len(data) != STRIPSPERSECTOR:
                print 'Error Reading ' + ch['PVNAME']
                continue
            for ix in range(STRIPSPERSECTOR):
                hh.SetBinContent(ix, iy + 1, data[ix])
            iy += 1

        for xx in [ttime, tt2]:
            xx.Clear()

        [r1, r2, r3] = calcRates(SVT.chans)
        tt2.AddText('Sums:  R1 / R2 / R3 = %.2E / %.2E / %.2E Hz' %
                    (r1, r2, r3))

        ttime.AddText(makeTime())

        if not gPad: sys.exit()

        cc.Modified()
        cc.Update()

        time.sleep(POLLPERIOD)
Esempio n. 5
0
nut = TCanvas('nut', 'FirstSession', 100, 10, 700, 900)
nut.Range(0, 0, 20, 24)
nut.SetFillColor(10)
nut.SetBorderSize(2)

pl = TPaveLabel(3, 22, 17, 23.7, 'My first PyROOT interactive session', 'br')
pl.SetFillColor(18)
pl.Draw()

t = TText(0, 0, 'a')
t.SetTextFont(62)
t.SetTextSize(0.025)
t.SetTextAlign(12)
t.DrawText(
    2, 20.3,
    'PyROOT provides ROOT bindings for Python, a powerful interpreter.')
t.DrawText(2, 19.3, 'Blocks of lines can be entered typographically.')
t.DrawText(2, 18.3, 'Previous typed lines can be recalled.')

t.SetTextFont(72)
t.SetTextSize(0.026)
t.DrawText(3, 17, r'>>>  x, y = 5, 7')
t.DrawText(3, 16, r'>>>  import math; x*math.sqrt(y)')
t.DrawText(
    3, 14,
    r'>>>  for i in range(2,7): print "sqrt(%d) = %f" % (i,math.sqrt(i))')
t.DrawText(3, 10,
           r'>>>  import ROOT; f1 = ROOT.TF1( "f1", "sin(x)/x", 0, 10 )')
t.DrawText(3, 9, r'>>>  f1.Draw()')
t.SetTextFont(81)
Esempio n. 6
0
def drawColorTable(clist=range(0, 50),
                   nrow=None,
                   ncol=None,
                   cmax=10,
                   tag="",
                   label=False,
                   RBG=False,
                   newRBG=True,
                   div=2):
    # https://root.cern.ch/doc/master/src_2TPad_8cxx_source.html#l01611

    if not ncol:
        ncol = min(cmax, len(clist))
    if not nrow:
        nrow = 1 if len(clist) <= cmax else int(ceil(len(clist) / float(cmax)))
    x1 = y1 = 0.
    x2 = y2 = 20.
    hs = (y2 - y1) / nrow
    ws = (x2 - x1) / ncol
    if label or RBG:
        width = 170 * ncol
        height = 80 * nrow
    else:
        width = 110 * ncol
        height = 80 * nrow
    scale = 400. / height
    if 400. < height: scale = sqrt(scale)
    canvas = TCanvas("c", "Fill Area colors", 0, 0, width, height)
    canvas.SetFillColor(0)
    canvas.Clear()
    canvas.Range(x1, y1, x2, y2)

    text = TText(0, 0, "")
    text.SetTextFont(61)
    text.SetTextSize(0.07 * scale)
    text.SetTextAlign(22)
    box = TBox()

    for r in range(0, nrow):
        ylow = y2 - hs * (r + 0.1)
        yup = y2 - hs * (r + 0.9)
        for c in range(0, ncol):
            i = ncol * r + c
            if i >= len(clist): break
            xlow = x1 + ws * (c + 0.1)
            xup = x1 + ws * (c + 0.9)
            color = clist[ncol * r + c]
            box.SetFillStyle(1001)
            box.SetFillColor(color)
            box.DrawBox(xlow, ylow, xup, yup)
            box.SetFillStyle(0)
            box.SetLineColor(1)
            box.DrawBox(xlow, ylow, xup, yup)
            if color == 1: text.SetTextColor(0)
            else: text.SetTextColor(1)
            name = "%d" % color
            if (isinstance(label, int) and i % div == label) or label:
                name = getColorString(color)
            if (not isinstance(RBG, bool) and isinstance(RBG, int)
                    and i % div == RBG) or (RBG
                                            and not isinstance(label, int)):
                name = getRGBString(color)
            elif newRBG and color >= 924:
                name = getRGBString(color)
            text.DrawText(0.5 * (xlow + xup), 0.5 * (ylow + yup), name)
        if i >= len(clist): break

    canvas.SaveAs("TColorTable%s.png" % tag)
    canvas.SaveAs("TColorTable%s.pdf" % tag)
Esempio n. 7
0
def main():

    if True:
        mf=TGMainFrame(gClient.GetRoot(),1500,475)
        gvf=TGVerticalFrame(mf,1500,475)
        rec=TRootEmbeddedCanvas("ccc",gvf,1500,450)
        rec2=TRootEmbeddedCanvas("ccc2",gvf,1500,25)
        gvf.AddFrame(rec,TGLayoutHints(ROOT.kLHintsExpandX|ROOT.kLHintsTop))
        gvf.AddFrame(rec2,TGLayoutHints(ROOT.kLHintsExpandX|ROOT.kLHintsBottom))
        mf.AddFrame(gvf,TGLayoutHints(ROOT.kLHintsExpandX))
        cc=rec.GetCanvas()
        cc2=rec2.GetCanvas()
        mf.SetEditable(0)
        mf.SetWindowName('HPS ECAL FADC SCALERS')
        mf.MapSubwindows()
        mf.Resize(1501,476)# resize to get proper frame placement
        mf.MapWindow()
    else:
        cc=TCanvas('cc','',1500,450)
   
    cc.cd()
    cc.SetBorderMode(0)
    cc.SetFixedAspectRatio(1)
    cc.FeedbackMode(1)
    
    gStyle.SetOptStat(0)
    gStyle.SetGridStyle(1)
    gStyle.SetGridColor(11)

    hh=TH2D('hh',';X;Y',46,-22,24,11,-5,6)
    hi=TH2I('hi',';X;Y',46,-22,24,11,-5,6)
    setupHists([hh,hi])
    xax,yax=hh.GetXaxis(),hh.GetYaxis()
    hh.Draw('COLZ')
    hi.Draw('TEXTSAME')
    
    gPad.SetLogz()
    gPad.SetGrid(1,1)
    gPad.SetLeftMargin(0.05)
    
    tt1=TPaveText(0.1,0.9,0.3,1.0,'NDC')
    tt2=TPaveText(0.7,0.91,0.9,0.99,'NDC')
    ttT=TPaveText(-22+13+0.05,6-5,-22+22,7-5-0.05)
    ttB=TPaveText(-22+13+0.05,4-5+0.05,-22+22,5-5)
    ttM=TPaveText(-22+0+0.05,5-5+0.05,-22+13,6-5.01)
    ttime=TPaveText(-10,-6.5,10,-5.8)
    tchan=TPaveText(0,0,0.9,1)
    setupPaveTexts([tt1,tt2,ttT,ttB,ttM,ttime,tchan])
    ttM.SetTextColor(2)
    
    bb=TBox()
    bb.SetFillStyle(1001)
    bb.SetFillColor(0)
    bb.SetLineWidth(1)
    bb.SetLineColor(1)
    bb.DrawBox(-9+0.05,-1,0,1.97)
    bb.DrawBox(-24,0,24.05,0.97)
    
    tarrow=TText(14.5,0.3,'Beam Left')
    arrow=TArrow(19,0.5,23,0.5,0.02,'|>')
    arrow.SetAngle(40)
    arrow.SetFillColor(1)
    arrow.SetLineWidth(2)
    
    tt=TText()
    tt.SetTextColor(1)
    tt.SetTextAngle(90)
    tt.SetTextSize(0.08)
    tt.DrawText(25.4,0,'kHz')
    tt.SetTextAngle(0)
    tt.SetTextColor(2)
    tt.DrawTextNDC(0.3,0.92,'ECAL FADC SCALERS')
   
    cc.cd()
    for xx in [tt2,ttT,ttB,ttM,arrow,tarrow,ttime]: xx.Draw()
    cc2.cd()
    tchan.Draw('NDC')
    cc.cd()
    
    ll=TLine()
    ll.DrawLine(xax.GetXmin(),yax.GetXmin(),xax.GetXmax(),yax.GetXmin())
    ll.DrawLine(xax.GetXmin(),yax.GetXmax(),xax.GetXmax(),yax.GetXmax())
    ll.DrawLine(xax.GetXmin(),yax.GetXmin(),xax.GetXmin(),0)
    ll.DrawLine(xax.GetXmax(),yax.GetXmin(),xax.GetXmax(),0)
    ll.DrawLine(xax.GetXmin(),yax.GetXmax(),xax.GetXmin(),1)
    ll.DrawLine(xax.GetXmax(),yax.GetXmax(),xax.GetXmax(),1)
    ll.DrawLine(xax.GetXmax(),0,0,0)
    ll.DrawLine(xax.GetXmax(),1,0,1)
    ll.DrawLine(xax.GetXmin(),0,-9,0)
    ll.DrawLine(xax.GetXmin(),1,-9,1)
    ll.DrawLine(-9,-1,0,-1)
    ll.DrawLine(-9,2,0,2)
    ll.DrawLine(-9,1,-9,2)
    ll.DrawLine(-9,-1,-9,0)
    ll.DrawLine(0,-1,0,0)
    ll.DrawLine(0,1,0,2)
   
    gPad.SetEditable(0)

    while True:

#        try:

            zvals=getPVS()
            for ii in range(len(zvals)):
                hh.SetBinContent(xax.FindBin(XVALS[ii]),yax.FindBin(YVALS[ii]),zvals[ii])
                hi.SetBinContent(xax.FindBin(XVALS[ii]),yax.FindBin(YVALS[ii]),zvals[ii])
            
            for xx in [ttime,tt2,ttT,ttB,ttM]: xx.Clear()
            [top,bottom,maximum]=calcRates(zvals)
            tt2.AddText('Total:  %.1f MHz'%((top+bottom)/1000))
            ttT.AddText('%.1f MHz'%(top/1000))
            ttB.AddText('%.1f MHz'%(bottom/1000))
            ttM.AddText('MAX SINGLE CRYSTAL = %.0f kHz'%(maximum))
            ttime.AddText(makeTime())
          
            if gPad.GetEvent()==11:
                xy=pix2xy(gPad)
                ee=ECAL.findChannelXY(xy[0],xy[1])
                if ee:
                    tchan.Clear()
                    tchan.AddText(printChannel(ee))
                    cc2.Modified()
                    cc2.Update()
            elif gPad.GetEvent()==12:
                tchan.Clear()
                cc2.Modified()
                cc2.Update()
    
    
            cc.Modified()
            cc.Update()
        
            time.sleep(1)
Esempio n. 8
0
def main():

    cc.cd()
    cc.SetBorderMode(0)
    cc.SetFixedAspectRatio(1)
    cc.FeedbackMode(1)

    gStyle.SetOptStat(0)
    gStyle.SetGridStyle(1)
    gStyle.SetGridColor(11)

    hh=TH2D('hh',';X;Y',22,-10.5,11.5,22,-10.5,11.5)
    hi=TH2I('hi',';X;Y',22,-10.5,11.5,22,-10.5,11.5)
    setupHists([hh,hi])
    xax,yax=hh.GetXaxis(),hh.GetYaxis()
    hh.Draw('COLZ')
    hi.Draw('TEXTSAME')

    gPad.SetLogz()
    gPad.SetGrid(1,1)
    gPad.SetLeftMargin(0.09)
    gPad.SetRightMargin(0.11)

    #tt2=TPaveText(0.7,0.96,0.9,0.99,'NDC')
    ttM=TPaveText(-3+0.05, 7-4.45, 4.0, 8-4.51)
    tt2=TPaveText(-3+0.05, 7-5.45, 4.0, 8-5.51)

    ttX=TPaveText(-2, 7-8.00, 3, 8-8.00)
    ttY=TPaveText(-2, 7-9.00, 3, 8-9.00)
    ttZ=TPaveText(-2, 6-8.80, 3, 8-9.30)
    ttZ.AddText("positive = beam top/right")

    ttime=TPaveText(-10,-12.5,10,-11.8)
    tchan=TPaveText(0,0,0.9,1)
    setupPaveTexts([tt2,ttM,ttime,tchan,ttX,ttY,ttZ])
    ttM.SetTextColor(2)
    ttM.SetFillStyle(0)
    ttZ.SetFillStyle(0)
    tt2.SetFillStyle(0)

    tarrow=TText(-0.9,0.7,'Beam Right')
    tarrow.SetTextSizePixels(15)
    arrow=TArrow(-1.4,0.5,2.4,0.5,0.02,'|>')
    arrow.SetAngle(40)
    arrow.SetFillColor(1)
    arrow.SetLineWidth(2)

    tt=TText()
    tt.SetTextColor(1)
    tt.SetTextAngle(90)
    tt.SetTextSize(0.04)
    tt.DrawText(12.4,0,'kHz')
    tt.SetTextAngle(0)
    tt.SetTextColor(1)
    tt.DrawTextNDC(0.3,0.92,'FTC FADC SCALERS')

    bb=TBox()
    bb.SetFillStyle(1001)
    bb.SetFillColor(0)
    bb.SetLineWidth(1)
    bb.SetLineColor(1)
    bb.DrawBox(-3.47,-1.47,4.47,2.46)
    bb.DrawBox(-1.47,-3.47,2.49,4.47)
    bb.DrawBox(-2.47,-2.47,3.49,3.47)

    cc.cd()
    for xx in [ttM,tt2,ttime,arrow,tarrow,ttX,ttY,ttZ]: xx.Draw()
    cc2.cd()
    tchan.Draw('NDC')
    cc.cd()

    gPad.SetEditable(0)

    while True:

            for ch in ECAL.chans:
              loadPV(ch)
              ch=ch.vals
              xx,yy=ch['X'],ch['Y']
              #if (ch['PVVAL']>10):
               # print xx,yy,ch['PVVAL']

              # swap x to make it downstream view:
              xx=-xx

              #after, fix the fact x=0 / y=0 don't exists
              if xx<0: xx+=1
              if yy<0: yy+=1
              hh.SetBinContent(xax.FindBin(xx),yax.FindBin(yy),ch['PVVAL'])
              hi.SetBinContent(xax.FindBin(xx),yax.FindBin(yy),ch['PVVAL'])

            for xx in [ttime,tt2,ttM,ttX,ttY]: xx.Clear()
            [total,maximum,top,bottom,left,right]=calcRates(ECAL.chans)

            tt2.AddText('Total:  %.1f MHz'%(total/1000))
            ttM.AddText('Max:  %.0f kHz'%(maximum))

            if total>1e2:
              xasy = (right-left)/total
              yasy = (top-bottom)/total
              ttX.AddText('X-Asy:  %+.1f%%'%(100*xasy))
              ttY.AddText('Y-Asy:  %+.1f%%'%(100*yasy))
            else:
              ttX.AddText('X-Asy:  N/A')
              ttY.AddText('Y-Asy:  N/A')

            ttime.AddText(makeTime())

            if not gPad: sys.exit()

            if gPad.GetEvent()==11:
                xy=pix2xy(gPad)
                ee=ECAL.findChannelXY(xy[0],xy[1])
                if ee:
                    tchan.Clear()
                    tchan.AddText(printChannel(ee))
                    cc2.Modified()
                    cc2.Update()
            elif gPad.GetEvent()==12:
                tchan.Clear()
                cc2.Modified()
                cc2.Update()


            cc.Modified()
            cc.Update()

            time.sleep(2)
Esempio n. 9
0
    leg1.SetTextSize(0.05)
    leg1.SetBorderSize(0)
    leg1.SetTextFont(22)
    leg1.AddEntry(G1, "M(Z')=5TeV", "l")
    leg1.AddEntry(G2, "M(Z')=10TeV", "l")
    leg1.AddEntry(G3, "M(Z')=20TeV", "l")
    leg1.AddEntry(G4, "M(Z')=40TeV", "l")

    t = TText()
    t.SetTextAlign(20)
    t.SetTextSize(0.03)
    t.SetTextFont(22)
    t.SetTextColor(1)
    label = ["20*20", "5*5", "1*1"]
    for i in range(3):
        t.DrawText(i + 1, -0.03, label[i])
    c.Draw()
    mg.Draw()
    leg.Draw()
    leg1.Draw()

    #    c.Print("raw_"+str(cut_value)+"_tau21_summary_U_after_cut_25bins_no_UOF.pdf")
    c.Print("raw_" + str(cut_value) +
            "_tau21_summary_U_after_cut_25bins_no_UOF_new_75pa.eps")

if (variable[k + 1] == "tau32"):
    f1 = ROOT.TFile.Open(
        "/Users/ms08962476/github/MannWhitneyUrawhit/codes/raw_" +
        str(cut_value) + "_tau32_5tev_04_after_cut_Man_75%.root")
    f2 = ROOT.TFile.Open(
        "/Users/ms08962476/github/MannWhitneyUrawhit/codes/raw_" +
Esempio n. 10
0
def main():

    cc.cd()
    cc.SetBorderMode(0)
    cc.SetFixedAspectRatio(1)
    cc.FeedbackMode(1)

    gStyle.SetOptStat(0)
    gStyle.SetGridStyle(1)
    gStyle.SetGridColor(18)

    hh = TH2D('hh', ';X;Y', 8 * 28, 0, 28, 8 * 23, 0, 23)
    hi = TH2I('hi', ';X;Y', 8 * 28, 0, 28, 8 * 23, 0, 23)
    setupHists([hh, hi])
    xax, yax = hh.GetXaxis(), hh.GetYaxis()
    hh.Draw('COLZ')
    hh.SetMinimum(1)
    hh.SetMaximum(1.5e3)
    #hi.Draw('TEXTSAME')

    gPad.SetLogz()
    gPad.SetGrid(1, 1)
    gPad.SetLeftMargin(0.09)
    gPad.SetRightMargin(0.11)

    #tt2=TPaveText(0.7,0.96,0.9,0.99,'NDC')
    ttM = TPaveText(-3 + 0.05, 7 - 4.45, 4.0, 8 - 4.51)
    tt2 = TPaveText(-3 + 0.05, 7 - 5.45, 4.0, 8 - 5.51)

    ttX = TPaveText(-2, 7 - 8.00, 3, 8 - 8.00)
    ttY = TPaveText(-2, 7 - 9.00, 3, 8 - 9.00)

    ttime = TPaveText(8, -2, 20, -1)
    tchan = TPaveText(0, 0, 0.9, 1)
    setupPaveTexts([tt2, ttM, ttime, tchan, ttX, ttY])
    ttM.SetTextColor(2)
    ttM.SetFillStyle(0)
    tt2.SetFillStyle(0)

    tt = TText()
    tt.SetTextColor(1)
    tt.SetTextAngle(90)
    tt.SetTextSize(0.04)
    tt.DrawText(29.5, 10, 'kHz')
    tt.SetTextAngle(0)
    tt.SetTextColor(1)
    tt.DrawTextNDC(0.3, 0.92, 'RICH SSP Scalers')

    #    bb=TBox()
    #    bb.SetFillStyle(1001)
    #    bb.SetFillColor(0)
    #    bb.SetLineWidth(1)
    #    bb.SetLineColor(1)
    #    bb.DrawBox(-3.47,-1.47,4.47,2.46)
    #    bb.DrawBox(-1.47,-3.47,2.49,4.47)
    #    bb.DrawBox(-2.47,-2.47,3.49,3.47)

    cc.cd()
    for xx in [ttime]:
        xx.Draw()  #ttM,tt2,ttime,ttX,ttY]: xx.Draw()
    cc2.cd()
    tchan.Draw('NDC')
    cc.cd()

    gPad.SetEditable(0)

    while True:

        for ch in ECAL.chans:
            loadPV(ch)
            ch = ch.vals
            xx, yy = ch['X'], ch['Y']
            data = ch['PVVAL']

            for ix in range(8):
                for iy in range(8):
                    ii = ix * 8 + iy
                    #print ch['PVNAME'],data[ii]
                    xoff = float(ix) / 8
                    yoff = float(iy) / 8

                    hh.SetBinContent(xax.FindBin(xx + xoff),
                                     yax.FindBin(yy + yoff), data[ii])


#                  hi.SetBinContent(xax.FindBin(xx+xoff),yax.FindBin(yy+yoff),data[ii])
#
        for xx in [ttime]:
            ttime.Clear()  # xx.,tt2,ttM,ttX,ttY]: xx.Clear()
        #            [total,maximum,top,bottom,left,right]=calcRates(ECAL.chans)

        #            tt2.AddText('Total:  %.1f MHz'%(total/1000))
        #            ttM.AddText('Max:  %.0f kHz'%(maximum))

        #            if total>1e2:
        #              xasy = (right-left)/total
        #              yasy = (top-bottom)/total
        #              ttX.AddText('X-Asy:  %+.1f%%'%(100*xasy))
        #              ttY.AddText('Y-Asy:  %+.1f%%'%(100*yasy))
        #            else:
        #              ttX.AddText('X-Asy:  N/A')
        #              ttY.AddText('Y-Asy:  N/A')

        ttime.AddText(makeTime())

        if not gPad: sys.exit()

        #            if gPad.GetEvent()==11:
        #                xy=pix2xy(gPad)
        #                ee=ECAL.findChannelXY(xy[0],xy[1])
        #                if ee:
        #                    tchan.Clear()
        #                    tchan.AddText(printChannel(ee))
        #                    cc2.Modified()
        #                    cc2.Update()
        #            elif gPad.GetEvent()==12:
        #                tchan.Clear()
        #                cc2.Modified()
        #                cc2.Update()

        cc.Modified()
        cc.Update()

        time.sleep(1)