Exemple #1
0
def plot(obj, plot_name, plot_notes=[]):
    canvas = TCanvas('canvas' + plot_name, "Canvas", 450, 450)
    gPad.SetLeftMargin(.13)
    gPad.SetTopMargin(.05)

    gStyle.SetOptStat(11)
    gStyle.SetOptFit(1111)

    if 'TH2' in obj.ClassName():
        gPad.SetRightMargin(.13)
        draw_options = 'COLZ'

    if 'profile' in obj.GetName():
        gPad.SetRightMargin(.05)
        draw_options = ''

    if 'graph' in obj.GetName():
        gPad.SetRightMargin(.05)
        draw_options = 'APE'
        obj.SetMarkerSize(.7)
        obj.SetMarkerStyle(21)

    note = TPaveText(.2, .7, .5, .9, "brNDC")
    note.SetFillStyle(0)
    note.SetFillColor(0)
    note.SetBorderSize(0)
    note.SetTextColor(1)
    note.SetTextFont(42)
    note.SetTextAlign(11)
    for note_text in plot_notes:
        note.AddText(note_text)

    obj.Draw(draw_options)
    note.Draw()
    canvas.Print('output/' + plot_name + '.pdf')
Exemple #2
0
    def addStats(self, parNames, parValues):
        pt = TPaveText(.15, .45, .55, .85, 'NDC')
        pt.SetBorderSize(1)
        pt.SetFillColor(0)
        pt.SetTextAlign(12)
        pt.SetTextFont(62)
        pt.AddText(' #chi^{2}/d.o.f.   ' + str(round(self.chi2, 2)) + ' / ' +
                   str(self.dof))

        for i, name in enumerate(parNames):
            if i not in self.fixParams:
                pt.AddText('')
                pt.AddText(' ' + name + '   ' + '{:.2e}'.format(parValues[i]) +
                           ' #pm ' + '{:.2e}'.format(self.fitErr[i]))

        pt.Draw()

        return pt