'_Zptcut' + str(zptcut) + '_Hptcut' +
                               str(hptcut) + '_metcut' + str(metcut) +
                               '_btagwp' + str(btagwp) + '.pkl')
    datuncs17 = pd.read_pickle('analysis_output_ZpAnomalon/' + args.date +
                               '/Run2017.AllZpAnomalonData_unc_' + reg +
                               '_Zptcut' + str(zptcut) + '_Hptcut' +
                               str(hptcut) + '_metcut' + str(metcut) +
                               '_btagwp' + str(btagwp) + '.pkl')
    datuncs18 = pd.read_pickle('analysis_output_ZpAnomalon/' + args.date +
                               '/Run2018.AllZpAnomalonData_unc_' + reg +
                               '_Zptcut' + str(zptcut) + '_Hptcut' +
                               str(hptcut) + '_metcut' + str(metcut) +
                               '_btagwp' + str(btagwp) + '.pkl')

    #check for plotting, prep backgrounds
    bkg_colors = gecorg.colsFromPalette(bkgnames, ROOT.kLake)
    if not year:
        lumi = 41.53 + 59.74
        print("Stacking for a luminosity of ", round(lumi, 2))
        bkg_info17 = gecorg.prepBkg(bkgupout17, bkgnames, bkg_colors,
                                    'xsects_2017.ini', 41.53, "yes")
        bkg_info18 = gecorg.prepBkg(bkgupout18, bkgnames, bkg_colors,
                                    'xsects_2017.ini', 59.74, "yes")
        bkguncs = (bkguncs17**2 + bkguncs18**2)**(1 / 2)
        datfiles = datfiles17 + datfiles18
        dat_info = [ROOT.TFile(dat) for dat in datfiles]
        datuncs = (datuncs17**2 + datuncs18**2)**(1 / 2)
        regiondescrip = reg + '_1718'
        keys = bkg_info17[0]['binlist'][0]['tfile'].GetListOfKeys()
    if year == 17:
        lumi = 41.53
    metcut = args.metcut
    btaggers = [
        'DeepMassDecorrelTagHbbvsQCD',  #move to command line option?
        'DeepMassDecorrelTagZbbvsQCD',
        'DeepMassDecorrelTagZHbbvsQCD',
        'pfMassIndependentDeepDoubleBvLJetTagsProbHbb',
    ]
    sigsamp = 'Zp1200-ND175-NS1'
    plotmax = 100000000000.0

    #Prep the plot
    mg = ROOT.TMultiGraph()
    gleg = ROOT.TLegend(0.45, 0.1, 0.90, 0.3)
    tc = ROOT.TCanvas("tc", "btagrco", 600, 600)

    btagcols = gecorg.colsFromPalette(btaggers, ROOT.kColorPrintableOnGrey)

    for i, btag in enumerate(btaggers):
        #Samples
        #bkgfiles = gecorg.gatherBkg('analysis_output_ZpAnomalon/'+args.date+'/','upout_'+btag,zptcut,hptcut,metcut)
        if year == 18:
            mcprefix = 'Autumn18'
        if year == 17:
            mcprefix = 'Fall17'

        DYJetsToLL = glob.glob('analysis_output_ZpAnomalon/' + args.date +
                               '/' + mcprefix + '.DYJetsToLL_M-50_HT*upout_' +
                               btag + '*_Zptcut' + str(zptcut) + '_Hptcut' +
                               str(hptcut) + '_metcut' + str(metcut) +
                               '_btagwp*')
        TT = glob.glob('analysis_output_ZpAnomalon/' + args.date + '/' +
    parser.add_argument("-y","--year", type=float,help = "year of samples eg. 2017 -> 17")
    args = parser.parse_args()

    #Get command line parameters
    lumi          = args.lumi
    sig_xsec      = args.xsec
    zptcut        = args.zptcut
    hptcut        = args.hptcut
    metcut        = args.metcut
    btagwp        = args.btagwp
    year          = args.year

    bkgfiles = go.gatherBkg('analysis_output_ZpAnomalon/'+args.date,'upout',zptcut,hptcut,metcut,btagwp,year)
    #bkguncs  = np.load('analysis_output_ZpAnomalon/'+args.date+'/Fall17.AllZpAnomalonBkgs_unc_Zptcut'+str(zptcut)+'_Hptcut'+str(hptcut)+'_metcut'+str(metcut)+'_btagwp'+str(btagwp)+'.npz')
    bkgnames = ["DYJetsToLL","TT","WZTo2L2Q","ZZTo2L2Q"]
    bkgcols  = go.colsFromPalette(bkgnames,ROOT.kLake)
    bkginfo  = go.prepBkg(bkgfiles,bkgnames,bkgcols,'xsects_2017.ini',lumi,"yes")#gathers xs scales

    metstr = "Percent Passing \(MET > "+str(metcut)+"\)"
    zptstr = "Percent Passing \(Z p_{T} > "+str(zptcut)+"\)"
    hptstr = "Percent Passing Fat Jet \(p_{T} > "+str(hptcut)+"\)"
    btgstr = "Percent Passing {0} btag WP".format(str(btagwp))
    sbstr  = "Percent in side band"
    
    
    cfdict = {metstr:{},zptstr:{},hptstr:{},btgstr:{},sbstr:{}}
    totorig = 0
    totymet = 0
    totyzpt = 0
    totyhpt = 0
    totybtg = 0
示例#4
0
    metcut        = args.metcut
    btagwp        = args.btagwp

    zp1200nd175ns1top = "analysis_output_ZpAnomalon/2021-03-26/ZpAnomalonHZ_UFO-Zp1200-ND175-NS1_topiary_Zptcut0.0_Hptcut250.0_metcut0.0_btagwp0.0.root"
    zp2000nd300ns1top = "analysis_output_ZpAnomalon/2021-03-26/ZpAnomalonHZ_UFO-Zp2000-ND300-NS1_topiary_Zptcut0.0_Hptcut250.0_metcut0.0_btagwp0.0.root"
    zp2000nd800ns200top = "analysis_output_ZpAnomalon/2021-03-26/ZpAnomalonHZ_UFO-Zp2000-ND800-NS200_topiary_Zptcut0.0_Hptcut250.0_metcut0.0_btagwp0.0.root"
    zp3000nd1200ns1top = "analysis_output_ZpAnomalon/2021-03-26/ZpAnomalonHZ_UFO-Zp3000-ND1200-NS1_topiary_Zptcut0.0_Hptcut250.0_metcut0.0_btagwp0.0.root"

    zp1200nd175ns1up = "analysis_output_ZpAnomalon/2021-03-29/ZpAnomalonHZ_UFO-Zp1200-ND175-NS1_upout_DeepMassDecorrelTagZHbbvsQCD_sideband_Zptcut"+str(zptcut)+"_Hptcut"+str(hptcut)+"_metcut"+str(metcut)+"_btagwp"+str(btagwp)+".root"
    zp2000nd300ns1up = "analysis_output_ZpAnomalon/2021-03-29/ZpAnomalonHZ_UFO-Zp2000-ND300-NS1_upout_DeepMassDecorrelTagZHbbvsQCD_sideband_Zptcut"+str(zptcut)+"_Hptcut"+str(hptcut)+"_metcut"+str(metcut)+"_btagwp"+str(btagwp)+".root"
    zp2000nd800ns200up = "analysis_output_ZpAnomalon/2021-03-29/ZpAnomalonHZ_UFO-Zp2000-ND800-NS200_upout_DeepMassDecorrelTagZHbbvsQCD_sideband_Zptcut"+str(zptcut)+"_Hptcut"+str(hptcut)+"_metcut"+str(metcut)+"_btagwp"+str(btagwp)+".root"
    zp3000nd1200ns1up = "analysis_output_ZpAnomalon/2021-03-29/ZpAnomalonHZ_UFO-Zp3000-ND1200-NS1_upout_DeepMassDecorrelTagZHbbvsQCD_sideband_Zptcut"+str(zptcut)+"_Hptcut"+str(hptcut)+"_metcut"+str(metcut)+"_btagwp"+str(btagwp)+".root"
    sigsamps = [zp1200nd175ns1up,zp2000nd300ns1up,zp2000nd800ns200up,zp3000nd1200ns1up]
    sigtops  = [zp1200nd175ns1top,zp2000nd300ns1top,zp2000nd800ns200top,zp3000nd1200ns1top]

    sigcols  = go.colsFromPalette(sigsamps,ROOT.kLake)
    siginfo  = go.prepSig(sigsamps,sigcols,sig_xsec,101.27)#gathers xs scales
    skimstr  = "Events with \( > 0\) fat jets and \( Z(\ell^{+}\ell^{-}) cand \)"
    trigstr  = "Events Pass trigger"
    zrecostr = "Events with \( 70 < m_{\ell\ell} < 110 \)"
    hrecostr = "Events Pass $H$ reco "
    metstr = "Events Passing \(MET > "+str(metcut)+"\)"
    zptstr = "Events Passing \(Z p_{T} > "+str(zptcut)+"\)"
    hptstr = "Events Passing Fat Jet \(p_{T} > "+str(hptcut)+"\)"
    btgstr = "Events Passing {0} btag WP".format(str(btagwp))
    sbstr  = "Events in side band"
    
    
    cfdict = {metstr:{},zptstr:{},hptstr:{},btgstr:{},sbstr:{},skimstr:{},trigstr:{},zrecostr:{},hrecostr:{}}
    
    totorig = 0