本文整理汇总了Python中ROOT.RooRealVar.setMax方法的典型用法代码示例。如果您正苦于以下问题:Python RooRealVar.setMax方法的具体用法?Python RooRealVar.setMax怎么用?Python RooRealVar.setMax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooRealVar
的用法示例。
在下文中一共展示了RooRealVar.setMax方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMax [as 别名]
#.........这里部分代码省略.........
# 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)
示例2: RooRealVar
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMax [as 别名]
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()):
if iEvent % 1000 == 0: print "iEvent: ",iEvent;
示例3: alpha
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMax [as 别名]
#.........这里部分代码省略.........
# * 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"),
RooFit.Save(1),
RooFit.PrintLevel(1 if VERBOSE else -1),
示例4:
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setMax [as 别名]
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 = {}