当前位置: 首页>>代码示例>>Python>>正文


Python RooArgSet.remove方法代码示例

本文整理汇总了Python中ROOT.RooArgSet.remove方法的典型用法代码示例。如果您正苦于以下问题:Python RooArgSet.remove方法的具体用法?Python RooArgSet.remove怎么用?Python RooArgSet.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ROOT.RooArgSet的用法示例。


在下文中一共展示了RooArgSet.remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RooArgSet

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
#pars.Print('v')
obs = RooArgSet(mass, ws.cat('dataCat'))
obs.setName('observables')
poi = RooArgSet(ws.var('x2'))
ws.var('x2').setRange(0.01, 1.2)
if ws.var('x3'):
    # poi.add(ws.var('x3'))
    ws.var('x3').setRange(0.01, 1.2)
if ws.var('x23'):
    # poi.add(ws.var('x23'))
    ws.var('x23').setRange(0.01, 1.2)
poi.setName('poi')
nuis = RooArgSet(pars)
nuis.setName('nuisance')
nuis.remove(poi)
nuis.remove(nuis.selectByAttrib('Constant', True))
## nuis.remove(ws.var('nbkg_pp'))
## nuis.remove(ws.var('nbkg_hi'))
## nuis.remove(ws.var('mscale_hi'))
## nuis.remove(ws.var('mscale_pp'))
## nuis.remove(ws.var('syst_bg_pp'))
## nuis.remove(ws.var('syst_bg_hi'))
## nuis.remove(ws.var('width_hi'))
## nuis.remove(ws.var('syst_width_hi'))
## nuis.remove(ws.var('npow'))
## nuis.remove(ws.var('syst_npow'))

print 'observables'
obs.Print()
开发者ID:TENorbert,项目名称:usercode-2,代码行数:31,代码来源:nullSimFit.py

示例2: RooArgSet

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
selection = 'hlt2_biased==1'
numDataSets = 40
weightName = ''

import P2VV.RooFitWrappers
from ROOT import TFile, RooArgSet
protoFile = TFile.Open(protoFilePathIn)
nTupleFileIn = TFile.Open(nTupleFilePathIn)
protoData = protoFile.Get('JpsiKK_sigSWeight')
nTupleIn = nTupleFileIn.Get('DecayTree')

from ROOT import RooRealVar, RooCategory
obsSet = RooArgSet( protoData.get() )
if runPeriods :
    rp = obsSet.find('runPeriod')
    if rp : obsSet.remove(rp)
    rp = RooCategory( 'runPeriod', 'runPeriod' )
    for per in runPeriods : rp.defineType( 'p%d' % per, per )
    obsSet.add(rp)

if KKMassBins :
    KKCat = obsSet.find('KKMassCat')
    if KKCat : obsSet.remove(KKCat)
    KKCat = RooCategory( 'KKMassCat', 'KKMassCat' )
    for ind in range( len(KKMassBins) - 1 ) : KKCat.defineType( 'bin%d' % ind, ind )
    obsSet.add(KKCat)

    from array import array
    KKBinsArray = array( 'd', KKMassBins )
    from ROOT import RooBinning
    KKBinning = RooBinning( len(KKMassBins) - 1, KKBinsArray, 'KKMassBinning' )
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:createDataSetFromNTuple.py

示例3: len

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
dsIn = fileIn.Get(dataSetName)
obsSetIn = dsIn.get()
dsIn.Print()

runPeriodCat = obsSetIn.find('runPeriod')
for period in runPeriods :
    assert runPeriodCat.isValidIndex(period)
if len(runPeriods) < runPeriodCat.numTypes() :
    from ROOT import RooCategory
    runPeriodCatOut = RooCategory( runPeriodCat.GetName(), runPeriodCat.GetTitle() )
    for catType in runPeriodCat :
        if catType.getVal() in runPeriods : runPeriodCatOut.defineType( catType.GetName(), catType.getVal() )

    from ROOT import RooArgSet
    obsSetOut = RooArgSet(obsSetIn)
    obsSetOut.remove(runPeriodCat)
    obsSetOut.add(runPeriodCatOut)
else :
    obsSetOut = obsSetIn

