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


Python BetterConfigParser.has_option方法代码示例

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


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

示例1: BetterConfigParser

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
    print "filelist[0]:",filelist[0];
else:
    print ''

vhbbPlotDef=opts.config[0].split('/')[0]+'/vhbbPlotDef.ini'
opts.config.append(vhbbPlotDef)#adds it to the config list

config = BetterConfigParser()
config.read(opts.config)

#path = opts.path
region = opts.region

# additional blinding cut:
addBlindingCut = None
if config.has_option('Plot_general','addBlindingCut'):#contained in plots, cut on the event number
    addBlindingCut = config.get('Plot_general','addBlindingCut')
    print 'adding add. blinding cut'

print "Compile external macros"
print "=======================\n"

#get locations:
Wdir=config.get('Directories','Wdir')# working direcoty containing the ouput
samplesinfo=config.get('Directories','samplesinfo')# samples_nosplit.cfg

path = config.get('Directories','plottingSamples')# from which samples to plot

section='Plot:%s'%region

info = ParseInfo(samplesinfo,path) #creates a list of Samples by reading the info in samples_nosplit.cfg and the conentent of the path.
开发者ID:GLP90,项目名称:Xbb,代码行数:33,代码来源:tree_stack.py

示例2: int

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
#print config.get('dc:%s'%var,'range')
nBins       = int(config.get('dc:%s'%var,'range').split(',')[0])
xMin        = float(config.get('dc:%s'%var,'range').split(',')[1])
xMax        = float(config.get('dc:%s'%var,'range').split(',')[2])
ROOToutname = config.get('dc:%s'%var,'dcName')
RCut        = config.get('dc:%s'%var,'cut')
signals     = config.get('dc:%s'%var,'signal').split(' ')
datas       = config.get('dc:%s'%var,'data')
Datacardbin = config.get('dc:%s'%var,'dcBin')
anType      = config.get('dc:%s'%var,'type')
setup       = eval(config.get('LimitGeneral','setup'))
doSYS       = config.get('dc:%s'%var,'doSYS')
doBin       = config.get('dc:%s'%var,'doBin')

#Systematics:
if config.has_option('LimitGeneral','addSample_sys'):
    addSample_sys = eval(config.get('LimitGeneral','addSample_sys'))
    additionals = [addSample_sys[key] for key in addSample_sys]
else:
    addSample_sys = None
    additionals = []

#find out if BDT or MJJ:
bdt = False
mjj = False
cr = False
if str(anType) == 'BDT':
    bdt = True
    systematics = eval(config.get('LimitGeneral','sys_BDT'))
elif str(anType) == 'Mjj':
    mjj = True
开发者ID:dcurry09,项目名称:Heppy,代码行数:33,代码来源:workspace_datacard.py

示例3: BTagShape

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
        btagDown = BTagShape("../data/csvdiscr.root")
        btagDown.computeFunctions(-1.,0.)
        btagFUp = BTagShape("../data/csvdiscr.root")
        btagFUp.computeFunctions(0.,+1.)
        btagFDown = BTagShape("../data/csvdiscr.root")
        btagFDown.computeFunctions(0.,-1.)
    else:
        ROOT.gSystem.Load(btagLibrary)
        from ROOT import BTagShapeInterface
        btagNom = BTagShapeInterface("../data/csvdiscr.root",0,0)
        btagUp = BTagShapeInterface("../data/csvdiscr.root",+1,0)
        btagDown = BTagShapeInterface("../data/csvdiscr.root",-1,0)
        btagFUp = BTagShapeInterface("../data/csvdiscr.root",0,+1.)
        btagFDown = BTagShapeInterface("../data/csvdiscr.root",0,-1.)
    
    lhe_weight_map = False if not config.has_option('LHEWeights', 'weights_per_bin') else eval(config.get('LHEWeights', 'weights_per_bin'))
    
    
    print '\t - %s' %(job.name)
    print('opening '+pathIN+'/'+job.prefix+job.identifier+'.root')
    input = ROOT.TFile.Open(pathIN+'/'+job.prefix+job.identifier+'.root','read')
    output = ROOT.TFile.Open(tmpDir+'/'+job.prefix+job.identifier+'.root','recreate')

    input.cd()
    if lhe_weight_map and 'DY' in job.name:
        inclusiveJob = info.get_sample('DY')
        print inclusiveJob.name
        inclusive = ROOT.TFile.Open(pathIN+inclusiveJob.get_path,'read')
        inclusive.cd()
        obj = ROOT.TObject
        for key in ROOT.gDirectory.GetListOfKeys():
开发者ID:perrozzi,项目名称:VHbb,代码行数:33,代码来源:write_regression_systematics.py

