<jupyter_start><jupyter_text>Relativistic kinematics Learning goals    Relativistic kinematics.    Standard model particles. BackgroundIf you know the mass of a particle, most of the time you know what that particle is. However, there is no way to just build a single detector that gives you the mass. You need to be clever and make use of Special relativity, specifically relativistic kinematics.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*} Let's code!Here is some sample code that reads in data from a small sample file from the CMS experiment. It loops over data from many different proton-proton collisions. If you haven't already, you will want to go through the [data model](https://github.com/particle-physics-playground/playground/blob/master/activities/codebkg_DataInterfacing.ipynb) (also included when you cloned this directory) exercise so you know how to pull out the relevant information. For each collision, you can get the 4-momenta of the jets, muons, electrons, and photons produced in these collisions.<jupyter_code>%matplotlib notebook
import pandas as pd
import tools.cms as cms
import h5py

filename = './data/dimuons_1000_collisions.hdf5'
filehandler = h5py.File(filename, 'r')

print("Keys: ")
for i, key in enumerate(filehandler.keys(), 1):
    print(f"{i:>2d}. {key}")

filehandler["datasets_and_counters"][()]<jupyter_output><empty_output><jupyter_text>Challenge!Copy this sample code and use it to calculate the mass of the muons. Make a histogram of this quantity. Hint!Make sure you do this for all the muons! Each collision can produce differing numbers of muons, so take care when you code this up. Your histogram should look something like the following sketch, though the peak will be at different values. The value of the peak, should be the mass of the particle Check your answer! You should also make histograms of the energy and magnitude of momentum ($|p|$). You should see a pretty wide range of values for these, and yet the mass is a very specific number.<jupyter_code>from IPython.display import Image
Image(filename='images/muons_sketch.jpeg')
# Your code here<jupyter_output><empty_output><jupyter_text>Suppose we didn't know anything about special relativity and we tried calculating the mass from what we know about classical physics. $$KE = \frac{1}{2}mv^2 \qquad KE = \frac{p^2}{2m} \qquad m = \frac{p^2}{2KE}$$Let's interpret the energy from the CMS data as the kinetic energy ($KE$). Use classical mechanics then to calculate the mass of the muon, given the energy/KE and the momentum. What does that histogram look like?*Your histogram should not look like the last one! We know that the Classical description of kinematics is not accurate for particle moving at high energies, so don't worry if the two histograms are different. That's the point!  :)*<jupyter_code># Your code here<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08140985651902682, 'fraction_numerical': 0.006862133499688085, 'mean_word_length': 5.227184466019417, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '34344', 'license': 'MIT', 'n_tokens_mistral': 918, 'n_tokens_neox': 860, 'n_words': 433, 'path': 'week-2/3-data-visualization/3. CMS Histgrams/B. CMS Muons.ipynb', 'repo_name': 'PCPUNMSM/Summer-School-2020', 'size': '3206'}