Esempio n. 1
0
# =============================================================================
logger.info ( 'Test for histogtram fits')
# =============================================================================
## make simple test 
mass2    = ROOT.RooRealVar ( 'test_mass2' , 'Some test mass' , 0 , 10 )
x        = mass2 

## book very simple data set
varset2  = ROOT.RooArgSet  ( mass2 )

import Ostap.FitModels as     Models 

events = 50000

logger.debug('Make a test data using Gamma-Distribution')
m_gamma0 = Models.GammaDist_pdf( 'GD0' , x )
m_gamma0.k    .setVal( 2 )
m_gamma0.theta.setVal( 2 )

dataset2 = m_gamma0.pdf.generate ( varset2 , events ) 
 

#
## 
h1 = ROOT.TH1D ( hID() , '' ,  10 , 0  , 10 ) ; h1.Sumw2() 
h2 = ROOT.TH1D ( hID() , '' ,  20 , 0  , 10 ) ; h2.Sumw2() 
h3 = ROOT.TH1D ( hID() , '' , 100 , 10 , 10 ) ; h3.Sumw2() 

random.seed(10) 
bins  = [ 0 ] 
for i in range(0,  9 ) : bins.append ( random.uniform ( 0 , 10 ) )
Esempio n. 2
0
else:
    logger = getLogger(__name__)
logger.info('Create 1D dataset for Ostap Tutorial ')
# ============================================================================
RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType():
    logger.info('DEFINE default storage type to be TTree! ')
    RAD.setDefaultStorageType(RAD.Tree)
# ============================================================================

x = ROOT.RooRealVar('x', 'x', 0, 10)
varset = ROOT.RooArgSet(x)

import Ostap.FitModels as Models

gamma = Models.GammaDist_pdf('GPDF', x)
gamma.k.setVal(2)
gamma.theta.setVal(1)

data = gamma.pdf.generate(varset, 100000)

h1 = x.histo(100)
h2 = x.histo(500)
h3 = h1_axis([0, 1, 2, 3, 6, 8, 10])

data.project(h1, 'x')
data.project(h2, 'x')
data.project(h3, 'x')

h4 = h1_axis(h2.equal_edges(5))
h5 = h1_axis(h2.equal_edges(10))