Exemple #1
0
def save_and_cleanup(outdir='plots'):
    ## Save plots
    if not os.path.exists(outdir):
        print "Creating folder `%s'" % outdir
        os.mkdir(outdir)
    else:
        ## TODO: remove outdir
        pass
    canvases.make_plots(['png', 'root'], outdir)
    canvases.make_pdf_from_eps(outdir)
    ## Store corrections
    for extractor in extractors:
        raw = extractor.raw.name.split('-')[0]
        target = extractor.target.name.split('-')[0]
        out_file_name = '_'.join([raw, 'to', target, 'qqcorrections.root'])
        extractor.write_corrector_to_file(outdir + '/' + out_file_name)
    ## Cleanup
    trees.close_files()
Exemple #2
0
def save_and_cleanup(outdir = 'plots'):
    ## Save plots
    if not os.path.exists(outdir):
        print "Creating folder `%s'" % outdir
        os.mkdir(outdir)
    else:
        ## TODO: remove outdir
        pass
    canvases.make_plots(['png', 'root'], outdir)
    canvases.make_pdf_from_eps(outdir)
    ## Store corrections
    for extractor in extractors:
        raw    = extractor.raw   .name.split('-')[0]
        target = extractor.target.name.split('-')[0]
        out_file_name = '_'.join([raw, 'to', target, 'qqcorrections.root'])
        extractor.write_corrector_to_file(outdir + '/' + out_file_name)
    ## Cleanup
    trees.close_files()
            cuts.append('Entry$ < %d' % max_entries)
        dataset = datasetly.get(tree=tree, variable=variable, cuts=cuts)
        variable = dataset.get().first()
        variable.SetTitle(cfg.title)
        variable.setUnit(cfg.unit)
        datasets.append(dataset)
    ## End of loop over expressions and selections
    dataset = datasets[0]
    for further_dataset in datasets[1:]:
        dataset.append(further_dataset)
    return dataset
## End of get_dataset()


#______________________________________________________________________________
def draw_and_append(plot):
    plot.Draw()
    plots.append(plot)
## End of draw_and_append(plot)


#______________________________________________________________________________
if __name__ == '__main__':
    import user
    test()
    ## Clean up to prevent horrible root crashes.
    if not '-i' in sys.argv:
        canvases.make_pdf_from_eps('plots')
        trees.close_files()
    
        variable = dataset.get().first()
        variable.SetTitle(cfg.title)
        variable.setUnit(cfg.unit)
        datasets.append(dataset)
    ## End of loop over expressions and selections
    dataset = datasets[0]
    for further_dataset in datasets[1:]:
        dataset.append(further_dataset)
    return dataset


## End of get_dataset()


#______________________________________________________________________________
def draw_and_append(plot):
    plot.Draw()
    plots.append(plot)


## End of draw_and_append(plot)

#______________________________________________________________________________
if __name__ == '__main__':
    import user
    test()
    ## Clean up to prevent horrible root crashes.
    if not '-i' in sys.argv:
        canvases.make_pdf_from_eps('plots')
        trees.close_files()