18t = ROOT.RooRealVar(
"t",
"time", -1., 15.)
19cosa = ROOT.RooRealVar(
"cosa",
"cos(alpha)", -1., 1.)
23tau = ROOT.RooRealVar(
"tau",
"#tau", 1.5)
24deltaGamma = ROOT.RooRealVar(
"deltaGamma",
"deltaGamma", 0.3)
25tm = ROOT.RooTruthModel(
"tm",
"tm", t)
26coshGBasis = ROOT.RooFormulaVar(
28 "exp(-@0/ @1)*cosh(@0*@2/2)",
33sinhGBasis = ROOT.RooFormulaVar(
35 "exp(-@0/ @1)*sinh(@0*@2/2)",
40coshGConv = tm.convolution(coshGBasis, t)
41sinhGConv = tm.convolution(sinhGBasis, t)
44poly1 = ROOT.RooPolyVar(
49 ROOT.RooFit.RooConst(0.5),
50 ROOT.RooFit.RooConst(0.2),
51 ROOT.RooFit.RooConst(0.2)),
53poly2 = ROOT.RooPolyVar(
"poly2",
"poly2", cosa, ROOT.RooArgList(
54 ROOT.RooFit.RooConst(1), ROOT.RooFit.RooConst(-0.2), ROOT.RooFit.RooConst(3)), 0)
57ampl1 = ROOT.RooProduct(
"ampl1",
"amplitude 1",
58 ROOT.RooArgList(poly1, coshGConv))
59ampl2 = ROOT.RooProduct(
"ampl2",
"amplitude 2",
60 ROOT.RooArgList(poly2, sinhGConv))
66f1 = ROOT.RooRealVar(
"f1",
"f1", 1, 0, 2)
67f2 = ROOT.RooRealVar(
"f2",
"f2", 0.5, 0, 2)
70pdf = ROOT.RooRealSumPdf(
"pdf",
"pdf", ROOT.RooArgList(
71 ampl1, ampl2), ROOT.RooArgList(f1, f2))
74data = pdf.generate(ROOT.RooArgSet(t, cosa), 10000)
83hh_cos = ampl1.createHistogram(
"hh_cos", t, ROOT.RooFit.Binning(
84 50), ROOT.RooFit.YVar(cosa, ROOT.RooFit.Binning(50)))
85hh_sin = ampl2.createHistogram(
"hh_sin", t, ROOT.RooFit.Binning(
86 50), ROOT.RooFit.YVar(cosa, ROOT.RooFit.Binning(50)))
87hh_cos.SetLineColor(ROOT.kBlue)
88hh_sin.SetLineColor(ROOT.kRed)
97ras_ampl1 = ROOT.RooArgSet(ampl1)
98pdf.plotOn(frame1, ROOT.RooFit.Components(ras_ampl1),
99 ROOT.RooFit.LineStyle(ROOT.kDashed))
100ras_ampl2 = ROOT.RooArgSet(ampl2)
101pdf.plotOn(frame1, ROOT.RooFit.Components(ras_ampl2), ROOT.RooFit.LineStyle(
102 ROOT.kDashed), ROOT.RooFit.LineColor(ROOT.kRed))
110pdf.plotOn(frame2, ROOT.RooFit.Components(ras_ampl1),
111 ROOT.RooFit.LineStyle(ROOT.kDashed))
112pdf.plotOn(frame2, ROOT.RooFit.Components(ras_ampl2), ROOT.RooFit.LineStyle(
113 ROOT.kDashed), ROOT.RooFit.LineColor(ROOT.kRed))
115c = ROOT.TCanvas(
"rf704_amplitudefit",
"rf704_amplitudefit", 800, 800)
118ROOT.gPad.SetLeftMargin(0.15)
119frame1.GetYaxis().SetTitleOffset(1.4)
122ROOT.gPad.SetLeftMargin(0.15)
123frame2.GetYaxis().SetTitleOffset(1.4)
126ROOT.gPad.SetLeftMargin(0.20)
127hh_cos.GetZaxis().SetTitleOffset(2.3)
130ROOT.gPad.SetLeftMargin(0.20)
131hh_sin.GetZaxis().SetTitleOffset(2.3)
134c.SaveAs(
"rf704_amplitudefit.png")