Exemple #1
0
def printTableDataDriven(f, srNames, crname=''):
    if crname != '' and crname[-1] != ' ': crname += ' '

    tab = Table()
    preds = getYieldEInTopoBins(f, srNames, 'metbins')
    alpha = getYieldEInTopoBins(f, srNames, 'alphaHist')
    purity = getYieldEInTopoBins(f, srNames, 'CRpurity')
    yMC_SR = getYieldEInTopoBins(f, srNames, 'MCyields_SR')
    yMC_CR = getYieldEInTopoBins(f, srNames, 'MCyields_CR')
    yld_CR = getYieldEInTopoBins(f, srNames, 'datayields_CR')

    metrange = getBinningFromTopoSRs(f, srNames)
    tab.add_column(
        'SR name',
        sum([[sr] * n for sr, n in zip(srNames, map(len, preds))], []))
    tab.add_column('MET [GeV]',
                   [m[0] + ' -- ' + m[1] for m in sum(metrange, [])])
    tab.add_column(crname + 'MC SR', [y.round(2) for y in sum(yMC_SR, [])])
    tab.add_column(crname + 'MC CR', [y.round(2) for y in sum(yMC_CR, [])])
    tab.add_column(crname + 'Purity', [y.round(2) for y in sum(purity, [])])
    tab.add_column(crname + 'TF_{CR}^{SR}',
                   [y.round(2).val for y in sum(alpha, [])])
    tab.add_column(crname + 'data CR', [y.round(2) for y in sum(yld_CR, [])])
    tab.add_column(crname + 'R_{CR}(data/MC)',
                   [(d / m).round(2)
                    for d, m in zip(sum(yld_CR, []), sum(yMC_CR, []))])
    tab.add_column(crname + 'Prediction', [y.round(2) for y in sum(preds, [])])

    tab.print_table()

    return tab
Exemple #2
0
def printTableWithMETextrpInfo(f1, f2, srNames, crname=''):
    if crname != '' and crname[-1] != ' ': crname += ' '

    tab = Table()
    preds1 = getYieldEInTopoBins(f1, srNames, 'metbins')
    alpha1 = getYieldEInTopoBins(f1, srNames, 'alphaHist')
    purity = getYieldEInTopoBins(f1, srNames, 'CRpurity')
    yMC_SR = getYieldEInTopoBins(f1, srNames, 'MCyields_SR')
    yMC_CR = getYieldEInTopoBins(f1, srNames, 'MCyields_CR')
    yld_CR = getYieldEInTopoBins(f1, srNames, 'datayields_CR')

    yMCaCR = getYieldEInTopoBins(f2, srNames, 'MCyields_CR')
    yldaCR = getYieldEInTopoBins(f2, srNames, 'datayields_CR')
    preds2 = getYieldEInTopoBins(f2, srNames, 'metbins')
    alpha2 = getYieldEInTopoBins(f2, srNames, 'alphaHist')

    metrange = getBinningFromTopoSRs(f1, srNames)

    tab.add_column(
        'SR name',
        sum([[sr] * n for sr, n in zip(srNames, map(len, preds1))], []))
    tab.add_column('MET range [GeV]',
                   [m[0] + ' -- ' + m[1] for m in sum(metrange, [])])
    tab.add_column(crname + 'MC SR', [y.round(2) for y in sum(yMC_SR, [])])
    tab.add_column(crname + 'MC CR raw', [y.round(2) for y in sum(yMC_CR, [])])
    tab.add_column(crname + 'Purity',
                   [y.round(2).val for y in sum(purity, [])])
    tab.add_column(crname + 'TF_{CR}^{SR}',
                   [y.round(2) for y in sum(alpha1, [])])
    tab.add_column(crname + 'data CR raw',
                   [y.round(2) for y in sum(yld_CR, [])])
    tab.add_column(crname + 'CR data/MC raw',
                   [(d / m).round(2)
                    for d, m in zip(sum(yld_CR, []), sum(yMC_CR, []))])
    tab.add_column(crname + 'Pred (no extrp)',
                   [y.round(2) for y in sum(preds1, [])])

    tab.add_column(crname + 'MC CR comb',
                   [y.round(2) for y in sum(yMCaCR, [])])
    tab.add_column(crname + 'data CR comb',
                   [y.round(2) for y in sum(yldaCR, [])])
    tab.add_column(crname + 'CR data/MC comb',
                   [(d / m).round(2)
                    for d, m in zip(sum(yldaCR, []), sum(yMCaCR, []))])
    tab.add_column(crname + 'Pred (MET extrp)',
                   [y.round(2) for y in sum(preds2, [])])

    tab.print_table()

    return tab
    #     tab.add_row(['T2tt'+sigpt+' org'] + sylds_org)
    #     wdtylds, wdterrs = getYieldAndErrsFromTopoSRs(f4, wdtNames, sigpt)
    #     sylds_wdt = [E(y,e).round(2) * scale for y, e in zip(wdtylds, wdterrs)]
    #     tab.add_row(['T2tt'+sigpt+' mtag'] + sylds_wdt)
    #     seff = getPercentage(sylds_wdt, sylds_org)
    #     tab.add_row(['T2tt'+sigpt+' eff'] + seff)

    #     # tab.add_line()
    #     ssb_org = [get_StoSB(s,b).round(2) for s,b in zip(sylds_org, bylds_org)]
    #     tab.add_row(['S/sqrt(S+B) org'] + ssb_org)
    #     ssb_wdt = [get_StoSB(s,b).round(2) for s,b in zip(sylds_wdt, bylds_wdt)]
    #     tab.add_row(['S/sqrt(S+B) mtag'] + ssb_wdt)

    #     tab.add_line()

    tab.print_table()

    # ssb_org = [get_StoSB(s,b).round(2) for s,b in zip(sylds_org, bylds_org)]
    # tab2.add_row(['SSB org'] + ssb_org)
    # ssb_wdt = [get_StoSB(s,b).round(2) for s,b in zip(sylds_wdt, bylds_wdt)]
    # tab2.add_row(['SSB wdt'] + ssb_wdt)

    # tab2.print_table()


    # f5 = r.TFile('../StopLooper/output/temp_org/allBkg_25ns.root')
    # f6 = r.TFile('../StopLooper/output/temp_org/SMS_T2tt.root')

    # f7 = r.TFile('../StopLooper/output/rtagbinned/allBkg_25ns.root')
    # f8 = r.TFile('../StopLooper/output/rtagbinned/SMS_T2tt.root')