本文整理汇总了Python中ROOT.RooRealVar.setMin方法的典型用法代码示例。如果您正苦于以下问题:Python RooRealVar.setMin方法的具体用法?Python RooRealVar.setMin怎么用?Python RooRealVar.setMin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooRealVar
的用法示例。
在下文中一共展示了RooRealVar.setMin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: alpha
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMin [as 别名]
#.........这里部分代码省略.........
# * The two PDFs are added together using the relative normalizations of the two bkg from MC
# * DATA is then fit in the sidebands only using the combined bkg PDF
# * The results of the fit are then estrapolated in the SR and the integral is evaluated.
# * This defines the bkg normalization in the SR
# *******************************************************#
# #
# V+jets normalization #
# #
# *******************************************************#
# Variables for V+jets
constVjet = RooRealVar("constVjet", "slope of the exp", -0.020, -1.0, 0.0)
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 30.0, -50.0, 400.0)
widthVjet = RooRealVar("widthVjet", "width of the erf", 100.0, 1.0, 200.0) # 0, 400
a0Vjet = RooRealVar("a0Vjet", "width of the erf", -0.1, -5, 0)
a1Vjet = RooRealVar("a1Vjet", "width of the erf", 0.6, 0, 5)
a2Vjet = RooRealVar("a2Vjet", "width of the erf", -0.1, -1, 1)
if channel == "XZhnnb":
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 500.0, 200.0, 1000.0)
if channel == "XZhnnbb":
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 350.0, 200.0, 500.0)
# if channel == "XWhenb" or channel == "XZheeb":
# offsetVjet.setVal(120.)
# offsetVjet.setConstant(True)
if channel == "XWhenb":
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 120.0, 80.0, 155.0)
if channel == "XWhenbb" or channel == "XZhmmb":
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 67.0, 50.0, 100.0)
if channel == "XWhmnb":
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 30.0, -50.0, 600.0)
if channel == "XZheeb":
offsetVjet.setMin(-400)
offsetVjet.setVal(0.0)
offsetVjet.setMax(1000)
widthVjet.setVal(1.0)
# Define V+jets model
if fitFuncVjet == "ERFEXP":
VjetMass = RooErfExpPdf("VjetMass", fitFuncVjet, J_mass, constVjet, offsetVjet, widthVjet)
elif fitFuncVjet == "EXP":
VjetMass = RooExponential("VjetMass", fitFuncVjet, J_mass, constVjet)
elif fitFuncVjet == "GAUS":
VjetMass = RooGaussian("VjetMass", fitFuncVjet, J_mass, offsetVjet, widthVjet)
elif fitFuncVjet == "POL":
VjetMass = RooChebychev("VjetMass", fitFuncVjet, J_mass, RooArgList(a0Vjet, a1Vjet, a2Vjet))
elif fitFuncVjet == "POW":
VjetMass = RooGenericPdf("VjetMass", fitFuncVjet, "@0^@1", RooArgList(J_mass, a0Vjet))
else:
print " ERROR! Pdf", fitFuncVjet, "is not implemented for Vjets"
exit()
if fitAltFuncVjet == "POL":
VjetMass2 = RooChebychev("VjetMass2", "polynomial for V+jets mass", J_mass, RooArgList(a0Vjet, a1Vjet, a2Vjet))
else:
print " ERROR! Pdf", fitAltFuncVjet, "is not implemented for Vjets"
exit()
# fit to main bkg in MC (whole range)
frVjet = VjetMass.fitTo(
setVjet,
RooFit.SumW2Error(True),
RooFit.Range("h_reasonable_range"),
RooFit.Strategy(2),
RooFit.Minimizer("Minuit2"),
示例2: main
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMin [as 别名]
#.........这里部分代码省略.........
# res6.Print()
# res7.Print()
# decorrelated background parameters for Bayesian limits
if args.decoBkg:
signal_norm.setConstant()
res = model.fitTo(rooDataHist, RooFit.Save(kTRUE), RooFit.Strategy(args.fitStrategy))
res.Print()
## temp workspace for the PDF diagonalizer
w_tmp = RooWorkspace("w_tmp")
deco = PdfDiagonalizer("deco",w_tmp,res)
# here diagonalizing only the shape parameters since the overall normalization is already decorrelated
background_deco = deco.diagonalize(background)
print "##################### workspace for decorrelation"
w_tmp.Print("v")
print "##################### original parameters"
background.getParameters(rooDataHist).Print("v")
print "##################### decorrelated parameters"
# needed if want to evaluate limits without background systematics
if args.fixBkg:
w_tmp.var("deco_eig1").setConstant()
w_tmp.var("deco_eig2").setConstant()
if not args.fixP3: w_tmp.var("deco_eig3").setConstant()
background_deco.getParameters(rooDataHist).Print("v")
print "##################### original pdf"
background.Print()
print "##################### decorrelated pdf"
background_deco.Print()
# release signal normalization
signal_norm.setConstant(kFALSE)
# set the background normalization range to +/- 5 sigma
bkg_val = background_norm.getVal()
bkg_error = background_norm.getError()
background_norm.setMin(bkg_val-5*bkg_error)
background_norm.setMax(bkg_val+5*bkg_error)
background_norm.Print()
# change background PDF names
background.SetName("background_old")
background_deco.SetName("background")
# needed if want to evaluate limits without background systematics
if args.fixBkg:
background_norm.setConstant()
p1.setConstant()
p2.setConstant()
p3.setConstant()
# -----------------------------------------
# dictionaries holding systematic variations of the signal shape
hSig_Syst = {}
hSig_Syst_DataHist = {}
sigCDF = TGraph(hSig.GetNbinsX()+1)
# JES and JER uncertainties
if args.jesUnc != None or args.jerUnc != None:
sigCDF.SetPoint(0,0.,0.)
integral = 0.
for i in range(1, hSig.GetNbinsX()+1):
x = hSig.GetXaxis().GetBinLowEdge(i+1)
integral = integral + hSig.GetBinContent(i)
sigCDF.SetPoint(i,x,integral)
if args.jesUnc != None:
hSig_Syst['JESUp'] = copy.deepcopy(hSig)
hSig_Syst['JESDown'] = copy.deepcopy(hSig)
示例3:
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMin [as 别名]
# needed if want to evaluate limits without background systematics
if args.fixBkg:
w_tmp.var("deco_eig1").setConstant()
w_tmp.var("deco_eig2").setConstant()
if not args.fixP3: w_tmp.var("deco_eig3").setConstant()
background_deco.getParameters(rooDataHist).Print("v")
print "##################### original pdf"
background.Print()
print "##################### decorrelated pdf"
background_deco.Print()
# release signal normalization
signal_norm.setConstant(kFALSE)
# set the background normalization range to +/- 5 sigma
bkg_val = background_norm.getVal()
bkg_error = background_norm.getError()
background_norm.setMin(bkg_val-5*bkg_error)
background_norm.setMax(bkg_val+5*bkg_error)
background_norm.Print()
# change background PDF names
background.SetName("background_old")
background_deco.SetName("background")
# needed if want to evaluate limits without background systematics
if args.fixBkg:
background_norm.setConstant()
p1.setConstant()
p2.setConstant()
p3.setConstant()
# -----------------------------------------
# dictionaries holding systematic variations of the signal shape