本文整理汇总了Python中ROOT.RooDataSet.plotOn方法的典型用法代码示例。如果您正苦于以下问题:Python RooDataSet.plotOn方法的具体用法?Python RooDataSet.plotOn怎么用?Python RooDataSet.plotOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ROOT.RooDataSet
的用法示例。
在下文中一共展示了RooDataSet.plotOn方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dump_simple
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
def dump_simple():
# try poisson
roo_lam = RooRealVar("lambda", ".", lam, 0.0, 1.5)
roo_x = RooRealVar('x', 'x range', 0, bins)
model = RooPoisson("poisson", "Poisson Model", roo_x, roo_lam)
#data = model.generate(RooArgSet(roo_x), n_events)
data = RooDataSet('data', 'Data', RooArgSet(roo_x))
for val in unbinned_from_binned(xdata, ydata):
roo_x.setVal(val)
data.add(RooArgSet(roo_x))
#// --- Perform extended ML fit of composite PDF to toy data ---
fitresult = model.fitTo(data, RooFit.Save(), RooFit.PrintLevel(-1)) ;
#// --- Plot toy data and composite PDF overlaid ---
mesframe = roo_x.frame(bins) ;
data.plotOn(mesframe) ;
model.plotOn(mesframe) ;
mesframe.Draw()
示例2: TFile
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
if args[0].startswith('MC'):
from ROOT import TFile
sig_file = TFile(input_data['sig_cache'])
sig_data = sig_file.Get(input_data['sig_dataset'])
prompt_file = TFile(input_data['prompt_cache'])
prompt_data = prompt_file.Get(input_data['prompt_dataset'])
else:
sig_file = TFile("/project/bfys/jleerdam/data/Bs2Jpsiphi/Reco14/fitNTuple_peakBkg_2011_2012_Reco14_TOS_HLT2B_20140415.root")
sig_tree = sig_file.Get("DecayTree")
period = 'p' + args[0][:4]
sig_data = RooDataSet('sig_data', 'sig_data', RooArgSet(momentum, weight, runPeriod),
RooFit.Import(sig_tree), RooFit.WeightVar(weight),
RooFit.Cut('runPeriod == runPeriod::%s' % period))
from ROOT import TFile
prompt_file = TFile(input_data['cache'])
prompt_data = prompt_file.Get(input_data['dataset'])
from ROOT import TCanvas
canvas = TCanvas('momentum_canvas', 'momentum_canvas', 600, 400)
canvas.SetLogy()
frame = momentum.frame(Range = (0, 500000))
from ROOT import kBlue, kGreen
sig_data.plotOn(frame, Rescale = (1 / sig_data.sumEntries()), MarkerColor = kBlue)
prompt_data.plotOn(frame, Rescale = (1 / prompt_data.sumEntries()), MarkerColor = kGreen)
frame.GetXaxis().SetTitle("P_{B} [MeV]")
frame.GetYaxis().SetTitle("scaled candidates")
frame.GetYaxis().SetRangeUser(0.00005, 0.1)
frame.Draw()
示例3: range
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
tp.SetBranchStatus('Bid', 1)
tp.SetBranchStatus('hid', 1)
tp.SetBranchStatus('time', 1)
for i in range(tp.GetEntries()):
tp.GetEntry(i)
# choose decay equation (1 of 2 for Dspi)
if (tp.Bid == 531 and tp.hid == 211):
time.setVal(tp.time)
dst.add(RooArgSet(time), tp.wt)
dst.Print()
# model.fitTo(dst)
# plot
tfr = time.frame()
dst.plotOn(tfr)
model.plotOn(tfr)
tfr.Draw()
mode_title = get_title_from_mode(mode)
if nokfactor:
k_title = 'no'
else:
k_title = 'with'
tfr.SetTitle('{} ({} #it{{k}}-factor smearing)'.format(mode_title, k_title))
tfr.GetYaxis().SetTitle('')
# FIXME: this is a hack, fix the real issue in splines
if trange:
rescale_roofit_pad(gPad, trange[0], trange[1])
canvas.Print(plotfile)
示例4: RooPullVar
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
tau_result.setVal(tau.getVal())
tau_result.setError(tau.getError())
result_data.add(RooArgSet(tau_result))
tau.setVal(tau_true.getVal())
tau.setError(0.1)
tau_pull = RooPullVar("tau_pull", "tau_pull", tau_result._target_(), tau_true._target_())
tau_pull = result_data.addColumn(tau_pull)
tau_pull = w.put(tau_pull)
mean = RealVar('mean', Value = 0, MinMax = (-4, 4))
sigma = RealVar('sigma', Value = 1, MinMax = (0.1, 5))
from ROOT import RooGaussian
gauss = Pdf(Name = 'gauss', Type = RooGaussian, Parameters = (tau_pull, mean, sigma))
result = gauss.fitTo(result_data, **fitOpts)
from ROOT import TPostScript
ps = TPostScript("test.eps", 113)
ps.FontEmbed()
from ROOT import TCanvas
canvas = TCanvas('canvas', 'canvas', 600, 400)
frame = tau_pull.frame(Range = (-5, 5))
frame.GetXaxis().SetTitle('#tau pull')
frame.GetYaxis().SetTitle('M Experiments')
result_data.plotOn(frame)
gauss.plotOn(frame)
frame.Draw()
canvas.Update()
ps.Close()
示例5: TCanvas
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
simPdf.addPdf(model3S,'b3')
fitregion = x.setRange('fitregion',10.35,10.8)
fitregion_1S = x.setRange('fitregion_1S',10.35,10.8)
fitregion_2S = x.setRange('fitregion_2S',10.35,10.8)
fitregion_3S = x.setRange('fitregion_3S',10.35,10.8)
#simPdf.fitTo(combData,RooFit.Save(), RooFit.Range('fitregion'),RooFit.SplitRange())
simPdf.fitTo(combData,RooFit.Save())
#plotting
frame1 = x.frame()
combData.plotOn(frame1,
RooFit.Cut("sample==sample::b1"),
RooFit.MarkerSize(0.7))
simPdf.plotOn(frame1, RooFit.Slice(sample,'b1'),
RooFit.ProjWData(RooArgSet(sample),combData),
RooFit.LineWidth(2))
c1 = TCanvas('c1','c1')
frame1.Draw()
frame2 = x.frame()
combData.plotOn(frame2,
RooFit.Cut("sample==sample::b2"),
RooFit.MarkerSize(0.7))
simPdf.plotOn(frame2, RooFit.Slice(sample,'b2'),
RooFit.ProjWData(RooArgSet(sample),combData),
RooFit.LineWidth(2))
示例6: rf501_simultaneouspdf
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
def rf501_simultaneouspdf():
# C r e a t e m o d e l f o r p h y s i c s s a m p l e
# -------------------------------------------------------------
# Create observables
x = RooRealVar( "x", "x", -8, 8 )
# Construct signal pdf
mean = RooRealVar( "mean", "mean", 0, -8, 8 )
sigma = RooRealVar( "sigma", "sigma", 0.3, 0.1, 10 )
gx = RooGaussian( "gx", "gx", x, mean, sigma )
# Construct background pdf
a0 = RooRealVar( "a0", "a0", -0.1, -1, 1 )
a1 = RooRealVar( "a1", "a1", 0.004, -1, 1 )
px = RooChebychev( "px", "px", x, RooArgList( a0, a1 ) )
# Construct composite pdf
f = RooRealVar( "f", "f", 0.2, 0., 1. )
model = RooAddPdf( "model", "model", RooArgList( gx, px ), RooArgList( f ) )
# C r e a t e m o d e l f o r c o n t r o l s a m p l e
# --------------------------------------------------------------
# Construct signal pdf.
# NOTE that sigma is shared with the signal sample model
mean_ctl = RooRealVar( "mean_ctl", "mean_ctl", -3, -8, 8 )
gx_ctl = RooGaussian( "gx_ctl", "gx_ctl", x, mean_ctl, sigma )
# Construct the background pdf
a0_ctl = RooRealVar( "a0_ctl", "a0_ctl", -0.1, -1, 1 )
a1_ctl = RooRealVar( "a1_ctl", "a1_ctl", 0.5, -0.1, 1 )
px_ctl = RooChebychev( "px_ctl", "px_ctl", x, RooArgList( a0_ctl, a1_ctl ) )
# Construct the composite model
f_ctl = RooRealVar( "f_ctl", "f_ctl", 0.5, 0., 1. )
model_ctl = RooAddPdf( "model_ctl", "model_ctl", RooArgList( gx_ctl, px_ctl ),
RooArgList( f_ctl ) )
# G e n e r a t e e v e n t s f o r b o t h s a m p l e s
# ---------------------------------------------------------------
# Generate 1000 events in x and y from model
data = model.generate( RooArgSet( x ), 100 )
data_ctl = model_ctl.generate( RooArgSet( x ), 2000 )
# C r e a t e i n d e x c a t e g o r y a n d j o i n s a m p l e s
# ---------------------------------------------------------------------------
# Define category to distinguish physics and control samples events
sample = RooCategory( "sample", "sample" )
sample.defineType( "physics" )
sample.defineType( "control" )
# Construct combined dataset in (x,sample)
combData = RooDataSet( "combData", "combined data", RooArgSet(x), RooFit.Index( sample ),
RooFit.Import( "physics", data ),
RooFit.Import( "control", data_ctl ) )
# C o n s t r u c t a s i m u l t a n e o u s p d f i n ( x , s a m p l e )
# -----------------------------------------------------------------------------------
# Construct a simultaneous pdf using category sample as index
simPdf = RooSimultaneous( "simPdf", "simultaneous pdf", sample )
# Associate model with the physics state and model_ctl with the control state
simPdf.addPdf( model, "physics" )
simPdf.addPdf( model_ctl, "control" )
# P e r f o r m a s i m u l t a n e o u s f i t
# ---------------------------------------------------
# Perform simultaneous fit of model to data and model_ctl to data_ctl
simPdf.fitTo( combData )
# P l o t m o d e l s l i c e s o n d a t a s l i c e s
# ----------------------------------------------------------------
# Make a frame for the physics sample
frame1 = x.frame( RooFit.Bins( 30 ), RooFit.Title( "Physics sample" ) )
# Plot all data tagged as physics sample
combData.plotOn( frame1, RooFit.Cut( "sample==sample::physics" ) )
# Plot "physics" slice of simultaneous pdf.
# NBL You _must_ project the sample index category with data using ProjWData
# as a RooSimultaneous makes no prediction on the shape in the index category
# and can thus not be integrated
simPdf.plotOn( frame1, RooFit.Slice( sample, "physics" ),
#.........这里部分代码省略.........
示例7: RooRealVar
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
#print "without NormSet"
#print "iLeft: ", iLeft.getVal()
#print "iTotal: ", iTotal.getVal()
n_total_evaluate = nGauss11.getVal() / iLeft.getVal()
print "n_total_evaluate: ", n_total_evaluate
#gauss11_ext.plotOn(xframe7,RooFit.Normalization( n_total_evaluate , RooAbsReal.NumEvent), RooFit.Range("whole_range"), RooFit.LineColor(RooFit.kRed))
#gauss11_ext.plotOn(xframe7,RooFit.Normalization( nGauss11.getVal() , RooAbsReal.NumEvent), RooFit.Range("whole_range"), RooFit.LineColor(RooFit.kRed))
gauss11_ext.plotOn(xframe7,RooFit.Normalization( nGauss11.getVal() , RooAbsReal.NumEvent), RooFit.Range("left_gaussian_range"), RooFit.LineColor(RooFit.kRed))
#gauss11_ext.plotOn(xframe7,RooFit.Normalization( nGauss11.getVal() , RooAbsReal.NumEvent), RooFit.Range("whole_range"), RooFit.LineColor(RooFit.kRed),RooFit.DrawOption("F"), RooFit.FillColor(RooFit.kRed), RooFit.FillStyle(1001) )
#data3.plotOn(xframe7)
data3_half.plotOn(xframe7)
#gauss11.plotOn(xframe7,RooFit.LineColor(RooFit.kRed))
# -------------------------------------------
# 8. use combined PDF to fit SB only and test fixAddCoefRange
xframe8 = x.frame(RooFit.Title("8. use combined PDF to fit SB only and test fixAddCoefRange"))
# gauss 12
mean12 = RooRealVar("mean12","mean of gaussian",-1,-10,10)
sigma12 = RooRealVar("sigma12","width of gaussian",2,0.1,10)
gauss12 = RooGaussian("gauss12","gaussian PDF",x,mean12,sigma12)
# gauss 13
示例8: FitMassPoint
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
def FitMassPoint(filename, massin, massmin, massmax, rwCPS=1, nbins=50):
### take the input tree from the file
inputFile = ROOT.TFile(filename);
tree = inputFile.Get("WJet");
print "Lineshape Higgs mass --> n entries: ", tree.GetEntries();
# RooFitting
rrv_mass = RooRealVar("rrv_mass","rrv_mass",massin,massmin,massmax);
rrv_weight = RooRealVar("rrv_weight","rrv_weight",0. ,10000000.);
rrv_mH1 = RooRealVar("rrv_mH1","rrv_mH1", massin, massmin, massmax );
rrv_gamma1 = RooRealVar("rrv_gamma1","rrv_gamma1",20.,0.,massmax);
rrv_mH2 = RooRealVar("rrv_mH2","rrv_mH2", massin, massmin, massmax )
rrv_gamma2 = RooRealVar("rrv_gamma2","rrv_gamma2",20.,0.,massmax)
rrv_mH3 = RooRealVar("rrv_mH3","rrv_mH3", massin, massmin, massmax );
rrv_gamma3 = RooRealVar("rrv_gamma3","rrv_gamma3",20.,0.,massmax);
rds_raw = RooDataSet("rds_raw","rds_raw",RooArgSet(rrv_mass,rrv_weight),RooFit.WeightVar(rrv_weight)); ## created the raw dataset --> raw lineshape
rds_cps = RooDataSet("rds_cps","rds_cps",RooArgSet(rrv_mass,rrv_weight),RooFit.WeightVar(rrv_weight)); ## create the cps dataset --> cps lineshape
rds_cps_intf = ROOT.RooDataSet("rds_cps_intf","rds_cps_intf",RooArgSet(rrv_mass,rrv_weight),RooFit.WeightVar(rrv_weight)); ## create the cps + interference dataset
model1_pdf = ROOT.RooRelBWRunningWidth("model1_pdf","model1_pdf",rrv_mass,rrv_mH1,rrv_gamma1); ## BWRunningWidth Pdf from the dedicated library
model2_pdf = ROOT.RooRelBWRunningWidth("model2_pdf","model2_pdf",rrv_mass,rrv_mH2,rrv_gamma2); ## BWRunningWidth Pdf from the dedicated library
model3_pdf = ROOT.RooRelBWRunningWidth("model3_pdf","model3_pdf",rrv_mass,rrv_mH3,rrv_gamma3); ## BWRunningWidth Pdf from the dedicated library
### loop on Higgs signal events
for i in range(tree.GetEntries()):
if i % 10000 == 0: print "reweighter, i: ", i;
tree.GetEntry(i);
curmass = getattr(tree,"W_H_mass_gen"); ## take the higgs generated mass inside the window; point not in the window are neglected
if curmass < massmax and curmass > massmin:
rrv_mass.setVal( curmass ); ## set the value of the RooRealVar
tmpweight_cps = getattr(tree,"complexpolewtggH"+str(massin))*rwCPS/getattr(tree,"avecomplexpolewtggH"+str(massin)); ## take the cps weight from the tree
tmpweight_cps_intf = getattr(tree,"complexpolewtggH"+str(massin))*rwCPS*getattr(tree,"interferencewtggH"+str(massin))/getattr(tree,"avecomplexpolewtggH"+str(massin)); ## cps*int
rds_raw.add( RooArgSet( rrv_mass ), 1. );
rds_cps.add( RooArgSet( rrv_mass ), tmpweight_cps );
rds_cps_intf.add( RooArgSet( rrv_mass ), tmpweight_cps_intf );
print ">>>>"
RooTrace.dump(ROOT.cout,ROOT.kTRUE);
RooTrace.mark();
print "<<<<"
#### final fit
model1_pdf.fitTo(rds_raw,RooFit.Save(1), RooFit.SumW2Error(kTRUE));
model1_pdf.fitTo(rds_raw,RooFit.Save(1), RooFit.SumW2Error(kTRUE), RooFit.Minimizer("Minuit2"));
model2_pdf.fitTo(rds_cps,RooFit.Save(1), RooFit.SumW2Error(kTRUE));
model2_pdf.fitTo(rds_cps,RooFit.Save(1), RooFit.SumW2Error(kTRUE), RooFit.Minimizer("Minuit2"));
model3_pdf.fitTo(rds_cps_intf,RooFit.Save(1), RooFit.SumW2Error(kTRUE));
model3_pdf.fitTo(rds_cps_intf,RooFit.Save(1), RooFit.SumW2Error(kTRUE), RooFit.Minimizer("Minuit2"));
## plot of the fits
mplot = rrv_mass.frame(RooFit.Title("mass plot"));
rds_raw.plotOn(mplot, RooFit.MarkerColor(kBlack), RooFit.LineColor(kBlack), RooFit.Binning(nbins,massmin,massmax), RooFit.DataError(RooAbsData.SumW2) );
rds_cps.plotOn(mplot, RooFit.MarkerColor(kRed), RooFit.LineColor(kRed), RooFit.Binning(nbins,massmin,massmax), RooFit.DataError(RooAbsData.SumW2) );
rds_cps_intf.plotOn(mplot, RooFit.MarkerColor(kBlue), RooFit.LineColor(kBlue), RooFit.Binning(nbins,massmin,massmax), RooFit.DataError(RooAbsData.SumW2) );
model1_pdf.plotOn(mplot, RooFit.LineColor(kBlack));
model2_pdf.plotOn(mplot, RooFit.LineColor(kRed), RooFit.LineStyle(2) );
model3_pdf.plotOn(mplot, RooFit.LineColor(kBlue), RooFit.LineStyle(3) );
rds_raw.plotOn(mplot, RooFit.MarkerColor(kBlack), RooFit.LineColor(kBlack), RooFit.Binning(nbins,massmin,massmax), RooFit.DataError(RooAbsData.SumW2) );
rds_cps.plotOn(mplot, RooFit.MarkerColor(kRed), RooFit.LineColor(kRed), RooFit.Binning(nbins,massmin,massmax), RooFit.DataError(RooAbsData.SumW2) );
rds_cps_intf.plotOn(mplot, RooFit.MarkerColor(kBlue), RooFit.LineColor(kBlue), RooFit.Binning(nbins,massmin,massmax), RooFit.DataError(RooAbsData.SumW2) );
print "rds_raw.sumEntries() = ", rds_raw.sumEntries()
print "model1_pdf: mH = ", rrv_mH1.getVal(), ", gamma = ", rrv_gamma1.getVal();
print "rds_cps.sumEntries() = ", rds_cps.sumEntries()
print "model2_pdf: mH = ", rrv_mH2.getVal(), ", gamma = ", rrv_gamma2.getVal();
print "rds_cps_intf.sumEntries() = ", rds_cps_intf.sumEntries()
print "model3_pdf: mH = ", rrv_mH3.getVal(), ", gamma = ", rrv_gamma3.getVal();
dummy_h1 = ROOT.TH1F("dummy_h1","dummy_h1",1,0,1);
dummy_h1.SetMarkerColor( ROOT.kBlack );
dummy_h2 = ROOT.TH1F("dummy_h2","dummy_h2",1,0,1);
dummy_h2.SetMarkerColor( ROOT.kRed );
dummy_h3 = ROOT.TH1F("dummy_h3","dummy_h3",1,0,1);
dummy_h3.SetMarkerColor( ROOT.kBlue );
L = TLegend(0.65,0.60,0.93,0.85);
L.SetFillStyle(0);
L.AddEntry(dummy_h1,"Powheg","p");
L.AddEntry(dummy_h2,"w/CPS weight","p");
L.AddEntry(dummy_h3,"w/CPS,Intf weight","p");
can2 = ROOT.TCanvas("can2","can2",800,800);
mplot.Draw();
L.Draw();
#.........这里部分代码省略.........
示例9: alpha
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
#.........这里部分代码省略.........
# 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)
##############################
# #
# Yu-hsiang test region #
# #
##############################
# test it in the channel "XZhnnb"
print "the channel is", channel
if channel == "XZhnnb":
# -------------------------------------------------------------------
# draw the setVjet
Jmass_frame = J_mass.frame(RooFit.Title("test frame"))
setVjet.plotOn(Jmass_frame)
# -------------------------------------------------------------------
# use a PDF to fit the dataset
print "fitFuncVjet is", fitFuncVjet
constVjet_value_initial = -0.020
offsetVjet_value_initial = 30.
widthVjet_value_initial = 100.
constVjet_test = RooRealVar("constVjet_test", "slope of the exp", constVjet_value_initial , -1., 0.)
offsetVjet_test = RooRealVar("offsetVjet_test", "offset of the erf", offsetVjet_value_initial, -50., 200.)
widthVjet_test = RooRealVar("widthVjet_test", "width of the erf", widthVjet_value_initial, 1., 200.)
modelVjet_test = RooErfExpPdf("modelVjet_test", "error function for V+jets mass", J_mass, constVjet_test, offsetVjet_test, widthVjet_test)
# constVjet_test.Print()
# offsetVjet_test.Print()
# widthVjet_test.Print()
# constVjet_test.setConstant(True)
# offsetVjet_test.setConstant(True)
# widthVjet_test.setConstant(True)
frVjet_test = modelVjet_test.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))
# constVjet_test.Print()
# offsetVjet_test.Print()
# widthVjet_test.Print()
constVjet_value_fit_MC = constVjet_test.getVal()
offsetVjet_value_fit_MC = offsetVjet_test.getVal()
widthVjet_value_fit_MC = widthVjet_test.getVal()
示例10: getattr
# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import plotOn [as 别名]
if (getattr(treeIn,"categories")==1 or getattr(treeIn,"categories")==3) and getattr(treeIn,"mZZ")> rrv_mass_lvj.getMin() and getattr(treeIn,"mZZ")<rrv_mass_lvj.getMax() and tmp_jet_mass>=65 and tmp_jet_mass<=105 and options.category == "HP" :
isGoodEvent = 1 ;
if (getattr(treeIn,"categories")==0 or getattr(treeIn,"categories")==2) and getattr(treeIn,"mZZ")> rrv_mass_lvj.getMin() and getattr(treeIn,"mZZ")<rrv_mass_lvj.getMax() and tmp_jet_mass>=65 and tmp_jet_mass<=130 and options.category == "LP" :
isGoodEvent = 1 ;
if isGoodEvent == 1:
### weigh MC events
tmp_event_weight = getattr(treeIn,"weight")*luminosity;
rrv_mass_lvj.setVal(getattr(treeIn,"mZZ"));
rdataset4fit_mlvj.add(RooArgSet(rrv_mass_lvj),tmp_event_weight/tmp_scale_to_lumi);
### signal over convolution plot
mplot_sig = rrv_mass_lvj.frame(RooFit.Title(""),RooFit.Bins(rrv_mass_lvj.getBins()));
rdataset4fit_mlvj.plotOn(mplot_sig,RooFit.Name("data_invisible"),RooFit.MarkerSize(1.5),RooFit.DataError(RooAbsData.SumW2), RooFit.XErrorSize(0));
doubleCB_sig = ROOT.RooDoubleCrystalBall("DoubleCB_BulkG_WW_mlvj","DoubleCB_BulkG_WW_mlvj",rrv_mass_lvj,rrv_mean_CB,rrv_total_sigma_CB,rrv_alpha1_CB,rrv_n1_CB,rrv_alpha2_CB,rrv_n2_CB);
bw_sig = RooBreitWigner("bw_"+options.channel,"bw_"+options.channel,rrv_mass_lvj,rrv_total_mean_CB,rrv_width_BW);
original_bin = rrv_mass_lvj.getBins();
rrv_mass_lvj.setBins(1000,"cache");
model_pdf_sig = RooFFTConvPdf("sig_xww_%s_%s"%(options.channel,options.category),"sigxww_%s_%s"%(options.channel,options.category),rrv_mass_lvj,bw_sig,doubleCB_sig);
model_pdf_sig.setBufferFraction(1.0);
rrv_mass_lvj.setBins(int(original_bin));
model_pdf_sig.plotOn(mplot_sig,RooFit.Name("total_MC"),RooFit.Normalization((rrv_number_signal.getVal()/tmp_scale_to_lumi)/(6.25*rdataset4fit_mlvj.sumEntries())),RooFit.DrawOption("L"), RooFit.LineColor(kBlue), RooFit.VLines(),RooFit.LineWidth(2),RooFit.LineStyle(1));
mplot_pull = get_pull(rrv_mass_lvj,mplot_sig);
mplot_sig.GetYaxis().SetRangeUser(0.,mplot_sig.GetMaximum()*1.2);