Exemplo n.º 1
0
def test_bifstudentT(): 
    logger.info ('Test bifurcated StudentT_pdf: bifurcated Student-t' ) 
    model = Models.Fit1D (
        signal = Models.BifurcatedStudentT_pdf ( name  = 'BfST' , 
                                                 xvar  = mass   ,
                                                 nL    = 25     ,
                                                 nR    = 25     ,                                                 
                                                 mean  = signal_gauss.mean   , 
                                                 sigma = signal_gauss.sigma  ) ,
        background = Models.Bkg_pdf ('BkgST2', xvar = mass , power = 0 )) 
    
    signal = model.signal 
    model.S.setVal(5000)
    model.B.setVal( 500)
    
    with rooSilent() : 
        result, frame = model. fitTo ( dataset0 )
        signal.nL   .release()
        signal.nR   .release()
        signal.sigma.release()
        result, frame = 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] )
        logger.info ( 'Asymmetry            is: %-28s ' %  result ( signal.asym  )[0] )
        logger.info ( 'n(L)                 is: %-28s ' %  result ( signal.nL    )[0] )
        logger.info ( 'n(R)                 is: %-28s ' %  result ( signal.nR    )[0] )
        
    models.add ( model )
Exemplo n.º 2
0
def test_bifstudentT():
    logger.info('Test bifurcated StudentT_pdf: bifurcated Student-t')
    model = Models.Fit1D(signal=Models.BifurcatedStudentT_pdf(
        name='BfST',
        xvar=mass,
        nL=25,
        nR=25,
        mean=signal_gauss.mean,
        sigma=signal_gauss.sigma),
                         background=Models.Bkg_pdf('BkgST2',
                                                   xvar=mass,
                                                   power=0),
                         S=S,
                         B=B)

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

    with rooSilent():
        result, frame = model.fitTo(dataset0)
        signal.nL.release()
        signal.nR.release()
        signal.sigma.release()
        result, frame = 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("Bifurkated Student's t-function\n%s" %
                result.table(prefix="# "))

    models.add(model)