def test_p1xp1_BB () : logger.info ('Simplest non-factorized fit model: ( Gauss + P1 ) (x) ( Gauss + P1 ) + BB' ) model = Models.Fit2D ( suffix = '_3' , signal_x = signal1 , signal_y = signal2s , bkg_1x = -1 , bkg_1y = -1 , bkg_2D = Models.PolyPos2D_pdf ( 'P2D' , m_x , m_y , nx = 2 , ny = 2 ) ) ## 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 ) 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_polypos2D() : logger.info ('Test PolyPos2D_pdf: positive polynomial in 2D' ) model = Models.PolyPos2D_pdf ( 'P2D' , m_x , m_y , nx = 2 , ny = 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) else : logger.info ( 'Bernstein Coefficients:\n%s' % model.pars() ) models.add ( model )
def test_p1xp1_BB(): logger.info( 'Simplest non-factorized fit model: ( Gauss + P1 ) (x) ( Gauss + P1 ) + BB' ) model = Models.Fit2D(suffix='_3', 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.PolyPos2D_pdf('P2D', m_x, m_y, nx=2, ny=2)) 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)