Esempio n. 1
0
def test_expopspol2D() :
    
    logger.info ('Test ExpoPSPol2D_pdf: Exponential times phase space factor, modulated by positive polynomial in X and Y ')
    
    ## "fictive phase space"
    psy   = Ostap.Math.PhaseSpaceNL ( 0 , 10 , 2 , 10 )
    model = Models.ExpoPSPol2D_pdf ( 'EPS',
                                     m_x    , m_y  ,
                                     psy    , 
                                     nx = 2 , ny = 2 )
    
    with rooSilent() : 
        result, f = model.fitTo ( dataset ) 
        model.draw1 ( dataset )        
        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)
    else :
        logger.info ( 'Bernstein Coefficients:\n%s' % model.pars() )  
            
       
    models.add ( model )
Esempio n. 2
0
def test_model_13 () :
    
    logger.info ('Non-factorizeable fit component:  ( Gauss + P1 ) (x) ( Gauss + P1 ) + (Expo*PS)**2')
    PS      = Ostap.Math.PhaseSpaceNL( 1.0  , 5.0 , 2 , 5 )
    model   = Models.Fit2D (
        suffix   = '_13' , 
        signal_x = signal1  ,
        signal_y = signal2s ,
        bkg_1x     = -1 , 
        bkg_1y     = -1 ,
        bkg_2D    = Models.ExpoPSPol2D_pdf ( 'P2D13' , m_x , m_y , psy = PS , nx = 1 , ny = 1 ) 
        )

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

    models.add ( model ) 
Esempio n. 3
0
def test_model_13():

    logger.info(
        'Non-factorizeable fit component:  ( Gauss + expo*P1 ) (x) ( Gauss + expo*P1 ) + (Expo*PS)**2'
    )
    PS = Ostap.Math.PhaseSpaceNL(1.0, 5.0, 2, 5)
    model = Models.Fit2D(suffix='_13',
                         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.ExpoPSPol2D_pdf('P2D13',
                                                      m_x,
                                                      m_y,
                                                      psy=PS,
                                                      nx=1,
                                                      ny=1))

    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)