cuts = '||'.join( 'runPeriod==%d' % period for period in runPeriods )

from ROOT import RooDataSet, RooFit
print 'creating new data set for run periods %s' % runPeriods
print 'applying cuts "%s"' % cuts
dsOut = RooDataSet( dsIn.GetName(), dsIn.GetTitle(), obsSetOut, Import = dsIn, Cut = cuts, WeightVar = ( weightName, True ) )
dsOut.Print()

print 'writing data set to file "%s"' % filePathOut
fileOut = TFile.Open( filePathOut, 'RECREATE' )
fileOut.Add(dsOut)
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:applyDataSetWeights.py

示例4: enumerate

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
# create data sets with final columns
obsSetMain = obsSetNTuple + [ var for var in weightVars ]
mainDataSet = dataTree.buildDataSet( Observables = obsSetMain, Name = 'JpsiKK', Title = 'JpsiKK', IndexName = 'index'
                                    , OrigDataSet = preSDataSet )
del preSDataSet
del preDataSet
dataTreeFile.Close()
from ROOT import gROOT
gROOT.cd('PyROOT:/')

from ROOT import RooArgSet, RooDataSet
dataSets = { }
for it, var in enumerate(weightVars) :
    argSet = RooArgSet( mainDataSet.get() )
    for remVar in weightVars :
        if remVar != var : argSet.remove( argSet.find( remVar.GetName() ) )
    dataName = dataSetNameOut if it == 0 else 'JpsiKK_%d' % it
    dataSets[var] = RooDataSet( dataName, dataName, argSet, Import = mainDataSet, WeightVar = ( var.GetName(), True ) )
    if not printYields : break

print 'P2VV - INFO: createBs2JpsiKKDataSet: produced data sets:'
mainDataSet.Print()
for var in weightVars :
    dataSets[var].Print()
    if not printYields : break
print

