[(4800, 5400)], [(4200, 4800)], [(3600, 4200)], [(3000, 3600)], [(2400, 3000)], ] for signal, signalMass, massbinsset in [ ("CIplusLL", "12000", massbinssets2), ("cs_ct14nlo_", "13000", massbinssets1), ("AntiCIplusLL", "12000", massbinssets2), ("DMAxial_Dijet_LO_Mphi_1_1p0_1p0_Mar5_gdmv_0_gdma_1p0_gv_0_ga_1", "6000", ""), ]: for massbins in massbinsset: limits = {} name = "pvalue_LHCa" + signal + "_" + ("_".join([ s[0:4] for s in str(massbins).strip("[]").split("(") ])).strip("_") + "_exp_" + signalMass + "_2016" print name f1 = open(name + ".txt") observed = 0 for l in f1.readlines(): if "CLb" in l: pval = float(l.split("=")[1].split("+")[0].strip(" ")) print "pvalue", pval, "significance", RooStats.PValueToSignificance( (1. - pval) / 2.) if "Significance:" in l: significance = float(l.strip().split(" ")[-1].strip(")")) print "significance", significance
if opts.nullFit: fr_null.Write() #fitter.ws.Print() output.Close() if pars.btagSelection: c1.SaveAs("DibosonBoostedBtaglnuJ_%s_%ijets_Stacked.png" % (mode, opts.Nj)) c2.SaveAs("DibosonBoostedBtaglnuJ_%s_%ijets_Subtracted.png" % (mode, opts.Nj)) cp1.SaveAs("DibosonBoostedBtaglnuJ_%s_%ijets_Pull.png" % (mode, opts.Nj)) else: c1.SaveAs("DibosonBoostedlnuJ_%s_%ijets_Stacked.png" % (mode, opts.Nj)) c2.SaveAs("DibosonBoostedlnuJ_%s_%ijets_Subtracted.png" % (mode, opts.Nj)) cp1.SaveAs("DibosonBoostedlnuJ_%s_%ijets_Pull.png" % (mode, opts.Nj)) print 'Time elapsed: %.1f sec' % timer.RealTime() print 'CPU time used: %.1f sec' % timer.CpuTime() print '%i degrees of freedom' % ndf print 'chi2: %.2f / %i = %.2f' % (chi2_1, ndf, (chi2 / ndf)) print 'chi2 probability: %.4g' % (TMath.Prob(chi2, ndf)) if opts.nullFit: likelihoodRatio = 2. * fr_null.minNll() - 2. * fr.minNll() print '2*nll_null - 2*nll: %.4f - %.4f = %.4f' % ( 2. * fr_null.minNll(), 2. * fr.minNll(), likelihoodRatio) pval = TMath.Prob(likelihoodRatio, 1) print 'p-value: %.4g' % pval print 'Gaussian significance: %.3g' % RooStats.PValueToSignificance(pval)
xpoints1=array.array('d') ypoints1=array.array('d') xerrors1=array.array('d') yerrors1=array.array('d') for i in range(2,20): x=i*0.25 ys=[] for toy in range(jobs*toysPerJob): ymax=0 for mass,significances in fWW: #if mass<1200: continue ymax=max(ymax,significances[toy]) ys+=[ymax] y=RooStats.PValueToSignificance(float(len([s for s in ys if s>=x]))/len(ys)) if y>10 or y<-10: continue xpoints1.append(x) ypoints1.append(y) xerrors1.append(0) if len([s for s in ys if s>=x])>0: yerror=2*(y-RooStats.PValueToSignificance(float(sqrt(len([s for s in ys if s>=x]))+len([s for s in ys if s>=x]))/len(ys))) else: yerror=y yerrors1.append(yerror) print x,y,yerror canvas = TCanvas("","",0,0,200,200) legend=TLegend(0.3,0.7,0.95,0.90,"")
observedZValue = [] tmpIntegratedLumi = 0.0 for ibin in xrange( h_den.GetNbinsX() ): if tmpIntegratedLumi/1000.>22.1: break tmpIntegratedLumi += h_den.GetBinContent(ibin) nobs = h_num["SRG3b"].Integral(0,ibin) nexp = 2.8*tmpIntegratedLumi/(22.1 * 1000.) nexpsig = 10*tmpIntegratedLumi/(22.1 * 1000.) integratedLumi.append(tmpIntegratedLumi/1000.) tmpPvalue = RooStats.NumberCountingUtils.BinomialObsP(nexpsig,nexp,0.27)/2. tmpZvalue = RooStats.PValueToSignificance( tmpPvalue ) if tmpPvalue else 0 expectedZValue.append( tmpZvalue ) tmpPvalue = RooStats.NumberCountingUtils.BinomialObsP(nexpsig,nexp*(1+0.27),0.27)/2. tmpZvalue = RooStats.PValueToSignificance( tmpPvalue ) if tmpPvalue else 0 expectedUpZValue.append( tmpZvalue ) tmpPvalue = RooStats.NumberCountingUtils.BinomialObsP(nexpsig,nexp*(1-0.27),0.27)/2. tmpZvalue = RooStats.PValueToSignificance( tmpPvalue ) if tmpPvalue else 0 expectedDownZValue.append( tmpZvalue ) tmpPvalue = RooStats.NumberCountingUtils.BinomialObsP(nobs,nexp,0.27)/2. tmpZvalue = RooStats.PValueToSignificance( tmpPvalue ) if tmpPvalue else 0 observedZValue.append( tmpZvalue )