本文整理汇总了Python中ROOT.RooRealVar.getMin方法的典型用法代码示例。如果您正苦于以下问题:Python RooRealVar.getMin方法的具体用法?Python RooRealVar.getMin怎么用?Python RooRealVar.getMin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooRealVar
的用法示例。
在下文中一共展示了RooRealVar.getMin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RooRealVar
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
dGamma = RooRealVar('dGamma', 'dGamma', -0.106, -3., 3.)
dM = RooRealVar('dM', 'dM', 17.768, 0.1, 20.)
C = RooRealVar('C', 'C', 1., 0., 2.)
one = const(1.)
zero = const(0.)
tau = Inverse('tau', 'tau', gamma)
# tauk = Inverse('tauk', 'tauk', kgamma)
## acceptance
spline_knots = [ 0.5, 1.0, 1.5, 2.0, 3.0, 12.0 ]
spline_coeffs = [ 5.03902e-01, 7.32741e-01, 9.98736e-01,
1.16514e+00, 1.25167e+00, 1.28624e+00 ]
assert(len(spline_knots) == len(spline_coeffs))
# knot binning
knotbinning = RooBinning(time.getMin(), time.getMax(),
'{}_knotbinning'.format(mode))
for v in spline_knots:
knotbinning.addBoundary(v)
knotbinning.removeBoundary(time.getMin())
knotbinning.removeBoundary(time.getMax())
oldbinning, lo, hi = time.getBinning(), time.getMin(), time.getMax()
time.setBinning(knotbinning, '{}_knotbinning'.format(mode))
time.setBinning(oldbinning)
time.setRange(lo, hi)
del knotbinning, oldbinning, lo, hi
# knot coefficients
coefflist = RooArgList()
for i, v in enumerate(spline_coeffs):
coefflist.add(const(v))
示例2: get_part_vars
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
jpsi = get_part_vars(aa, 'psi', jpsi_idx)
if k.pt < 250: continue
counters[0] = counters[0] + 1
if mu1.pt < 550 or mu2.pt < 550: continue
counters[1] = counters[1] + 1
if mu1.ipchi2 < 16 or mu2.ipchi2 < 16 or k.ipchi2 < 16: continue
counters[2] = counters[2] + 1
if psi_dls[jpsi_idx] < 5: continue
counters[3] = counters[3] + 1
if abs(jpsimass - jpsi.m) > 50: continue
counters[4] = counters[4] + 1
if k.pnn_k < 0.9: continue
counters[5] = counters[5] + 1
hist.Fill(bp0_m[j])
if ( bp0_m[j] > m.getMin() and bp0_m[j] < m.getMax() ):
m.setVal(bp0_m[j])
ds.add(argset)
aa.SetBranchStatus("bp1*",1)
aa.SetBranchStatus("piz*",1)
aa.SetBranchStatus("bp0*",0)
for i in range(aa.GetEntries()):
s = aa.GetEntry(i)
if s == -1:
print "Error reading event ",i,", skipping"
continue
if i%10000 == 0:
print i," entry of ",aa.GetEntries()
print counters2
示例3: range
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
ez1_m = aa.ez1_m
ez1_idx_trk0 = aa.ez1_idx_trk0
ez1_idx_trk1 = aa.ez1_idx_trk1
ez1_idx_gam = aa.ez1_idx_gam
for j in range(len(ez1_m)):
mu1_idx = int(ez1_idx_trk0[j])
mu2_idx = int(ez1_idx_trk1[j])
gam_idx = int(ez1_idx_gam[j])
mu1 = get_trk_vars(aa, mu1_idx)
mu2 = get_trk_vars(aa, mu2_idx)
gam = get_part_vars(aa, 'gam', gam_idx)
#print ez1_m[j]
hist2.Fill(ez1_m[j])
if ( ez1_m[j] > m2.getMin() and ez1_m[j] < m2.getMax() ):
m2.setVal(ez1_m[j])
gpt.setVal(gam.pt)
geta.setVal(gam.eta)
gp.setVal(gam.p)
gamma_pt.Fill(gam.pt)
gamma_eta.Fill(gam.eta)
ds2.add(argset2)
oFile = TFile("/user2/sfarry/workspaces/energyflow/tuples/eta_data2016_turbo_embedded_mumugammaonly.root", "RECREATE")
ds.Write()
ds2.Write()
hist.Write()
hist2.Write()
gamma_pt.Write()
示例4: RooWorkspace
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
pedCut, 'goff')
pedhist = gDirectory.Get('pedhist')
ws = RooWorkspace('ws')
x = RooRealVar('x', 'energy', minPed, maxPed, 'fC')
x.Print()
ds = fillDataSet(dataTree.GetV1(), x, dataTree.GetSelectedRows())
getattr(ws, 'import')(ds)
findOnePe(pedhist, ws, Npe=opts.npe)
pedPlusOne = ws.pdf('pedPlusOne')
peMean = ws.var('peMean')
pedMean = ws.var('pedMean')
## pedhist.Draw()
## onePeF.Draw('same')
xf = x.frame(x.getMin(), x.getMax(), int(x.getMax()-x.getMin()))
ds.plotOn(xf)
pedPlusOne.plotOn(xf) #,
#RooFit.Range('pedPlus_fit'))
pedPlusOne.plotOn(xf, #RooFit.Range('pedPlus_fit'),
RooFit.Components("bg*"),
RooFit.LineColor(kRed),
RooFit.LineStyle(kDashed))
xf.Draw()
gPad.Update()
print '\nsingle fC/pe for HO ({0}, {1}):'.format(opts.eta, opts.phi),\
'{0:0.3f} +/- {1:0.3f}'.format(peMean.getVal(), peMean.getError())
示例5: __init__
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
class Fit2L:
def __init__(self, file_names, br_name="mass"):
self.file_names = file_names
self.br_name = br_name
min_x = 8
max_x = 12
self.obs = RooRealVar("obs", "m4l", min_x, max_x)
self.nbins = int((max_x - min_x) * 20)
self.obs.setBin(self.nbins)
# self.ws = ROOT.RooWorkspace("combined", "combined")
self.obs.setRange("fit", 8.5, 11.5)
self.dummy_hists = []
self.chi2_cut = 10000
def build_model(self):
# mean = RooRealVar("mean", "mass of 1S", 9.46, 9.2, 9.7)
# sigma = RooRealVar("sigma", "sigma of gaussian", 0.14, 0.09, 0.3)
mean = RooRealVar("mean", "mass of 1S", 9.48352)
sigma = RooRealVar("sigma", "sigma of gaussian", 1.38574e-01)
gaussian = ROOT.RooGaussian("gauss", "gauss", self.obs, mean, sigma)
## try Crystal Ball
# alpha = RooRealVar("alpha", "alpha of CB", 5.9, 0, 100)
# cb_n = RooRealVar("cb_n", "n of CB", 55.4, 0, 100)
# gaussian = ROOT.RooCBShape("gauss", "gauss", self.obs, mean, sigma, alpha, cb_n)
n_sig = RooRealVar("n_sig", "number of signal", 5000, 0, 100000)
esig = ROOT.RooExtendPdf("esig", "esig", gaussian, n_sig)
m2_shift = RooRealVar("m2_shift", "m2 shift", 0.56296)
m2 = ROOT.RooFormulaVar("m2", "mass of 2S", "@0+ @1", RooArgList(mean, m2_shift))
s2 = ROOT.RooFormulaVar("s2", "sigma*(unit+m2_shift)/mean", "@0*([email protected]/9.46)", RooArgList(sigma, m2_shift))
g2 = ROOT.RooGaussian("g2", "gauss", self.obs, m2, s2)
n2 = RooRealVar("n2", "number of 2S", 800, 100, 100000)
# n2 = ROOT.RooFormulaVar("n2", "number of 2S" ,"n_sig*0.26", RooArgList(n_sig))
esig2 = ROOT.RooExtendPdf("esig2", "esig2", g2, n2)
m3_shift = RooRealVar("m3_shift", "m3 shift", 0.8949)
m3 = ROOT.RooFormulaVar("m3", "mass of 3S", "mean + m3_shift", RooArgList(mean, m3_shift))
s3 = ROOT.RooFormulaVar("s3", "sigma*(unit+m2_shift)/mean", "@0*([email protected]/9.46)", RooArgList(sigma, m3_shift))
g3 = ROOT.RooGaussian("g3", "gauss", self.obs, m3, s3)
# n3 = RooRealVar("n3", "number of 3S" , 50, 0, 1000)
n3 = ROOT.RooFormulaVar("n3", "number of 3S", "n2*0.45", RooArgList(n2))
esig3 = ROOT.RooExtendPdf("esig3", "esig3", g3, n3)
n_bkg = RooRealVar("n_bkg", "number of bkg", 1000, 0, 1e6)
# p0 = RooRealVar("p0", "p0", 5.8677e-02, -1E6, 1E6)
# p1 = RooRealVar("p1", "p1", -5.086E-02, -1E6, 1E6)
# p2 = RooRealVar("p2", "p2", -1.96e-02, -1E6, 1E6)
# p3 = RooRealVar("p3", "p3", -1.08E-02, -1E6, 1E6)
# p4 = RooRealVar("p4", "p4", -1.55E-02, -1E6, 1E6)
# best fitted value using 2015+2016
p0 = RooRealVar("p0", "p0", 5.86772e-02)
p1 = RooRealVar("p1", "p1", -5.08695e-02)
p2 = RooRealVar("p2", "p2", -1.95595e-02)
p3 = RooRealVar("p3", "p3", -1.08105e-02)
p4 = RooRealVar("p4", "p4", -1.54855e-02)
bkg = ROOT.RooChebychev("bkg", "bkg", self.obs, RooArgList(p0, p1, p2, p3, p4))
# bkg = ROOT.RooPolynomial("bkg", "bkg", self.obs, RooArgList(p0, p1, p2))
ebkg = ROOT.RooExtendPdf("ebkg", "ebkg", bkg, n_bkg)
model = ROOT.RooAddPdf("model", "model", RooArgList(esig, esig2, esig3, ebkg))
getattr(self.ws, "import")(model)
def get_data(self):
"""
create RooDataSet from file_names
"""
tree = ROOT.TChain("upsilon", "upsilon")
if type(self.file_names) is list:
for file_name in self.file_names:
tree.Add(file_name)
else:
tree.Add(self.file_names)
nentries = tree.GetEntries()
print "total: ", nentries
obs_set = RooArgSet(self.obs)
data = ROOT.RooDataSet("data", "data", obs_set)
for ientry in xrange(nentries):
tree.GetEntry(ientry)
for i, m4l in enumerate(getattr(tree, self.br_name)):
# m4l = m4l/1000
if m4l > self.obs.getMax() or m4l < self.obs.getMin():
continue
if tree.chi2[i] > self.chi2_cut:
continue
self.obs.setVal(m4l)
data.add(obs_set)
getattr(self.ws, "import")(data)
def fit(self):
if not hasattr(self, "ws"):
self.ws = ROOT.RooWorkspace("combined", "combined")
self.build_model()
self.get_data()
data = self.ws.obj("data")
#.........这里部分代码省略.........
示例6: __init__
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
#.........这里部分代码省略.........
#p3 = RooRealVar("p3", "p3", -6.53710e-03)
#p4 = RooRealVar("p4", "p4", 9.76852e-03)
bkg = ROOT.RooChebychev("bkg", "bkg", self.obs, RooArgList(p0, p1, p2, p3, p4))
#bkg = ROOT.RooChebychev("bkg", "bkg", self.obs, RooArgList(p0, p1, p2))
#bkg = ROOT.RooPolynomial("bkg", "bkg", self.obs, RooArgList(p0, p1, p2))
ebkg = ROOT.RooExtendPdf("ebkg", "ebkg", bkg, n_bkg)
model = ROOT.RooAddPdf(self.model_name, self.model_name, RooArgList(esig, esig2, esig3, ebkg))
getattr(self.ws, "import")(model, ROOT.RooFit.RecycleConflictNodes())
#getattr(self.ws, "import")(model, ROOT.RooFit.RenameConflictNodes("new"))
def is_unprescaled_runs(self, tree):
run_ = tree.run
res = True
if run_ >= 297730 and run_ < 307619:
res = False
return res
def get_data(self):
fin = ROOT.TFile.Open(self.file_name)
tree = fin.Get("upsilon")
nentries = tree.GetEntries()
print "total: ", nentries
print "onia pT cut: ", self.onia_pt_cut
obs_set = RooArgSet(self.obs)
data = ROOT.RooDataSet("data", "data", obs_set)
for ientry in xrange(nentries):
tree.GetEntry(ientry)
if self.only_unprescaled and not self.is_unprescaled_runs(tree):
continue
for i,m4l in enumerate(getattr(tree, self.br_name)):
#m4l = m4l/1000
if m4l > self.obs.getMax() or m4l < self.obs.getMin():
continue
# apply chi2
if tree.chi2[i] > self.chi2_cut:
continue
# apply trigger
if self.with_3mu4 and not tree.trig_3mu4:
continue
# apply dionia selection
if self.dionia_selection and tree.pass_diOnia != 1:
continue
has_one_lowPt = (tree.mu_pt_1[i] > 3E3 and tree.mu_pt_1[i] < 4E3) or (tree.mu_pt_2[i] > 3E3 and tree.mu_pt_2[i] < 4E3)
if self.use_low_pt_muon and not has_one_lowPt:
continue
if self.no_low_pt and has_one_lowPt:
continue
# apply onia pT cut
pT = tree.pt[i]
if not self.pass_onia_pt_cut(pT):
continue
self.obs.setVal(m4l)
data.add(obs_set)
getattr(self.ws, "import")(data)
print "selected events: ", data.sumEntries()
fin.Close()
def fit(self):
print "my configuration:",self.get_ws_name()
示例7: TString
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
fileIn_name = TString(options.inPath+"/"+file_Directory+signal_file_name);
if gammaVal == 0.05 : sf = 5 ;
elif gammaVal == 0.15 : sf = 3 ;
elif gammaVal == 0.30 : sf = 1.5 ;
if gammaVal == 0.05 or mass[iMass] == 1000 : binWidth = 20;
elif gammaVal == 0.15 or mass[iMass] == 1500 : binWidth = 30;
elif gammaVal == 0.30 or mass[iMass] == 1500 : binWidth = 50;
elif gammaVal == 0.15 or mass[iMass] == 2000 : binWidth = 50;
elif gammaVal == 0.30 or mass[iMass] == 2000 : binWidth = 75;
else:
binWidth = 20;
rrv_mass_lvj = RooRealVar("rrv_mass_lvj_plot","M_{WW}",float(mass[iMass]),float(mass[iMass]-mass[iMass]*gammaVal*sf),float(mass[iMass]+mass[iMass]*gammaVal*sf),"GeV/c^{2}");
rrv_mass_lvj.setBins(int((rrv_mass_lvj.getMax()-rrv_mass_lvj.getMin())/binWidth));
rrv_mass_lvj.setMax(rrv_mass_lvj.getMin()+rrv_mass_lvj.getBins()*binWidth);
rrv_weight = RooRealVar("rrv_weight","rrv_weight",0. ,10000000.);
## open the signal file
fileIn = TFile(fileIn_name.Data());
treeIn = fileIn.Get("SelectedCandidatesPlain");
rdataset4fit_mlvj = RooDataSet("rdataset4fit_BulkG_WW_inclusive_M%3d_W%d_%s_mlvj"%(int(mass[iMass]),int(mass[iMass]*gammaVal),options.channel),"rdataset4fit_BulkG_WW_inclusive_M%3d_W%d_%s_mlvj"%(int(mass[iMass]),int(mass[iMass]*gammaVal),options.channel),RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight));
luminosity = 19700;
tmp_scale_lumi = 0 ;
for iEvent in range(treeIn.GetEntries()):
示例8: array
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
tt_cat = w.cat('truetime_cat')
x_means = array('d', [])
x_errs = array('d', [])
y_means = array('d', [])
y_errs = array('d', [])
for s in tt_cat:
cut = '{0} == {0}::{1}'.format(tt_cat.GetName(), s.GetName())
par = sdata.meanVar(t_true, cut)
x_means.append(par.getVal())
x_errs.append(par.getError())
par = fpf.find('mean_' + s.GetName())
y_means.append(par.getVal())
y_errs.append(par.getError())
from ROOT import TF1
l = TF1('pol0', 'pol0', t_true.getMin(), t_true.getMax())
from ROOT import TGraphErrors
g = TGraphErrors(len(x_means), x_means, y_means, x_errs, y_errs)
line_result = g.Fit(l, 'S0+', 'L')
from ROOT import TCanvas
cn = 'canvas_' + args[0][pos : -5]
canvas = TCanvas(cn, cn, 600, 400)
g.Draw('AP')
g.GetXaxis().SetTitle("t_{true} [ps]")
g.GetYaxis().SetTitle("#mu / #sigma_{t}")
g.GetYaxis().SetRangeUser(-0.12, 0)
from ROOT import kBlue
l.SetLineColor(kBlue)
示例9: Long
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import getMin [as 别名]
## ndf = Long(0)
## if havePeds:
## fit = langaupedfit(sig_hist, ped_hist, fpar, fparerr, chisqr, ndf)
## #fit = preFitHisto(sig_hist, fpar, fparerr, chisqr, ndf)
## else:
## fit = preFitHisto(sig_hist, fpar, fparerr, chisqr, ndf)
c2 = TCanvas('c2', 'signal')
sigDS = fillDataSet(dataTree.GetV1(), x, dataTree.GetSelectedRows(),
'sigDS')
mpv = RooRealVar('mpv', 'mpv',
sig_hist.GetBinCenter(sig_hist.GetMaximumBin()),
#50.,
x.getMin(), x.getMax(), 'fC')
width = RooRealVar('width', 'width', sig_hist.GetRMS()/5., #fpar[0],
0., 50., 'fC')
lnd = RooLandau('lnd', 'lnd', x, mpv, width)
sigma = RooRealVar('sigma', '#sigma', #fpar[3],
sig_hist.GetRMS()/5.,
0., 50., 'fC')
mean = RooConstVar('mean', 'mean', 0.)
res = RooGaussian('res', 'res', x, mean, sigma)
lxg = RooFFTConvPdf('lxg', 'lxg', x, lnd, res)
xf = x.frame(RooFit.Bins(Nbins))
sigDS.plotOn(xf)
fmip = RooRealVar('fmip', 'f_{mip}', 0.95, 0., 1.)