if printYields :
    # print event yields
    print 'P2VV - INFO: createBs2JpsiKKDataSet: event yields:'
    allCats = [  mainDataSet.get().find( obsDict['runPeriod'][0] )
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:createBs2JpsiKKDataSet.py

示例5: RooArgSet

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
dataNames = [ 'JpsiKK', 'JpsiKK_sigSWeight', 'JpsiKK_cbkgSWeight' ]
cut = 'hlt2_biased==1'
removeObs = [ 'wMC', 'mdau1', 'tagCatP2VV' ] #, 'polarity', 'hlt2_prescale', 'nPVCat', 'BpTCat' ]
dataFilePathIn  = 'P2VVDataSets20112012Reco14_I2Mass_6KKMassBins_4TagCats.root'
dataFilePathOut = 'P2VVDataSets20112012Reco14_I2Mass_6KKMassBins_4TagCats_HLT2B.root'

import P2VV.RooFitWrappers
from ROOT import TObject, TFile, RooFit, RooDataSet, RooArgSet
dataFile = TFile.Open(dataFilePathIn)
newDataFile = TFile.Open( dataFilePathOut, 'RECREATE' )
newData = [ ]
print 'read datasets from file "%s"' % dataFile.GetName()
for dataName in dataNames :
    print 'reading dataset "%s"' % dataName
    data = dataFile.Get(dataName)
    data.Print()

    newArgSet = RooArgSet( data.get() )
    for name in removeObs : newArgSet.remove( newArgSet.find(name) )
    newData.append( RooDataSet( dataName, dataName, newArgSet, RooFit.Import(data), RooFit.Cut(cut) ) )
    newData[-1].Print()
    newDataFile.Add( newData[-1] )

print 'write dataset to file "%s"' % newDataFile.GetName()
newDataFile.Write( dataFilePathOut, TObject.kOverwrite )
开发者ID:matthewkenzie,项目名称:P2VV,代码行数:27,代码来源:convertDataSet.py

示例6: RooArgSet

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
dataNames = [ 'JpsiKK_sigSWeight' ] #[ 'JpsiKK', 'JpsiKK_sigSWeight', 'JpsiKK_cbkgSWeight' ]
removeObs = [ 'wMC', 'mdau1', 'tagCatP2VV' ] #, 'polarity', 'hlt2_prescale', 'nPVCat', 'BpTCat' ]
dataFilePathIn  = 'P2VVDataSets20112012Reco14_I2Mass_6KKMassBins_2TagCats_20140309.root'
dataFilePathOut = 'P2VVDataSets2012Reco14_I2Mass_6KKMassBins_2TagCats_20140309.root'

import P2VV.RooFitWrappers
from ROOT import TObject, TFile, RooFit, RooDataSet, RooArgSet, RooCategory
dataFile = TFile.Open(dataFilePathIn)
newDataFile = TFile.Open( dataFilePathOut, 'RECREATE' )
newData = [ ]
print 'read datasets from file "%s"' % dataFile.GetName()
for dataName in dataNames :
    print 'reading dataset "%s"' % dataName
    data = dataFile.Get(dataName)
    data.Print()

    newArgSet = RooArgSet( data.get() )
    for name in removeObs : newArgSet.remove( newArgSet.find(name) )
    if runPeriod :
        newArgSet.remove( newArgSet.find('runPeriod') )
        rp = RooCategory( 'runPeriod', 'runPeriod' )
        rp.defineType( 'p%d' % runPeriod, runPeriod )
        newArgSet.add(rp)

    newData.append( RooDataSet( dataName, dataName, newArgSet, RooFit.Import(data), RooFit.Cut(cut) ) )
    newData[-1].Print()
    newDataFile.Add( newData[-1] )

print 'write dataset to file "%s"' % newDataFile.GetName()
newDataFile.Write( dataFilePathOut, TObject.kOverwrite )
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:32,代码来源:convertDataSet.py

示例7: dict

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
dataSets.pop('preS')
dataTreeFile.Close()
from ROOT import gROOT
gROOT.cd('PyROOT:/')

print 'P2VV - INFO: createB2CCFitNTuple: produced data set:\n' + ' ' * 13,
dataSets['main'][0].Print()
print

# create weighted data sets
from ROOT import RooArgSet
obsSets = dict( [ ( var.GetName(), RooArgSet( dataSets['main'][0].get() ) ) for var in weightVars ] )
for varName, obsSet in obsSets.iteritems() :
    for var in weightVars :
        if var.GetName() == varName : continue
        obsSet.remove( obsSet.find( var.GetName() ) )

from ROOT import RooDataSet
dataSets['sigSWeight']  = ( RooDataSet( 'JpsiKK_sigSWeight',  'JpsiKK_sigSWeight', obsSets['N_sigMass_sw']
                                       , Import = dataSets['main'][0], WeightVar = ( weightVars[0].GetName(), True ) ), [ ] )
dataSets['cbkgSWeight'] = ( RooDataSet( 'JpsiKK_cbkgSWeight', 'JpsiKK_cbkgSWeight', obsSets['N_cbkgMass_sw']
                                       , Import = dataSets['main'][0], WeightVar = ( weightVars[1].GetName(), True ) ), [ ] )
for sample, data in zip( samples, dataSets['main'][1] ) :
    dataSets['sigSWeight'][1].append(  RooDataSet( 'JpsiKK_sigSWeight_'  + sample[0], 'JpsiKK_sigSWeight', obsSets['N_sigMass_sw']
                                                  , Import = data, WeightVar = ( weightVars[0].GetName(), True ) ) )
    dataSets['cbkgSWeight'][1].append( RooDataSet( 'JpsiKK_cbkgSWeight_' + sample[0], 'JpsiKK_cbkgSWeight', obsSets['N_cbkgMass_sw']
                                                  , Import = data, WeightVar = ( weightVars[1].GetName(), True ) ) )

print 'P2VV - INFO: createB2CCFitNTuple: signal data set:\n' + ' ' * 13,
dataSets['sigSWeight'][0].Print()
print
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:createB2CCFitNTuple.py

示例8: sum

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
    else :
        pdfs['sig'][stateName]  = simMassPdf.getPdf(stateName).pdfList().at(0).createIntegral( intSet, normSet )
        pdfs['cbkg'][stateName] = simMassPdf.getPdf(stateName).pdfList().at(1).createIntegral( intSet, normSet )
for comp in comps :
    yields[comp]['total'] = sum( y for y in yields[comp].itervalues() )

print 'P2VV - INFO: signal and background yields:'
for comp in comps :
    print '  %4s: %9.2f' % ( comp, yields[comp]['total'] )

# create datasets
from ROOT import RooFit, RooDataSet, RooRealVar
dataObs = RooArgSet( dataSet.get() )
if genMass :
    var = dataObs.find('mass')
    if var : dataObs.remove(var)
    splitData = dict( [ ( comp, dict( [ ( state.GetName(), RooDataSet('%s_%s' % (dataSet.GetName(), comp), dataSet.GetTitle(), dataObs) )\
                                        for state in splitCat ] ) ) for comp in comps ] )
else :
    sigWeight = RooRealVar( 'sigWeight', 'sigWeight', 1. )
    dataObs.add(sigWeight)
    if weightData :
        splitData = dict( [ ( comp, dict( [ ( 'total', RooDataSet( '%s_%s' % ( dataSet.GetName(), comp ), dataSet.GetTitle()
                                                                  , dataObs, RooFit.WeightVar(sigWeight) ) ) ] ) ) for comp in comps ] )
    else :
        splitData = dict( [ ( comp, dict( [ ( 'total', RooDataSet( '%s_%s' % ( dataSet.GetName(), comp ), dataSet.GetTitle()
                                                                  , dataObs ) ) ] ) ) for comp in comps ] )

# function to get observable value from dataset
def getObsVal( names, obsSet ) :
    vals = [ ]
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:splitDataSetSigBkg.py

示例9: RooArgSet

# 需要导入模块: from ROOT import RooArgSet [as 别名]
# 或者: from ROOT.RooArgSet import remove [as 别名]
from ROOT import TFile, RooArgSet
dataFile = TFile.Open('P2VVDataSets20112012Reco14_I2Mass_6KKMassBins_2TagCats_kinematics.root')
data = dataFile.Get('JpsiKK_sigSWeight')
dataFile.Close()
varSet = RooArgSet( data.get() )
for var in [ 'wMC', 'hlt2_prescale', 'polarity', 'tagCatP2VV', 'nPVCat', 'BpTCat', 'runPeriod' ] :
    varSet.remove( varSet.find(var) )

from ROOT import RooCategory
varSet11 = RooArgSet(varSet)
varSet12 = RooArgSet(varSet)
runPeriod11 = RooCategory( 'runPeriod', 'runPeriod' )
runPeriod12 = RooCategory( 'runPeriod', 'runPeriod' )
runPeriod11.defineType( 'p2011', 2011 )
runPeriod12.defineType( 'p2012', 2012 )
varSet11.add(runPeriod11)
varSet12.add(runPeriod12)
from ROOT import RooFit, RooDataSet
data11 = RooDataSet( data.GetName(), data.GetTitle(), varSet11, RooFit.Import(data), RooFit.Cut('hlt2_biased==1 && runPeriod==2011') )
data12 = RooDataSet( data.GetName(), data.GetTitle(), varSet12, RooFit.Import(data), RooFit.Cut('hlt2_biased==1 && runPeriod==2012') )

from ROOT import TObject
dataFile11 = TFile.Open( 'P2VVDataSets2011Reco14_I2Mass_6KKMassBins_2TagCats_kinematics_HLT2B.root', 'RECREATE' )
dataFile11.Add(data11)
dataFile11.Write( 'P2VVDataSets2011Reco14_I2Mass_6KKMassBins_2TagCats_kinematics_HLT2B.root', TObject.kOverwrite )
dataFile11.Close()

dataFile12 = TFile.Open( 'P2VVDataSets2012Reco14_I2Mass_6KKMassBins_2TagCats_kinematics_HLT2B.root', 'RECREATE' )
dataFile12.Add(data12)
dataFile12.Write( 'P2VVDataSets2012Reco14_I2Mass_6KKMassBins_2TagCats_kinematics_HLT2B.root', TObject.kOverwrite )
dataFile12.Close()
开发者ID:GerhardRaven,项目名称:P2VV,代码行数:33,代码来源:splitDataSets.py


注:本文中的ROOT.RooArgSet.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。