Exemplo n.º 1
0
def test_splinesym2D():

    logger = getLogger('test_splinesym2D')

    logger.info('Test Spline2Dsym_pdf: Symetric 2D-spline')

    ss = Ostap.Math.BSpline(m_x.xmin(), m_x.xmax(), 1, 2)
    ss3 = Ostap.Math.PositiveSpline2DSym(ss)

    model = Models.Spline2Dsym_pdf('SS2D', m_x, m_y, ss3)

    with rooSilent():
        result, f = model.fitTo(dataset)
    with use_canvas('test_splinesym2D'):
        with wait(1):
            model.draw1(dataset)
        with wait(1):
            model.draw2(dataset)

    result, f = model.fitTo(dataset, silent=True)

    if 0 != result.status() or 3 != result.covQual():
        logger.warning('Fit is not perfect MIGRAD=%d QUAL=%d ' %
                       (result.status(), result.covQual()))
        print(result)

    models.add(model)
Exemplo n.º 2
0
def test_model_16():
    logger.info(
        'Symmetric fit model with non-factorazeable symmetric (spline) background component:  ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + Spline2Dsym'
    )
    SPLINES = Ostap.Math.PositiveSpline2DSym(spline1)
    model = Models.Fit2DSym(suffix='_16',
                            signal_x=signal1,
                            signal_y=signal2s,
                            bkg_1x=1,
                            bkg_2D=Models.Spline2Dsym_pdf('P2D16',
                                                          m_x,
                                                          m_y,
                                                          spline=SPLINES))

    ## fit with fixed mass and sigma
    with rooSilent():
        result, frame = model.fitTo(dataset)
        model.signal_x.sigma.release()
        model.signal_y.sigma.release()
        model.signal_x.mean.release()
        model.signal_y.mean.release()
        result, frame = model.fitTo(dataset)

    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('S1xS2 : %20s' % result(model.SS)[0])
        logger.info('S1xB2 : %20s' % (result(model.SB)[0] / 2))
        logger.info('B1xS2 : %20s' % (result(model.BS)[0] / 2))
        logger.info('B1xB2 : %20s' % result(model.BB)[0])

    models.add(model)
Exemplo n.º 3
0
def test_model_15():

    logger.info(
        'Non-factorized symmetric background component (spline):  ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + Spline2Dsym'
    )
    SPLINES = Ostap.Math.Spline2DSym(spline1)
    model = Models.Fit2D(suffix='_15',
                         signal_1=Models.Gauss_pdf('Gx',
                                                   m_x.getMin(),
                                                   m_x.getMax(),
                                                   mass=m_x),
                         signal_2=Models.Gauss_pdf('Gy',
                                                   m_y.getMin(),
                                                   m_y.getMax(),
                                                   mass=m_y),
                         power1=1,
                         power2=1,
                         bkg2D=Models.Spline2Dsym_pdf('P2D15',
                                                      m_x,
                                                      m_y,
                                                      spline=SPLINES))

    model.signal1.sigma.fix(m.error())
    model.signal2.sigma.fix(m.error())
    model.signal1.mean.fix(m.value())
    model.signal2.mean.fix(m.value())
    model.signal1.mean.fix(m.value())
    model.signal2.mean.fix(m.value())
    model.bkg1.tau.fix(0)
    model.bkg2.tau.fix(0)

    ## fit with fixed mass and sigma
    with rooSilent():
        result, frame = model.fitTo(dataset)
        model.signal1.sigma.release()
        model.signal2.sigma.release()
        model.signal1.mean.release()
        model.signal2.mean.release()
        result, frame = model.fitTo(dataset)

    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('S1xS2 : %20s' % result(model.ss)[0])
        logger.info('S1xB2 : %20s' % result(model.sb)[0])
        logger.info('B1xS2 : %20s' % result(model.bs)[0])
        logger.info('B1xB2 : %20s' % result(model.bb)[0])

    models.add(model)
Exemplo n.º 4
0
def test_model_15():

    logger = getLogger('test_model_15')
    logger.info(
        'Non-factorized symmetric background component (spline):  ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + Spline2Dsym'
    )
    SPLINES = Ostap.Math.PositiveSpline2DSym(spline1)
    model = Models.Fit2D(suffix='_15',
                         signal_x=signal1,
                         signal_y=signal2s,
                         bkg_1x=-1,
                         bkg_1y=-1,
                         bkg_2D=Models.Spline2Dsym_pdf('P2D15',
                                                       m_x,
                                                       m_y,
                                                       spline=SPLINES))

    ## fit with fixed mass and sigma
    with rooSilent():
        result, frame = model.fitTo(dataset)
        model.signal_x.sigma.release()
        model.signal_y.sigma.release()
        model.signal_x.mean.release()
        model.signal_y.mean.release()
        result, frame = model.fitTo(dataset)
        result, frame = model.fitTo(dataset)
    with use_canvas('test_model_15'):
        with wait(1):
            model.draw1(dataset)
        with wait(1):
            model.draw2(dataset)

    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('S1xS2 : %20s' % result(model.SS)[0])
        logger.info('S1xB2 : %20s' % result(model.SB)[0])
        logger.info('B1xS2 : %20s' % result(model.BS)[0])
        logger.info('B1xB2 : %20s' % result(model.BB)[0])

    models.add(model)
Exemplo n.º 5
0
def test_model_15():

    logger.info(
        'Non-factorized symmetric background component (spline):  ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + Spline2Dsym'
    )
    SPLINES = Ostap.Math.Spline2DSym(spline1)
    model = Models.Fit2D(suffix='_15',
                         signal_1=signal1,
                         signal_2=signal2s,
                         bkg1=-1,
                         bkg2=-1,
                         bkg2D=Models.Spline2Dsym_pdf('P2D15',
                                                      m_x,
                                                      m_y,
                                                      spline=SPLINES))

    ## fit with fixed mass and sigma
    with rooSilent():
        result, frame = model.fitTo(dataset)
        model.signal1.sigma.release()
        model.signal2.sigma.release()
        model.signal1.mean.release()
        model.signal2.mean.release()
        result, frame = model.fitTo(dataset)

    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('S1xS2 : %20s' % result(model.SS)[0])
        logger.info('S1xB2 : %20s' % result(model.SB)[0])
        logger.info('B1xS2 : %20s' % result(model.BS)[0])
        logger.info('B1xB2 : %20s' % result(model.BB)[0])

    models.add(model)