本文整理汇总了Python中ROOT.RooRealVar.setError方法的典型用法代码示例。如果您正苦于以下问题:Python RooRealVar.setError方法的具体用法?Python RooRealVar.setError怎么用?Python RooRealVar.setError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooRealVar
的用法示例。
在下文中一共展示了RooRealVar.setError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TString
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setError [as 别名]
sig_param = sig_par.Next()
while sig_param:
sig_param.Print()
if TString(sig_param.GetName()).Contains(
"rrv_mean_CB_ggH"
): ## copy the mean value for the DoubleCB and BW
rrv_mean_CB = sig_param
elif TString(sig_param.GetName()).Contains("rrv_sigma_CB_ggH"):
rrv_sigma_CB = RooRealVar(
"rrv_sigma_CB_ggH%s_signal_region_em_mlvj" % (mass),
"rrv_sigma_CB_ggH%s_signal_region_em_mlvj" % (mass),
sig_param.getVal() * options.narrow_factor,
)
rrv_sigma_CB.setError(sig_param.getError() * options.narrow_factor)
# rrv_sigma_CB = sig_param;
# rrv_sigma_CB.setVal(sig_param.getVal()*options.narrow_factor);
elif TString(sig_param.GetName()).Contains("rrv_alpha_CB_ggH"):
rrv_alpha_CB = sig_param
elif TString(sig_param.GetName()).Contains("rrv_n_CB_ggH"):
rrv_n_CB = sig_param
sig_param = sig_par.Next()
## cycle on DoubleCB parameters -> copy them in a new set
sig_parameters2 = RooDoubleCrystalBall2.getParameters(
old_workspace.data(datasetname + "_" + options.channel)
)
sig_par2 = sig_parameters2.createIterator()
sig_par2.Reset()
示例2: alpha
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setError [as 别名]
#.........这里部分代码省略.........
setDataSR = RooDataSet("setDataSR", "setDataSR", variables, RooFit.Cut(SRcut), RooFit.WeightVar(weight), RooFit.Import(treeData))
setDataVR = RooDataSet("setDataVR", "setDataVR", variables, RooFit.Cut(VRcut), RooFit.WeightVar(weight), RooFit.Import(treeData)) # Observed in the VV mass, just for plotting purposes
# same for the bkg datasets from MC, where we just apply the base selections (not blind)
setVjet = RooDataSet("setVjet", "setVjet", variables, RooFit.Cut(baseCut), RooFit.WeightVar(weight), RooFit.Import(treeVjet))
setVjetSB = RooDataSet("setVjetSB", "setVjetSB", variables, RooFit.Import(setVjet), RooFit.Cut(SBcut), RooFit.WeightVar(weight))
setVjetSR = RooDataSet("setVjetSR", "setVjetSR", variables, RooFit.Import(setVjet), RooFit.Cut(SRcut), RooFit.WeightVar(weight))
setVV = RooDataSet("setVV", "setVV", variables, RooFit.Cut(baseCut), RooFit.WeightVar(weight), RooFit.Import(treeVV))
setVVSB = RooDataSet("setVVSB", "setVVSB", variables, RooFit.Import(setVV), RooFit.Cut(SBcut), RooFit.WeightVar(weight))
setVVSR = RooDataSet("setVVSR", "setVVSR", variables, RooFit.Import(setVV), RooFit.Cut(SRcut), RooFit.WeightVar(weight))
setTop = RooDataSet("setTop", "setTop", variables, RooFit.Cut(baseCut), RooFit.WeightVar(weight), RooFit.Import(treeTop))
setTopSB = RooDataSet("setTopSB", "setTopSB", variables, RooFit.Import(setTop), RooFit.Cut(SBcut), RooFit.WeightVar(weight))
setTopSR = RooDataSet("setTopSR", "setTopSR", variables, RooFit.Import(setTop), RooFit.Cut(SRcut), RooFit.WeightVar(weight))
print " Data events SB: %.2f" % setDataSB.sumEntries()
print " V+jets entries: %.2f" % setVjet.sumEntries()
print " VV, VH entries: %.2f" % setVV.sumEntries()
print " Top,ST entries: %.2f" % setTop.sumEntries()
# the relative normalization of the varius bkg is taken from MC by counting all the events in the full fatJetMass range
#coef = RooRealVar("coef", "coef", setVV.sumEntries()/setVjet.sumEntries(),0.,1.)
coef_VV_Vjet = RooRealVar("coef2_1", "coef2_1", setVV.sumEntries()/setVjet.sumEntries(), 0., 1.)
coef_Top_VVVjet = RooRealVar("coef3_21", "coef3_21", setTop.sumEntries()/(setVjet.sumEntries()+setVV.sumEntries()),0.,1.);
coef_VV_Vjet.setConstant(True)
coef_Top_VVVjet.setConstant(True)
# Define entries
entryVjet = RooRealVar("entryVjets", "V+jets normalization", setVjet.sumEntries(), 0., 1.e6)
entryVV = RooRealVar("entryVV", "VV normalization", setVV.sumEntries(), 0., 1.e6)
entryTop = RooRealVar("entryTop", "Top normalization", setTop.sumEntries(), 0., 1.e6)
entrySB = RooRealVar("entrySB", "Data SB normalization", setDataSB.sumEntries(SBcut), 0., 1.e6)
entrySB.setError(math.sqrt(entrySB.getVal()))
entryLSB = RooRealVar("entryLSB", "Data LSB normalization", setDataSB.sumEntries(LSBcut), 0., 1.e6)
entryLSB.setError(math.sqrt(entryLSB.getVal()))
entryHSB = RooRealVar("entryHSB", "Data HSB normalization", setDataSB.sumEntries(HSBcut), 0., 1.e6)
entryHSB.setError(math.sqrt(entryHSB.getVal()))
#*******************************************************#
# #
# NORMALIZATION #
# #
#*******************************************************#
# set reasonable ranges for J_mass and X_mass
# these are used in the fit in order to avoid ROOFIT to look in regions very far away from where we are fitting
J_mass.setRange("h_reasonable_range", LOWMIN, HIGMAX)
X_mass.setRange("X_reasonable_range", XBINMIN, XBINMAX)
# Set RooArgSets once for all, see https://root.cern.ch/phpBB3/viewtopic.php?t=11758
jetMassArg = RooArgSet(J_mass)
#*******************************************************#
# #
# V+jets normalization #
# #
#*******************************************************#
# Variables for V+jets
constVjet = RooRealVar("constVjet", "slope of the exp", -0.020, -1., 0.)
offsetVjet = RooRealVar("offsetVjet", "offset of the erf", 30., -50., 200.)
widthVjet = RooRealVar("widthVjet", "width of the erf", 100., 1., 200.)
offsetVjet.setConstant(True)
示例3: getattr
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setError [as 别名]
rrv_n2_CB = sig_param;
sig_param = sig_par.Next();
### copy all the datasets
getattr(new_workspace,"import")(old_workspace.data(datasetname+"_xww_"+options.channel+"_"+options.category));
## Breit Wigner Core --> mean and the resolution fixed
rrv_width_BW = RooRealVar("rrv_width_BW_BulkG_WW_"+options.channel+"_"+options.category,"rrv_width_BW_BulkG_WW_"+options.channel+"_"+options.category,mass[iMass]*gammaVal);
rrv_mean_BW.setConstant(kTRUE);
rrv_width_BW.setConstant(kTRUE);
## Breit Wigner Core --> mean sys are to be applied on the mean of BW
rrv_mean_scale_p1 = RooRealVar("CMS_sig_p1_jes","CMS_sig_p1_jes",0);
rrv_mean_scale_p1.setConstant(kTRUE);
rrv_mean_scale_p1.setError(1);
rrv_mean_scale_p2 = RooRealVar("CMS_sig_p1_scale_em","CMS_sig_p1_scale_em",0);
rrv_mean_scale_p2.setConstant(kTRUE);
rrv_mean_scale_p2.setError(1);
rrv_mean_scale_X1 = RooRealVar("rrv_mean_shift_scale_lep_BW_"+options.channel+"_"+options.category,"rrv_mean_shift_scale_lep_BW_"+options.channel+"_"+options.category,float(0.001));
rrv_mean_scale_X1.setConstant(kTRUE);
rrv_mean_scale_X2 = RooRealVar("rrv_mean_shift_scale_jes_BW_"+options.channel+"_"+options.category,"rrv_mean_shift_scale_jes_BW_"+options.channel+"_"+options.category,float(0.033));
rrv_mean_scale_X2.setConstant(kTRUE);
rrv_total_mean_CB = RooFormulaVar("rrv_total_mean_BW_"+options.channel,"@0*([email protected]*@2)*([email protected]*@4)", RooArgList(rrv_mean_BW,rrv_mean_scale_p1,rrv_mean_scale_X1,rrv_mean_scale_p2,rrv_mean_scale_X2));
bw = RooBreitWigner("bw_BulkWW_xww_"+options.channel,"bw_BulkG_WW_"+options.channel,old_workspace.var("rrv_mass_lvj"),rrv_total_mean_CB,rrv_width_BW);
示例4: alpha
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setError [as 别名]
#.........这里部分代码省略.........
"setVjetSR", "setVjetSR", variables, RooFit.Import(setVjet), RooFit.Cut(SRcut), RooFit.WeightVar(weight)
)
setVV = RooDataSet(
"setVV", "setVV", variables, RooFit.Cut(baseCut), RooFit.WeightVar(weight), RooFit.Import(treeVV)
)
setVVSB = RooDataSet(
"setVVSB", "setVVSB", variables, RooFit.Import(setVV), RooFit.Cut(SBcut), RooFit.WeightVar(weight)
)
setVVSR = RooDataSet(
"setVVSR", "setVVSR", variables, RooFit.Import(setVV), RooFit.Cut(SRcut), RooFit.WeightVar(weight)
)
setTop = RooDataSet(
"setTop", "setTop", variables, RooFit.Cut(baseCut), RooFit.WeightVar(weight), RooFit.Import(treeTop)
)
setTopSB = RooDataSet(
"setTopSB", "setTopSB", variables, RooFit.Import(setTop), RooFit.Cut(SBcut), RooFit.WeightVar(weight)
)
setTopSR = RooDataSet(
"setTopSR", "setTopSR", variables, RooFit.Import(setTop), RooFit.Cut(SRcut), RooFit.WeightVar(weight)
)
print " Data events SB: %.2f" % setDataSB.sumEntries()
print " V+jets entries: %.2f" % setVjet.sumEntries()
print " VV, VH entries: %.2f" % setVV.sumEntries()
print " Top,ST entries: %.2f" % setTop.sumEntries()
nVV = RooRealVar("nVV", "VV normalization", setVV.sumEntries(SBcut), 0.0, 2 * setVV.sumEntries(SBcut))
nTop = RooRealVar("nTop", "Top normalization", setTop.sumEntries(SBcut), 0.0, 2 * setTop.sumEntries(SBcut))
nVjet = RooRealVar("nVjet", "Vjet normalization", setDataSB.sumEntries(), 0.0, 2 * setDataSB.sumEntries(SBcut))
nVjet2 = RooRealVar("nVjet2", "Vjet2 normalization", setDataSB.sumEntries(), 0.0, 2 * setDataSB.sumEntries(SBcut))
# Apply Top SF
nTop.setVal(nTop.getVal() * topSF[nLept][nBtag])
nTop.setError(nTop.getVal() * topSFErr[nLept][nBtag])
# Define entries
entryVjet = RooRealVar("entryVjets", "V+jets normalization", setVjet.sumEntries(), 0.0, 1.0e6)
entryVV = RooRealVar("entryVV", "VV normalization", setVV.sumEntries(), 0.0, 1.0e6)
entryTop = RooRealVar("entryTop", "Top normalization", setTop.sumEntries(), 0.0, 1.0e6)
entrySB = RooRealVar("entrySB", "Data SB normalization", setDataSB.sumEntries(SBcut), 0.0, 1.0e6)
entrySB.setError(math.sqrt(entrySB.getVal()))
entryLSB = RooRealVar("entryLSB", "Data LSB normalization", setDataSB.sumEntries(LSBcut), 0.0, 1.0e6)
entryLSB.setError(math.sqrt(entryLSB.getVal()))
entryHSB = RooRealVar("entryHSB", "Data HSB normalization", setDataSB.sumEntries(HSBcut), 0.0, 1.0e6)
entryHSB.setError(math.sqrt(entryHSB.getVal()))
###################################################################################
# _ _ #
# | \ | | | (_) | | (_) #
# | \| | ___ _ __ _ __ ___ __ _| |_ ___ __ _| |_ _ ___ _ __ #
# | . ` |/ _ \| '__| '_ ` _ \ / _` | | / __|/ _` | __| |/ _ \| '_ \ #
# | |\ | (_) | | | | | | | | (_| | | \__ \ (_| | |_| | (_) | | | | #
# |_| \_|\___/|_| |_| |_| |_|\__,_|_|_|___/\__,_|\__|_|\___/|_| |_| #
# #
###################################################################################
# fancy ASCII art thanks to, I guess, Jose
# start by creating the fit models to get the normalization:
# * MAIN and SECONDARY bkg are taken from MC by fitting the whole J_mass range
# * 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
示例5: RooRealVar
# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import setError [as 别名]
if labelText : label.DrawLatexNDC( 0.25, 0.85, labelText )
mumuMassCanvLog.Print( mumuPlotsFilePath + ')' )
###########################################################################################################################################
## Make KK mass plots ##
########################
#Build KK mas pdf
from ROOT import RooRealVar, RooRelBreitWigner, RooConstVar, RooFFTConvPdf, RooGaussModel
#Mass Resolution Model
KKMassVar = KKMass._target_()
resMean = RooRealVar( 'resMean' , 'resMean' , 0.62, -5., 5. )
resSigma = RooRealVar( 'resSigma' , 'resSigma' , 1.21, 0.01, 5. )
resMean.setError(0.02)
resSigma.setError(0.04)
GaussModel = RooGaussModel( 'GaussModel', 'GaussModel', KKMassVar, resMean, resSigma )
#Build Phi Mass Pdf
mean = RooConstVar( 'mean' , 'mean' , 1019.455 )
width = RooConstVar( 'width' , 'width' , 4.26 )
spin = RooConstVar( 'spin' , 'spin' , 1. )
radius = RooConstVar( 'radius', 'radius', -1. )
K1mass = RooConstVar( 'K1mass', 'K1mass', 493.68 )
K2mass = RooConstVar( 'K2mass', 'K2mass', 493.68 )
phiMassBW = RooRelBreitWigner('phiMassBW', 'phiMassBW', KKMassVar, mean, width, spin, radius, K1mass, K2mass )
phiMassPdf = RooFFTConvPdf ('phiMassPdf', 'phiMassPdf', KKMassVar, phiMassBW, GaussModel )