示例#1
0
    splitConstr['sf_sigma_slope']['2012']  =  ( 0.271, 0. )
    splitConstr['sf_sigma_quad']['2012']   =  ( 3.136, 0. )

for par, vals in splitConstr.iteritems() :
    from P2VV.Parameterizations.FullPDFs import SimulCatSettings
    constr = SimulCatSettings( '%sConstr' % par )
    constr.addSettings( [ 'runPeriod' ], [ [ 'p2011' ] ], vals['2011'] )
    constr.addSettings( [ 'runPeriod' ], [ [ 'p2012' ] ], vals['2012'] )
    pdfConfig['externalConstr'][par] = constr

    
if fixUpAcc :
    for it, sett in enumerate( pdfConfig['externalConstr']['betaTimeEff'] ) :
        per = sett[0]['runPeriod']
        assert per in [ [ 'p2011' ], [ 'p2012' ] ]
        betaVal = pdfConfig.parameters().pop( 'betaTimeEff_%s' % per[0] )[0]
        pdfConfig['externalConstr']['betaTimeEff'][it] = ( sett[0], ( betaVal, 0. ) )

if fixTagging :
    pdfConfig['externalConstr']['wTagP0OS'] = ( pdfConfig.parameters().pop('wTagP0OS')[0], 0. )
    pdfConfig['externalConstr']['wTagP1OS'] = ( pdfConfig.parameters().pop('wTagP1OS')[0], 0. )
    pdfConfig['externalConstr']['wTagP0SS'] = ( pdfConfig.parameters().pop('wTagP0SS')[0], 0. )
    pdfConfig['externalConstr']['wTagP1SS'] = ( pdfConfig.parameters().pop('wTagP1SS')[0], 0. )
if fixTagAsym :
    pdfConfig['externalConstr']['wTagDelP0OS'] = ( pdfConfig.parameters().pop('wTagDelP0OS')[0], 0. )
    pdfConfig['externalConstr']['wTagDelP1OS'] = ( pdfConfig.parameters().pop('wTagDelP1OS')[0], 0. )
    pdfConfig['externalConstr']['wTagDelP0SS'] = ( pdfConfig.parameters().pop('wTagDelP0SS')[0], 0. )
    pdfConfig['externalConstr']['wTagDelP1SS'] = ( pdfConfig.parameters().pop('wTagDelP1SS')[0], 0. )

if constrDelM :
    pdfConfig['externalConstr']['dM'] = ( 17.768, 0.024 )
示例#2
0
ws['lambdaCP'].setConstant(False)


###########################################################################################################################################
## fit data ##
##############

# fit
fitResult = pdf.fitTo( fitData, SumW2Error = False, Save = True, NumCPU = options.NumCpu, Optimize = 2, Timer = True, 
                       Minimizer = 'Minuit2', Strategy = 1, Offset = True 
                       )

# save
from P2VV.Imports import parNames, parValues
fitResult.PrintSpecial( text = True, ParNames = parNames, ParValues = parValues )
fitResult.SetName( parFileOut.replace('.par','') )
from ROOT import TFile
resultFile = TFile.Open( parFileOut.replace('.par','.root'), 'recreate')
resultFile.cd()
fitResult.Write()
resultFile.Close()

if parFileOut:
    pdfConfig.getParametersFromPdf( pdf,  fitData )
    pdfConfig.writeParametersToFile( filePath = parFileOut, Floating = True )
    if 'True' in options.writeUnBlPar:
        for parName in ['phiCP', 'dGamma']:
            par = pdfConfig.parameters().pop('__%s__'%parName)
            pdfConfig.parameters()[parName] = (ws[parName].getVal(), ) + par[1:]
        pdfConfig.writeParametersToFile( filePath = parFileOut.replace('.par','_unbl.par'), Floating = True )