import ROOT
dt = ROOT.RooRealVar("dt", "dt", -20, 20)
dm = ROOT.RooRealVar("dm", "dm", 0.472)
tau = ROOT.RooRealVar("tau", "tau", 1.547)
w = ROOT.RooRealVar("w", "mistag rate", 0.1)
dw = ROOT.RooRealVar("dw", "delta mistag rate", 0.)
mixState = ROOT.RooCategory("mixState", "B0/B0bar mixing state")
mixState.defineType("mixed", -1)
mixState.defineType("unmixed", 1)
tagFlav = ROOT.RooCategory("tagFlav", "Flavour of the tagged B0")
tagFlav.defineType("B0", 1)
tagFlav.defineType("B0bar", -1)
dterr = ROOT.RooRealVar("dterr", "dterr", 0.1, 1.0)
bias1 = ROOT.RooRealVar("bias1", "bias1", 0)
sigma1 = ROOT.RooRealVar("sigma1", "sigma1", 0.1)
gm1 = ROOT.RooGaussModel("gm1", "gauss model 1", dt, bias1, sigma1)
bmix = ROOT.RooBMixDecay("bmix", "decay", dt, mixState, tagFlav,
tau, dm, w, dw, gm1, ROOT.RooBMixDecay.DoubleSided)
data = bmix.generate(ROOT.RooArgSet(dt, mixState, tagFlav), 2000)
tbins = ROOT.RooBinning(-15, 15)
tbins.addUniform(60, -15, 0)
tbins.addUniform(15, 0, 15)
dtframe = dt.frame(ROOT.RooFit.Range(-15, 15),
ROOT.RooFit.Title("dt distribution with custom binning"))
data.plotOn(dtframe, ROOT.RooFit.Binning(tbins))
bmix.plotOn(dtframe)
abins = ROOT.RooBinning(-10, 10)
abins.addBoundary(0)
abins.addBoundaryPair(1)
abins.addBoundaryPair(2)
abins.addBoundaryPair(3)
abins.addBoundaryPair(4)
abins.addBoundaryPair(6)
aframe = dt.frame(ROOT.RooFit.Range(-10, 10), ROOT.RooFit.Title(
"mixState asymmetry distribution with custom binning"))
data.plotOn(aframe, ROOT.RooFit.Asymmetry(
mixState), ROOT.RooFit.Binning(abins))
bmix.plotOn(aframe, ROOT.RooFit.Asymmetry(mixState))
aframe.SetMinimum(-1.1)
aframe.SetMaximum(1.1)
c = ROOT.TCanvas("rf108_plotbinning", "rf108_plotbinning", 800, 400)
c.Divide(2)
c.cd(1)
ROOT.gPad.SetLeftMargin(0.15)
dtframe.GetYaxis().SetTitleOffset(1.6)
dtframe.Draw()
c.cd(2)
ROOT.gPad.SetLeftMargin(0.15)
aframe.GetYaxis().SetTitleOffset(1.6)
aframe.Draw()
c.SaveAs("rf108_plotbinning.png")