def do_gen_generator_comparison_plots(pythia_dir, herwig_dir, plot_dir): """Compare genjets from different generators""" # Distributions sources = [ {"root_dir": pythia_dir, 'label': PYTHIA_LABEL, "style": {'line_style': 1}}, {"root_dir": herwig_dir, 'label': HERWIG_LABEL, "style": {'line_style': 2}} ] qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join(plot_dir, "plots_dy_vs_qcd_gen_compare_generators"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, pt_bins=qgc.THEORY_PT_BINS, subplot_type=None, do_flav_tagged=False, ofmt=OUTPUT_FMT) # Delta plots sources = [ {"root_dir": pythia_dir, 'label': PYTHIA_LABEL, "style": {'line_color': ROOT.kBlack}}, {"root_dir": herwig_dir, 'label': HERWIG_LABEL, "style": {'line_color': ROOT.kRed, 'line_style': 2}} ] qgd.do_pt_min_delta_plots(sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join(plot_dir, "deltas_ptMin_gen_compare_generators"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, ofmt=OUTPUT_FMT) qgd.do_angularity_delta_plots(sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join(plot_dir, "deltas_angularities_gen_compare_generators"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, pt_bins=qgc.THEORY_PT_BINS, ofmt=OUTPUT_FMT)
def do_chs_vs_puppi_plots(chs_dir, puppi_dir, plot_dir): sources = [{ "root_dir": chs_dir, 'label': ", CHS" }, { "root_dir": puppi_dir, 'label': ", PUPPI", "style": { 'line_style': 3 }, "zpj_style": { "line_color": qgc.DY_COLOURS[-2], "fill_color": qgc.DY_COLOURS[-2] }, "qcd_style": { "line_color": qgc.QCD_COLOURS[-2], "fill_color": qgc.QCD_COLOURS[-2] } }] qgg.do_all_exclusive_plots_comparison(sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join( plot_dir, "chs_vs_puppi"), zpj_dirname="ZPlusJets_QG", dj_dirname="Dijet_QG", var_prepend="", pt_bins=None, subplot_type=None, do_flav_tagged=True, ofmt=OUTPUT_FMT)
def do_reco_generator_comparison_plots(pythia_dir, herwig_dir, plot_dir): """Compare reco jets from different generators""" # PYTHIA_LABEL = "\nMG+Pythia8" # HERWIG_LABEL = "\nHerwig++" # HERWIG_LABEL = "\nPythia only" # Distributions sources = [ {"root_dir": pythia_dir, 'label': PYTHIA_LABEL, "style": {'line_style': 1}}, {"root_dir": herwig_dir, 'label': HERWIG_LABEL, "style": {'line_style': 2}, "zpj_style": {'line_color': 632, 'marker_color': 632}, "qcd_style": {'line_color': 600, 'marker_color': 600} } ] if "pythiaOnlyFlat" not in herwig_dir: qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "plots_dy_vs_qcd_compare_oldNewFlav"), subplot_type=None, do_flav_tagged=True, pt_bins=qgc.THEORY_PT_BINS, ofmt=OUTPUT_FMT) # Do a version jsut using dijet samples for higher pT for sdict in sources: sdict['zpj_style'] = {'label': qgc.QCD_Dijet_QFLAV_LABEL + sdict['label']} qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS, dy_filename=qgc.QCD_FILENAME, zpj_dirname=qgc.DJ_RECOJET_RDIR, plot_dir=os.path.join(plot_dir, "plots_dy_vs_qcd_compare_generators_only_qcd"), subplot_type=None, do_flav_tagged=True, pt_bins=qgc.THEORY_PT_BINS, ofmt=OUTPUT_FMT)
def do_jet_algo_comparison_plots(ak4_dir, ak8_dir, plot_dir="compare_jet_algo", zpj_dirname="ZPlusJets_QG", dj_dirname="Dijet_QG", var_list=None, var_prepend="", pt_bins=None, subplot_type="diff"): """Do 1D plots comparing different jet algos""" sources = [ {"root_dir": ak4_dir, 'label': ", AK4", "style": {'line_style': 1}}, {"root_dir": ak8_dir, 'label': ", AK8", "style": {'line_style': 2}} ] qgg.do_all_exclusive_plots_comparison(sources, var_list=var_list, plot_dir=plot_dir, zpj_dirname=zpj_dirname, dj_dirname=dj_dirname, var_prepend=var_prepend, pt_bins=pt_bins, subplot_type=subplot_type, subplot_title="#Delta(AK8,AK4)", do_flav_tagged=True, ofmt=OUTPUT_FMT)
def do_reco_plots(root_dir): # do_all_2D_plots(root_dir) sources = [{"root_dir": root_dir, 'label': "", "style": {'line_style': 1}}] dy_filename = qgc.QCD_FILENAME if "pythiaOnlyFlat" in root_dir else qgc.DY_FILENAME zpj_dirname = qgc.DJ_RECOJET_RDIR if "pythiaOnlyFlat" in root_dir else qgc.ZPJ_RECOJET_RDIR qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS_WITH_FLAV, dy_filename=dy_filename, zpj_dirname=zpj_dirname, plot_dir=os.path.join( root_dir, "plots_dy_vs_qcd"), pt_bins=qgc.THEORY_PT_BINS, subplot_type=None, do_flav_tagged=True) do_reco_pu_comparison_plots(root_dir)
def do_comparison_plots(workdir_label_pairs, output_dir): dirnames = [w[0] for w in workdir_label_pairs] # templates, we'll change the filename/dir as per instance total_len = len(workdir_label_pairs) mark = cu.Marker() sources = [{ "root_dir": wd, 'label': label, "style": { 'line_style': 1, 'line_color': cu.get_colour_seq(ind, total_len), 'marker_color': cu.get_colour_seq(ind, total_len), 'marker_style': m, 'marker_size': 0.75, } } for ind, ((wd, label), m) in enumerate( zip(workdir_label_pairs, mark.cycle(cycle_filling=True)))] # print(sources) # COMPARE NOMINAL QCD if exists_in_all(qgc.QCD_FILENAME, dirnames): # qgp.do_all_exclusive_plots_comparison(sources, # var_list=qgc.COMMON_VARS, # pt_bins=qgc.PT_BINS, # qcd_filename=qgc.QCD_FILENAME, # dj_cen_dirname="Dijet_QG_central_tighter", # dj_fwd_dirname=None, # zpj_dirname=None, # plot_dir=os.path.join(output_dir, "plots_qcd_compare_dijet_central"), # subplot_type="ratio", # will use the 1st entry by default # subplot_title="* / %s" % (sources[0]['label']), # do_flav_tagged=False, # has_data=False) # qgp.do_all_exclusive_plots_comparison(sources, # var_list=qgc.COMMON_VARS, # pt_bins=qgc.PT_BINS, # qcd_filename=qgc.QCD_FILENAME, # dj_cen_dirname=None, # dj_fwd_dirname="Dijet_QG_forward_tighter", # zpj_dirname=None, # plot_dir=os.path.join(output_dir, "plots_qcd_compare_dijet_forward"), # subplot_type="ratio", # will use the 1st entry by default # subplot_title="* / %s" % (sources[0]['label']), # do_flav_tagged=False, # has_data=False) # do both dijet jets together # add gen level gen_qcd_sources = [deepcopy(sources[0])] # only 1st one for now for gd in gen_qcd_sources: gd.update({ 'dj_fwd_dirname': 'Dijet_QG_gen', 'label': gd['label'] + ' [Gen]' }) style_dict = gd['style'] style_dict.update({'line_style': 2}) style_dict.update({'line_color': style_dict['line_color'] + 5}) style_dict.update({'marker_color': style_dict['marker_color'] + 5}) style_dict.update({'marker_style': style_dict['marker_style'] + 1}) qgp.do_all_exclusive_plots_comparison( sources + gen_qcd_sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.QCD_FILENAME, dj_cen_dirname=None, dj_fwd_dirname="Dijet_QG_tighter", zpj_dirname=None, plot_dir=os.path.join(output_dir, "plots_qcd_compare_dijet"), subplot_type="ratio", # will use the 1st entry by default subplot_title="* / %s" % (sources[0]['label']), do_flav_tagged=False, has_data=False, title=qgc.Dijet_LABEL, show_region_labels=False) # COMPARE NOMINAL DY if exists_in_all(qgc.DY_FILENAME, dirnames): qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.DY_FILENAME, dj_cen_dirname=None, dj_fwd_dirname=None, zpj_dirname="ZPlusJets_QG", plot_dir=os.path.join(output_dir, "plots_dy_compare"), subplot_type="ratio", # will use the 1st entry by default subplot_title="* / %s" % (sources[0]['label']), do_flav_tagged=False, has_data=False, title=qgc.ZpJ_LABEL, show_region_labels=False) # COMPARE JETHT+ZEROBIAS if exists_in_all(qgc.JETHT_ZB_FILENAME, dirnames): qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.JETHT_ZB_FILENAME, dj_cen_dirname="Dijet_QG_central_tighter", dj_fwd_dirname=None, zpj_dirname=None, plot_dir=os.path.join(output_dir, "plots_jetht_zb_compare_dijet_central"), subplot_type="ratio", # will use the 1st entry by default subplot_title="* / %s" % (sources[0]['label']), do_flav_tagged=False, has_data=True) qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.JETHT_ZB_FILENAME, dj_cen_dirname=None, dj_fwd_dirname="Dijet_QG_forward_tighter", zpj_dirname=None, plot_dir=os.path.join(output_dir, "plots_jetht_zb_compare_dijet_forward"), subplot_type="ratio", # will use the 1st entry by default subplot_title="* / %s" % (sources[0]['label']), do_flav_tagged=False, has_data=True) # COMPARE SINGLEMU # COMPARE HERWIG++ QCD if exists_in_all(qgc.QCD_HERWIG_FILENAME, dirnames): qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.QCD_HERWIG_FILENAME, dj_cen_dirname="Dijet_QG_central_tighter", dj_fwd_dirname=None, zpj_dirname=None, plot_dir=os.path.join(output_dir, "plots_qcd_herwig_compare_dijet_central"), subplot_type="ratio", # will use the 1st entry by default subplot_title="* / %s" % (sources[0]['label']), subplot_limits=[0.9, 1.1], do_flav_tagged=False, has_data=False) qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.QCD_HERWIG_FILENAME, dj_cen_dirname=None, dj_fwd_dirname="Dijet_QG_forward_tighter", zpj_dirname=None, plot_dir=os.path.join(output_dir, "plots_qcd_herwig_compare_dijet_forward"), subplot_type="ratio", # will use the 1st entry by default subplot_title="* / %s" % (sources[0]['label']), subplot_limits=[0.9, 1.1], do_flav_tagged=False, has_data=False)
def do_pythia_comparison_distribution_plots(mgpythia_dir, pythia_only_dir, plot_dir): """To compare mg+pythia vs pythia distributions""" # reco sources = [{ "root_dir": mgpythia_dir, 'label': ", Madgraph+Pythia", "style": { 'line_style': 1 } }, { "root_dir": pythia_only_dir, 'label': ", Pythia only", "style": { 'line_style': 1, 'line_color': ROOT.kRed, 'fill_color': ROOT.kRed, } }] qgg.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS_WITH_FLAV, plot_dir=os.path.join(plot_dir, "mg_pythia_vs_pythia_only"), zpj_dirname="", subplot_type="ratio", subplot_title="#splitline{Ratio wrt}{MG+Pythia}", do_flav_tagged=False, pt_bins=qgc.THEORY_PT_BINS) qgg.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS_WITH_FLAV, plot_dir=os.path.join(plot_dir, "mg_pythia_vs_pythia_only"), zpj_dirname="", subplot_type="ratio", subplot_title="#splitline{Ratio wrt}{MG+Pythia}", do_flav_tagged=True, pt_bins=qgc.THEORY_PT_BINS) return # gen sources = [{ "root_dir": mgpythia_dir, 'label': ", Madgraph+Pythia", "style": { 'line_style': 1 } }, { "root_dir": pythia_only_dir, 'label': ", Pythia only", "style": { 'line_style': 1, 'line_color': ROOT.kRed, 'fill_color': ROOT.kRed } }] qgg.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS_WITH_FLAV[:-1], var_prepend="gen", plot_dir=os.path.join(plot_dir, "mg_pythia_vs_pythia_only_gen"), dj_dirname=qgc.DJ_GENJET_RDIR, zpj_dirname="", subplot_type="ratio", subplot_title="#splitline{Ratio wrt}{MG+Pythia}", do_flav_tagged=False, pt_bins=qgc.THEORY_PT_BINS) qgg.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS_WITH_FLAV[:-1], var_prepend="gen", plot_dir=os.path.join(plot_dir, "mg_pythia_vs_pythia_only_gen"), dj_dirname=qgc.DJ_GENJET_RDIR, zpj_dirname="", subplot_type="ratio", subplot_title="#splitline{Ratio wrt}{MG+Pythia}", do_flav_tagged=True, pt_bins=qgc.THEORY_PT_BINS)
# do_flav_tagged=False, # pt_bins=qgc.PT_BINS, # title=title+"\n"+qgc.ZpJ_LABEL, # has_data=True, # ofmt=OUTPUT_FMT) print("Doing Z+J groomed vs ungroomed") all_sources[2]['subplot'] = 0 all_sources[3]['subplot'] = 1 qgp.do_all_exclusive_plots_comparison( sources=all_sources, var_list=qgc.COMMON_VARS[:], plot_dir=os.path.join(pythia_dir, "groomed_vs_ungroomed_jet_zpj"), dy_filename=qgc.DY_FILENAME, qcd_filename=None, dj_cen_dirname=None, dj_fwd_dirname=None, show_region_labels=False, subplot_type="ratio", subplot_title="#splitline{Groomed/}{ungroomed}", do_flav_tagged=False, pt_bins=qgc.PT_BINS, title=title + "\n" + qgc.ZpJ_LABEL, has_data=True, ofmt=OUTPUT_FMT) # Do Z+jet and dijet regions altogether # qgp.do_all_exclusive_plots_comparison(sources=sources, # var_list=qgc.COMMON_VARS[:], # plot_dir=os.path.join(pythia_dir, "groomed_vs_ungroomed_jet_dijet_zpj"), # subplot_type="ratio", # subplot_title="#splitline{Groomed/}{ungroomed}", # do_flav_tagged=False,
def do_plots(nominal_dir, herwig_dir, output_dir, syst_ups=None, syst_downs=None): """ nominal_dir is without any systematic herwig_dir is the herwig directory for comparison syst_ups and syst_downs are lists of (dirname, label) to add to the plot """ lw = 2 # COMPARE QCD if os.path.isfile(os.path.join(nominal_dir, qgc.QCD_FILENAME)): sources = [{ "root_dir": nominal_dir, 'label': "Nominal MG5+Pythia8", "style": { 'line_style': 1, 'line_width': lw, 'line_color': qgc.QCD_COLOUR, 'fill_color': qgc.QCD_COLOUR, 'marker_color': qgc.QCD_COLOUR, 'marker_style': cu.Marker.get(qgc.QCD_MARKER), 'marker_size': 0, } }] # Add systematics # SHIFT UP if syst_ups: for ind, (syst_up_dir, syst_up_label, syst_up_col) in enumerate(syst_ups): this_source = deepcopy(sources[0]) this_source['root_dir'] = syst_up_dir this_source.update( dict(style=dict(line_color=syst_up_col, line_width=lw, fill_color=syst_up_col, line_style=2, marker_color=syst_up_col, marker_style=cu.Marker.get('triangleUp'), marker_size=0), label=syst_up_label, subplot=0)) sources.append(this_source) # SHIFT DOWN if syst_downs: for ind, (syst_down_dir, syst_down_label, syst_down_col) in enumerate(syst_downs): this_source = deepcopy(sources[0]) this_source['root_dir'] = syst_down_dir this_source.update( dict(style=dict(line_color=syst_down_col, line_width=lw, fill_color=syst_down_col, line_style=3, marker_color=syst_down_col, marker_style=cu.Marker.get('triangleDown'), marker_size=0), label=syst_down_label, subplot=0)) sources.append(this_source) subplot_lim = (0.75, 1.25) # qgp.do_all_exclusive_plots_comparison(sources, # var_list=qgc.COMMON_VARS, # pt_bins=qgc.PT_BINS, # qcd_filename=qgc.QCD_FILENAME, # dj_cen_dirname="Dijet_QG_central_tighter", # dj_fwd_dirname=None, # zpj_dirname=None, # plot_dir=os.path.join(output_dir, "plots_qcd_compare_dijet_central"), # subplot_type="ratio", # subplot_title="Variation / nominal", # subplot_limits=subplot_lim, # do_flav_tagged=False, # has_data=False) # qgp.do_all_exclusive_plots_comparison(sources, # var_list=qgc.COMMON_VARS, # pt_bins=qgc.PT_BINS, # qcd_filename=qgc.QCD_FILENAME, # dj_cen_dirname=None, # dj_fwd_dirname="Dijet_QG_forward_tighter", # zpj_dirname=None, # plot_dir=os.path.join(output_dir, "plots_qcd_compare_dijet_forward"), # subplot_type="ratio", # subplot_title="Variation / nominal", # subplot_limits=subplot_lim, # do_flav_tagged=False, # has_data=False) qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.QCD_FILENAME, dj_cen_dirname=None, dj_fwd_dirname="Dijet_QG_tighter", zpj_dirname=None, plot_dir=os.path.join(output_dir, "plots_qcd_compare_dijet"), subplot_type="ratio", # will use the 1st entry by default subplot_title="Variation / nominal", subplot_limits=subplot_lim, do_flav_tagged=False, has_data=False, title=qgc.Dijet_LABEL, show_region_labels=False) # COMPARE DY if os.path.isfile(os.path.join(nominal_dir, qgc.DY_FILENAME)): sources = [{ "root_dir": nominal_dir, 'label': "Nominal MG5+Pythia8", "style": { 'line_style': 1, 'line_width': lw, 'line_color': qgc.DY_COLOUR, 'fill_color': qgc.DY_COLOUR, 'marker_color': qgc.DY_COLOUR, 'marker_style': cu.Marker.get(qgc.DY_MARKER), 'marker_size': 0, } }] # Add systematics # SHIFT UP if syst_ups: for ind, (syst_up_dir, syst_up_label, syst_up_col) in enumerate(syst_ups): this_source = deepcopy(sources[0]) this_source['root_dir'] = syst_up_dir this_source.update( dict(style=dict(line_color=syst_up_col, line_width=lw, fill_color=syst_up_col, line_style=2, marker_color=syst_up_col, marker_style=cu.Marker.get('triangleUp'), marker_size=0), label=syst_up_label, subplot=0)) sources.append(this_source) # SHIFT DOWN if syst_downs: for ind, (syst_down_dir, syst_down_label, syst_down_col) in enumerate(syst_downs): this_source = deepcopy(sources[0]) this_source['root_dir'] = syst_down_dir this_source.update( dict(style=dict(line_color=syst_down_col, line_width=lw, fill_color=syst_down_col, line_style=3, marker_color=syst_down_col, marker_style=cu.Marker.get('triangleDown'), marker_size=0), label=syst_down_label, subplot=0)) sources.append(this_source) subplot_lim = (0.75, 1.25) qgp.do_all_exclusive_plots_comparison( sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.PT_BINS, qcd_filename=qgc.DY_FILENAME, dj_cen_dirname=None, dj_fwd_dirname=None, zpj_dirname="ZPlusJets_QG", plot_dir=os.path.join(output_dir, "plots_dy_compare"), subplot_type="ratio", subplot_title="Variation / nominal", subplot_limits=subplot_lim, do_flav_tagged=False, has_data=False, title=qgc.ZpJ_LABEL, show_region_labels=False)
def do_reco_reweight_comparison_plots(pythia_dir, herwig_dir, herwig_reweighted_dir, plot_dir): """Compare effect of reweighting to Pythia spectrum - reco jets""" # Just do Herwig vs Herwig reweighted sources = [ {"root_dir": herwig_reweighted_dir, 'label': REWEIGHT_LABEL, "style": {'line_style': 1}}, {"root_dir": herwig_dir, 'label': NOT_REWEIGHT_LABEL, "style": {'line_style': 2}} ] qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "plots_dy_vs_qcd_compare_reweight"), pt_bins=qgc.THEORY_PT_BINS, subplot_type=None, do_flav_tagged=False, ofmt=OUTPUT_FMT) sources = [ {"root_dir": herwig_reweighted_dir, 'label': REWEIGHT_LABEL, "style": {'line_color': ROOT.kGreen+2}}, {"root_dir": herwig_dir, 'label': NOT_REWEIGHT_LABEL, "style": {'line_color': ROOT.kAzure}} ] # qgd.do_pt_min_delta_plots(sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "deltas_ptMin_compare_reweight")) qgd.do_angularity_delta_plots(sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "deltas_angularities_compare_reweight"), pt_bins=qgc.THEORY_PT_BINS, ofmt=OUTPUT_FMT) # Now just do Pythia vs Herwig reweighted sources = [ {"root_dir": pythia_dir, 'label': ", MG + Pythia", "style": {'line_style': 1}}, {"root_dir": herwig_reweighted_dir, 'label': ", Herwig, reweighted to MG+Pythia", "style": {'line_style': 1}, "zpj_style": {'line_color': ROOT.kRed, 'fill_color': ROOT.kRed}, "qcd_style": {'line_color': ROOT.kBlue, 'fill_color': ROOT.kBlue} } ] qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "plots_dy_vs_qcd_compare_reweight_compare_pythia_herwig_reweight"), pt_bins=qgc.THEORY_PT_BINS, subplot_type=None, do_flav_tagged=False, ofmt=OUTPUT_FMT) # Now put Pythia, Herwig, & Herwig reweighted on same plots sources = [ {"root_dir": pythia_dir, 'label': ", MG + Pythia", "style": {'line_style': 1}}, {"root_dir": herwig_reweighted_dir, 'label': ", Herwig, reweighted to MG+Pythia", "style": {'line_style': 2}, "zpj_style": {'line_color': ROOT.kRed, 'fill_color': ROOT.kRed}, "qcd_style": {'line_color': ROOT.kBlue, 'fill_color': ROOT.kBlue} }, {"root_dir": herwig_dir, 'label': ", Herwig, not reweighted", "style": {'line_style': 2}} ] qgg.do_all_exclusive_plots_comparison(sources=sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "plots_dy_vs_qcd_compare_reweight_compare_generators"), pt_bins=qgc.THEORY_PT_BINS, # subplot_type="diff", subplot_type=None, # subplot_title="#splitline{#Delta wrt}{%s}" % sources[0]['label'], subplot_title="#Delta", do_flav_tagged=False, ofmt=OUTPUT_FMT) sources = [ {"root_dir": pythia_dir, 'label': ", MG + Pythia", "style": {'line_color': ROOT.kBlack}}, {"root_dir": herwig_reweighted_dir, 'label': REWEIGHT_LABEL, "style": {'line_color': ROOT.kGreen+2}}, {"root_dir": herwig_dir, 'label': NOT_REWEIGHT_LABEL, "style": {'line_color': ROOT.kAzure}} ] # qgd.do_pt_min_delta_plots(sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "deltas_ptMin_compare_normal_and_reweight")) qgd.do_angularity_delta_plots(sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join(plot_dir, "deltas_angularities_compare_normal_and_reweight"), pt_bins=qgc.THEORY_PT_BINS, ofmt=OUTPUT_FMT)
"style": { 'line_color': ROOT.kRed, 'marker_color': ROOT.kRed } }, ] # Do Z+jets region only qgp.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc. COMMON_VARS[:5], # can't do charged-only as doesn't exist for non-wta plot_dir=os.path.join(pythia_wta_dir, "wta_vs_normal_jet_axis_zpj_ungroomed"), dy_filename=qgc.DY_FILENAME, zpj_dirname="ZPlusJets_QG", qcd_filename=None, dj_cen_dirname=None, dj_fwd_dirname=None, subplot_type="ratio", subplot_title="#splitline{WTA/normal}{jet axis}", do_flav_tagged=False, pt_bins=qgc.PT_BINS, ofmt=OUTPUT_FMT) # Do Dijet region only qgp.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc.COMMON_VARS[:5], plot_dir=os.path.join(pythia_wta_dir, "wta_vs_normal_jet_axis_dijet_ungroomed"), dy_filename=None,
def do_gen_plots(root_dir): sources = [{"root_dir": root_dir, 'label': "", "style": {'line_style': 1}}] # need to avoid genPartonFlavour do_all_2D_plots(root_dir, var_list=qgc.COMMON_VARS_WITH_FLAV[:-1], var_prepend="gen", plot_dir="plots_2d_gen", zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR) qgg.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc.COMMON_VARS_WITH_FLAV[:-1], var_prepend="gen", plot_dir=os.path.join(root_dir, "plots_dy_vs_qcd_gen"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, pt_bins=qgc.THEORY_PT_BINS, subplot_type=None, do_flav_tagged=not is_herwig_sample(root_dir)) do_gen_reco_comparison_plots(root_dir, var_list=qgc.COMMON_VARS, gen_var_prepend="gen", reco_var_prepend="", plot_dir="plot_reco_gen", zpj_reco_dirname=qgc.ZPJ_RECOJET_RDIR, dj_reco_dirname=qgc.DJ_RECOJET_RDIR, zpj_gen_dirname=qgc.ZPJ_GENJET_RDIR, dj_gen_dirname=qgc.DJ_GENJET_RDIR, pt_bins=qgc.THEORY_PT_BINS) qgr.do_angularity_roc_plots(sources, var_list=qgc.COMMON_VARS, pt_bins=qgc.THEORY_PT_BINS, zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, var_prepend="gen", plot_dir=os.path.join(root_dir, 'roc_angularities_gen')) # Separation plots qgd.do_pt_min_delta_plots(sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join(root_dir, "deltas_ptMin_gen"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, save_component_hists=True) qgd.do_angularity_delta_plots(sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join( root_dir, "deltas_angularities_gen"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, pt_bins=qgc.THEORY_PT_BINS, save_component_hists=True) # flav-tagged versions if is_herwig_sample(root_dir): return qgd.do_pt_min_delta_plots(sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join(root_dir, "deltas_ptMin_gen"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, flavour_tag=True, save_component_hists=True) qgd.do_angularity_delta_plots(sources, var_list=qgc.COMMON_VARS, var_prepend="gen", plot_dir=os.path.join( root_dir, "deltas_angularities_gen"), zpj_dirname=qgc.ZPJ_GENJET_RDIR, dj_dirname=qgc.DJ_GENJET_RDIR, pt_bins=qgc.THEORY_PT_BINS, flavour_tag=True, save_component_hists=True)
def do_reco_pu_comparison_plots(root_dir): """Compare by PU bins""" pu_bins = [(5, 15), (20, 25), (30, 40)] sources = [] for ind, (pu_min, pu_max) in enumerate(pu_bins): sources.append({ "root_dir": root_dir, 'label': ", PU %d-%d" % (pu_min, pu_max), 'zpj_dirname': qgc.ZPJ_RECOJET_RDIR + "_PU_%d_to_%d" % (pu_min, pu_max), 'dj_dirname': qgc.DJ_RECOJET_RDIR + "_PU_%d_to_%d" % (pu_min, pu_max), "style": { 'line_style': 1, "line_width": 2 }, "zpj_style": { 'line_color': qgc.DY_COLOURS[ind], 'fill_color': qgc.DY_COLOURS[ind], 'marker_color': qgc.DY_COLOURS[ind] }, "qcd_style": { 'line_color': qgc.QCD_COLOURS[ind], 'fill_color': qgc.QCD_COLOURS[ind], 'marker_color': qgc.QCD_COLOURS[ind] } }) subplot_title = "#splitline{Ratio wrt}{PU %d-%d}" % (pu_bins[0][0], pu_bins[0][1]) qgg.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc.COMMON_VARS, zpj_dirname=None, plot_dir=os.path.join(root_dir, "plots_dy_vs_qcd_compare_pu_dijet"), pt_bins=qgc.THEORY_PT_BINS, subplot_type="ratio", subplot_title=subplot_title, do_flav_tagged=False) qgg.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc.COMMON_VARS, dj_dirname=None, plot_dir=os.path.join(root_dir, "plots_dy_vs_qcd_compare_pu_zpj"), pt_bins=qgc.THEORY_PT_BINS, subplot_type="ratio", subplot_title=subplot_title, do_flav_tagged=False) qgg.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc.COMMON_VARS, zpj_dirname=None, plot_dir=os.path.join(root_dir, "plots_dy_vs_qcd_compare_pu_dijet"), pt_bins=qgc.THEORY_PT_BINS, subplot_type="ratio", subplot_title=subplot_title, do_flav_tagged=True) qgg.do_all_exclusive_plots_comparison( sources=sources, var_list=qgc.COMMON_VARS, dj_dirname=None, plot_dir=os.path.join(root_dir, "plots_dy_vs_qcd_compare_pu_zpj"), pt_bins=qgc.THEORY_PT_BINS, subplot_type="ratio", subplot_title=subplot_title, do_flav_tagged=True) return # Separation plots for ind, s in enumerate(sources): sources[ind]['style']['line_width'] = 2 sources[ind]['style']['line_color'] = qgc.DY_COLOURS[ind] if ind == 2: qgd.do_angularity_delta_plots( sources[ind:ind + 1], var_list=qgc.COMMON_VARS, plot_dir=os.path.join( root_dir, "deltas_angularities_compare_pu_PU_%d_to_%d" % (pu_bins[ind][0], pu_bins[ind][1])), pt_bins=qgc.THEORY_PT_BINS, save_component_hists=True) qgd.do_angularity_delta_plots(sources, var_list=qgc.COMMON_VARS, plot_dir=os.path.join( root_dir, "deltas_angularities_compare_pu"), pt_bins=qgc.THEORY_PT_BINS)