Exemplo n.º 1
0
## 1) import dataset and variable 
from OstapTutor.TestData2 import m_psi, data

logger.info ( 'Data: %s' % data ) 


## 2) create the model: signnal + background

import Ostap.FitModels as Models

## 2a) create the  signal : 


signal = Models.CrystalBall_pdf ( 'CB'          ,
                                  mass  = m_psi , 
                                  sigma = 0.013 ,
                                  alpha = 1.5   ,
                                  n     = 1     , 
                                  mean  = 3.096 )   

# signal = Models.CB2_pdf ( 'CB'          ,
#                          mass   = m_psi , 
#                          sigma  = 0.013 ,
#                          alphaL = 1.5   ,
#                          alphaR = 1.5   ,
#                          nL     = 1     , 
#                          nR     = 1     , 
#                          mean   = 3.096 )   

# signal = Models.Bukin_pdf ( 'Bk'          ,
#                            mass   = m_psi , 
#                            sigma  = 0.013 ,
Exemplo n.º 2
0
                   (result.status(), result.covQual()))
    print result
else:
    print 'Signal & Background are: ', result('S')[0], result('B')[0]
    print 'Mean   & Sigma      are: ', result('mean_Gauss')[0], result(
        'sigma_Gauss')[0]

models.append(model_gauss)

# =============================================================================
## CrystalBall PDF
# =============================================================================
logger.info('Test CrystalBall_pdf')
model_cb = Models.Fit1D(signal=Models.CrystalBall_pdf(name='CB',
                                                      mass=mass,
                                                      alpha=3,
                                                      sigma=signal_gauss.sigma,
                                                      mean=signal_gauss.mean),
                        background=model_gauss.background)

with rooSilent():
    result, frame = model_cb.fitTo(dataset0)
    model_cb.signal.alpha.release()
    result, frame = model_cb.fitTo(dataset0)
    result, frame = model_cb.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: