示例#1
0
def test_logistic():

    logger.info("Test  LOGISTIC: Logistic distribution")
    model = Models.Fit1D(signal=Models.Logistic_pdf('LOGI',
                                                    xvar=mass,
                                                    mean=signal_gauss.mean),
                         background=Models.Bkg_pdf('BkgLOGI',
                                                   xvar=mass,
                                                   power=0),
                         S=S,
                         B=B)

    signal = model.signal
    model.S.setVal(5000)
    model.B.setVal(500)

    with rooSilent():
        result, f = model.fitTo(dataset0)
        result, f = model.fitTo(dataset0)
        signal.mean.release()
        signal.sigma.release()
        result, f = 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("Logistic distribution\n%s" % result.table(prefix="# "))

    models.add(model)
示例#2
0
def test_logistic():

    logger.info("Test  LOGISTIC: Logistic distribution")
    model = Models.Fit1D(signal=Models.Logistic_pdf('LOGI',
                                                    mass=mass,
                                                    mean=signal_gauss.mean),
                         background=Models.Bkg_pdf('BkgLOGI',
                                                   mass=mass,
                                                   power=0))

    signal = model.signal
    model.s.setVal(5000)
    model.b.setVal(500)

    with rooSilent():
        result, f = model.fitTo(dataset0)
        result, f = model.fitTo(dataset0)
        signal.mean.release()
        signal.sigma.release()
        result, f = 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('Sigma                is: %-28s ' %
                    result(signal.sigma)[0])

    models.add(model)