Telling particles apart
I built a small CMS-style detector in Geant4 and asked it which particle was which. It can tell an electron from a muon. It cannot tell a pion from a kaon, five different ways, and the reason is in the physics.
Paolo Minhas · Project 3 of the DAML course, School of Physics and Astronomy, University of Edinburgh
01The task and the detector
The starting point was the two-layer tracker from the Week 6 Geant4 workshop. Each layer is a thin cylinder that records where a charged particle crosses it. I wrapped it in a 50 cm electromagnetic calorimeter of lead tungstate and a 1.9 m hadronic calorimeter, both Geant4 cylinders with their own sensitive detector that sums the energy deposited per event. A 2 T magnetic field runs along the beam so that tracks bend.
Two more layers came later: a thin ring of air outside everything as a muon chamber, and, for the last part, a cylinder of water between the trackers and the calorimeters to make Cherenkov light. The aim was to identify particles from the pattern of layers that fire, with a 70% efficiency as the target.
Interactive
Fire a particle through the detector
Fire at the same momentum
An electron showers in the ECAL and stops there: nearly all its energy shows up in that one layer.
ECAL. The electromagnetic calorimeter, a 50 cm lead-tungstate cylinder. It sums the energy deposited per event.
What the simulation measured
Identified correctly 63% of the time (flat 0.2 to 20 GeV), and never below about 2 GeV.
What each layer does for each particle is textbook behaviour, not simulation output. The percentages come from the project notebook.
In plain English
02Reading momentum off a bent track
A charged particle in a magnetic field travels on a circle, and a bigger momentum means a flatter circle. With two tracker hits at 4 m and 8 m, the notebook turns the small difference in their azimuth angle, , into a momentum:
The lab below runs those lines. Its two presets are the real track pairs from event 6 of the first run, and it prints the notebook’s recorded angle beside the one the formula predicts.
Interactive
Bend a track, read the momentum
Plan view, drawn to scale. The dashed line is where the track would go with no field.
Start from
The simulation used 2 T.
- Transverse momentum
- 45.39 GeV
- Bending radius
- 75.7 m
- Sagitta at 8 m
- 10.6 cm
- Hit-to-hit angle Δφ
- 26.44 mrad
Against the notebook
The notebook recorded φ₁ = 2.61381, φ₂ = 2.58737, θ = 1.62829, so Δφ = 0.02644 rad; the formula above gives 0.02644 rad from the reconstructed 45.466 GeV. The reconstructed momentum is 45.466 GeV against a true 45.4997 GeV, a difference of -0.07%.
A track of transverse momentum bends on a circle of radius metres, so it can only get away from the centre. Reaching the outer tracker at 8 m therefore needs : 2.4 GeV in a 2.0 T field. This track gets there.
In the first run, a file of lepton pairs with each lepton near 45.5 GeV, I paired hits in the two trackers by their polar angle and ran the formulas. Track pairs were found in 511 of the 2,000 events, and for most of them the rebuilt momentum is within about half a percent of the truth.
03A beam that was too tidy
My first attempt at identification used that same file. A hand-written rule on the calorimeter share and the track momentum labelled 447 track pairs electrons, 397 muons and 58 photons, and left 378 unknown, against truth labels of 818, 443 and 19. That is not usable, and I put it down to the data rather than the rule: every lepton was near 45.5 GeV, so there was no energy dependence to study.
So I swapped the HepMC file reader for Geant4’s general particle source. A short macro fires one particle type from the centre, isotropically, with energies spread flat between 200 MeV and 20 GeV. That made the rest of the project possible: efficiency could now be measured as a function of energy.
04Electrons and muons
The first run of the new setup had electrons, muons and antimuons, 2,000 events in all. The rule was a single line: more than 1 GeV in the ECAL means electron, otherwise muon. An electron showers in the ECAL and leaves almost all its energy there; a muon passes through and leaves very little.
Real results
Electron or muon?
Which detectors the decision may use
The rule: over 1 GeV in the ECAL means electron.
Everything below 1 GeV is called a muon, which is why muons look good.
The white tick is the 70% target set for the project. 2000 simulated events, energies flat between 0.2 and 20 GeV.
Muons look good because they are the default answer: anything that deposits under 1 GeV is called one. Electrons are the honest test, and at 63% they miss the 70% target. By energy the picture is stark: no electron below about 2 GeV is identified at all, and the efficiency only crosses 70% near 10 GeV.
The muon chamber is the obvious fix for the muon side. A hit in the outer air layer, together with a track, means the particle got through everything, so any hit overrides the ECAL and calls it a muon. Muon identification rises from 85% to 94%, overall from 74% to 79%, and electrons do not change, because the chamber has nothing to say about them. Most of the gain is above about 5 GeV.
05Pions and kaons
An electron and a muon look nothing alike to a calorimeter. A pion and a kaon do. Both are hadrons, both shower in the HCAL, and at the same momentum they carry similar energy. The project’s later question was whether the calorimeters alone could separate them.
The first rule used the share of the energy in the HCAL: above 0.5 means kaon. The 0.5 was a placeholder. It gave 84% for pions and 17% for kaons, 0.507 overall. The pion figure looks respectable. It is not:
Here is why. Pions and kaons both split into two groups, those that stop early (HCAL share near 0) and those that punch through (near 1), and the two histograms lie on top of each other. A cut can only separate what differs, and nothing in this plot does.
The next step, as the course suggested, was machine learning. I trained a gradient-boosted classifier on four inputs (ECAL deposit, HCAL deposit, the HCAL share of the total, and the total). Its test accuracy was 0.487, a little worse than the cut’s 0.507. A classifier cannot find structure that is not in its inputs.
06The Cherenkov idea
The standard answer in real experiments, ALICE and LHCb among them, is a ring-imaging Cherenkov detector. A charged particle moving faster than light does in a medium emits a cone of light, and the cone’s opening angle depends on speed. Momentum comes from the track curvature, speed from the ring, and a pion and a kaon of the same momentum have different masses, so different speeds.
I modelled it with water as the radiator (refractive index 1.33, a 10 m absorption length across four photon energies from 2 to 3.5 eV) and an air layer outside it where photons are counted. The water is not sensitive; the particles interact with it as they would in real life, and the photons are recorded afterwards. A first version of this detector wrote an empty output file, and the data used below come from the version that works.
The notebook's formulas, live
Why a water RICH can't separate high-momentum kaons
With the pion starts to radiate at 0.16 GeV and the kaon at 0.56 GeV. Both angles then climb towards the same limit, , because at high momentum a pion and a kaon are both travelling at almost the speed of light.
Show
- Pion
- 41.1°
- Kaon
- 38.9°
- Difference
- 2.16°
Kaons and pions can be told apart by angle from 0.56 GeV up to about 2.7 GeV. If the beam is flat in momentum from 0.2 to 20 GeV, as the macros set it up, that window holds about 11% of the particles. Between 0.16 and 0.56 GeV pions glow and kaons stay dark, another 1.8%. The rest sits where the two rings are the same ring.
The lab says something uncomfortable. A water RICH separates kaons from pions in a window from the kaon’s threshold of 0.56 GeV up to a few GeV, and the beam I used runs flat to 20 GeV. Most of the kaons were never in the window.
07What the RICH returned
The rules I tried were simple: more than 5 photons in the RICH means pion, otherwise kaon, with the HCAL share as the fallback for the combined version. The summary below is from 500 pions and 500 kaons.
| Rule | Pions | Kaons | Overall |
|---|---|---|---|
| HCAL share only | 0.852 | 0.146 | 0.499 |
| RICH photons only | 0.640 | 0.324 | 0.482 |
| RICH, then HCAL | 0.962 | 0.040 | 0.501 |
Every overall figure is about one half, and in every row the pion and kaon columns add up to about 1. Put side by side, the seven classifiers of this project look like this:
Arithmetic on the notebook's numbers
How much does each classifier actually know?
Add a classifier’s efficiency for one species to its efficiency for the other and subtract 1. A classifier that ignores the particle and just says “pion” 84% of the time scores 0; a perfect one scores 1.
Electron vs muon: ECAL energy over 1 GeV
Electron vs muon: plus a muon chamber
Pion vs kaon: HCAL fraction over 0.5
Pion vs kaon: gradient-boosted trees
Pion vs kaon: HCAL fraction (RICH run)
Pion vs kaon: RICH photon count over 5
Pion vs kaon: RICH, falling back to HCAL
Orange: electron against muon. Blue: pion against kaon. The gradient-boosting row is worked out from its accuracy of 0.487 on a roughly balanced test sample, so it is approximate. With about 500 events of each species, an efficiency near 0.5 carries a statistical uncertainty of about ±2%, so every blue bar is consistent with zero.
The efficiency curves by energy show the same thing in another way. The RICH-only rule does not separate the two species; it calls everything a kaon at low momentum and everything a pion at high momentum, switching over where the photon count rises.
Two things in these plots are not what the theory says. First, pions should be glowing from 0.16 GeV, but both species record almost no photons until 2 or 3 GeV, and above that the pion and kaon counts overlap. Second, the simulated hit angles span 45° to 135° instead of clustering near 41°. The notebook takes a hit’s polar angle as the Cherenkov angle, which would be right only if the particle were travelling along the polar axis; the hits are almost certainly measured from the beam axis instead, so each one would first have to be rotated into its own particle’s frame. I did not find what was holding back the photon counts, nor make that rotation.
In plain English
08How far to trust it
These are the checks I made on the notebook while building this page, in a neutral tone, and what they could not settle.
- Every number is the notebook’s. The efficiencies, resolutions and accuracies on this page are printed outputs. The informedness bars and the “share of the beam” figures are arithmetic on them (the beam share assumes a flat 0.2 to 20 GeV spectrum, as in the macros). Nothing was re-simulated, and the Geant4 code and sample files were not part of what I had to hand.
- The tracker radii are the code’s defaults. The 4 m and 8 m in the curvature lab are the values the reconstruction function takes as defaults (with the field at 2 T). I did not check them against the Geant4 geometry file, which is not part of what I had to hand.
- There are no error bars on the efficiencies. From the binomial formula, an efficiency near 0.5 measured on about 500 events has an uncertainty of roughly ±2%. That makes the pion-and-kaon results consistent with chance, and it means the bin-by-bin curves, with a handful of events in each low-energy bin, are noisy.
- The thresholds were first guesses. The 1 GeV electron cut, the 0.5 HCAL share and the 5-photon cut were each tried once and not scanned. A scan, and an ROC curve for each rule, would show whether any threshold does better than chance; I would expect not for pions and kaons, but the notebook does not show it.
- The calorimeter calibration was a placeholder. An early cell sets calibration constants of 3.3 and 10 with a note to change them; the identification then uses raw deposits, so the energy-resolution plots are of uncalibrated sums.
- The RICH angle is unconfirmed. As above, the hit angles are in detector coordinates, so the notebook cannot yet test the theory curves, and both the photon-count and the angle readings in section 7 are open questions.
- Two readings are mine. The curl-up explanation of the electron efficiency (section 4) and the coordinate explanation of the RICH angles (section 7) are readings of the plots, not tests, and are labelled as such.
09More plots from the notebook
The rest of the figures I used, with the same captions as in the notebook’s own output. Click one to enlarge it.
Source: the Project 3 notebook for the DAML course. Cherenkov formulas: see any detector-physics text, for example the PDG review on particle detectors. Back to all research.