19t = ROOT.RooRealVar(
"t",
"time", -1., 15.)
20cosa = ROOT.RooRealVar(
"cosa",
"cos(alpha)", -1., 1.)
24tau = ROOT.RooRealVar(
"tau",
"#tau", 1.5)
25deltaGamma = ROOT.RooRealVar(
"deltaGamma",
"deltaGamma", 0.3)
26tm = ROOT.RooTruthModel(
"tm",
"tm", t)
27coshGBasis = ROOT.RooFormulaVar(
29 "exp(-@0/ @1)*cosh(@0*@2/2)",
34sinhGBasis = ROOT.RooFormulaVar(
36 "exp(-@0/ @1)*sinh(@0*@2/2)",
41coshGConv = tm.convolution(coshGBasis, t)
42sinhGConv = tm.convolution(sinhGBasis, t)
45poly1 = ROOT.RooPolyVar(
50 ROOT.RooFit.RooConst(0.5),
51 ROOT.RooFit.RooConst(0.2),
52 ROOT.RooFit.RooConst(0.2)),
54poly2 = ROOT.RooPolyVar(
"poly2",
"poly2", cosa, ROOT.RooArgList(
55 ROOT.RooFit.RooConst(1), ROOT.RooFit.RooConst(-0.2), ROOT.RooFit.RooConst(3)), 0)
58ampl1 = ROOT.RooProduct(
"ampl1",
"amplitude 1",
59 ROOT.RooArgList(poly1, coshGConv))
60ampl2 = ROOT.RooProduct(
"ampl2",
"amplitude 2",
61 ROOT.RooArgList(poly2, sinhGConv))
67f1 = ROOT.RooRealVar(
"f1",
"f1", 1, 0, 2)
68f2 = ROOT.RooRealVar(
"f2",
"f2", 0.5, 0, 2)
71pdf = ROOT.RooRealSumPdf(
"pdf",
"pdf", ROOT.RooArgList(
72 ampl1, ampl2), ROOT.RooArgList(f1, f2))
75data = pdf.generate(ROOT.RooArgSet(t, cosa), 10000)
84hh_cos = ampl1.createHistogram(
"hh_cos", t, ROOT.RooFit.Binning(
85 50), ROOT.RooFit.YVar(cosa, ROOT.RooFit.Binning(50)))
86hh_sin = ampl2.createHistogram(
"hh_sin", t, ROOT.RooFit.Binning(
87 50), ROOT.RooFit.YVar(cosa, ROOT.RooFit.Binning(50)))
88hh_cos.SetLineColor(ROOT.kBlue)
89hh_sin.SetLineColor(ROOT.kRed)
98ras_ampl1 = ROOT.RooArgSet(ampl1)
99pdf.plotOn(frame1, ROOT.RooFit.Components(ras_ampl1),
100 ROOT.RooFit.LineStyle(ROOT.kDashed))
101ras_ampl2 = ROOT.RooArgSet(ampl2)
102pdf.plotOn(frame1, ROOT.RooFit.Components(ras_ampl2), ROOT.RooFit.LineStyle(
103 ROOT.kDashed), ROOT.RooFit.LineColor(ROOT.kRed))
111pdf.plotOn(frame2, ROOT.RooFit.Components(ras_ampl1),
112 ROOT.RooFit.LineStyle(ROOT.kDashed))
113pdf.plotOn(frame2, ROOT.RooFit.Components(ras_ampl2), ROOT.RooFit.LineStyle(
114 ROOT.kDashed), ROOT.RooFit.LineColor(ROOT.kRed))
116c = ROOT.TCanvas(
"rf704_amplitudefit",
"rf704_amplitudefit", 800, 800)
119ROOT.gPad.SetLeftMargin(0.15)
120frame1.GetYaxis().SetTitleOffset(1.4)
123ROOT.gPad.SetLeftMargin(0.15)
124frame2.GetYaxis().SetTitleOffset(1.4)
127ROOT.gPad.SetLeftMargin(0.20)
128hh_cos.GetZaxis().SetTitleOffset(2.3)
131ROOT.gPad.SetLeftMargin(0.20)
132hh_sin.GetZaxis().SetTitleOffset(2.3)
135c.SaveAs(
"rf704_amplitudefit.png")