tree = inf.Get('hadtop/events') hAll = TH1F('hAll', 'hAll', bins, xmin, xmax) hPass = TH1F('hPass', 'hPass', bins, xmin, xmax) hAll.Sumw2() hPass.Sumw2() tree.Draw(var + '>>hAll', 'ht>450 && nBJets>1 && triggerBit[7]') tree.Draw( var + '>>hPass', 'ht>450 && nBJets>1 && triggerBit[7] && (triggerBit[0] || triggerBit[2])') print hAll.Integral() print hPass.Integral() eff = TEfficiency('Efficiency', 'Efficiency', bins, xmin, xmax) eff.SetPassedHistogram(hPass, "f") eff.SetTotalHistogram(hAll, "f") eff.SetMarkerColor(ROOT.kBlack) eff.SetLineColor(ROOT.kBlack) eff.SetMarkerStyle(20) x = [] y = [] exl = [] exh = [] eyl = [] eyh = [] for i in xrange(hAll.GetNbinsX()): x.append(hAll.GetBinCenter(i + 1)) exl.append(0)
hRef.SetFillColor(ROOT.kGray) hRef.Draw('hist') hSig.Draw('sameE') leg = TLegend(0.6, 0.7, 0.9, 0.9) leg.AddEntry(hSig, 'Ref. + Sig. trigger', 'LP') leg.AddEntry(hRef, 'Ref. trigger', 'F') leg.SetFillColor(0) leg.SetBorderSize(0) leg.SetTextFont(42) leg.SetTextSize(0.05) leg.Draw() can2 = TCanvas('can_TrigEff', 'can_TrigEff', 900, 600) eff = TEfficiency('efficiency', 'efficiency', hRef.GetNbinsX(), 0, 2000) eff.SetPassedHistogram(hSig, 'f') eff.SetTotalHistogram(hRef, 'f') eff.SetLineColor(ROOT.kBlack) eff.SetMarkerColor(ROOT.kBlack) eff.SetMarkerStyle(20) fit = TF1('fit', '(1-[2])+[2]*TMath::Erf((x-[0])/[1])', xmin, xmax) fit.SetParameters(800, 100, 0.3) fit.SetLineColor(ROOT.kBlue) eff.Fit(fit, 'RQ') line = TF1('line', '1', xmin, xmax) line.GetXaxis().SetTitle('m_{jj} (GeV)') line.GetYaxis().SetTitle('Trigger Efficiency') line.SetLineColor(ROOT.kBlack) line.SetLineStyle(2) line.SetMinimum(0.3)