if debugging: sigmaside_kk = 0.001 leftlowside = -sidehigh * sigmaside_kk + kkMean.getValV() leftupside = -sidelow * sigmaside_kk + kkMean.getValV() rightlowside = +sidelow * sigmaside_kk + kkMean.getValV() rightupside = +sidehigh * sigmaside_kk + kkMean.getValV() signallow = -signalside * sigmaside_kk + kkMean.getValV() signalup = +signalside * sigmaside_kk + kkMean.getValV() tt_mass.setRange("signalrange", signallow, signalup) tt_mass.setRange("sideleftrange", leftlowside, leftupside) tt_mass.setRange("siderightrange", rightlowside, rightupside) signalIntegralBkg = kkBkg.analyticalIntegral( kkBkg.getAnalyticalIntegral(RooArgSet(tt_mass), RooArgSet(tt_mass)), "signalrange") leftsideIntegralBkg = kkBkg.analyticalIntegral( kkBkg.getAnalyticalIntegral(RooArgSet(tt_mass), RooArgSet(tt_mass)), "sideleftrange") rightsideIntegralBkg = kkBkg.analyticalIntegral( kkBkg.getAnalyticalIntegral(RooArgSet(tt_mass), RooArgSet(tt_mass)), "siderightrange") totIntegralBkg = kkBkg.analyticalIntegral( kkBkg.getAnalyticalIntegral(RooArgSet(tt_mass), RooArgSet(tt_mass))) sigBkgEvts = signalIntegralBkg / totIntegralBkg * ((nBkgKK.getValV())) sidBkgEvts = (leftsideIntegralBkg + rightsideIntegralBkg) / totIntegralBkg * ((nBkgKK.getValV()))
lineup.SetLineWidth(2) #linelow.Draw() #lineup.Draw() #tot.paramOn(phiFrame,RooFit.Layout(0.57,0.99,0.65)) sigevents = () masskk.setRange("phiregion_five",phimass-0.005,phimass+0.005) masskk.setRange("phiregion_ten",phimass-0.01,phimass+0.01) masskk.setRange("totrange",phimin,phimax) totIntegralSig = signal.createIntegral(RooArgSet(masskk),"totrange").getVal() totIntegralBkg = bkg.analyticalIntegral(bkg.getAnalyticalIntegral(RooArgSet(masskk),RooArgSet(masskk)),"totrange") totIntegralTot = tot.createIntegral(RooArgSet(masskk),"totrange").getVal() fiveIntegralSig = signal.createIntegral(RooArgSet(masskk),"phiregion_five").getVal() tenIntegralSig = signal.createIntegral(RooArgSet(masskk),"phiregion_ten").getVal() fiveIntegralBkg = bkg.analyticalIntegral(bkg.getAnalyticalIntegral(RooArgSet(masskk),RooArgSet(masskk)),"phiregion_five") tenIntegralBkg = bkg.analyticalIntegral(bkg.getAnalyticalIntegral(RooArgSet(masskk),RooArgSet(masskk)),"phiregion_ten") fiveIntegralTot = tot.createIntegral(RooArgSet(masskk),"phiregion_five").getVal() tenIntegralTot = tot.createIntegral(RooArgSet(masskk),"phiregion_ten").getVal() fiveIntegralSig = fiveIntegralSig * nSig.getValV() / totIntegralSig tenIntegralSig = tenIntegralSig * nSig.getValV() / totIntegralSig fiveIntegralBkg = fiveIntegralBkg * nBkg.getValV() / totIntegralBkg
# In[14]: plotname = "plots/phi_" + histname c.SaveAs(plotname + ".png") c.SaveAs(plotname + ".eps") c.SaveAs(plotname + ".pdf") # In[15]: mass.setRange("signalrange",signallow,signalup) mass.setRange("sideleftrange",leftlowside,leftupside) mass.setRange("siderightrange",rightlowside,rightupside) signalIntegralBkg = cheb.analyticalIntegral(cheb.getAnalyticalIntegral(RooArgSet(mass),RooArgSet(mass)),"signalrange") leftsideIntegralBkg = cheb.analyticalIntegral(cheb.getAnalyticalIntegral(RooArgSet(mass),RooArgSet(mass)),"sideleftrange") rightsideIntegralBkg = cheb.analyticalIntegral(cheb.getAnalyticalIntegral(RooArgSet(mass),RooArgSet(mass)),"siderightrange") # In[16]: totIntegralBkg= cheb.analyticalIntegral(cheb.getAnalyticalIntegral(RooArgSet(mass),RooArgSet(mass))) # In[17]: sigBkgEvts = signalIntegralBkg/totIntegralBkg*((1.0-sFrac.getValV())*numEvts) sidBkgEvts = (leftsideIntegralBkg+rightsideIntegralBkg)/totIntegralBkg*((1.0-sFrac.getValV())*numEvts)
linesigup.Draw() # In[14]: plotname = "plots/phi_" + histname c.SaveAs(plotname + ".png") c.SaveAs(plotname + ".eps") c.SaveAs(plotname + ".pdf") # In[15]: mass.setRange("signalrange", signallow, signalup) mass.setRange("sideleftrange", leftlowside, leftupside) mass.setRange("siderightrange", rightlowside, rightupside) signalIntegralBkg = cheb.analyticalIntegral( cheb.getAnalyticalIntegral(RooArgSet(mass), RooArgSet(mass)), "signalrange") leftsideIntegralBkg = cheb.analyticalIntegral( cheb.getAnalyticalIntegral(RooArgSet(mass), RooArgSet(mass)), "sideleftrange") rightsideIntegralBkg = cheb.analyticalIntegral( cheb.getAnalyticalIntegral(RooArgSet(mass), RooArgSet(mass)), "siderightrange") # In[16]: totIntegralBkg = cheb.analyticalIntegral( cheb.getAnalyticalIntegral(RooArgSet(mass), RooArgSet(mass))) # In[17]:
signal.plotOn(phiFrame,LineColor(kGreen),Normalization(1.0-bFrac)) tot.paramOn(phiFrame,RooFit.Layout(0.72,0.99,0.4))#,Parameters(RooArgSet(nSig))) #signal.paramOn(phiFrame,RooFit.Layout(0.57,0.99,0.65),Parameters(RooArgSet(mean,sigma))) lowranges = [] uppranges = [] sides = [3.0,5.0,8.0] for i in sides: mass_ref_c_kkk.setRange("sigma_"+ str(i),mean.getVal()-float(i)*sigma.getVal(),mean.getVal()+float(i)*sigma.getVal()) lowranges.append(mean.getVal()-float(i)*sigma.getVal()) uppranges.append(mean.getVal()+float(i)*sigma.getVal()) totIntegralSig = signal.createIntegral(RooArgSet(mass_ref_c_kkk)).getVal() totIntegralBkg = bkg.analyticalIntegral(bkg.getAnalyticalIntegral(RooArgSet(mass_ref_c_kkk),RooArgSet(mass_ref_c_kkk))) totIntegralTot = tot.createIntegral(RooArgSet(mass_ref_c_kkk)).getVal() print "Tot sig: " + str(totIntegralSig) print "Tot bkg: " + str(totIntegralBkg) print "Tot tot: " + str(totIntegralTot) sigIntegrals = [] totIntegrals = [] bkgIntegrals = [] phiFrame.Draw() #sidesigma = np.sqrt(gamma.getValV()**2 + sigma.getValV()**2)