Example #1
0
def test_gengauss_v2():
    logger.info('Test GenGaussV2_pdf: Generalized Gaussian function V2')
    model_gauss_gv2 = Models.Fit1D(signal=Models.GenGaussV2_pdf(
        name='Gv2', mass=mass, mean=signal_gauss.mean),
                                   background=Models.Bkg_pdf('BkgGGV2',
                                                             mass=mass,
                                                             power=0))

    model_gauss_gv2.signal.kappa.fix(0)

    with rooSilent():
        result, frame = model_gauss_gv2.fitTo(dataset0)
        model_gauss_gv2.signal.mean.release()
        model_gauss_gv2.s.setVal(5000)
        model_gauss_gv2.b.setVal(500)
        result, frame = model_gauss_gv2.fitTo(dataset0)
        ##model_gauss_gv2.signal.kappa.release()
        model_gauss_gv2.s.setVal(5000)
        model_gauss_gv2.b.setVal(500)
        result, frame = model_gauss_gv2.fitTo(dataset0)
        result, frame = model_gauss_gv2.fitTo(dataset0)
        model_gauss_gv2.s.setVal(5000)
        model_gauss_gv2.b.setVal(500)
        result, frame = model_gauss_gv2.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_gv2)
Example #2
0
def test_gengauss_v2():
    logger.info('Test GenGaussV2_pdf: Generalized Gaussian function V2')
    model_gauss_gv2 = Models.Fit1D(signal=Models.GenGaussV2_pdf(
        name='Gv2', xvar=mass, mean=signal_gauss.mean),
                                   background=Models.Bkg_pdf('BkgGGV2',
                                                             xvar=mass,
                                                             power=0),
                                   S=S,
                                   B=B)

    model_gauss_gv2.signal.kappa.fix(0)

    with rooSilent():
        result, frame = model_gauss_gv2.fitTo(dataset0)
        model_gauss_gv2.signal.mean.release()
        model_gauss_gv2.S.setVal(5000)
        model_gauss_gv2.B.setVal(500)
        result, frame = model_gauss_gv2.fitTo(dataset0)
        ##model_gauss_gv2.signal.kappa.release()
        model_gauss_gv2.S.setVal(5000)
        model_gauss_gv2.B.setVal(500)
        result, frame = model_gauss_gv2.fitTo(dataset0)
        result, frame = model_gauss_gv2.fitTo(dataset0)
        model_gauss_gv2.S.setVal(5000)
        model_gauss_gv2.B.setVal(500)
        result, frame = model_gauss_gv2.fitTo(dataset0)

        model_gauss_gv2.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(v2) function\n%s' %
                result.table(prefix="# "))

    models.add(model_gauss_gv2)