Beispiel #1
0
def test_2gauss():

    logger.info('Test DoubleGauss_pdf: Double Gaussian')

    signal_2gauss = Models.DoubleGauss_pdf(name='Gau2',
                                           mean=signal_gauss.mean,
                                           sigma=signal_gauss.sigma,
                                           xvar=mass,
                                           fraction=0.9,
                                           scale=1.2)

    model_2gauss = Models.Fit1D(signal=signal_2gauss,
                                background=Models.Bkg_pdf('Bkg22G',
                                                          xvar=mass,
                                                          power=0),
                                S=S,
                                B=B)

    model_2gauss.B.setVal(500)
    model_2gauss.S.setVal(6000)
    with rooSilent():
        result, frame = model_2gauss.fitTo(dataset0)
        signal_2gauss.fraction.release()
        result, frame = model_2gauss.fitTo(dataset0)
        model_2gauss.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('double Gaussian function\n%s' % result.table(prefix="# "))

    models.add(model_2gauss)
Beispiel #2
0
def test_2gauss():

    logger.info('Test DoubleGauss_pdf: Double Gaussian')

    signal_2gauss = Models.DoubleGauss_pdf(name='Gau2',
                                           mean=signal_gauss.mean,
                                           sigma=signal_gauss.sigma,
                                           xvar=mass,
                                           fraction=0.9,
                                           scale=1.2)

    model_2gauss = Models.Fit1D(signal=signal_2gauss,
                                background=Models.Bkg_pdf('Bkg22G',
                                                          xvar=mass,
                                                          power=0))

    model_2gauss.B.setVal(500)
    model_2gauss.S.setVal(6000)
    with rooSilent():
        result, frame = model_2gauss.fitTo(dataset0)
        signal_2gauss.fraction.release()
        result, frame = model_2gauss.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   & Sigma      are: %-28s & %-28s ' %
                    (result('mean_Gauss')[0], result('sigma_Gauss')[0]))

    models.add(model_2gauss)