def naive_pt_combination(args): args = differentialutils.force_asimov(args) hgg = get_hgg(args) hzz = get_hzz(args) combination = fermilabcode.minicombine.PtCombination([hgg, hzz]) combination.color = 1 combination.plot_scans() hgg_hist = fermilabcode.minicombine.data_to_hist(hgg, title='hgg', color=2) hzz_hist = fermilabcode.minicombine.data_to_hist(hzz, title='hzz', color=4) combination_hist_hzz = combination.get_histogram_bestfit_hzz_binning() combination_hist_hzz.color = 3 plot = differentials.plotting.plots.QuickPlot( 'spectrum_ptcomb_withHzz', x_min=0., x_max=500., y_min=-1., y_max=3., ) plot.add(hgg_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add(hzz_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add(combination_hist_hzz, 'repr_point_with_horizontal_bar') plot.add(combination.to_hist(), 'repr_point_with_vertical_bar_and_horizontal_bar') plot.draw() plot.wrapup() combination.dump('combination_data' + ('_asimov' if args.asimov else ''))
def projection_pth_smH_scan(args): args = differentialutils.force_asimov(args) decay_channel = differentialutils.get_decay_channel_tag(args) wsdict = scenario2 if args.scenario2 else scenario1 ws = wsdict[decay_channel] logging.warning('Running for 6000 fb-1 !!!!') config = differential_config(args, ws, 'pth_smH', lumiscale=lumiscale6000) config.nPoints = 70 def tight_ranges(config): """Very manual tight r_ ranges based on Hgg scan results""" for POI in config.POIs: if 'GT600' in POI: config.set_parameter_range(POI, 0.64, 1.4) else: config.set_parameter_range(POI, 0.875, 1.14) verbosity = 1 if args.hbb: set_hbb_parameter_ranges(args, config) # config.saveNuisances.extend([ # 'CMS_PU', 'CMS_res_j', 'CMS_scale_j', 'bbeff', 'eleveto', 'hqq125GenpT2failcat1mcstat', 'hqq125GenpT2passcat1mcstat', 'hqq125GenpT3failcat1mcstat', 'hqq125GenpT3failcat2mcstat', 'hqq125GenpT3passcat1mcstat', 'hqq125GenpT3passcat2mcstat', 'hqq125GenpT4failcat1mcstat', 'hqq125GenpT4failcat2mcstat', 'hqq125GenpT4passcat1mcstat', 'hqq125GenpT4passcat2mcstat', 'hqq125failmuonCRmcstat', 'hqq125pt', 'hqq125ptShape', 'lumi_13TeV_2016', 'muid', 'muiso', 'mutrigger', 'muveto', 'qcdfailmuonCRmcstat', 'qcdpassmuonCRmcstat', 'scale', 'scalept', 'smear', 'stqqfailmuonCRmcstat', 'stqqpassmuonCRmcstat', 'tqqfailcat1mcstat', 'tqqfailcat2mcstat', 'tqqfailmuonCRmcstat', 'tqqpasscat1mcstat', 'tqqpasscat2mcstat', 'tqqpassmuonCRmcstat', 'trigger', 'veff', 'vvqqfailmuonCRmcstat', 'wlnufailmuonCRmcstat', 'wlnupassmuonCRmcstat', 'wqqfailcat1mcstat', 'wqqfailcat2mcstat', 'wqqpasscat1mcstat', 'wqqpasscat2mcstat', 'wznormEW', 'xhqq125GenpT1failcat1mcstat', 'xhqq125GenpT1failcat2mcstat', 'xhqq125GenpT1passcat1mcstat', 'xhqq125GenpT1passcat2mcstat', 'xhqq125GenpT2failcat1mcstat', 'xhqq125GenpT2failcat2mcstat', 'xhqq125GenpT2passcat1mcstat', 'xhqq125GenpT2passcat2mcstat', 'xhqq125GenpT3failcat1mcstat', 'xhqq125GenpT3failcat2mcstat', 'xhqq125GenpT3passcat1mcstat', 'xhqq125GenpT3passcat2mcstat', 'xhqq125GenpT4failcat1mcstat', 'xhqq125GenpT4failcat2mcstat', 'xhqq125GenpT4passcat1mcstat', 'xhqq125GenpT4passcat2mcstat', 'xhqq125failmuonCRmcstat', 'xhqq125passmuonCRmcstat', 'zllfailmuonCRmcstat', 'znormEW', 'znormQ', 'zqqfailcat1mcstat', 'zqqfailcat2mcstat', 'zqqfailmuonCRmcstat', 'zqqpasscat1mcstat', 'zqqpasscat2mcstat', 'tqqfailcat1norm', 'tqqfailcat2norm', 'tqqfailmuonCRnorm', 'tqqpasscat1norm', 'tqqpasscat2norm', 'tqqpassmuonCRnorm', 'tqqnormSF', 'tqqeffSF', 'lumiscale' # ]) # verbosity = 3 if args.hgg: tight_ranges(config) if args.combWithHbb: set_hbb_parameter_ranges(args, config) tight_ranges(config) if args.hbb or args.hzz: scan_directly(args, config, verbosity) else: postfit_and_scan(args, config)
def CMS_ATLAS_plot(self, args): args = differentialutils.force_asimov(args) plot = differentials.plotting.plots.MultiContourPlot( 'KappatKappagPlotter_CMSATLAS' + ('_asimov' if args.asimov else ''), [self.summed] ) plot.x_title = '#kappa_{t}' plot.y_title = 'c_{g}' plot.disable_CMS_labels = True plot.draw_individual_contours = False plot.set_ranges_by_contour = False plot.draw() plot.wrapup()
def summed_only_plot(self, args): args = differentialutils.force_asimov(args) plot = differentials.plotting.plots.MultiContourPlot( 'KappabKappacPlotter_summed_3000fb' + ('_asimov' if args.asimov else ''), [self.summed_kappabkappac, self.summed_kappabkappac_3000fb] ) plot.x_title = '#kappa_{c}' plot.y_title = '#kappa_{b}' plot.disable_CMS_labels = True plot.draw_individual_contours = False plot.set_ranges_by_contour = True plot.draw() plot.wrapup()
def plot_combination_overlays(args): args = differentialutils.force_asimov(args) plotter = PtSpectraPlotter() plotter.plot_overlays(args) plotter.plot_overlays_3000fb(args) plotter.name += '_to400' plotter.y_min = 0.2 plotter.y_max = 2.0 plotter.x_min = 0. plotter.x_max = 400. plotter.scale_canvas_height = 250 plotter.plot_overlays(args) plotter.plot_overlays_3000fb(args)
def __init__(self, args): super(CombineConfigKBKC, self).__init__(args) args = differentialutils.force_asimov(args) self.onBatch = True self.queue = 'all.q' self.asimov = True if args.asimov else False self.decay_channel = differentialutils.get_decay_channel_tag(args) self.POIs = ['kappab', 'kappac'] self.PhysicsModelParameters = ['kappab=1.0', 'kappac=1.0'] self.subDirectory = 'out/Scan_projection_kbkc_{0}_{1}'.format( differentials.core.datestr(), self.decay_channel) self.hardPhysicsModelParameters.append('lumiscale={0}'.format( self.lumiscale)) self.freezeNuisances.append('lumiscale') if args.scenario2: self.tags.append('scenario2') self.set_ranges() self.datacard = self.get_workspacedict()[self.decay_channel]
def __init__(self, args, decay_channel): super(PlotPatcher, self).__init__() args = differentialutils.force_asimov(args) differentials.plotting.pywrappers.CMS_Latex_lumi.CMS_lumi = 3000 self.args = args self.is_scenario2 = args.scenario2 self.decay_channel = decay_channel self.quick_draw_list = [] self.preprocess() self.scan = self.get_scan() self.scan.name = self.decay_channel self.scan.color = self.colors[decay_channel] if not (self.is_combination()): self.scan.only_1sigma_contours = True self.unpatched = self.scan.to_hist() self.unpatched.name = self.decay_channel self.add_to_quick_draw_list('rawscan', self.unpatched)
def plot_naive_pt_combination(args): args = differentialutils.force_asimov(args) hgg = get_hgg(args) hzz = get_hzz(args) combination = get_combination(args) hgg_hist = fermilabcode.minicombine.data_to_hist(hgg, title=differentials.core.get_standard_title('hgg'), color=2) hzz_hist = fermilabcode.minicombine.data_to_hist(hzz, title=differentials.core.get_standard_title('hzz'), color=4) combination_hist = fermilabcode.minicombine.data_to_hist(combination, title=differentials.core.get_standard_title('combination'), color=1) hgg_hist_xs = fermilabcode.minicombine.data_to_hist(hgg, title=differentials.core.get_standard_title('hgg'), color=2, do_xs=True) hzz_hist_xs = fermilabcode.minicombine.data_to_hist(hzz, title=differentials.core.get_standard_title('hzz'), color=4, do_xs=True) combination_hist_xs = fermilabcode.minicombine.data_to_hist(combination, title=differentials.core.get_standard_title('combination'), color=1, do_xs=True) plot = differentials.plotting.plots.BottomPanelPlot('spectrum_ptcomb') plot.y_title_top = '#Delta#sigma(p_{T}^{H})/#Deltap_{T}^{H} (pb/GeV)' plot.y_title_bottom = 'ratio to SM' plot.x_title = 'p_{T}^{H} (GeV)' plot.disable_CMS_labels = True plot.top_x_min = 0.0 plot.top_x_max = 500.0 plot.bottom_x_min = 0.0 plot.bottom_x_max = 500.0 # plot.top_y_max = 10 # plot.top_y_min = 0.00000001 plot.add_bottom(hgg_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add_bottom(hzz_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add_bottom(combination_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.make_legend() plot.add_top(hgg_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.add_top(hzz_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.add_top(combination_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.add_top(differentials.plotting.pywrappers.CMS_Latex_lumi(text_size=0.07), '') plot.draw() plot.wrapup()
def projection_pth_smH_scan_GT200(args): args = differentialutils.force_asimov(args) decay_channel = differentialutils.get_decay_channel_tag(args) d = differentials.core.AttrDict() d.s1 = differentials.core.AttrDict() d.s2 = differentials.core.AttrDict() d.s1.hgg = 'projections/workspaces_Oct24/ws_pth_smH_hgg_GT200_s1.root' d.s2.hgg = 'projections/workspaces_Oct24/ws_pth_smH_hgg_GT200_s2.root' ws = (d.s2 if args.scenario2 else d.s1)[decay_channel] config = differential_config(args, ws, 'pth_smH', lumiscale=lumiscale3000) def tight_ranges(config): """Very manual tight r_ ranges based on Hgg scan results""" for POI in config.POIs: if 'GT600' in POI: config.set_parameter_range(POI, 0.64, 1.4) else: config.set_parameter_range(POI, 0.875, 1.14) if args.hbb: set_hbb_parameter_ranges(args, config) if args.hgg: tight_ranges(config) if args.combWithHbb: set_hbb_parameter_ranges(args, config) tight_ranges(config) # Overwrite to do only the scan for 1 POI config.POIs = ['r_smH_PTH_GT200'] config.subDirectory += '_GT200only' if args.hbb or args.hzz: scan_directly(args, config, verbosity=1) else: postfit_and_scan(args, config)
def OLD_plot_naive_pt_combination_asimov_with3000fb(args): args = differentialutils.force_asimov(args) combination = fermilabcode.minicombine.load_data('fermilabcode/combination_data_Mar22.py') combination.mu = [ 1.0 for mu in combination.mu ] combination_hist = fermilabcode.minicombine.data_to_hist(combination, title=differentials.core.get_standard_title('combination'), color=1) combination_hist_xs = fermilabcode.minicombine.data_to_hist(combination, title=differentials.core.get_standard_title('combination'), color=1, do_xs=True) combination_hist_xs.title = '35.9 fb^{-1}' combination_3000fb = copy.deepcopy(combination) combination_3000fb.mu_up = [ d * 1/sqrt(3000./35.9) for d in combination_3000fb.mu_up ] combination_3000fb.mu_down = [ d * 1/sqrt(3000./35.9) for d in combination_3000fb.mu_down ] combination_3000fb_hist = fermilabcode.minicombine.data_to_hist(combination_3000fb, title=differentials.core.get_standard_title('combination'), color=2) combination_3000fb_hist_xs = fermilabcode.minicombine.data_to_hist(combination_3000fb, title=differentials.core.get_standard_title('combination'), color=2, do_xs=True) combination_3000fb_hist_xs.title = '3 ab^{-1}' plot = differentials.plotting.plots.BottomPanelPlot('spectrum_ptcomb_highlumi_asimov') plot.y_title_top = '#Delta#sigma(p_{T}^{H})/#Deltap_{T}^{H} (pb/GeV)' plot.y_title_bottom = 'ratio to SM' plot.x_title = 'p_{T}^{H} (GeV)' plot.disable_CMS_labels = True plot.top_x_min = 0.0 plot.top_x_max = 500.0 plot.bottom_x_min = 0.0 plot.bottom_x_max = 500.0 plot.top_y_min = 0.001 plot.make_legend() # plot.add_bottom(combination_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add_top(combination_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.add_bottom(combination_3000fb_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add_top(combination_3000fb_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.add_top(differentials.plotting.pywrappers.CMS_Latex_lumi(text_size=0.07), '') plot.draw() plot.wrapup()
def plot_naive_pt_combination_asimov_with3000fb(args): args = differentialutils.force_asimov(args) combination = get_combination(args) combination_3000fb = get_combination_at_lumi(args, 3000.) combination_hist = fermilabcode.minicombine.data_to_hist(combination, title=differentials.core.get_standard_title('combination'), color=1) combination_hist_xs = fermilabcode.minicombine.data_to_hist(combination, title=differentials.core.get_standard_title('combination'), color=1, do_xs=True) combination_hist_xs.title = 'CMS 35.9 fb^{-1}' combination_3000fb_hist = fermilabcode.minicombine.data_to_hist(combination_3000fb, title=differentials.core.get_standard_title('combination'), color=2) combination_3000fb_hist_xs = fermilabcode.minicombine.data_to_hist(combination_3000fb, title=differentials.core.get_standard_title('combination'), color=2, do_xs=True) combination_3000fb_hist_xs.title = 'CMS 3 ab^{-1}' plot = differentials.plotting.plots.BottomPanelPlot('spectrum_ptcomb_asimov_with_3000fb') plot.y_title_top = '#Delta#sigma(p_{T}^{H})/#Deltap_{T}^{H} (pb/GeV)' plot.y_title_bottom = 'ratio to SM' plot.x_title = 'p_{T}^{H} (GeV)' plot.disable_CMS_labels = True plot.top_x_min = 0.0 plot.top_x_max = 500.0 plot.bottom_x_min = 0.0 plot.bottom_x_max = 500.0 # plot.top_y_max = 10 # plot.top_y_min = 0.00000001 # plot.add_bottom(combination_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.add_bottom(combination_3000fb_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.make_legend() plot.add_top(combination_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.add_top(combination_3000fb_hist_xs, 'repr_point_with_vertical_bar_and_horizontal_bar', plot.leg) plot.draw() plot.wrapup()
def thetaplot_kappatkappag_ATLAS(args): args = differentialutils.force_asimov(args) ATLAS_combination = get_combination_ATLAS() ATLAS_kappatkappag = get_kappatkappag(ATLAS_combination) ATLAS_kappatkappag.title = 'ATLAS 36.1 fb^{-1}' ATLAS_kappatkappag.color = 2 ATLAS_kappatkappag_hist = ATLAS_kappatkappag.to_hist() plot = quick_single_hist_plot( args, ATLAS_kappatkappag_hist, name='ATLAS_kappatkappag', x_title = '#kappa_{t}', y_title = 'c_{g}', set_ranges_by_contour=False ).wrapup() # Get SM normalization binning = ATLAS_kappatkappag.chi2.binning() smxs = ATLAS_kappatkappag.chi2.evaluate_parametrization_xs(ATLAS_kappatkappag.bestfit.pois) inc_smxs = differentials.integral.Integrator(binning, smxs).integral(-10000., 350.) logging.info('Will normalize to SM xs: {0} pb'.format(inc_smxs)) # thetas = fermilabcode.minicombine.get_axis(-0.5*pi, 0.5*pi, 12) theta_1sigma_left = atan2(0.03, 0.6) theta_1sigma_right = atan2(-0.12, 2.4) thetas = [ 0.5*pi, theta_1sigma_left, 0.0, theta_1sigma_right, -0.5*pi ] theta_hists = [] for theta in thetas: ct = cos(theta) cg = sin(theta) pois = [ ct, cg ] xss = ATLAS_kappatkappag.chi2.evaluate_parametrization_xs(pois) inc_xs = differentials.integral.Integrator(binning, xss).integral(-10000., 350.) # Normalize to the SM normalization xss = [ xs * (inc_smxs/inc_xs) for xs in xss ] # Now get the mu's mus = [ xs / xs_sm for xs, xs_sm in zip(xss, smxs) ] histogram = differentials.plotting.pywrappers.Histogram( differentials.plotting.plotting_utils.get_unique_rootname(), '#theta = {0:.2f} #pi'.format(theta/pi), binning, mus ) # histogram.color = 2 theta_hists.append(histogram) ATLAS_combination_hist = fermilabcode.minicombine.data_to_hist(ATLAS_combination, title='Data', color=1, x_max=350.) plot = differentials.plotting.plots.QuickPlot( 'ATLAS_spectra_theta', x_min=0., x_max=350., y_min=-1., y_max=5., ) plot.x_title = 'p_{T}^{H} (GeV)' plot.y_title = '#mu' for theta_hist in theta_hists: plot.add(theta_hist, 'repr_basic_histogram') plot.add(ATLAS_combination_hist, 'repr_point_with_vertical_bar_and_horizontal_bar') plot.draw() plot.wrapup()
def naive_kappatkappag_combination(args): args = differentialutils.force_asimov(args) CMS_combination = get_combination(args) CMS_kappatkappag = get_kappatkappag(CMS_combination) CMS_kappatkappag.title = 'CMS 35.9 fb^{-1}' CMS_kappatkappag.color = 2 CMS_kappatkappag_hist = CMS_kappatkappag.to_hist() plot = quick_single_hist_plot( args, CMS_kappatkappag_hist, name='kappatkappag', x_title = '#kappa_{t}', y_title = 'c_{g}', set_ranges_by_contour=False ).wrapup() ATLAS_combination = get_combination_ATLAS() ATLAS_kappatkappag = get_kappatkappag(ATLAS_combination) ATLAS_kappatkappag.title = 'ATLAS 36.1 fb^{-1}' ATLAS_kappatkappag.color = 4 plot = differentials.plotting.plots.MultiContourPlot( 'multicont_kappatkappag_CMS_ATLAS' + ('_asimov' if args.asimov else ''), [ CMS_kappatkappag, ATLAS_kappatkappag, ] ) plot.x_title = '#kappa_{t}' plot.y_title = 'c_{g}' plot.disable_CMS_labels = True plot.draw_individual_contours = False plot.set_ranges_by_contour = False plot.draw() plot.wrapup() CMS_3000fb_combination = get_combination_at_lumi(args, 3000.) CMS_3000fb_kappatkappag = get_kappatkappag( CMS_3000fb_combination, c1_min = 0.5, c1_max = 1.6, c2_min = -0.05, c2_max = 0.04, ) CMS_3000fb_kappatkappag.title = 'CMS 3000 fb^{-1}' CMS_3000fb_kappatkappag.color = 46 ATLAS_3000fb_combination = get_combination_ATLAS_3000fb() ATLAS_3000fb_kappatkappag = get_kappatkappag( ATLAS_3000fb_combination, c1_min = 0.5, c1_max = 1.6, c2_min = -0.05, c2_max = 0.04, ) ATLAS_3000fb_kappatkappag.title = 'ATLAS 3000 fb^{-1}' ATLAS_3000fb_kappatkappag.color = 38 # Add also the combination of both summed = CMS_3000fb_kappatkappag.sum(ATLAS_3000fb_kappatkappag) summed.title = 'CMS+ATLAS 3000 fb^{-1}' summed.color = 8 plot = differentials.plotting.plots.MultiContourPlot( 'multicont_kappatkappag_CMS_ATLAS_with3000fb_withCombination' + ('_asimov' if args.asimov else ''), [ CMS_kappatkappag, ATLAS_kappatkappag, CMS_3000fb_kappatkappag, ATLAS_3000fb_kappatkappag, summed ] ) plot.legend.SetNColumns(1) plot.legend.set( x1 = c.GetLeftMargin() + 0.01, y1 = c.GetBottomMargin() + 0.02, x2 = c.GetLeftMargin() + 0.40, y2 = c.GetBottomMargin() + 0.44 ) plot.x_min = 0.5 plot.x_max = 1.6 plot.y_min = -0.05 plot.y_max = 0.04 plot.x_title = '#kappa_{t}' plot.y_title = 'c_{g}' plot.disable_CMS_labels = True plot.draw_individual_contours = False plot.set_ranges_by_contour = False plot.draw() plot.wrapup()
def __init__(self, args): super(KappatKappagPlotter, self).__init__() args = differentialutils.force_asimov(args) self.set_run1(args) self.set_3ab(args)
def projection_kbkc_scan_floatingBRs(args): args = differentialutils.force_asimov(args) Config = CombineConfigKBKC_floatingBRs_scenario2 if args.scenario2 else CombineConfigKBKC_floatingBRs config = Config(args) differentialutils.run_postfit_scan(config)
def projection_kbkc_scan_couplingdependentBRs(args): args = differentialutils.force_asimov(args) Config = CombineConfigKBKC_couplingdependentBRs_scenario2 if args.scenario2 else CombineConfigKBKC_couplingdependentBRs config = Config(args) differentialutils.run_postfit_fastscan_scan(config)