예제 #1
0
def test_johnsonSU():

    logger.info("Test  JohnsonSU-Distribution")
    model = Models.Fit1D(signal=Models.JohnsonSU_pdf('JSU',
                                                     xvar=mass,
                                                     xi=signal_gauss.mean),
                         background=Models.Bkg_pdf('BkgJSU',
                                                   xvar=mass,
                                                   power=0),
                         S=S,
                         B=B)

    signal = model.signal

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

    with rooSilent():
        result, f = model.fitTo(dataset0)
        result, f = model.fitTo(dataset0)
        signal.lambd.release()
        signal.delta.release()
        result, f = 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("Johnson-SU function\n%s" % result.table(prefix="# "))

    models.add(model)
예제 #2
0
def test_johnsonSU () :
    
    logger.info("Test  JohnsonSU-Distribution")
    model = Models.Fit1D (
        signal = Models.JohnsonSU_pdf( 'JSU'                    ,
                                       xvar = mass              , 
                                       xi   = signal_gauss.mean ) ,
        background = Models.Bkg_pdf ('BkgJSU', xvar = mass , power = 0 )) 
    
    signal = model.signal
    
    model.S.setVal(5000)
    model.B.setVal( 500)
    
    with rooSilent() : 
        result,f  = model.fitTo ( dataset0 )  
        result,f  = model.fitTo ( dataset0 )  
        signal.lambd .release()
        signal.delta.release()
        result,f  = 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 ( 'Xi                   is: %-28s ' %  result ( signal.xi     )[0] )
        logger.info ( 'Lambda               is: %-28s ' %  result ( signal.lambd  )[0] )
        logger.info ( 'Delta                is: %-28s ' %  result ( signal.delta  )[0] )
        logger.info ( 'Gamma                is: %-28s ' %  result ( signal.gamma  )[0] )

    models.add ( model )
예제 #3
0
def draw_jsu():
    im = ROOT.RooRealVar('im', 'im', 0., 1.)
    model_jsu = md.JohnsonSU_pdf('J_SU',
                                 im,
                                 xi=0.5,
                                 lambd=.1,
                                 delta=5.,
                                 gamma=0.5)
    model_jsu.draw_options['total_fit_options'] = ROOT.RooFit.LineColor(
        ROOT.kBlue), ROOT.RooFit.LineWidth(5)
    model_jsu.draw()
예제 #4
0
def fit_jsu():
    im = ROOT.RooRealVar('im', 'im', 2.42, 2.52)
    pk = ROOT.RooRealVar('pk', 'peak', 2.47, 2.46, 2.48)
    gam = ROOT.RooRealVar('gamma', 'gamma', 1., 0., 1.5)
    delt = ROOT.RooRealVar('delta', 'delta', 0., 0., 20.0)

    sig_ap = Models.JohnsonSU_pdf('sig_ap', xvar=im, xi = pk, lambd = None, \
                                            delta = delt, gamma=gam)
    bkg0 = Models.Bkg_pdf('bkg0', xvar=im, power=1.)

    model = Models.Fit1D(signal=sig_ap, background=bkg0)
    rfile = ROOT.TFile("../datasets/test_xic_100invpb.root", "READ")
    ds = rfile["da_lc"]
    ds = ds.reduce("im > 2.42 && im < 2.52")
    dh = (ds.reduce(ROOT.RooArgSet(im), "im>0")).binnedClone()

    with timing():
        r, w = model.fitTo(dh)
        r, w = model.fitTo(ds, draw=True, nbins=200, ncpu=4)
    r.draw()