Hello,
I wrote a script that creates TProfile and then draw them in the same canvas. I’m putting here only the plotting-related part of the code:
errors_vs_mu_B0 = TProfile("Errors_vs_mu_B0", "", x_max, 0, x_max)
errors_vs_mu_B1 = TProfile("Errors_vs_mu_B1", "", x_max, 0, x_max)
errors_vs_mu_B2 = TProfile("Errors_vs_mu_B2", "", x_max, 0, x_max)
for i in dd_B0.values():
errors_vs_mu_B0.Fill(i[0], i[1])
for i in dd_B1.values():
errors_vs_mu_B1.Fill(i[0], i[1])
for i in dd_B2.values():
errors_vs_mu_B2.Fill(i[0], i[1])
outfile = TFile ("output.root", "UPDATE")
gROOT.cd()
c1 = TCanvas()
c1.SetName("prova")
errors_vs_mu_B0.GetXaxis().SetRangeUser(0.,80)
errors_vs_mu_B0.GetXaxis().SetTitle("<# interactions/event>")
errors_vs_mu_B0.GetYaxis().SetTitle("# errors/event/module")
errors_vs_mu_B0.SetLineColor(kBlue)
errors_vs_mu_B1.SetLineColor(kBlack)
errors_vs_mu_B2.SetLineColor(kRed)
errors_vs_mu_B0.Draw()
errors_vs_mu_B1.Draw("same")
errors_vs_mu_B2.Draw("same")
c1.Draw()
c1.Modified()
c1.Update()
outfile.Append(c1)
outfile.Write()
The problem is that only the last two TProfile are drawn, so errors_vs_mu_B1 and errors_vs_mu_B2, not errors_vs_mu_B0. It’s a bit strange, probably I’m missing something. I also checked that the object are correctly created, so I’m suspecting that the problem is really related only to the plotting.
Let me know if you need further informations.
Thanks!