本文整理汇总了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)