def plotLowMassRegions(signal_hist, bkgr_hist, tex_names, out_path, extra_text=None, sample_groups=False): #Plot per grouping plotGeneralGroups(signal_hist, bkgr_hist, tex_names, out_path, 'oldAN_lowMass', extra_text=extra_text, sample_groups=sample_groups) # # All groups in 1 plot # Need a line to distinguish leading pt regions (so at 4.5) # line_collection = [drawLineFormat(x0=4.5, color=ROOT.kRed)] # # Accompanying extra text # if extra_text is None: extra_text = [] extra_text.append( extraTextFormat('p_{T}(leading) < 30 GeV', tdrStyle_Left_Margin + (plotsize / 4.), 0.68, None, 22)) extra_text.append( extraTextFormat('30 GeV < p_{T}(leading) < 55 GeV', tdrStyle_Left_Margin + (plotsize * 3 / 4.), 0.68, None, 22)) # Custom labels custom_labels = ['0-10', '10-20', '20-30', '> 30'] * 2 if sample_groups: p = Plot(signal_hist, tex_names, bkgr_hist=bkgr_hist, name='All', x_name='M_{2lOS}^{min} [GeV]', y_name='Events', extra_text=extra_text, y_log=True, color_palette='AN2017', color_palette_bkgr='AN2017', syst_hist=0.1, draw_ratio='errorsOnly') else: p = Plot(signal_hist, tex_names, bkgr_hist=bkgr_hist, name='All', x_name='M_{2lOS}^{min} [GeV]', y_name='Events', extra_text=extra_text, y_log=True, syst_hist=0.1, draw_ratio='errorsOnly') p.drawHist(output_dir=out_path, draw_lines=line_collection, min_cutoff=0.1, custom_labels=custom_labels)
from HNL.Plotting.plot import Plot if args.isTest: output_dir = makePathTimeStamped( os.getcwd() + '/data/Results/compareLightLeptonId/ROC/' + args.signal + '-' + args.bkgr) else: output_dir = makePathTimeStamped( os.getcwd() + '/data/testArea/Results/compareLightLeptonId/ROC/' + args.signal + '-' + args.bkgr) curves = [] ordered_f_names = [] extra_text = [ extraTextFormat('efficiency: ' + args.signal, xpos=0.2, ypos=0.82, textsize=1.2, align=12) ] #Text to display event type in plot extra_text.append( extraTextFormat('misid: ' + args.bkgr, textsize=1.2, align=12)) #Text to display event type in plot for f_path in input_signal: f_name = f_path.rsplit('/', 1)[1].split('.')[0] ordered_f_names.append(f_name.split('-')[0]) roc_curve = ROC(f_name.split('-')[0], f_path, misid_path=bkgr_prefix + '/' + f_name + '.root') curves.append(roc_curve.returnGraph()) p = Plot(curves,
iso + 1 + (mu * sub_bins), h.GetBinError(1)) global_index += 1 custom_labels = algos[algo] * main_bins lines_to_draw = [] extra_text = [] for l in xrange(1, main_bins): lx = l * sub_bins lines_to_draw.append( drawLineFormat(x0=lx, x1=lx, color=ROOT.kRed)) main_bin_length = plot_size_hor / (2 * main_bins) for l in xrange(main_bins): tx = tdrStyle_Left_Margin + main_bin_length * (1 + 2 * l) extra_text.append( extraTextFormat( getMuWPs(algo)[l], tx, 0.32, None, 22)) extra_text.append( extraTextFormat( getCorrespondingLightLepDiscr(algo)[1], tx, None, None, 22)) extra_text.append(extraTextFormat(algo, 0.2, 0.8)) extra_text.append( extraTextFormat( ele_wp + ' ' + getCorrespondingLightLepDiscr(algo)[0])) p = Plot(list_of_hist[channel][algo][ele_wp]['Signal'], tex_names, name='_'.join([channel, algo, ele_wp]), bkgr_hist=list_of_hist[channel][algo][ele_wp]
# if args.includeReco != 'noIso': # # Read content of file # # rf = TFile(ip+'/ROC.root') # key_names = [k[0] for k in rootFileContent(rf)] # algos = {k.split('/')[1].split('-')[0] for k in key_names} algos = {k.split('/')[-1] for k in glob.glob(ip + '/*')} extra_text = [] signal_str = 'HNL ; M_{HNL} = ' + signal_name.split( '-m')[-1] + ' GeV' if 'HNL' in signal_name else signal_name extra_text.append( extraTextFormat('Signal: ' + signal_str, 0.2, 0.78)) extra_text.append(extraTextFormat('Background: ' + bkgr_name)) extra_text.append(extraTextFormat('p_{T}^{#tau} > 20 GeV')) extra_text.append(extraTextFormat('|#eta_{#tau}| < 2.3')) if d == 'iso' and args.makeCombinations: ele_wp = {} mu_wp = {} curves = [] ordered_names = [] for algo in algos: signal_path = os.path.join(ip, algo, 'all', 'ROC.root') bkgr_path = os.path.join(input_paths['background'][d][0], algo, 'all', 'ROC.root') rf = TFile(signal_path) key_names = [k[0] for k in rootFileContent(rf)]
cat_names = ['inclusive'] else: cat_names = CATEGORIES for sample in sample_names: if sample != 'HNLmass': continue base_dir = os.getcwd( ) + '/data/calcTriggerEff/' + sample + '/' + args.separateTriggers sub_files = glob.glob(base_dir + '/*.root') for sub_f in sub_files: f_name = sub_f.split('/')[-1].split('.')[0] rf = ROOT.TFile(sub_f) eff_lists = {} for cat in cat_names: eff_lists[cat] = {} extra_text = [extraTextFormat(CATEGORY_TEX_NAMES[cat], ypos=0.83) ] if cat is not None else None var = [ k[0].split('/')[-1] for k in rootFileContent(rf, starting_dir='efficiency_' + str(cat)) ] for v in var: if args.separateTriggers is None or args.separateTriggers == 'full': trigger_list = ['allTriggers'] else: trigger_list = returnCategoryTriggerNames(cat) eff_lists[cat][v] = [ Efficiency('_'.join([str(cat), v, 'integral', str(i)]), None,
) #Remove hist with 0 events, they will otherwise crash the plotting code if n_filled_hist == 0: continue hist_to_plot_pie = ROOT.TH1D( str(c) + '_pie', str(c), n_filled_hist, 0, n_filled_hist) sample_names = [] j = 1 for s in background_collection: fill_val = list_of_values['bkgr'][s][c]['total'] if fill_val > 0: hist_to_plot_pie.SetBinContent(j, fill_val) sample_names.append(s) j += 1 try: extra_text = [ extraTextFormat(SUPERCATEGORY_TEX_NAMES[c], ypos=0.83) ] if c is not None else None except: extra_text = [extraTextFormat('other', ypos=0.83) ] if c is not None else None x_names = CATEGORY_TEX_NAMES.values() x_names.append('total') p = Plot(hist_to_plot_pie, sample_names, name='Events_' + str(c), x_name=CATEGORY_TEX_NAMES, y_name='Events', extra_text=extra_text) p.drawPieChart(output_dir=destination + '/PieCharts', draw_percent=True, message=args.message)
'noFilter' : 'No Filter', 'threeLeptonGenFilter': '#splitline{At least 3 gen light leptons}{with p_{T} > 5 GeV}', 'threeLeptonGenFilter7GeV': '#splitline{At least 3 gen light leptons}{with p_{T} > 7 GeV}', 'hadronicTauGenFilter': '#splitline{At least 1 gen #tau_{h}}{with p_{T} > 18 GeV}', 'tauPlusLightGenFilter': '#splitline{At least 1 gen #tau_{h} with p_{T} > 18 GeV}{and 1 light lepton w p_{T} > 15 GeV}', 'threeLeptonGenFilterInverted': '#splitline{No more than 3 gen light leptons}{with p_{T} > 5 GeV}', 'threeLeptonGenFilter7GeVInverted': '#splitline{No more than 3 gen light leptons}{with p_{T} > 7 GeV}', 'hadronicTauGenFilterInverted': '#splitline{No gen #tau_{h}}{with p_{T} > 18 GeV}', 'tauPlusLightGenFilterInverted': '#splitline{No 1 gen #tau_{h} with p_{T} > 18 GeV}{and 1 light lepton w p_{T} > 5 GeV}', } from ROOT import kRed lines = [drawLineFormat(x0 = 20., x1=20., color=kRed)] if args.flavor == 'tau' else None from HNL.Plotting.plot import Plot extra_text = [extraTextFormat('V_{'+args.flavor+'N} = 0.01')] for i, c_key in enumerate(efficiency[cut_str].keys()): category_name = CATEGORY_NAMES[c_key] if c_key in CATEGORIES else c_key for j, t_key in enumerate(efficiency[cut_str][c_key].keys()): h_bkgr = efficiency[cut_str][c_key][t_key].getEfficiency() h_signal = [efficiency[n][c_key][t_key].getEfficiency() for n in args.stackBaselineCuts] if args.stackBaselineCuts is not None else None bkgr_names = args.stackBaselineCuts if args.stackBaselineCuts else [] draw_ratio = True if len(bkgr_names) > 0 else None extra_text_cat = extra_text + [extraTextFormat(category_name)] # legend_names = [legend_dict[x] for x in [cut_str]+bkgr_names] legend_names = [legend_dict[x] for x in bkgr_names+[cut_str]] p = Plot(h_signal, legend_names, 'efficiency_'+str(category_name), h_bkgr.GetXaxis().GetTitle(), 'Efficiency', bkgr_hist = h_bkgr, x_log=True, y_log=True, extra_text=extra_text_cat, draw_ratio = draw_ratio, color_palette = 'Didar', color_palette_bkgr = 'Black') p.drawHist(output_dir = output_dir, draw_option = 'EP', bkgr_draw_option = 'EP', draw_lines = lines) # hist_for_special_plot = [efficiency['threeLeptonGenFilter']['NoTau']['regularRun'], efficiency['hadronicTauGenFilter']['TauFinalStates']['regularRun']]
if args.masses is not None: output_dir = os.path.join(output_dir, 'customMasses', '-'.join([str(m) for m in args.masses])) else: output_dir = os.path.join(output_dir, 'allMasses') output_dir = makePathTimeStamped(output_dir) # # Create plots for each category # from HNL.EventSelection.eventCategorization import CATEGORY_NAMES, CATEGORY_FROM_NAME print list_of_hist.keys() for c in list_of_hist.keys(): print c c_name = CATEGORY_NAMES[c] if c not in cat.ANALYSIS_CATEGORIES.keys() else c printSelections(mixed_list[0]+'/variables.root', os.path.join(output_dir, c_name, 'Selections.txt')) extra_text = [extraTextFormat(cat.returnTexName(c), xpos = 0.2, ypos = 0.82, textsize = None, align = 12)] #Text to display event type in plot if not args.bkgrOnly: extra_text.append(extraTextFormat('V_{'+args.flavor+'N} = '+str(args.coupling))) #Text to display event type in plot extra_text.append(extraTextFormat('Signal scaled to background', textsize = 0.7)) #Text to display event type in plot # Plots that display chosen for chosen signal masses and backgrounds the distributions for the different variables # S and B in same canvas for each variable for v in var: print v legend_names = list_of_hist[c][v]['signal'].keys()+list_of_hist[c][v]['bkgr'].keys() # Make list of background histograms for the plot object (or None if no background) if not list_of_hist[c][v]['bkgr'].values() or args.signalOnly: bkgr_hist = None else: bkgr_hist = list_of_hist[c][v]['bkgr'].values()
def drawHist(self, output_dir = None, normalize_signal = False, draw_option = 'EHist', bkgr_draw_option = 'Stack', draw_cuts = None, custom_labels = None, draw_lines = None, message = None, min_cutoff = None): # # Some default settings # setDefault() # # Create Canvas and pads # self.canvas = ROOT.TCanvas("Canv"+self.name, "Canv"+self.name, 1000, 1000) self.setPads() self.plotpad.Draw() self.plotpad.cd() # # Throw some errors in case of faulty input # if isinstance(self.x_name, list): raise RuntimeError('invalid x_names') if custom_labels is not None and len(custom_labels) != self.s[0].GetNbinsX(): raise RuntimeError("Inconsistent number of bins ("+str(self.s[0].GetNbinsX())+") compared to number of labels given ("+len(custom_labels)+")") if draw_option == 'Stack' and len(self.b) > 0: raise RuntimeError('The "Stack" option for signal is meant to be used when there is no background. In case of background, input the hist to stack as background.') # # Set Signal Histogram Styles # for h, n in zip(self.s, self.tex_names): # Prepare for stacked signal if draw_option == "Stack": # Order signals from lowest to highest self.s, self.s_tex_names = pt.orderHist(self.s, self.s_tex_names, lowest_first=True) self.hs = ROOT.THStack("hs", "hs") for i, (h, n) in enumerate(zip(self.s, self.s_tex_names)): color_index = ps.getPaletteIndex(self.color_palette, self.s.index(h), n) h.SetFillColor(ps.getColor(self.color_palette, color_index)) h.SetLineColor(ps.getColor(self.color_palette, color_index)) self.hs.Add(h) # Prepare for very basic signal elif draw_option == "HNL": # Order signals so those with 0 sum of weights come last and arent skipped (which causes the axis to not be updated) self.s, self.s_tex_names = pt.orderHist(self.s, self.s_tex_names) h.SetLineColor(ps.getHNLColor(n)) h.SetLineWidth(4) # Otherwise generic settings else: # Order signals so those with 0 sum of weights come last and arent skipped (which causes the axis to not be updated) self.s, self.s_tex_names = pt.orderHist(self.s, self.s_tex_names) color_index = ps.getPaletteIndex(self.color_palette, self.s.index(h), n) h.SetLineColor(ps.getColor(self.color_palette, color_index)) h.SetLineWidth(4) h.SetMarkerStyle(0) h.SetMarkerColor(ps.getColor(self.color_palette, color_index)) # # Set Bkgr Histogram Styles # if len(self.b) > 0: self.total_b = self.b[0].Clone('total_bkgr') # Generic settings for i, (h, n) in enumerate(zip(self.b, self.b_tex_names)): color_index = ps.getPaletteIndex(self.color_palette_bkgr, i, n) h.SetLineColor(ps.getColor(self.color_palette_bkgr, color_index)) h.SetLineWidth(3) if i != 0: self.total_b.Add(h) # Prepare for stacking (Can not conflict with signal stacks due to runtimeError raise at the beginning) if bkgr_draw_option == 'Stack': self.b, self.b_tex_names = pt.orderHist(self.b, self.b_tex_names, lowest_first = True) self.hs = ROOT.THStack("hs", "hs") for i, (h, n) in enumerate(zip(self.b, self.b_tex_names)): color_index = ps.getPaletteIndex(self.color_palette_bkgr, i, n) h.SetFillColor(ps.getColor(self.color_palette_bkgr, color_index)) self.hs.Add(h) self.tex_names = self.s_tex_names + self.b_tex_names # # Set title (background is drawn first so it gets dibs) # if self.draw_ratio is not None or self.draw_significance: title = " ; ; "+self.y_name else: title = " ;" +self.x_name+ " ; "+self.y_name if len(self.b) > 0: if bkgr_draw_option == 'Stack': self.hs.SetTitle(title) else: self.b[0].SetTitle(title) else: if draw_option == "Stack": self.hs.SetTitle(title) else: self.s[0].SetTitle(title) # # Draw background first # tmp_bkgr_draw_option = bkgr_draw_option.split('E')[-1] if len(self.b) > 0: if bkgr_draw_option == 'Stack': self.hs.Draw("Hist") #Draw before using GetHistogram, see https://root-forum.cern.ch/t/thstack-gethistogram-null-pointer-error/12892/4 if self.draw_ratio is not None or self.draw_significance: self.hs.GetHistogram().GetXaxis().SetLabelOffset(9999999) else: for i, b in enumerate(self.b): if i == 0: b.Draw(tmp_bkgr_draw_option) if self.draw_ratio is not None or self.draw_significance: b.GetXaxis().SetLabelOffset(9999999) else: b.Draw(tmp_bkgr_draw_option + 'Same') # # Draw signal # tmp_draw_option = draw_option.split('E')[-1] if draw_option == "Stack": self.hs.Draw("Hist") #Draw before using GetHistogram, see https://root-forum.cern.ch/t/thstack-gethistogram-null-pointer-error/12892/4 if self.draw_ratio is not None or self.draw_significance: self.hs.GetHistogram().GetXaxis().SetLabelOffset(9999999) else: for ih, h in enumerate(self.s): if h.GetSumOfWeights() == 0: continue if normalize_signal: if len(self.b) == 0: # raise RuntimeError("Trying to normalize a signal to a nonexisting background in drawHist") #Normalize everything to the first histogram if ih > 0: h.Scale(self.s[0].GetSumOfWeights()/h.GetSumOfWeights()) else: h.Scale(self.total_b.GetSumOfWeights()/h.GetSumOfWeights()) if(self.s.index(h) == 0 and self.b is None): h.Draw(tmp_draw_option) else: h.Draw(tmp_draw_option+'Same') self.drawErrors(draw_option, bkgr_draw_option) #Draw observed if self.observed is not None: self.observed.SetLineColor(ROOT.kBlack) self.observed.SetMarkerColor(ROOT.kBlack) self.observed.SetMarkerStyle(8) self.observed.SetMarkerSize(1) self.observed.Draw("EPSame") tdr.setTDRStyle() #TODO: Find out why we need a setTDRStyle after drawing the stack # # Calculate ranges of axis and set to log if requested # self.setAxisLog(stacked = (len(self.b) > 0 and 'Stack' in bkgr_draw_option) or 'Stack' in draw_option, min_cutoff = min_cutoff) # # Set custom labels if needed # if custom_labels is not None and not self.draw_ratio and not self.draw_significance: if len(self.b) > 0: if bkgr_draw_option == 'Stack': for i, n in enumerate(custom_labels): self.hs.GetHistogram().GetXaxis().SetBinLabel(i+1, n) else: for i, n in enumerate(custom_labels): self.b[0].GetXaxis().SetBinLabel(i+1, n) else: if draw_option == "Stack": for i, n in enumerate(custom_labels): self.hs.GetHistogram().GetXaxis().SetBinLabel(i+1, n) else: for i, n in enumerate(custom_labels): self.s[0].GetXaxis().SetBinLabel(i+1, n) # # Option only used in plotVariables.py # if draw_cuts is not None: if self.extra_text is None: self.extra_text = [] lines = [] i = 0 #Cant use enumerate because of if statement, first filled value might be at i=2 but lines[2] doesnt exist then for j, (h, l) in enumerate(zip(self.s, draw_cuts[0])): if l is not None: lines.append(ROOT.TLine(l, 0, l, self.s[0].GetMaximum())) lines[i].SetLineColor(self.s[j].GetLineColor()) lines[i].SetLineStyle(10) lines[i].SetLineWidth(2) lines[i].Draw('Same') self.extra_text.append(pt.extraTextFormat('p_{T}(l'+str(j+1)+') < '+str(l) +' GeV')) i += 1 self.extra_text.append(pt.extraTextFormat('Eff: %.4g' % draw_cuts[1]+'%')) if draw_lines is not None: line_collection = [] #Multiple lines if isinstance(draw_lines[0], list): for il, l in enumerate(draw_lines): x0 = l[0] if l[0] is not None else self.overall_min*0.001 x1 = l[1] if l[1] is not None else self.overall_max*3000 y0 = l[2] if l[2] is not None else self.min_to_set*0.01 y1 = l[3] if l[3] is not None else self.max_to_set*300 color = l[4] if l[4] is not None else ROOT.kBlack line_collection.append(ROOT.TLine(x0, y0, x1, y1)) line_collection[il].SetLineColor(color) line_collection[il].SetLineWidth(l[5]) line_collection[il].SetLineStyle(l[6]) for l in line_collection: l.Draw('same') #Write extra text if self.extra_text is not None: self.drawExtraText() self.canvas.cd() #Create Legend legend = ROOT.TLegend(0.4, .7, .9, .9) legend.SetNColumns(1) legend.SetTextSize(.03) loop_obj = [item for item in self.s] if len(self.b) > 0: loop_obj.extend(self.b) for h, n in zip(loop_obj, self.tex_names): legend.AddEntry(h, n) if self.observed is not None: legend.AddEntry(self.observed, 'data') legend.SetFillStyle(0) legend.SetBorderSize(0) legend.Draw() if self.draw_ratio is not None: just_errors = self.draw_ratio == 'errorsOnly' if self.b is None: raise RuntimeError("Cannot ask ratio or significance if no background is given") ratios = self.calculateRatio() self.drawRatio(ratios, custom_labels, just_errors) self.ratio_pad.Update() if self.draw_significance: if self.b is None: raise RuntimeError("Cannot ask ratio or significance if no background is given") significance_lines = [] for s in self.s: significance_lines.append(ROOT.TLine(s.GetBinLowEdge(1), 0, s.GetBinLowEdge(self.s[0].GetNbinsX()+1), 0)) significances = self.calculateSignificance(cumulative=True) self.drawSignificance(significances, custom_labels, significance_lines) self.sig_pad.Update() ROOT.gPad.Update() self.canvas.Update() #CMS lumi cl.CMS_lumi(self.canvas, 4, 11, 'Preliminary', self.year) #Save everything self.savePlot(output_dir +'/'+ self.name, message) ROOT.SetOwnership(self.canvas, False) return
weight = ROOT.vector('float')() for i in xrange(len(test_tree['classID'])): class_id.push_back(not test_tree['classID'][i]) weight.push_back(test_tree['weight'][i]) for mname in mnames: mva_output[mname].push_back(test_tree[mname][i]) ROC_integrals = [] for iname, mname in enumerate(mnames): progress(iname, len(mnames)) ROCs[mname] = ROOT.TMVA.ROCCurve(mva_output[mname], class_id, weight) ROC_integrals.append(ROCs[mname].GetROCIntegral()) ROC_curve = ROCs[mname].GetROCCurve() ROC_curve = fillRandGraph(ROC_curve, 10) extra_text = [ extraTextFormat("AUC: " + str(ROCs[mname].GetROCIntegral())) ] p = Plot(signal_hist=[ROC_curve], tex_names=[mname], name='roc_' + mname, extra_text=extra_text) p.drawGraph(output_dir=out_file_name.rsplit('/', 1)[0] + '/kBDT/plots', draw_style="AP") print 'Making pdf' mnames = sortByOtherList(mnames, ROC_integrals) mnames.reverse() pdf = FPDF() for mname in mnames: pdf.add_page() pdf.image(
hist_to_plot[sn].SetBinError(i+1, list_of_errors['signal'][sample_name][c]['total']) x_names = [CATEGORY_TEX_NAMES[n] for n in SUPER_CATEGORIES[supercat]] p = Plot(hist_to_plot, hist_names, name = 'Events-bar-signal-'+supercat+'-'+args.coupling, x_name = x_names, y_name = 'Events', y_log=True) p.drawBarChart(output_dir = destination+'/BarCharts', parallel_bins=True, message = args.message) if not args.noPieCharts: example_sample = list_of_values['bkgr'].keys()[0] for i, c in enumerate(sorted(list_of_values['bkgr'][example_sample].keys())): hist_to_plot_pie = ROOT.TH1D(str(c)+'_pie', str(c), len(list_of_values['bkgr']), 0, len(list_of_values['bkgr'])) for j, s in enumerate(list_of_values['bkgr'].keys()): # hist_to_plot_pie.SetBinContent(j+1, list_of_values['bkgr'][s][c]['total'].getHist().GetSumOfWeights()) hist_to_plot_pie.SetBinContent(j+1, list_of_values['bkgr'][s][c]['total']) hist_to_plot_pie.SetBinError(j+1, list_of_errors['bkgr'][s][c]['total']) try: extra_text = [extraTextFormat(SUPERCATEGORY_TEX_NAMES[c], ypos = 0.83)] if c is not None else None except: extra_text = [extraTextFormat('other', ypos = 0.83)] if c is not None else None x_names = CATEGORY_TEX_NAMES.values() x_names.append('total') p = Plot(hist_to_plot_pie, list_of_values['bkgr'].keys(), name = 'Events_'+str(c), x_name = CATEGORY_TEX_NAMES, y_name = 'Events', extra_text = extra_text) p.drawPieChart(output_dir = destination+'/PieCharts', draw_percent=True, message = args.message) if not args.noCutFlow: import glob all_files = glob.glob(os.path.expandvars('$CMSSW_BASE/src/HNL/EventSelection/data/eventsPerCategory/'+selection_str+'/'+mass_str+'/HNL-'+args.coupling+'*/events.root')) all_files = sorted(all_files, key = lambda k : int(k.split('/')[-2].split('.')[0].split('-m')[-1])) all_names = [k.split('/')[-1].split('.')[0] for k in all_files] from HNL.EventSelection.cutter import plotCutFlow
output_dir = makePathTimeStamped(output_dir) # # Create plots for each category # from HNL.EventSelection.eventCategorization import CATEGORY_NAMES # for c in list_of_hist.keys(): for c in cat.SUPER_CATEGORIES.keys(): c_name = CATEGORY_NAMES[ c] if c not in cat.SUPER_CATEGORIES.keys() else c # extra_text = [extraTextFormat(cat.returnTexName(c), xpos = 0.2, ypos = 0.82, textsize = None, align = 12)] #Text to display event type in plot extra_text = [ extraTextFormat(c_name, xpos=0.2, ypos=0.82, textsize=None, align=12) ] #Text to display event type in plot if not args.bkgrOnly: extra_text.append( extraTextFormat('V_{' + args.flavor + 'N} = ' + str(args.coupling)) ) #Text to display event type in plot if not args.signalOnly: extra_text.append( extraTextFormat('Signal scaled to background', textsize=0.7) ) #Text to display event type in plot # Plots that display chosen for chosen signal masses and backgrounds the distributions for the different variables