def test_expopol2D(): logger = getLogger('test_expopol2D') logger.info( 'Test ExpoPol2D_pdf: Exponential times exponential modulated by positive polynomial in X and Y ' ) ## "fictive phase space" model = Models.ExpoPol2D_pdf('EP', m_x, m_y, nx=2, ny=2) with rooSilent(): result, f = model.fitTo(dataset) with use_canvas('test_expopol2D'): with wait(1): model.draw1(dataset) with wait(1): 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_pbxpb_BB () : logger.info ('Non-factorizeable background component: ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + (expo*P1)**2') model = Models.Fit2D ( suffix = '_7' , signal_x = signal1 , signal_y = signal2s , bkg_1x = 1 , bkg_1y = 1 , bkg_2D = Models.ExpoPol2D_pdf ( 'P2D7' , m_x , m_y , nx = 1 , ny = 1 ) ) model.bkg_1x .tau .fix ( 0 ) model.bkg_1y .tau .fix ( 0 ) ## 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_pbxpb_BB(): logger.info( 'Non-factorizeable background component: ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + (expo*P1)**2' ) model = Models.Fit2D(suffix='_7', 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.ExpoPol2D_pdf('P2D7', m_x, m_y, nx=1, ny=1)) 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)