def test_bukin(): logger.info( 'Test Bukin_pdf: Bukin function: skew gaussian core + exponenial/gaussian tails' ) model_bukin = Models.Fit1D(signal=Models.Bukin_pdf( name='Bukin', xvar=mass, xi=0, rhoL=0, rhoR=0, mean=signal_gauss.mean, sigma=signal_gauss.sigma), background=Models.Bkg_pdf('BkgBK', xvar=mass, power=0), S=S, B=B) model_bukin.signal.mean.fix(m.value()) model_bukin.signal.sigma.fix(m.error()) model_bukin.S.setVal(5000) model_bukin.B.setVal(500) with rooSilent(): result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.xi.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.rhoL.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.rhoR.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.mean.release() model_bukin.signal.sigma.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.draw(dataset0) if 0 != result.status() or 3 != result.covQual(): logger.warning('Fit is not perfect MIGRAD=%d QUAL=%d ' % (result.status(), result.covQual())) logger.info('Bukin function\n%s' % result.table(prefix="# ")) models.add(model_bukin)
def test_bukin(): logger.info( 'Test Bukin_pdf: Bukin function: skew gaussian core + exponenial/gaussian tails' ) model_bukin = Models.Fit1D(signal=Models.Bukin_pdf( name='Bukin', mass=mass, xi=0, rhol=0, rhor=0, mean=signal_gauss.mean, sigma=signal_gauss.sigma), background=Models.Bkg_pdf('BkgBK', mass=mass, power=0)) model_bukin.signal.mean.fix(m.value()) model_bukin.signal.sigma.fix(m.error()) model_bukin.s.setVal(5000) model_bukin.b.setVal(500) with rooSilent(): result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.xi.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.rhol.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.rhor.release() result, frame = model_bukin.fitTo(dataset0) model_bukin.signal.mean.release() model_bukin.signal.sigma.release() result, frame = model_bukin.fitTo(dataset0) if 0 != result.status() or 3 != result.covQual(): logger.warning('Fit is not perfect MIGRAD=%d QUAL=%d ' % (result.status(), result.covQual())) print result else: logger.info('Signal & Background are: %-28s & %-28s ' % (result('S')[0], result('B')[0])) logger.info('Mean & Sigma are: %-28s & %-28s ' % (result('mean_Gauss')[0], result('sigma_Gauss')[0])) models.add(model_bukin)
from Functions import * #------------------------------------------------------------------------------- rfile = ROOT.TFile("test_file.root", "READ") ds = rfile["ds"] #------------------------------------------------------------------------------- im = ROOT.RooRealVar('im', 'im', 2.240, 2.330) pk = ROOT.RooRealVar('pk', 'peak ', 2.2875, 2.286, 2.289) sg = ROOT.RooRealVar('sg', 'sigma', 0.0045, 0.003, 0.010) rl = ROOT.RooRealVar('rl', 'rhoL', 0.0000, 0.000, 2.000) rr = ROOT.RooRealVar('rr', 'rhoR', 0.0000, 0.000, 2.000) xi = ROOT.RooRealVar('xi', 'xi', 0.0000, -0.010, 0.010) #------------------------------------------------------------------------------- sig_bu = Models.Bukin_pdf('sig_bu', xvar=im, mean=pk, sigma=sg, xi=xi, rhoL=rl, rhoR=rr) bkg0 = Models.Bkg_pdf('bkg0', xvar=im, power=0) model = Models.Fit1D(signal=sig_bu, background=bkg0) #------------------------------------------------------------------------------- dh = (ds.reduce(ROOT.RooArgSet(im), "im>0")).binnedClone() with timing(): r, w = model.fitTo(dh) r, w = model.fitTo(ds, draw=True, nbins=100, ncpu=4) #------------------------------------------------------------------------------- print(r) #------------------------------------------------------------------------------- h = w.pullHist() draw_param(r,