Пример #1
0
 def make_a_legend(entries=5):
     vh_legend = Legend(
         entries, rightmargin=0.26, topmargin=0.05, leftmargin=0.375)
     vh_legend.SetEntrySeparation(0.0)
     vh_legend.SetMargin(0.35)
     vh_legend.SetBorderSize(0)
     return vh_legend
Пример #2
0
        if fileNames[0] in fileDescr:
            if fileDescr[fileNames[0]]:
                legend.AddEntry(None, label=fileDescr[fileNames[0]], style="")
        legend.AddEntry(None, label="(reference)", style="")
        for idx, ratiohist in enumerate(ratiohists):
            legend.AddEntry(ratiohist,
                            label=os.path.basename(fileNames[idx + 1]),
                            style="l")
            # add additional info if specified by the user
            if fileNames[idx + 1] in fileDescr:
                if fileDescr[fileNames[idx + 1]]:
                    legend.AddEntry(None,
                                    label=fileDescr[fileNames[idx + 1]],
                                    style="")
        legend.SetBorderSize(0)
        legend.SetMargin(0.3)
        legend.Draw()
        # we need to keep the legend around in memory or it will be deleted before the plot is drawn
        ROOT.SetOwnership(legend, False)  # True to own, False to release
    return cans


def findHistogramsInFile(filename, regexlist, strict, verbose=False):
    """ searches the ROOT file given by filename and returns a list of files matching 
    one of the regular expressions in regexlist
    """
    log = logging.getLogger('pyroplot')
    import re
    import rootpy
    from rootpy.io import root_open
    # speed up search routine by explicitly caching the regular expressions