numEvts = dh.sum(False) print numEvts # In[10]: tot.fitTo(dh) # In[11]: massFrame = mass.frame() massFrame.SetTitle("Phi signal") dh.plotOn(massFrame) tot.plotOn(massFrame) gauss.plotOn(massFrame, LineColor(kGreen), LineStyle(kDashed), Normalization((sFrac.getValV() * numEvts) / (numEvts))) cheb.plotOn(massFrame, LineColor(kMagenta), LineStyle(kDotted), Normalization(((1.0 - sFrac.getValV()) * numEvts) / (numEvts))) tot.paramOn(massFrame, Layout(0.60, 0.99, 0.75)) massFrame.Draw() # In[12]: plotmax = hist.GetMaximum() * 1.05 sidesigma = sigma.getValV() leftlowside = -7. * sidesigma + mean.getValV() leftupside = -5. * sidesigma + mean.getValV() rightlowside = +5. * sidesigma + mean.getValV() rightupside = +7. * sidesigma + mean.getValV() signallow = -3. * sidesigma + mean.getValV() signalup = +3. * sidesigma + mean.getValV()
mean.setConstant(False) gamma.setConstant(False) sigma_1.setConstant(False) sigma_2.setConstant(False) rPhifit = tot.fitTo(splotData,Range(phimin,phimax),RooFit.NumCPU(args.ncpu),RooFit.Verbose(False)) nfits = nfits + 1 c = TCanvas("canvas","canvas",1200,900) phiFrame = masskk.frame(Range(phimin,phimax),Normalization((nSig.getValV() + nBkg.getValV())), Title("#phi Mass")) splotData.plotOn(phiFrame) ratio = 1.0/float(nfits) tot.plotOn(phiFrame,Normalization(ratio)) bFrac = (nBkg.getValV())/(nSig.getValV() + nBkg.getValV()) bkg.plotOn(phiFrame,LineColor(kRed),Normalization(bFrac),LineStyle(kDashed)) signal.plotOn(phiFrame,LineColor(kGreen),Normalization(1.0-bFrac)) a0.setConstant(True) a1.setConstant(True) a2.setConstant(True) a3.setConstant(True) a4.setConstant(True) nBkg.setConstant(True) tot.paramOn(phiFrame,RooFit.Layout(0.57,0.99,0.65)) phiFrame.Draw() sidesigma = np.sqrt((rFrac.getValV())*sigma_1.getValV()**2 + (1.0 - (rFrac.getValV()))*sigma_2.getValV()**2)
# In[10]: tot.fitTo(dh) # In[11]: massFrame = mass.frame() massFrame.SetTitle("Phi signal") dh.plotOn(massFrame) tot.plotOn(massFrame) gauss.plotOn(massFrame,LineColor(kGreen),LineStyle(kDashed),Normalization((sFrac.getValV()*numEvts)/(numEvts))) cheb.plotOn(massFrame,LineColor(kMagenta),LineStyle(kDotted),Normalization(((1.0-sFrac.getValV())*numEvts)/(numEvts))) tot.paramOn(massFrame,Layout(0.60,0.99,0.75)); massFrame.Draw() # In[12]: plotmax = hist.GetMaximum()*1.05 sidesigma = sigma.getValV() leftlowside = -7.*sidesigma + mean.getValV() leftupside = -5.*sidesigma + mean.getValV() rightlowside = +5.*sidesigma + mean.getValV() rightupside = +7.*sidesigma + mean.getValV() signallow = -3.*sidesigma + mean.getValV()