hsd[float(lxy)] = h hs = [hsd[k] for k in sorted(hsd)] leg = Legend(hs, pad=c, leftmargin=0.5, margin=0.1, entryheight=0.02, textsize=12) draw(hs, pad=c, xlimits=(1e-1, 500), logy=True, logx=True) leg.Draw() t = LuminosityLabel('XX#rightarrow2A#rightarrow4#mu ({}, {}) GeV'.format( mxx, ma)) t.draw() c.SaveAs(os.path.join(outdir, 'ch4mu_dplxy.pdf'.format(outdir))) c.clear() massdir = getattr(f.ch2mu2e, masstag) lxytags = [x.name for x in massdir.keys()] # lxy-0p3_ctau-0p0025 hsd = {} for tag in lxytags: lxy_, ctau_ = tag.split('_') lxy = lxy_.split('-')[1].replace('p', '.') ctau = ctau_.split('-')[1].replace('p', '.') h = getattr(massdir, tag).dplxy h.linewidth = 2 h.drawstyle = 'PLC hist' h.scale(1. / h.integral()) h.legendstyle = 'L' h.title = 'lxy: {}cm c#tau: {}mm'.format(lxy, ctau)
h.linewidth=2 h.title=sigtag+' (norm. 30fb)' h.legendstyle='L' sighs.append(h) draw([bkgh]+sighs, ylimits=(1e-4,1e3), logy=True) leg = Legend([bkgh]+sighs, pad=canvas, margin=0.25, leftmargin=0.45, topmargin=0.02, entrysep=0.01, entryheight=0.02, textsize=10) leg.Draw() title = TitleAsLatex('[4#mu] muon-type lepton-jet isolation') title.Draw() canvas.SaveAs('{}/ch4mu_muljiso.pdf'.format(outdir)) canvas.clear() signalsigs = [] for h in sighs: h_ = h.clone() for i in range(1, h.nbins()+1): b = math.sqrt(bkgh.integral(xbin1=i, overflow=True)) s = h.integral(xbin1=i, overflow=True) if s==0 or b==0: h_[i]=h_[i-1] else: h_[i] = calculate_simpsig(s, b) h_[i].error = 0 h_.scale(1/h_.integral()) signalsigs.append(h_) ROOT.gPad.SetLogy(0)