예제 #1
0
electron_eta = []
electron_phi = []
maxfactor = 1.3
for variable in variables:
    compare = []
    app = compare.append
    for hist in histograms:
        if variable in hist:
            app(hists['SingleElectron'][hist])
    if 'Isolation' in variable:
        maxfactor = 2
    elif 'mvaTrigV0' in variable:
        maxfactor = 1.5
    else:
        maxfactor = 1.3
    canvas, legend = plotting.compareShapes(compare, labels, styles, maxfactor)
    legend.Draw()
    plotting.saveAs(canvas,
                    variable,
                    outputFormats=outputFormats,
                    outputFolder=outputFolder)

#MET plots
variables = [
    'MET_0btag', 'MET_0orMoreBtag', 'Transverse_Mass_MET20_0orMoreBtag',
    'Transverse_Mass_0orMoreBtag'
]
selections = ['QCDAntiID', 'QCDNonIso']
histograms = [
    'HLTQCDAnalyser_inclusive/' + selection + '/' + trigger +
    '/patMETsPFlow/' + variable for variable in variables
electron_eta = []
electron_phi = []
maxfactor = 1.3
for variable in variables:
    compare = []
    app = compare.append
    for hist in histograms:
        if variable in hist:
            app(hists["SingleElectron"][hist])
    if "Isolation" in variable:
        maxfactor = 2
    elif "mvaTrigV0" in variable:
        maxfactor = 1.5
    else:
        maxfactor = 1.3
    canvas, legend = plotting.compareShapes(compare, labels, styles, maxfactor)
    legend.Draw()
    plotting.saveAs(canvas, variable, outputFormats=outputFormats, outputFolder=outputFolder)

# MET plots
variables = ["MET_0btag", "MET_0orMoreBtag", "Transverse_Mass_MET20_0orMoreBtag", "Transverse_Mass_0orMoreBtag"]
selections = ["QCDAntiID", "QCDNonIso"]
histograms = [
    "HLTQCDAnalyser_inclusive/" + selection + "/" + trigger + "/patMETsPFlow/" + variable
    for variable in variables
    for trigger in triggers
    for selection in selections
]
hists = FileReader.getHistogramsFromFiles(histograms, files)
hists = plotting.rebin(hists, 5, "*MET_")
hists = plotting.rebin(hists, 5, "*Transverse_Mass")