Hello there!
I have two files, nu.root and mu.root. Each one of these files has a tree called tree, with a leaf called energy. I want to make three different histograms: one for the energy distribution of muons (mu.root), one for the energy distribution of neutrinos (nu.root) and one for the energy distribution of both muons and neutrinos.
The plots must have 10 bins and the energies are between 10 and 200 GeV.
I have tried something like this:
NAMES=["(nu.root", "nu.pdf"), ("mu.root", "mu.pdf")]
for tuple in NAMES:
f=ROOT.TFile(tuple[0])
tree=f.Get("tree")
c1=TCanvas("canvas")
hevts = ROOT.TH1D("hevts", "events", 10, 10, 200)
tree.Draw("energy >> hevts")
c1.Draw()
c1.SaveAs(tuple[1])
c1.Delete()
f.Close()
This should make both the muon and the neutrino histograms, but I don’t know how to do one single histogram with the two data combined…
Suggestions are welcome!