本文整理匯總了Python中ROOT.RooAddPdf.getParameters方法的典型用法代碼示例。如果您正苦於以下問題:Python RooAddPdf.getParameters方法的具體用法?Python RooAddPdf.getParameters怎麽用?Python RooAddPdf.getParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ROOT.RooAddPdf
的用法示例。
在下文中一共展示了RooAddPdf.getParameters方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TCanvas
# 需要導入模塊: from ROOT import RooAddPdf [as 別名]
# 或者: from ROOT.RooAddPdf import getParameters [as 別名]
canSname = 'can_Sub_Mjj'+str(mass)
canS = TCanvas(canSname,canSname,900,600)
#gPad.SetLogy()
roohistSig = RooDataHist('roohist','roohist',RooArgList(x),hSig)
signal.fitTo(roohistSig)
frame = x.frame()
roohistSig.plotOn(frame)
signal.plotOn(frame)
signal.plotOn(frame,RooFit.Components('bkg'),RooFit.LineColor(ROOT.kRed),RooFit.LineWidth(2),RooFit.LineStyle(ROOT.kDashed))
frame.GetXaxis().SetRangeUser(900,4500)
frame.GetXaxis().SetTitle('m_{jj} (GeV)')
frame.Draw()
parsSig = signal.getParameters(roohistSig)
parsSig.setAttribAll('Constant', True)
if fitDat:
# -----------------------------------------
# define parameters for background
NBINS = 180
p1 = RooRealVar('p1','p1',7,1,10)
p2 = RooRealVar('p2','p2',5,1,10)
p3 = RooRealVar('p3','p3',0.03,0.01,0.07)
background = RooGenericPdf('background','(pow([email protected]/8000,@1)/pow(@0/8000,@[email protected]*log(@0/8000)))',RooArgList(x,p1,p2,p3))
roohistBkg = RooDataHist('roohist','roohist',RooArgList(x),hDat)
res = background.fitTo(roohistBkg)
示例2: TCanvas
# 需要導入模塊: from ROOT import RooAddPdf [as 別名]
# 或者: from ROOT.RooAddPdf import getParameters [as 別名]
canS = TCanvas('Template_TT','Template_TT',900,600)
#gPad.SetLogy()
res = signal.fitTo(roohisto[0],RooFit.Save())
res.Print()
frame = x.frame()
roohisto[0].plotOn(frame)
signal.plotOn(frame)
signal.plotOn(frame,RooFit.Components('ttbar_gaus1'),RooFit.LineColor(ROOT.kRed),RooFit.LineWidth(2),RooFit.LineStyle(ROOT.kDashed))
signal.plotOn(frame,RooFit.Components('ttbar_gaus2'),RooFit.LineColor(ROOT.kGreen+1),RooFit.LineWidth(2),RooFit.LineStyle(ROOT.kDashed))
#signal.plotOn(frame,RooFit.Components('sig3'),RooFit.LineColor(ROOT.kMagenta),RooFit.LineWidth(2),RooFit.LineStyle(ROOT.kDashed))
frame.GetXaxis().SetTitle('m_{t} (GeV)')
frame.Draw()
gPad.Update()
canS.Print(canS.GetName()+".pdf")
parsSig = signal.getParameters(roohisto[0])
parsSig.setAttribAll('Constant', True)
# -----------------------------------------
# fit qcd
m1QCD = RooRealVar('qcd_mean1' ,'qcd_mean1',200,130,350)
s1QCD = RooRealVar('qcd_sigma1','qcd_sigma1',50,20,200)
qcd1 = RooGaussian('qcd_gaus1','qcd_gaus1',x,m1QCD,s1QCD)
m2QCD = RooRealVar('qcd_mean2' ,'qcd_mean2',140,130,300)
s2QCD = RooRealVar('qcd_sigma2','qcd_sigma2',50,10,200)
qcd2 = RooGaussian('qcd_gaus2' ,'qcd_gaus2',x,m2QCD,s2QCD)
fqcd = RooRealVar('qcd_f1','qcd_f1',0.5,0,1)
示例3:
# 需要導入模塊: from ROOT import RooAddPdf [as 別名]
# 或者: from ROOT.RooAddPdf import getParameters [as 別名]
l1=RooRealVar("l1","l1",1.,0.,1000.)
l2=RooRealVar("l2","l2",1.,0.,1000.)
#sigbkg=RooPolynomial("sigbkg"+str(cut),"bkg",mass,RooArgList(l0,l1,l2))
#sigbkg=RooChebychev("sigbkg"+str(cut),"bkg",mass,RooArgList(l0,l1))
sigbkg=RooLogistics("sigbkg"+str(cut),"bkg",mass,l0,l1)
#sigbkg=RooExponential("sigbkg"+str(cut),"sigbkg",mass,l0)
nsigref=RooRealVar("nsigref","number of signal events",100,0,1e10)
sigmodel=RooAddPdf("sigmodel"+str(cut),"sig+bkg",RooArgList(sigbkg,sig),RooArgList(nbkg,nsigref))
s0.setConstant(False)
s1.setConstant(False)
sigmodel.fitTo(signal,RooFit.SumW2Error(True)) #,RooFit.Range("signal")
sigmodel.fitTo(signal,RooFit.SumW2Error(True)) #,RooFit.Range("signal")
sigmodel.fitTo(signal,RooFit.SumW2Error(True)) #,RooFit.Range("signal")
chi2=RooChi2Var("chi2","chi2",sigmodel,signal,RooFit.DataError(RooAbsData.SumW2))
nbins=data.numEntries()
nfree=sigmodel.getParameters(data).selectByAttrib("Constant",False).getSize()
s0.setConstant(True)
s1.setConstant(True)
if cut>=1:
fullintegral=sumsighist.Integral()
else:
fullintegral=sighist.Integral()
print "SIGNAL FRACTION",nsigref.getValV()/(nsigref.getValV()+nbkg.getValV())
if nsigref.getValV()==0: continue
if fit=="data":
xframe=mass.frame(RooFit.Title("signal fraction in peak ="+str(int(nsigref.getValV()/(nsigref.getValV()+nbkg.getValV())*1000.)/1000.)+"+-"+str(int(nsigref.getError()/(nsigref.getValV()+nbkg.getValV())*1000.)/1000.)+", #chi^{2}/DOF = "+str(int((chi2.getVal()/(nbins-nfree))*10.)/10.)))
signal.plotOn(xframe,RooFit.DataError(RooAbsData.SumW2))
sigmodel.plotOn(xframe,RooFit.Normalization(1.0,RooAbsReal.RelativeExpected))
sigmodel.plotOn(xframe,RooFit.Components("sigbkg"+str(cut)),RooFit.LineStyle(kDashed),RooFit.Normalization(1.0,RooAbsReal.RelativeExpected))