示例4: BTagShape

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
        btagFUp.computeFunctions(0.0, +1.0)
        btagFDown = BTagShape("../data/csvdiscr.root")
        btagFDown.computeFunctions(0.0, -1.0)
    else:
        ROOT.gSystem.Load(btagLibrary)
        from ROOT import BTagShapeInterface

        btagNom = BTagShapeInterface("../data/csvdiscr.root", 0, 0)
        btagUp = BTagShapeInterface("../data/csvdiscr.root", +1, 0)
        btagDown = BTagShapeInterface("../data/csvdiscr.root", -1, 0)
        btagFUp = BTagShapeInterface("../data/csvdiscr.root", 0, +1.0)
        btagFDown = BTagShapeInterface("../data/csvdiscr.root", 0, -1.0)

    lhe_weight_map = (
        False
        if not config.has_option("LHEWeights", "weights_per_bin")
        else eval(config.get("LHEWeights", "weights_per_bin"))
    )

    print "\t - %s" % (job.name)
    print ("opening " + pathIN + "/" + job.prefix + job.identifier + ".root")
    input = ROOT.TFile.Open(pathIN + "/" + job.prefix + job.identifier + ".root", "read")
    output = ROOT.TFile.Open(tmpDir + "/" + job.prefix + job.identifier + ".root", "recreate")

    input.cd()
    if lhe_weight_map and "DY" in job.name:
        inclusiveJob = info.get_sample("DY")
        print inclusiveJob.name
        inclusive = ROOT.TFile.Open(pathIN + inclusiveJob.get_path, "read")
        inclusive.cd()
        obj = ROOT.TObject
开发者ID:dcurry09,项目名称:Xbb,代码行数:33,代码来源:write_regression_systematics.py

示例5: BetterConfigParser

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
    parser.add_option("-r","--regions", dest="regions", default='',
                          help="cut region identifiers, separated by comma")
    parser.add_option("-t","--type", dest="fitType", default='',
                          help="shapes_prefit, shapes_fit_b, shapes_fit_s")

    (opts, args) = parser.parse_args(argv)
    if opts.config == "":
            opts.config = ["config"]

    # Import after configure to get help message
    from myutils import BetterConfigParser, mvainfo, ParseInfo
    config = BetterConfigParser()
    config.read(opts.config)

    if len(opts.fitType) < 1:
        if config.has_option('Fit','FitType'):
            opts.fitType = config.get('Fit','FitType')
        else:
            opts.fitType = "shapes_prefit"

    # run plotter
    if len(opts.regions) < 1:
        regions = eval(config.get('Fit', 'regions')).keys()
    else:
        regions = opts.regions.split(',')
    for region in regions:
        plotter = PostfitPlotter(config=config, region=region, directory=opts.fitType)
        plotter.prepare()
        plotter.run()

开发者ID:GLP90,项目名称:Xbb,代码行数:31,代码来源:postfit_plot.py

示例6: BetterConfigParser

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
if opts.config =="":
        opts.config = "config"
        
from myutils import BetterConfigParser, printc, ParseInfo, mvainfo, StackMaker, HistoMaker

print opts.config
opts.config.append('heppy13TeVconfig/vhbbPlotDef.ini')
config = BetterConfigParser()
config.read(opts.config)

#path = opts.path
region = opts.region

# additional blinding cut:
addBlindingCut = None
if config.has_option('Plot_general','addBlindingCut'):
    addBlindingCut = config.get('Plot_general','addBlindingCut')
    print 'adding add. blinding cut'

#get locations:
Wdir=config.get('Directories','Wdir')
samplesinfo=config.get('Directories','samplesinfo')

path = config.get('Directories','plottingSamples')

section='Plot:%s'%region

info = ParseInfo(samplesinfo,path)

#----------Histo from trees------------
def doPlot():
开发者ID:leonardogiannini,项目名称:heppynmore,代码行数:33,代码来源:tree_stack.py

示例7: BetterConfigParser

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]

# opts.config.append('13TeVconfig/vhbbPlotDef.ini')
# print 'Plot Config List: ',opts.config

config = BetterConfigParser()
config.read(opts.config)

# path = opts.path
region = opts.region

batch = opts.batch
print batch
# additional blinding cut:
addBlindingCut = None
if config.has_option("Plot_general", "addBlindingCut"):
    addBlindingCut = config.get("Plot_general", "addBlindingCut")
    print "adding add. blinding cut"

# get locations:
Wdir = config.get("Directories", "Wdir")

# the samples_nosplit.cfg file in 13TeV
samplesinfo = config.get("Directories", "samplesinfo")

# which directory to take the samples from(sys_out currently)
path = config.get("Directories", "plottingSamples")


# Add external macros
# For batch jobs lock the compliation
开发者ID:dcurry09,项目名称:Heppy,代码行数:32,代码来源:tree_stack.py

示例8: str

# 需要导入模块: from myutils import BetterConfigParser [as 别名]
# 或者: from myutils.BetterConfigParser import has_option [as 别名]
print "Using", ("dc:%s" % var, "var")
print name
print title
print nBins
print xMin
print xMax
print ROOToutname
print RCut
print signals
print datas
print Datacardbin
print anType
print setup

# Systematics:
if config.has_option("LimitGeneral", "addSample_sys"):
    addSample_sys = eval(config.get("LimitGeneral", "addSample_sys"))
    additionals = [addSample_sys[key] for key in addSample_sys]
else:
    addSample_sys = None
    additionals = []
# find out if BDT or MJJ:
bdt = False
mjj = False
cr = False
if str(anType) == "BDT":
    bdt = True
    systematics = eval(config.get("LimitGeneral", "sys_BDT"))
elif str(anType) == "Mjj":
    mjj = True
    systematics = eval(config.get("LimitGeneral", "sys_Mjj"))
开发者ID:silviodonato,项目名称:Xbb,代码行数:33,代码来源:workspace_datacard.py


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