Track equations for muons

Charged tracks in a uniform magnetic field in the barrel geometry follow the track equations:

\[\phi(r) = \phi_{0} - \sin^{-1}\left(\frac{r}{2R}\right)\] \[z(r) = z_{0} + \cot{\theta} \left[2R \sin^{-1}\left(\frac{r}{2R}\right)\right]\]

where $R = \frac{p_{\mathrm{T}}}{0.003 B}$, $R$ and $r$ are in cm and $B$ is the magnetic field in Tesla. The constant 0.003 is the speed of light multiplied by the necessary conversion factors. A muon with $p_{\mathrm{T}} = 2~\text{GeV}$ in the CMS experiment ($B = 3.8~\text{T}$) has $R = 1.75~\text{m}$.

In the endcap geometry, the track equations are:

\[\phi(z) = \phi_{0} + \frac{z - z_{0}}{2R \cot{\theta}}\] \[r(z) = \left|2R \sin\left( \frac{z - z_{0}}{2R \cot{\theta}} \right) \right|\]

where $R \cot{\theta} = \frac{p_{\mathrm{z}}}{0.003 B}$, $z$ is in cm. By the way, $\cot{\theta}$ can be easily calculated from $\eta$ via the equation $\cot{\theta} = \sinh(\eta)$.

When considering a vertex-unconstrained fit, with transverse impact parameter $d_{0} \neq 0$, the $\phi_{r}$ equation becomes:

\[\begin{align*} \sin(\phi - \phi_{0}) &= -\frac{r}{2R} \frac{\left(1-{d_{0}}^2/r^2\right)}{\left(1 + d_{0}/R\right)} - \frac{d_{0}}{r} \\ &\approx -\frac{r}{2R} - \frac{d_{0}}{r} \end{align*}\]

For the endcap muon trigger in CMS, one has to take into account several considerations:

  • Detector planes perpendicular (instead of parallel) to the solenoid magnetic field;
  • Significant multiple scattering;
  • Significant energy loss;
  • Neutron background;
  • Non-uniform magnetic field, including a non-zero radial component.

Grid tools on UF HiPerGator

Recently I moved my codes to the UF HiPerGator machines (also referred to as the HPC machines) which are running RHEL 7. Info about HiPerGator can be found on:

One issue that I ran into was that the grid tools used by CMS, e.g. voms-proxy-*, uberftp, gfal-copy, globus-url-copy, etc, are not automatically set up. To get them working, I got the following instructions from Bockjoo Kim:

source /cvmfs/oasis.opensciencegrid.org/osg-software/osg-wn-client/current/el7-x86_64/setup.sh
export X509_CERT_DIR=/cvmfs/cms.cern.ch/grid/etc/grid-security/certificates
export X509_VOMS_DIR=/cvmfs/cms.cern.ch/grid/etc/grid-security/vomsdir
export VOMS_USERCONF=/cvmfs/cms.cern.ch/grid/etc/vomses

Jupyter notebook code indentation

The Jupyter notebook code indentation is 4 spaces by default. It can be configured as documented here. Basically, to change it to 2 spaces, look for the file ~/.jupyter/nbconfig/notebook.json. If the directory or the file doesn’t exist, create them. Then edit the file to add the following:

{
  "CodeCell": {
    "cm_config": {
      "indentUnit": 2
    }
  }
}

(Tested on Jupyter 4.4.0.)


Running CMSSW with Docker

Trying to install CMSSW in an OS that is not officially supported (e.g. Mac OS, Arch Linux, etc) can be very difficult. It’s possible to run a virtual machine with Scientific Linux or CentOS as the guest OS instead. But there is also a more lightweight solution, which is to use a Docker container.

The official Docker images provided by ‘cmssw’ are huge (5-10 GB). Apparently there is a different Docker image that you can use, which is provided by ‘hepsw’, and is smaller (~200 MB). You can find the Dockerfiles used to build the images at https://github.com/cms-sw/cms-docker (for ‘cmssw’) and at https://github.com/hepsw/docks (for ‘hepsw’).

The following instructions should provide a functional CMSSW environment using the hepsw/cvmfs-cms image (tested on Linux Mint 18 as the host OS). Note that the image is based on slc-6.

# Install Docker from the repository
sudo apt install docker.io

# Load the Docker image
# '--privileged' option is required because of FUSE
sudo systemctl start docker
sudo docker run -h dev --privileged -i -t hepsw/cvmfs-cms

Once the image is loaded, you should be in the interactive session in the guest OS. To setup CMSSW:

yum install -y glibc glibc-headers glibc-devel.x86_64

export SCRAM_ARCH=slc6_amd64_gcc700
scramv1 project CMSSW CMSSW_10_4_0
cd CMSSW_10_4_0/src
eval `scramv1 runtime -sh`
scram b

To disable the annoying fastestmirror plugin for yum, open the file /etc/yum/pluginconf.d/fastestmirror.conf, and change enabled=1 to enabled=0.