h6_e.GetAxis(idims.q2).SetRange(5,5) he_mmp = asrootpy(h6_e.Projection(5)) fbg4 = fitbg(he_mmp, 'pol4') fig = draw(he_mmp) drawf(fbg4, 'blue') fbg8 = fitbg(he_mmp, 'pol8') drawf(fbg8, 'green') # <codecell> fig = plt.figure(figsize=(14, 8), dpi=100, facecolor='white') fig = draw(he_mmp, fig=fig) drawf(fbg8, 'black') hsig = asrootpy(he_mmp.Clone('hsig')) hsig.Add(fbg8,-1) fsig = f_bwexpgaus(limsmass=(mw-0.003,mw+0.005), limsmag=(1,200), limssigma=(0.01, 0.03), limsehl=(0.0005,0.01)) hsig.Fit(fsig, 'N0', '') #, *omegarange) hsig.SetColor('blue') fig = draw(hsig, 1, 1, 1, fig) drawf(fsig, 'blue') # <codecell> print('bg skip: '+2*'(%.3f,%.3f) ' % tuple([fbgskip[i][j] for i in range(0,2) for j in range(0,2)])) wsigma = fsig.GetParameter(2) wmean = fsig.GetParameter(1) siglo, sighi = wmean-3*wsigma, wmean+3*wsigma print('signal 3-sigma region: (%.3f,%.3f)' % (siglo,sighi)) for ipar in range(0,fsig.GetNpar()): print(fsig.GetParameter(ipar)) m, s = fsig.Mean(siglo, sighi), sqrt(fsig.Variance(siglo, sighi))
fbgrej = bgwrapper.newtf1 fbg = bgwrapper.tf1 # fbgw = RejectWrapper(r.TF1('fbg', 'pol2', 0.4, 1.2), fbgskip) # fbg = r.TF1('fbg', 'pol2', 0.4, 1.2) # fbg = r.TF1('fbg', d_pol2, 0.4, 1.2, 3) # fbg.rejranges = fbgskip # h.Fit(fbg, '', '', 0.56, 0.74) h.Fit(fbgrej, 'N0', '', 0.4, 1.05) h.GetListOfFunctions().Add(fbg.Clone('fbg')) h.GetListOfFunctions()[0].SetRange(0.4, 1.2) hsig = h.Clone('hsig') hsig.Add(h.GetListOfFunctions()[0], -1) hsig.SetMarkerColor(r.kGreen) hsig.SetLineColor(r.kGreen) # fs = f_gausexp() fs = f_bwexpgaus() hsig.Fit(fs, '', '', *omegarange) hsig.GetListOfFunctions()[0].SetLineColor(r.kGreen) # define signal+background function # def d_fsigbg(v, par): # p0, p1, p2, p3, p4, p5, p6 = par[0], par[1], par[2], par[3], par[4], par[5], par[6] # parsig = [p0, p1, p2, p3] # return d_gausexp(v, parsig)+p4+p5*v[0]+p6*v[0]**2 # fsigbg = RejectWrapper(r.TF1('fsigbg', d_fsigbg, 0.4, 1.2, 7), [etarange]).newtf1 fsigbg = RejectWrapper(f_bwexpgaus_pol4(), [etarange]).newtf1 # fsigbg = r.TF1('fsigbg', d_fsigbg, 0.4, 1.2, 7) # fsigbg.rejranges = [etarange] fsigbg.lims = {} fsigbg.lims.update(fs.lims)