本文整理汇总了Python中tools.DHadTable.cell_get方法的典型用法代码示例。如果您正苦于以下问题:Python DHadTable.cell_get方法的具体用法?Python DHadTable.cell_get怎么用?Python DHadTable.cell_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.DHadTable
的用法示例。
在下文中一共展示了DHadTable.cell_get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parsefile
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def parsefile(f, lowmass, highmass, indict):
x0 = lowmass
x1 = highmass
xc = (x0 + x1)/2.
tab = DHadTable(f)
N1 = float(tab.cell_get('N1', 'Value'))
N2 = float(tab.cell_get('N2', 'Value'))
if N1 > 1000 or N2 > 1000 :
return
indict['x'].append(xc)
indict['exl'].append(xc-x0)
indict['exh'].append(x1-xc)
N = N1 + N2
err_low_N1 = float(tab.cell_get('N1', 'Low'))
err_low_N2 = float(tab.cell_get('N2', 'Low'))
err_low = (err_low_N1**2 + err_low_N2**2)**.5
err_high_N1 = float(tab.cell_get('N1', 'High'))
err_high_N2 = float(tab.cell_get('N2', 'High'))
err_high = (err_high_N1**2 + err_high_N2**2)**.5
yc = float(N)
yl = float(err_low)
yh = float(err_high)
indict['y'].append(yc)
indict['eyl'].append(yl)
indict['eyh'].append(yh)
示例2: get_argus_paras_single
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def get_argus_paras_single(label, dt_type, tag, mode):
if 'argus' in label:
prefix = 'dir_' + label.replace('argus', 'desideband')
argus_para_base = attr.fitpath
tabfile = tools.set_file('txt', dt_type, mode, tag,
prefix=prefix,
extbase=argus_para_base)
sys.stdout.write('Loading ARGUS parameters from %s ...\n' %tabfile)
tab = DHadTable(tabfile)
xi = float(tab.cell_get('xi', 'Value'))
p = float(tab.cell_get('p', 'Value'))
return xi, p
示例3: get_generated_numbers_single
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def get_generated_numbers_single(i, prefix=''):
if '281ipb' in prefix:
mult_fact = 10
elif '537ipb' in prefix:
mult_fact = 20
elif '818ipb' in prefix or 'v13' in prefix:
mult_fact = 30
else:
raise NameError(prefix)
mode = i[0]
sign = i[1]
tag_number = modes[mode]['tag_num_s']
count = tag_number*mult_fact
if mode == 205:
if sign == 1:
count = 29972 # 30000
if sign == -1:
count = 35969 # 36000
if 'noFSR' in prefix:
mode = i[0]
sign = i[1]
logfile = tools.set_file('log', 's', mode, 's', sign, prefix,
extbase=evtlogbase)
tab = DHadTable(logfile)
FSR = tab.cell_get('FSR', 'Value')
count = count - int(FSR)
return count
示例4: get_generated_numbers_double
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def get_generated_numbers_double(pair, prefix=''):
if '281ipb' in prefix:
mult_fact = 10
elif '537ipb' in prefix:
mult_fact = 20
elif '818ipb' in prefix or 'v13' in prefix:
mult_fact = 30
else:
raise NameError(prefix)
i = pair[0]
j = pair[1]
#genpath = attr.genpath
#print genpath
#sys.exit()
#if attr.analysis == '10.1' and '281ipbv0' in prefix :
# genpath = '/nfs/cor/user/ponyisi/cleog/scripts-summerconf/'
tag_number = 2000
count = tag_number * mult_fact
if 'v13' in prefix:
fname = modes[i]['fname']
fnamebar = modes[j]['fnamebar']
modename = 'Double_%s__%s' %(fname, fnamebar)
if modename == 'Double_Dp_to_KKpi__Dm_to_KKpi':
count = 47966
if modename == 'Double_Dp_to_KKpi__Dm_to_Kpipipi0':
count = 58403
if modename == 'Double_Dp_to_KKpi__Dm_to_Kpipi':
count = 57954
if modename == 'Double_Dp_to_KKpi__Dm_to_Kspipi0':
count = 57969
if modename == 'Double_Dp_to_KKpi__Dm_to_Kspipipi':
count = 24693
if modename == 'Double_Dp_to_KKpi__Dm_to_Kspi':
count = 57953
if modename == 'Double_Dp_to_Kpipi__Dm_to_KKpi':
count = 59952
if modename == 'Double_Dp_to_Kpipipi0__Dm_to_KKpi':
count = 55955
if modename == 'Double_Dp_to_Kspi__Dm_to_KKpi':
count = 57954
if modename == 'Double_Dp_to_Kspipi0__Dm_to_KKpi':
count = 57956
if modename == 'Double_Dp_to_Kspipipi__Dm_to_KKpi':
count = 57954
if 'noFSR' in prefix:
logfile = tools.set_file('log', 's', pair, 'd', prefix=prefix,
extbase=evtlogbase)
tab =DHadTable(logfile)
FSR = tab.cell_get('FSR', 'Value')
count = count - int(FSR)
return count
示例5: init_paras_single
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def init_paras_single(label, dt_type, tag, mode):
if '281ipb' in label:
init_para_prefix = 'dir_281ipbv12'
elif '537ipb' in label:
init_para_prefix = 'dir_537ipbv12'
elif '818ipb' in label or 'v13' in label:
init_para_prefix = 'dir_818ipbv12'
else:
raise ValueError(label)
init_para_base = attr.fitpath
if dt_type == 'generic':
if label in ['281ipbv7', '537ipbv7', '818ipbv7']:
dt_type = 'signal'
tabfile = tools.set_file('txt', dt_type, mode, tag,
prefix=init_para_prefix,
extbase=init_para_base)
sys.stdout.write('Loading init paras from %s ... \n' %tabfile)
tab = DHadTable(tabfile)
N1 = float(tab.cell_get('N1', 'Value'))
N2 = float(tab.cell_get('N2', 'Value'))
Nbkgd1 = float(tab.cell_get('Nbkgd1', 'Value'))
Nbkgd2 = float(tab.cell_get('Nbkgd2', 'Value'))
md = float(tab.cell_get('md', 'Value'))
p = float(tab.cell_get('p', 'Value'))
sigmap1 = float(tab.cell_get('sigmap1', 'Value'))
xi = float(tab.cell_get('xi', 'Value'))
return N1, N2, Nbkgd1, Nbkgd2, md, p, sigmap1, xi
示例6: get_resolution_paras
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def get_resolution_paras(mode, label):
if 'resolution' in label:
Sigma = 0.005
Fa = 0.05
Fb = 0.05
Sa = 2.0
Sb = 2.0
else:
tab_name='para_momentum_resolution'
short_label = label.split('/')[0]
if short_label in ['281ipbv0', '281ipbv12', '537ipbv12',
'818ipbv12', '818ipbv13', 'v13']:
tab_name = '%s/%s' % (short_label, tab_name)
else:
raise NameError(label)
tab_prefix = ''
tab_opt_sigma = 'value'
tab_opt_fa = 'value'
tab_opt_fb = 'value'
tab_opt_sa = 'value'
tab_opt_sb = 'value'
tabfile = tools.set_file(
extbase=attr.tabpath, prefix=tab_prefix,
comname=tab_name, ext='txt')
sys.stdout.write('Loading lineshape parameters from %s... \n' %tabfile)
tab = DHadTable(tabfile)
line_no = attr.mode_line_dict[mode]
Sigma = float(tab.cell_get(line_no, 'sigma (MeV)',tab_opt_sigma))/1000
Fa = float(tab.cell_get(line_no, 'fa', tab_opt_fa))
Fb = float(tab.cell_get(line_no, 'fb', tab_opt_fb))
Sa = float(tab.cell_get(line_no, 'sa', tab_opt_sa))
Sb = float(tab.cell_get(line_no, 'sb', tab_opt_sb))
return Sigma, Fa, Fb, Sa, Sb
示例7: generic_yields_single
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def generic_yields_single(fo, prefix, opt='', label='', verbose=0):
#sys_err = attr.sys_err(label)
dt_type = 'g'
tag = 's'
#sys_err_by_mode = attr.sys_err_by_mode(label)
for mode in modes:
if opt == 'statonly':
syerrmul = 0
else:
syerrmul = sys_err_by_mode[mode]['ST Background modeling']
if mode ==0:
lepton_veto = sys_err_by_mode[mode]['Lepton veto']
syerrmul = math.sqrt(syerrmul**2+ lepton_veto**2)
input_file = tools.set_file('txt', dt_type, mode, tag,
prefix=prefix, extbase=attr.fitpath)
tab = DHadTable(input_file)
N1 = tab.cell_get(1, 'Value')
N1_err = tab.cell_get(1, 'Error')
N1_err_sys = str(float(N1)*syerrmul)
N2 = tab.cell_get(2, 'Value')
N2_err = tab.cell_get(2, 'Error')
N2_err_sys = str(float(N2)*syerrmul)
fo.write('%s\n%s\n%s\n' % (N1, N1_err, N1_err_sys))
fo.write('%s\n%s\n%s\n' % (N2, N2_err, N2_err_sys))
if verbose > 1:
print '%s +/- %s +/- %s' % (N1, N1_err, N1_err_sys)
print '%s +/- %s +/- %s' % (N2, N2_err, N2_err_sys)
if verbose >0:
print 'single tag generic yield finished.'
示例8: get_dcsd_sys
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def get_dcsd_sys(label, i, j):
if label in ['818ipbv7']:
sys_err = attr.sys_err(label)
dcsd_sys = float(sys_err['Double DCSD interference(Neutral DT)'])
dcsd_cor = None
elif label in ['818ipbv8', '818ipbv9', '818ipbv10']:
tabdir = '818ipbv7'
tabfile = os.path.join(attr.cbxtabpath, tabdir,
'dcsd_correction.txt')
tab = DHadTable(tabfile)
modename = '%s %s' %(modes[i]['fname'], modes[j]['fnamebar'])
dcsd_val_err = tab.cell_get(modename, 'Yield correction factor')
dcsd_cor = float(dcsd_val_err.split('+/-')[0])
dcsd_sys = float(dcsd_val_err.split('+/-')[1])
else:
raise NameError(lable)
return dcsd_sys, dcsd_cor
示例9: generic_yields_double
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def generic_yields_double(fo, prefix, opt='', label='', verbose=0):
dt_type = 'g'
tag = 'd'
mode_pair_list = attr.PossibleDoubleTags
n = 0
for mode_pair in mode_pair_list:
i = mode_pair[0]
j = mode_pair[1]
txtfile = tools.set_file('txt', dt_type, mode_pair, tag,
prefix=prefix, extbase=attr.fitpath)
tab = DHadTable(txtfile)
N = tab.cell_get(1, 'Value')
N_err = tab.cell_get(1, 'Error')
if 'DCSD_0' in opt :
dcsd_sys = 0
if opt == 'statonly':
syerrmul = 0
else:
syerrmul = 0
if i in (0, 1, 3):
dcsd_sys, dcsd_cor = get_dcsd_sys(label, i, j)
syerrmul += dcsd_sys**2
if dcsd_cor != None:
sys.stdout.write(
'Correcting mode (%s %s) with %s +/- %s ...\n' %(
i,j,dcsd_cor, dcsd_sys))
N = str(float(N)*dcsd_cor)
syerrmul = syerrmul**.5
N_err_sys = str(float(N)*syerrmul)
fo.write('%s\n%s\n%s\n' % (N, N_err, N_err_sys))
n += 1
if verbose > 1:
print '%s +/- %s +/- %s' % (N, N_err, N_err_sys)
if verbose >0:
print 'Total double tag generic yield lines ... %s' %n
示例10: DHadTable
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
import modes
sys.stdout.write('Loading syserr_818ipbv12.4 ...')
## ----------------------------------------------------------
## Systematic Errors
## ----------------------------------------------------------
tabdir = '818ipbv12.4'
tabfile = os.path.join(attr.cbxtabpath, tabdir,
'mode_dependent_syst.txt')
sys.stdout.write('from %s ...' % tabfile)
tab = DHadTable(tabfile)
tab.data_trim(factor=0.01)
sys_err_by_mode = {
0: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Kpi')),
'Lepton veto' : float(tab.cell_get('Lepton veto', 'Kpi'))
},
1: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Kpipi0'))
},
3: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'K3pi'))
},
200: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Kpipi'))
},
201: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Kpipipi0'))
},
202: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Kspi'))
},
203: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Kspipi0'))
},
204: {'ST Background modeling': float(tab.cell_get('Bkgd shape', 'Ks3pi'))
示例11: yields_and_efficiencies
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
def yields_and_efficiencies(opts, args):
label = args[0]
prefix = 'dir_'+label
yldfile = tools.set_file(extbase=attr.brfpath, prefix=prefix,
comname='yields_and_efficiencies')
f = UserFile()
single_modes = [(pair, sign) for pair in modes for sign in [-1, 1]]
input_label = label
if '.' in label:
input_label = label.split('.')[0]
prefix='dir_'+input_label+'/crossfeeds'
dt_type = 'signal'
for x in single_modes:
if x[1] == 1:
uname = modes[x[0]]['uname']
fname = modes[x[0]]['fname']
else:
uname = modes[x[0]]['unamebar']
fname = modes[x[0]]['fnamebar']
txtname = '%s_Single_%s_fakes_Single_%s.txt' % (dt_type, fname, fname)
txtfile = tools.set_file(extbase=attr.fitpath, prefix=prefix, comname=txtname)
tab = DHadTable(txtfile)
entries = tab.cell_get('entries', 'Value')
entries = tab.cell_trim(entries, rnd='1')
yld = tab.cell_get('yield', 'Value')
yld = tab.cell_trim(yld, rnd='.000001')
ratio = tab.cell_get('ratio', 'Value')
ratio = tab.cell_trim(ratio, rnd='.000001')
f.data.append('%s: %s %s %s\n' % (fname, entries, yld, ratio))
for x, y in [(x, y) for x in single_modes for y in single_modes if x!=y]:
if x[1] == 1:
uname = modes[x[0]]['uname']
fname = modes[x[0]]['fname']
else:
uname = modes[x[0]]['unamebar']
fname = modes[x[0]]['fnamebar']
if y[1] == 1:
unameb = modes[y[0]]['uname']
fnameb = modes[y[0]]['fname']
else:
unameb = modes[y[0]]['unamebar']
fnameb = modes[y[0]]['fnamebar']
txtname = '%s_Single_%s_fakes_Single_%s.txt' % (dt_type, fname, fnameb)
txtfile = tools.set_file(extbase=attr.fitpath, prefix=prefix, comname=txtname)
tab = DHadTable(txtfile)
entries = tab.cell_get('entries', 'Value')
entries = tab.cell_trim(entries, rnd='1')
yld = tab.cell_get('yld', 'Value')
ylderr = tab.cell_get('yld', 'Error')
try:
float(yld)/float(ylderr)
except:
sys.stdout.write('The original ylderr is %s, set to 1.0e10.\n' % ylderr)
ylderr = 1.0e10
yldsigma = str(float(yld)/float(ylderr))
yldsigma = tab.cell_trim(yldsigma, rnd='.000001')
yld = tab.cell_trim(yld, rnd='.000001')
ratio = str(float(yld)/float(entries))
ratio = tab.cell_trim(ratio, rnd='.000001')
ratioerr = str(float(ylderr)/float(entries))
ratioerr = tab.cell_trim(ratioerr, rnd='.000001')
f.data.append('%s fakes %s: %s %s %s %s %s\n' % (
fname, fnameb, yldsigma, entries, yld, ratio, ratioerr))
f.output(yldfile, verbose=1)
return yldfile
示例12: fit_backgrounds_single_mode
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
#.........这里部分代码省略.........
sigma = ROOT.RooRealVar('sigma', 'D width', 0.0001, 0.005, 'GeV')
pars = [arg_cutoff, arg_slope, bkg, sigma, yld]
mbc_d0 = ROOT.RooRealVar('mbc_d0', 'D0 Mbc', 1.8647, 'GeV')
mbc_dp = ROOT.RooRealVar('mbc_dp', 'D+ Mbc', 1.8694, 'GeV')
gauss_d0 = ROOT.RooGaussian('gauss_d0', 'D0 gaussian', mbc, mbc_d0, sigma)
gauss_dp = ROOT.RooGaussian('gauss_dp', 'D+ gaussian', mbc, mbc_dp, sigma)
argus = ROOT.RooArgusBG('argus', 'Argus BG', mbc, arg_cutoff, arg_slope)
sumpdf_d0 = ROOT.RooAddPdf('sumpdf_d0', 'D0 sum pdf',
ROOT.RooArgList(gauss_d0, argus),
ROOT.RooArgList(yld, bkg))
sumpdf_dp = ROOT.RooAddPdf('sumpdf_dp', 'Dp sum pdf',
ROOT.RooArgList(gauss_dp, argus),
ROOT.RooArgList(yld, bkg))
Extended = ROOT.RooFit.Extended(ROOT.kTRUE)
Save = ROOT.RooFit.Save(ROOT.kTRUE)
Hesse = ROOT.RooFit.Hesse(ROOT.kFALSE)
Verbose = ROOT.RooFit.Verbose(ROOT.kFALSE)
if 'D0' in mode:
pdf = sumpdf_d0
else:
pdf = sumpdf_dp
if 'nogaus' in label:
yld.setVal(1)
yld.setConstant(ROOT.kTRUE)
pars.remove(yld)
if 'floatsigma' not in label:
datatype = 'data'
tag = 'single'
if '281ipb' in label:
prefix = 'dir_281ipbv7'
frame_max = bkg_generic_ddbar_281_max[mode]
elif '537ipb' in label:
prefix = 'dir_537ipbv7'
frame_max = bkg_generic_ddbar_537_max[mode]
elif '818ipb' in label:
prefix = 'dir_818ipbv7'
frame_max = bkg_generic_ddbar_818_max[mode]
if 'noxfeed' in label:
frame_max = bkg_generic_ddbar_818_max_noxfeed[mode]
else:
raise NameError(label)
tabfile = set_file('txt', datatype, mode, tag,
prefix=prefix,
extbase=attr.fitpath())
sys.stdout.write('Using width from %s \n' %tabfile)
tab = DHadTable(tabfile)
sigmap1 = float(tab.cell_get('sigmap1', 'Value'))
sigma.setVal(sigmap1)
sigma.setConstant(ROOT.kTRUE)
pars.remove(sigma)
res = pdf.fitTo(dataset, Extended, Save, Verbose)
res.Print('v')
c1 = ROOT.TCanvas('c1', 'canvas1', 600, 600)
c1.SetFixedAspectRatio(0)
xframe = mbc.frame()
xframe.SetMaximum(frame_max)
xframe.SetMarkerSize(0.3)
dataset.plotOn(xframe)
pdf.plotOn(xframe)
nfitParam = len(pars)
chisq_ndof = xframe.chiSquare(nfitParam)
nbin = xframe.GetNbinsX()
ndof = nbin - nfitParam
chisq = chisq_ndof * ndof
chisqbox = ROOT.TPaveText(0.1, 0.1, 0.4, 0.15, 'BRNDC')
chisqbox.SetFillColor(0)
chisqbox.SetBorderSize(1)
chisqbox.AddText('#chi^{2}/ndof = %.3f/%d = %.3f' %
(chisq, ndof, chisq_ndof))
xframe.addObject(chisqbox)
pdf.paramOn(xframe, dataset)
xframe.SetTitle('Generic faking %s' % mode)
xframe.Draw()
c1.Print(epsfile)
tools.save_fit_result(pars, txtfile)
if not test:
tools.eps2png(epsfile)
tools.eps2pdf(epsfile)
示例13: fit_backgrounds_single
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
#.........这里部分代码省略.........
mbc_d0 = ROOT.RooRealVar('mbc_d0', 'D0 Mbc', 1.8647, 'GeV')
mbc_dp = ROOT.RooRealVar('mbc_dp', 'D+ Mbc', 1.8694, 'GeV')
gauss_d0 = ROOT.RooGaussian('gauss_d0', 'D0 gaussian', mbc, mbc_d0, sigma)
gauss_dp = ROOT.RooGaussian('gauss_dp', 'D+ gaussian', mbc, mbc_dp, sigma)
argus = ROOT.RooArgusBG('argus', 'Argus BG', mbc, arg_cutoff, arg_slope)
sumpdf_d0 = ROOT.RooAddPdf('sumpdf_d0', 'D0 sum pdf',
ROOT.RooArgList(gauss_d0, argus),
ROOT.RooArgList(yld, bkg))
sumpdf_dp = ROOT.RooAddPdf('sumpdf_dp', 'Dp sum pdf',
ROOT.RooArgList(gauss_dp, argus),
ROOT.RooArgList(yld, bkg))
Extended = ROOT.RooFit.Extended(ROOT.kTRUE)
Save = ROOT.RooFit.Save(ROOT.kTRUE)
Hesse = ROOT.RooFit.Hesse(ROOT.kFALSE)
Verbose = ROOT.RooFit.Verbose(ROOT.kFALSE)
if '281ipb' in label:
prefix = 'dir_281ipbv7'
elif '537ipb' in label:
prefix = 'dir_537ipbv7'
elif '818ipb' in label:
prefix = 'dir_818ipbv7'
else:
raise NameError(label)
c1 = ROOT.TCanvas('c1', 'canvas1', 800, 1000)
#c1.SetFixedAspectRatio(0)
c1.Divide(3,3)
pad = 1
for mode in modes:
mode_root_name = get_mode_root_name(mode)
if datatype == 'generic/ddbar':
frametitle = 'Generic faking %s' % mode_root_name
elif datatype == 'generic/cont':
frametitle = 'Continuum production faking %s' % mode_root_name
elif datatype == 'generic/tau':
frametitle = '#tau #tau production faking %s' % mode_root_name
elif datatype == 'generic/radret':
frametitle = 'Radiative return faking %s' % mode_root_name
else:
raise NameError(datatype)
c1.cd(pad)
pad += 1
comname = '%s_%s' %(datatype.replace('/', '_'), mode)
bkgpath = os.path.join(attr.bkgpath(), input_label)
bkgfile = set_file(extbase=bkgpath, comname=comname, ext='evt')
if not os.access(bkgfile, os.F_OK):
input_prefix = 'dir_%s' % input_label
bkgfile = set_file(extbase=attr.bkgpath(),
dt_type=datatype.replace('/', '_'),
tag='s', mode=mode, prefix=input_prefix,
comname=comname, ext='evt', forceCombine=1)
dataset = ROOT.RooDataSet.read(bkgfile, dataset_args)
if 'D0' in mode:
pdf = sumpdf_d0
else:
pdf = sumpdf_dp
if 'floatsigma' not in label:
tab_datatype = 'data'
tag = 'single'
tabfile = set_file('txt', tab_datatype, mode, tag,
prefix=prefix,
extbase=attr.fitpath())
sys.stdout.write('Using width from %s \n' %tabfile)
tab = DHadTable(tabfile)
sigmap1 = float(tab.cell_get('sigmap1', 'Value'))
sigma.setVal(sigmap1)
sigma.setConstant(ROOT.kTRUE)
res = pdf.fitTo(dataset, Extended, Save, Verbose)
res.Print('v')
xframe = mbc.frame()
xframe.SetMarkerSize(0.3)
if '818ipb' in label and 'noxfeed' in label:
frame_max = bkg_generic_ddbar_818_max_noxfeed[mode]
xframe.SetMaximum(frame_max)
dataset.plotOn(xframe)
pdf.plotOn(xframe)
pdf.paramOn(xframe, dataset)
xframe.SetTitle(frametitle)
xframe.Draw()
c1.Print(epsfile)
if not test:
tools.eps2png(epsfile)
tools.eps2pdf(epsfile)
示例14: fit_sidebands_single_mode
# 需要导入模块: from tools import DHadTable [as 别名]
# 或者: from tools.DHadTable import cell_get [as 别名]
#.........这里部分代码省略.........
pdf = ROOT.RooSimultaneous('totalPdf', 'totalPdf', dflav)
if 'D0' in mode:
pdf.addPdf(sumpdf_d0, 'dflav')
pdf.addPdf(sumpdf_d0bar, 'dbarflav')
else:
pdf.addPdf(sumpdf_dp, 'dflav')
pdf.addPdf(sumpdf_dm, 'dbarflav')
if 'nogaus' in label:
yld.setVal(1)
yld.setConstant(ROOT.kTRUE)
pars.remove(yld)
if 'floatsigma' not in label:
datatype = 'data'
tag = 'single'
if '818ipb' in label:
prefix = 'dir_818ipbv12'
frame_max = 1500 #bkg_generic_ddbar_818_max[mode]
else:
raise NameError(label)
tabfile = set_file('txt', datatype, modekey, tag,
prefix=prefix,
extbase=attr.fitpath)
sys.stdout.write('Using width from %s \n' %tabfile)
tab = DHadTable(tabfile)
sigmap1 = float(tab.cell_get('sigmap1', 'Value'))
sigma.setVal(sigmap1)
sigma.setConstant(ROOT.kTRUE)
pars.remove(sigma)
#res = pdf.fitTo(dataset, Extended, Save, Verbose)
res = pdf.fitTo(dataset, 'emr') #Migrad only, no MINOS
res.Print('v')
if not has_charge_conjugate:
canvas = ROOT.TCanvas('canvas', 'canvas1', 600, 600)
canvas.SetFixedAspectRatio(0)
xframe = mbc.frame()
xframe.SetMaximum(frame_max)
xframe.SetMarkerSize(0.3)
dataset.plotOn(xframe)
pdf.plotOn(xframe)
nfitParam = len(pars)
chisq_ndof = xframe.chiSquare(nfitParam)
nbin = xframe.GetNbinsX()
ndof = nbin - nfitParam
chisq = chisq_ndof * ndof
chisqbox = ROOT.TPaveText(0.1, 0.1, 0.4, 0.15, 'BRNDC')
chisqbox.SetFillColor(0)
chisqbox.SetBorderSize(1)
chisqbox.AddText('#chi^{2}/ndof = %.2f/%d = %.2f' %
(chisq, ndof, chisq_ndof))
xframe.addObject(chisqbox)