parser.add_argument( "-r", "--region", help="region of phase space: totalr,sideband, or signalr") args = parser.parse_args() zptcut = args.zptcut hptcut = args.hptcut metcut = args.metcut btagwp = args.btagwp year = args.year reg = args.region bkgnames = ["DYJetsToLL", "TT", "WZTo2L2Q", "ZZTo2L2Q"] bkgcounts = go.gatherBkg('analysis_output_ZpAnomalon/' + args.date, 'totalevents_' + reg, zptcut, hptcut, metcut, btagwp, year) bkgerrfs = go.gatherBkg('analysis_output_ZpAnomalon/' + args.date, 'selected_errors_' + reg, zptcut, hptcut, metcut, btagwp, year) print("calculaing statistical uncertainties") #find luminosity scaling for each background config = configparser.RawConfigParser() config.optionxform = str if year == 17: fp = open('xsects_2017.ini') mcprefix = 'Fall17' datprefix = 'Run2017' lumi = 41.53 if year == 18:
help="year of samples eg. 2017 -> 17") args = parser.parse_args() #Get command line parameters sig_xsec = args.xsec zptcut = args.zptcut hptcut = args.hptcut metcut = args.metcut btagwp = args.btagwp year = args.year reg = args.region lumi = 0 #samples bkgupout17 = gecorg.gatherBkg('analysis_output_ZpAnomalon/' + args.date, 'upout_' + reg, zptcut, hptcut, metcut, btagwp, 17) bkgupout18 = gecorg.gatherBkg('analysis_output_ZpAnomalon/' + args.date, 'upout_' + reg, zptcut, hptcut, metcut, btagwp, 18) bkgnames = ["DYJetsToLL", "TT", "WZTo2L2Q", "ZZTo2L2Q"] sigfiles = glob.glob('analysis_output_ZpAnomalon/' + args.date + '/Zp*_upout_' + reg + '*_Zptcut' + str(zptcut) + '_Hptcut' + str(hptcut) + '_metcut' + str(metcut) + '_btagwp' + str(btagwp) + '.root') datfiles17 = glob.glob('analysis_output_ZpAnomalon/' + args.date + '/Run2017*upout_sideband*_Zptcut' + str(zptcut) + '_Hptcut' + str(hptcut) + '_metcut' + str(metcut) + '_btagwp' + str(btagwp) + '.root') datfiles18 = glob.glob('analysis_output_ZpAnomalon/' + args.date + '/Run2018*upout_sideband*_Zptcut' + str(zptcut) +
parser.add_argument("-j","--hptcut", type=float,help = "hpt cut of samples") parser.add_argument("-wp","--btagwp", type=float,help = "btag working point") parser.add_argument("-date","--date",help="date folder with plots to stack") 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
help="date folder with plots to stack") parser.add_argument( "-r", "--region", help="region of phase space: totalr,sideband, or signalr") args = parser.parse_args() #Get command line parameters zptcut = args.zptcut hptcut = args.hptcut metcut = args.metcut btagwp = args.btagwp reg = args.region bkgupout17 = go.gatherBkg('analysis_output_ZpAnomalon/' + args.date, 'upout_' + reg, zptcut, hptcut, metcut, btagwp, 17) bkgtopia17 = go.gatherBkg('analysis_output_ZpAnomalon/2021-03-26', 'topiary', 0.0, 250.0, 0.0, 0.0, 17) bkgupout18 = go.gatherBkg('analysis_output_ZpAnomalon/' + args.date, 'upout_' + reg, zptcut, hptcut, metcut, btagwp, 18) bkgtopia18 = go.gatherBkg('analysis_output_ZpAnomalon/2021-03-28', 'topiary', 0.0, 250.0, 0.0, 0.0, 18) #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) bkginfo17 = go.prepBkg(bkgupout17, bkgnames, bkgcols, 'xsects_2017.ini', 41.53, "yes") #gathers xs scales bkginfo18 = go.prepBkg(bkgupout18, bkgnames, bkgcols, 'xsects_2017.ini',
args = parser.parse_args() #Get command line parameters lumi = args.lumi sig_xsec = args.xsec released_plot = args.plot zptcut = args.zptcut hptcut = args.hptcut metcut = args.metcut btagwp = args.btagwp year = args.year plotmax = 20.0 #Samples bkgfiles17 = gecorg.gatherBkg('analysis_output_ZpAnomalon/'+args.date+'/','upout_totalr',zptcut,hptcut,metcut,btagwp,17) bkgfiles18 = gecorg.gatherBkg('analysis_output_ZpAnomalon/'+args.date+'/','upout_totalr',zptcut,hptcut,metcut,btagwp,18) bkgnames = ["DYJetsToLL","TT","WZTo2L2Q","ZZTo2L2Q"] sigfiles = glob.glob('analysis_output_ZpAnomalon/'+args.date+'/Zp*totalr*_Zptcut'+str(zptcut)+'_Hptcut'+str(hptcut)+'_metcut'+str(metcut)+'_btagwp'+str(btagwp)+'.root') #Prep signals sig_colors = gecorg.colsFromPalette(sigfiles,ROOT.kCMYK) sig_info = gecorg.prepSig(sigfiles,sig_colors,sig_xsec,101.27) #Prep backgrounds bkg_colors = gecorg.colsFromPalette(bkgnames,ROOT.kLake) bkg_info17 = gecorg.prepBkg(bkgfiles17,bkgnames,bkg_colors,'xsects_2017.ini',41.53,"yes") bkg_info18 = gecorg.prepBkg(bkgfiles18,bkgnames,bkg_colors,'xsects_2017.ini',59.74,"yes") #Make the stacked plot hname = released_plot
parser.add_argument("-wp","--btagwp", type=float,help = "btag working point") parser.add_argument("-date","--date", type=str,help = "date folder with output") 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 #samples bkgfiles = gecorg.gatherBkg('analysis_output_ZpAnomalon/'+args.date+'/','upout',zptcut,hptcut,metcut,btagwp,year)#recalculated ones with errrors mcprefix = 'Autumn18' descrip = 'upout' bkgnames = ["DYJetsToLL","TT","WZTo2L2Q","ZZTo2L2Q"] sigfiles = glob.glob('analysis_output_ZpAnomalon/'+args.date+'/Zp*_upout*_Zptcut'+str(zptcut)+'_Hptcut'+str(hptcut)+'_metcut'+str(metcut)+'_btagwp'+str(btagwp)+'.root')#not changed for new naming yet datfiles = glob.glob('analysis_output_ZpAnomalon/'+args.date+'/Run2017*upout*_Zptcut'+str(zptcut)+'_Hptcut'+str(hptcut)+'_metcut'+str(metcut)+'_btagwp'+str(btagwp)+'.root')#not changed for new naming yet bkguncs = pd.read_pickle('analysis_output_ZpAnomalon/'+args.date+'/Fall17.AllZpAnomalonBkgs_unc_Zptcut'+str(zptcut)+'_Hptcut'+str(hptcut)+'_metcut'+str(metcut)+'_btagwp'+str(btagwp)+'.pkl') datuncs =pd.read_pickle('analysis_output_ZpAnomalon/'+args.date+'/Run2017.AllZpAnomalonData_unc_Zptcut'+str(zptcut)+'_Hptcut'+str(hptcut)+'_metcut'+str(metcut)+'_btagwp'+str(btagwp)+'.pkl') #Prep signals sig_colors = gecorg.colsFromPalette(sigfiles,ROOT.kCMYK) sig_info = gecorg.prepSig(sigfiles,sig_colors,sig_xsec,lumi) #Prep backgrounds