本文整理匯總了Python中ROOT.RooAddPdf.createCdf方法的典型用法代碼示例。如果您正苦於以下問題:Python RooAddPdf.createCdf方法的具體用法?Python RooAddPdf.createCdf怎麽用?Python RooAddPdf.createCdf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ROOT.RooAddPdf
的用法示例。
在下文中一共展示了RooAddPdf.createCdf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: studyVqqResolution
# 需要導入模塊: from ROOT import RooAddPdf [as 別名]
# 或者: from ROOT.RooAddPdf import createCdf [as 別名]
#.........這裏部分代碼省略.........
if i==2: reg='endcap'
h=histos[r+k+reg]
x=RooRealVar("x", h.GetXaxis().GetTitle(), h.GetXaxis().GetXmin(), h.GetXaxis().GetXmax())
data=RooDataHist("data", "dataset with x", RooArgList(x), h)
frame=x.frame()
RooAbsData.plotOn( data, frame, RooFit.DataError(RooAbsData.SumW2) )
mean1=RooRealVar("mean1","mean1",0,-0.5,0.5);
sigma1=RooRealVar("sigma1","sigma1",0.1,0.01,1.0);
gauss1=RooGaussian("g1","g",x,mean1,sigma1)
if r=='dpt' or r=='den' :
mean2=RooRealVar("mean2","mean2",0,-0.5,0.5);
sigma2=RooRealVar("sigma2","sigma2",0.1,0.01,1.0);
alphacb=RooRealVar("alphacb","alphacb",1,0.1,3);
ncb=RooRealVar("ncb","ncb",4,1,100)
gauss2 = RooCBShape("cb2","cb",x,mean2,sigma2,alphacb,ncb);
else:
mean1.setRange(0,0.5)
mean2=RooRealVar("mean2","mean",0,0,1);
sigma2=RooRealVar("sigma2","sigma",0.1,0.01,1.0);
gauss2=RooGaussian("g2","g",x,mean2,sigma2) ;
frac = RooRealVar("frac","fraction",0.9,0.0,1.0)
if data.sumEntries()<100 :
frac.setVal(1.0)
frac.setConstant(True)
model = RooAddPdf("sum","g1+g2",RooArgList(gauss1,gauss2), RooArgList(frac))
status=model.fitTo(data,RooFit.Save()).status()
if status!=0 : continue
model_cdf=model.createCdf(RooArgSet(x)) ;
cl=0.90
ul=0.5*(1.0+cl)
closestToCL=1.0
closestToUL=-1
closestToMedianCL=1.0
closestToMedian=-1
for ibin in xrange(1,h.GetXaxis().GetNbins()*10):
xval=h.GetXaxis().GetXmin()+(ibin-1)*h.GetXaxis().GetBinWidth(ibin)/10.
x.setVal(xval)
cdfValToCL=math.fabs(model_cdf.getVal()-ul)
if cdfValToCL<closestToCL:
closestToCL=cdfValToCL
closestToUL=xval
cdfValToCL=math.fabs(model_cdf.getVal()-0.5)
if cdfValToCL<closestToMedianCL:
closestToMedianCL=cdfValToCL
closestToMedian=xval
RooAbsPdf.plotOn(model,frame)
frame.Draw()
if i==1: drawHeader()
labels.append( TPaveText(0.6,0.92,0.9,0.98,'brNDC') )
ilab=len(labels)-1
labels[ilab].SetName(r+k+'txt')
labels[ilab].SetBorderSize(0)
labels[ilab].SetFillStyle(0)
labels[ilab].SetTextFont(42)
labels[ilab].SetTextAlign(12)
kinReg=k.replace('to','-')
kinReg=kinReg.replace('Inf','#infty')
labels[ilab].AddText('['+reg+'] '+kinReg)