<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Looking at the dimuon spectrum over a wide energy range
<h3>Learning goals</h3>
<ul>
    <li>Relativistic kinematics.
    <li>Mesons.
</ul>
<b>Background</b>
To determine the mass ($m$) of a particle you need to know the 4-momenta of the particles ($\mathbf{P}$) that are detected after the collision
Step1:  <h2><font color="red">Challenge!</font></h2>
Use the sample code to find the mass of the particle that the two muons came from (parent particle). 
To do this, you will need to loop over all pairs of muons for each collision, sum their 4-momenta (energy, px, py, and pz) and then use that to calculate the invariant mass. 
Do this for all possible pairs and in addition, break it down so that you calculate the invariant mass for the cases where
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import matplotlib.pylab as plt
%matplotlib notebook
import h5hep 
import pps_tools as hep
from file_download_tools import download_file
infile = "../data/dimuons_1000_collisions.hdf5"
print("Reading in the data....")
collisions = hep.get_collisions(infile,experiment='CMS',verbose=False)
    
print(len(collisions)) 
Explanation: Looking at the dimuon spectrum over a wide energy range
<h3>Learning goals</h3>
<ul>
    <li>Relativistic kinematics.
    <li>Mesons.
</ul>
<b>Background</b>
To determine the mass ($m$) of a particle you need to know the 4-momenta of the particles ($\mathbf{P}$) that are detected after the collision: the energy ($E$), the momentum in the x direction ($p_x$), the momentum in the y direction ($p_y$), the momentum in the z direction ($p_z$).
$$\mathbf{P} = (E,p_x,p_y,p_z)$$
\begin{equation} m = \sqrt{E^2-(p_x^2+p_y^2 + p_z^2)} \end{equation}
Some particles are very unstable and decay (turn into) to two or more other particles. In fact, they can decay so quickly, that they never interact with your detector! Yikes!
However, we can reconstruct the parent particle (sometimes referred to as <b>the initial state particle</b>) and its 4-momentum by adding the 4-momenta of the child particles (sometimes referred to as <b>the decay products</b>). 
$$\mathbf{P_{\rm parent}} = \mathbf{P_{\rm child 0}} + \mathbf{P_{\rm child 1}} + \mathbf{P_{\rm child 2}} + ...$$
which breaks down into...
$$E_{\rm parent} = E_{\rm child 0} + E_{\rm child 1} + E_{\rm child 2} + ...$$
$$p_{\rm x parent} = p_{\rm x child 0} + p_{\rm x child 1} + p_{\rm x child 2} + ...$$
$$p_{\rm y parent} = p_{\rm y child 0} + p_{\rm y child 1} + p_{\rm y child 2} + ...$$
$$p_{\rm z parent} = p_{\rm z child 0} + p_{\rm y child 1} + p_{\rm z child 2} + ...$$
<b>Let's code!</b>
Here is some very, very basic starter code. It reads in data from the CMS experiment. 
If you haven't already, you will want to go through the Data Interfacing model (also included when you cloned this directory) exercise so you know how to pull out the relevant information. 
In order to see the full physics of the dimuon system, we need a larger data file than the one used for the previous activity (this one has 100,000 collisions rather than 1,000). The code for doing so is shown below, but for more details on how to download other files, see the download more data exercise, also included in this repository.
End of explanation
from IPython.display import Image
Image(filename='images/dimuons_sketch.jpeg')
#your code here
Explanation: <h2><font color="red">Challenge!</font></h2>
Use the sample code to find the mass of the particle that the two muons came from (parent particle). 
To do this, you will need to loop over all pairs of muons for each collision, sum their 4-momenta (energy, px, py, and pz) and then use that to calculate the invariant mass. 
Do this for all possible pairs and in addition, break it down so that you calculate the invariant mass for the cases where:
* Both muons are positively charged.
* Both muons are negatively charged.
* The muons have opposite charges.
Be careful. Some collisions may have more than 2 muons, so write your code such that it calculates all possible pairs of muons in a given collisions. For example, if there are 3 muons in a collision, there are 3 possible pairs that you can make. 
<i>Hint!</i>
It is very likely that a particle exists where there is a peak in the data. However, this is not always true. 
A peak in the data is most likely the mass of a particle. You can look at the approximate mass to figure out which particle 
is found in the data.
Your histogram should look something like the following sketch. The value of the peaks should be the mass of a particle. You should be able to find two particles in their ground state. <a href="http://en.wikipedia.org/wiki/J/psi_meson">Check your answer for the first particle!</a> <a href="http://en.wikipedia.org/wiki/Upsilon_meson">Check your answer for the second particle!</a>
End of explanation
<END_TASK>