PyROOT Exercise 1: Histogram Drawing

Exercise

Write a python macro ExerciseHist.py.

  1. Open the Zmumu.root file and load the tree called physics.
  2. Create two histograms with 40 bins ranging from 0 to 0.2 GeV to plot the muon masses.
  3. Fill the histograms with leading and subleading muon mass from branches lep1_m and lep2_m.
  4. Calculate the mean values and RMSs.
  5. Calculate the integrals.

Bonus questions:

  1. Are the integrals the same and why?
  2. Write the histogram to a file.

Solution