Beispiel #1
0
 def AddTex(self, t='', x=0.15, y=0.87, s=0.04):
     tl = TLatex(-20, 50, t)
     tl.SetNDC()
     tl.SetTextAlign(12)
     tl.SetX(x)
     tl.SetY(y)
     tl.SetTextFont(42)
     tl.SetTextSize(s)
     self.Tex.append(tl)
def AddText(txt):
    texcms = TLatex(-20.0, 50.0, txt)
    texcms.SetNDC()
    texcms.SetTextAlign(12)
    texcms.SetX(0.5)
    texcms.SetY(0.34)
    texcms.SetTextSize(0.02)
    texcms.SetTextSizePixels(32)
    return texcms
Beispiel #3
0
 def DrawTextCMS(self):
     texcms = TLatex(0, 0, self.cmstex)
     texcms.SetNDC()
     texcms.SetX(self.cmstexX)
     texcms.SetY(self.cmstexY)
     texcms.SetTextAlign(12)
     texcms.SetTextSize(self.cmstexS)
     texcms.SetTextSizePixels(22)
     return texcms
Beispiel #4
0
 def DrawTextCMSmode(self):
     texpre = TLatex(0, 0, self.texcmsMode)
     texpre.SetNDC()
     texpre.SetTextAlign(12)
     texpre.SetX(self.texcmsModeX)
     texpre.SetY(self.texcmsModeY)
     texpre.SetTextFont(52)
     texpre.SetTextSize(self.texcmsModeS)
     texpre.SetTextSizePixels(22)
     return texpre
Beispiel #5
0
def GetTLatex(t, x, y, s = 0.04):
  t = TLatex(-20, 50, t);
  t.SetNDC();
  t.SetTextAlign(12);
  t.SetX(x);
  t.SetY(y);
  t.SetTextFont(42);
  t.SetTextSize(s);
  t.Draw()
  return t
Beispiel #6
0
    def SetCanvas(self):
        self.canvas = None
        self.plot = None
        self.ratio = None
        c = TCanvas('c', 'c', 10, 10, 1600, 1200)
        if self.doRatio:
            c.Divide(1, 2)
            plot = c.GetPad(1)
            ratio = c.GetPad(2)
        else:
            plot = c.GetPad(0)
        #if self.doRatio:
        plot.SetPad(self.hpadx0, self.hpady0, self.hpadx1, self.hpady1)
        plot.SetMargin(self.hpadMleft, self.hpadMright, self.hpadMbottom,
                       self.hpadMtop)
        #else: plot = c.GetPad(0)

        if self.doRatio:
            ratio.SetPad(self.rpadx0, self.rpady0, self.rpadx1, self.rpady1)
            ratio.SetMargin(self.rpadMleft, self.rpadMright, self.rpadMbottom,
                            self.rpadMtop)
        else:
            #ratio.SetPad(0,0,0,0)
            plot.SetPad(0, 0, 1, 1)

        # Draw the text
        texcms = self.DrawTextCMS()
        texmod = self.DrawTextCMSmode()
        texlum = self.DrawTextLumi()
        self.Tex.append(texcms)
        self.Tex.append(texmod)
        self.Tex.append(texlum)
        if hasattr(self, 'texch') and self.texch != '':
            tch = TLatex(-20, 50, self.texch)
            tch.SetNDC()
            tch.SetTextAlign(12)
            tch.SetX(self.texchX)
            tch.SetY(self.texchY)
            tch.SetTextFont(42)
            tch.SetTextSize(self.texchS)
            self.Tex.append(tch)
        for r in self.Tex:
            r.Draw()

        TGaxis.SetMaxDigits(3)
        if self.doSetLogY: plot.SetLogy()

        # Legend
        self.legend = self.SetLegend()
        self.legendRatio = self.SetLegendRatio()

        self.canvas = c
        self.plot = plot
        if self.doRatio: self.ratio = ratio
Beispiel #7
0
 def DrawTextLumi(self):
   if not hasattr(self, 'lumi'): self.lumi = 0
   t = self.texlumi if not '%' in self.texlumi else (self.texlumi%self.lumi if not self.doinvfb else self.texlumi%(self.lumi/1000.))
   tlum = TLatex(-20., 50., t)
   tlum.SetNDC()
   tlum.SetTextAlign(12)
   tlum.SetTextFont(42)
   tlum.SetX(self.texlumiX)
   tlum.SetY(self.texlumiY)
   tlum.SetTextSize(self.texlumiS)
   tlum.SetTextSizePixels(22)
   return tlum
Beispiel #8
0
def Draw2Dsig(tag='exp', pname='limits', ms=275, ml=100, lim=[]):
    h = Get2Dhisto(pname + '.p', tag)
    c = TCanvas('c', 'c', 10, 10, 1200, 800)
    if lim != []:
        zmin, zmax = lim
        h.SetMaximum(zmax)
        h.SetMinimum(zmin)
    h.SetTitle('%s significance' % tag)
    g = TGraph(1)
    g.SetPoint(1, ms + 5, ml + 5)
    g.SetMarkerSize(1)
    g.SetMarkerStyle(20)
    gStyle.SetPalette(51)  #58)
    h.Draw('colz')
    g.Draw('psame')
    t = TLatex(0, 0, 'Injected signal %s_%s' % (str(ms), str(ml)))
    t.SetNDC()
    t.SetX(0.15)
    t.SetY(0.85)
    t.SetTextAlign(12)
    t.Draw()
    for f in ['png', 'pdf']:
        c.Print('%s.%s' % (pname.replace('limits', 'scan'), f))
Beispiel #9
0
def addLegendText(text):
    tex2 = TLatex(-20., 50., text)
    tex2.SetX(0.25), tex2.SetY(0.83)
    tex2.SetNDC(), tex2.SetTextAlign(12)
    tex2.SetTextColor(2), tex2.SetTextFont(42)
    return tex2