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