예제 #1
0
def test_gengauss_v1():
    logger.info('Test GenGaussV1_pdf: Generalized Gaussian V1')
    model_gauss_gv1 = Models.Fit1D(signal=Models.GenGaussV1_pdf(
        name='Gv1', xvar=mass, mean=signal_gauss.mean),
                                   background=Models.Bkg_pdf('BkgGGV1',
                                                             xvar=mass,
                                                             power=0),
                                   S=S,
                                   B=B)

    model_gauss_gv1.signal.beta.fix(2)
    model_gauss_gv1.signal.mean.fix(m.value())
    model_gauss_gv1.S.setVal(5000)
    model_gauss_gv1.B.setVal(500)

    with rooSilent():
        result, frame = model_gauss_gv1.fitTo(dataset0)
        model_gauss_gv1.signal.alpha.release()
        result, frame = model_gauss_gv1.fitTo(dataset0)
        model_gauss_gv1.signal.mean.release()
        result, frame = model_gauss_gv1.fitTo(dataset0)
        model_gauss_gv1.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('generalized Gaussian(v1) function\n%s' %
                result.table(prefix="# "))

    models.add(model_gauss_gv1)
예제 #2
0
def test_gengauss_v1():
    logger.info('Test GenGaussV1_pdf: Generalized Gaussian V1')
    model_gauss_gv1 = Models.Fit1D(signal=Models.GenGaussV1_pdf(
        name='Gv1', mass=mass, mean=signal_gauss.mean),
                                   background=Models.Bkg_pdf('BkgGGV1',
                                                             mass=mass,
                                                             power=0))

    model_gauss_gv1.signal.beta.fix(2)
    model_gauss_gv1.signal.mean.fix(m.value())
    model_gauss_gv1.s.setVal(5000)
    model_gauss_gv1.b.setVal(500)

    with rooSilent():
        result, frame = model_gauss_gv1.fitTo(dataset0)
        model_gauss_gv1.signal.alpha.release()
        result, frame = model_gauss_gv1.fitTo(dataset0)
        model_gauss_gv1.signal.mean.release()
        result, frame = model_gauss_gv1.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]))

    models.add(model_gauss_gv1)