def test_spline2D() : logger.info ('Test Spline2D_pdf : 2D-spline') s1 = Ostap.Math.BSpline ( m_x.xmin(), m_x.xmax() , 1 , 2 ) s2 = Ostap.Math.BSpline ( m_y.xmin(), m_y.xmax() , 1 , 2 ) s3 = Ostap.Math.PositiveSpline2D ( s1 , s2 ) model = Models.Spline2D_pdf ( 'S2D' , m_x , m_y, s3 ) model = Models.ExpoPol2Dsym_pdf ( 'S2DS', m_x , m_y , n = 2 ) with rooSilent() : result, f = model.fitTo ( dataset ) model.draw1 ( dataset ) model.draw2 ( dataset ) result, f = model.fitTo ( dataset , silent = True ) if 0 != result.status() or 3 != result.covQual() : logger.warning('Fit is not perfect MIGRAD=%d QUAL=%d ' % ( result.status() , result.covQual () ) ) print(result) models.add ( model )
def test_model_14(): logger.info( 'Non-factorazeable background component (spline): ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + Spline2D' ) SPLINE = Ostap.Math.Spline2D(spline1, spline1) model = Models.Fit2D(suffix='_14', signal_1=Models.Gauss_pdf('Gx', m_x.getMin(), m_x.getMax(), mass=m_x), signal_2=Models.Gauss_pdf('Gy', m_y.getMin(), m_y.getMax(), mass=m_y), power1=1, power2=1, bkg2D=Models.Spline2D_pdf('P2D14', m_x, m_y, spline=SPLINE)) model.signal1.sigma.fix(m.error()) model.signal2.sigma.fix(m.error()) model.signal1.mean.fix(m.value()) model.signal2.mean.fix(m.value()) model.signal1.mean.fix(m.value()) model.signal2.mean.fix(m.value()) model.bkg1.tau.fix(0) model.bkg2.tau.fix(0) ## fit with fixed mass and sigma with rooSilent(): result, frame = model.fitTo(dataset) model.signal1.sigma.release() model.signal2.sigma.release() model.signal1.mean.release() model.signal2.mean.release() result, frame = model.fitTo(dataset) 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('S1xS2 : %20s' % result(model.ss)[0]) logger.info('S1xB2 : %20s' % result(model.sb)[0]) logger.info('B1xS2 : %20s' % result(model.bs)[0]) logger.info('B1xB2 : %20s' % result(model.bb)[0]) models.add(model)
def test_model_14(): logger = getLogger('test_model_14') logger.info( 'Non-factorazeable background component (spline): ( Gauss + P1 ) (x) ( Gauss + P1 ) + Spline2D' ) SPLINE = Ostap.Math.PositiveSpline2D(spline1, spline1) model = Models.Fit2D(suffix='_14', signal_x=signal1, signal_y=signal2s, bkg_1x=-1, bkg_1y=-1, bkg_2D=Models.Spline2D_pdf('P2D14', m_x, m_y, spline=SPLINE)) ## fit with fixed mass and sigma with rooSilent(): result, frame = model.fitTo(dataset) model.signal_x.sigma.release() model.signal_y.sigma.release() model.signal_x.mean.release() model.signal_y.mean.release() result, frame = model.fitTo(dataset) result, frame = model.fitTo(dataset) with use_canvas('test_model_14'): with wait(1): model.draw1(dataset) with wait(1): model.draw2(dataset) 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('S1xS2 : %20s' % result(model.SS)[0]) logger.info('S1xB2 : %20s' % result(model.SB)[0]) logger.info('B1xS2 : %20s' % result(model.BS)[0]) logger.info('B1xB2 : %20s' % result(model.BB)[0]) models.add(model)
def test_model_14(): logger.info( 'Non-factorazeable background component (spline): ( Gauss + P1 ) (x) ( Gauss + P1 ) + Spline2D' ) SPLINE = Ostap.Math.Spline2D(spline1, spline1) model = Models.Fit2D(suffix='_14', signal_1=signal1, signal_2=signal2s, bkg1=-1, bkg2=-1, bkg2D=Models.Spline2D_pdf('P2D14', m_x, m_y, spline=SPLINE)) ## fit with fixed mass and sigma with rooSilent(): result, frame = model.fitTo(dataset) model.signal1.sigma.release() model.signal2.sigma.release() model.signal1.mean.release() model.signal2.mean.release() result, frame = model.fitTo(dataset) 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('S1xS2 : %20s' % result(model.SS)[0]) logger.info('S1xB2 : %20s' % result(model.SB)[0]) logger.info('B1xS2 : %20s' % result(model.BS)[0]) logger.info('B1xB2 : %20s' % result(model.BB)[0]) models.add(model)