def test_laplace(): logger.info('Test Asymmetric Laplace shape') model = Models.Fit1D( signal=Models.AsymmetricLaplace_pdf(name='AL', xvar=mass, mean=signal_gauss.mean, slope=signal_gauss.sigma), background=None, S=S, B=B) signal = model.signal signal.slope.release() signal.mean.fix() model.S.setVal(5000) model.B.setVal(500) with rooSilent(): result, frame = model.fitTo(dataset0) result, frame = model.fitTo(dataset0) model.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("asymmetric Laplace function\n%s" % result.table(prefix="# ")) models.add(model)
def test_laplace(): logger.info ('Test Asymmetric Laplace shape' ) laplace = Models.AsymmetricLaplace_pdf ( name = 'AL', xvar = x , mean = 5 , slope = 1 ) from ostap.fitting.convolution import Convolution_pdf ## constant resolution laplace_1 = Convolution_pdf ( name = 'L1' , pdf = laplace, resolution = 0.75 ) ## resolution PDF from ostap.fitting.resolution import ResoApo2 rAp = ResoApo2 ( 'A' , x , 0.75 ) ## resolution as PDF laplace_2 = Convolution_pdf ( name = 'L2' , pdf = laplace, resolution = rAp ) laplace.draw( silent = True ) laplace_1.draw( silent = True ) laplace_2.draw() models.add ( laplace ) models.add ( laplace_1 ) models.add ( laplace_2 )
def test_laplace(): logger.info('Test Asymmetric Laplace shape') model = Models.Fit1D( signal=Models.AsymmetricLaplace_pdf(name='AL', xvar=mass, mean=signal_gauss.mean, slope=signal_gauss.sigma), background=None) signal = model.signal signal.slope.release() signal.mean.fix() model.S.setVal(5000) model.B.setVal(500) with rooSilent(): result, frame = model.fitTo(dataset0) result, frame = model.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 is: %-28s ' % result(signal.mean)[0]) logger.info('Slope is: %-28s ' % result(signal.slope)[0]) logger.info('Asymmetry is: %-28s ' % result(signal.asym)[0]) models.add(model)