Exemple #1
0
dataset2.project ( h3 , x . GetName () )
dataset2.project ( h4 , x . GetName () )
dataset2.project ( h5 , x . GetName () )

h1s = h1.rescale_bins ( 1 )
h2s = h2.rescale_bins ( 1 )
h3s = h3.rescale_bins ( 1 )
h4s = h4.rescale_bins ( 1 )
h5s = h5.rescale_bins ( 1 )

# =============================================================================
logger.info('Test  Gamma-Distribution')
# =============================================================================
m_gamma = Models.GammaDist_pdf( 'GD1' , x )

with rooSilent() : 
    result,f  = m_gamma.fitTo ( dataset2 )  
    result,f  = m_gamma.fitTo ( dataset2 )  
    
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 :
    print  "\tGamma:       k    = %s " % result( m_gamma.k.GetName()     )[0]
    print  "\tGamma:       theta= %s " % result( m_gamma.theta.GetName() )[0]   


# =============================================================================
logger.info("Test  2-expo-distribution")
# =============================================================================
m_2expo = Models.TwoExpos_pdf( '2exp' , x )
increasing = Models.Monothonic_pdf('PI', mass4, power=3, increasing=True)
decreasing = Models.Monothonic_pdf('PD', mass4, power=3, increasing=False)
inc_convex = Models.Convex_pdf('PIX',
                               mass4,
                               power=3,
                               increasing=True,
                               convex=True)
dec_convex = Models.Convex_pdf('PDX',
                               mass4,
                               power=3,
                               increasing=False,
                               convex=True)
convex = Models.ConvexOnly_pdf('PX', mass4, power=3, convex=True)
concave = Models.ConvexOnly_pdf('PX', mass4, power=3, convex=False)

with timing('Positive   5'), rooSilent():
    r5, f = positive.fitTo(dataset5)
with timing('Increasing 5'), rooSilent():
    i5, f = increasing.fitTo(dataset5)
with timing('Convex     5'), rooSilent():
    x4, f = inc_convex.fitTo(dataset5)
with timing('ConvexOnly 5'), rooSilent():
    c4, f = convex.fitTo(dataset5)

## logger.info ( 'Positive   pars: %s' % positive  .pdf.function().pars() )
## logger.info ( 'Increasing pars: %s' % increasing.pdf.function().pars() )
## logger.info ( 'Convex     pars: %s' % inc_convex.pdf.function().pars() )

for i in (positive, increasing, inc_convex, convex):
    pars = i.pdf.function().bernstein().pars()
    pars = list(pars)