← Case studies
Nuclear Physics

Predicting particle trajectories with neural networks

Physicists at Jefferson Lab fire electrons at protons and reconstruct the particles that fly out. Two small neural networks built with Deep Netts now tell their Java software which signals belong to real particles – so it finds more tracks, faster, in the same data.

+15.6%
more tracks reconstructed from the same real data
35%
faster track reconstruction
+15–35%
more events for physics analyses
2 networks
built with Deep Netts, running in Java

At a glance

Who
Dr. Gagik Gavalian and colleagues at Jefferson Lab, with Old Dominion University (Norfolk, Virginia).
The task
Track reconstruction: turning raw detector signals into particle paths. It took 80–90% of all event processing time.
The problem
At high beam intensity the detector fills with background, the possible combinations explode and good tracks get lost.
The solution
Two small feed-forward networks built with the open source Deep Netts community edition, inside the lab's Java software.
The result
15.6% more tracks, 35% faster tracking and 15–35% more events for physics – from the same data.

See it in motion

One event in the CLAS12 detector, from the collision to the tracks the two Deep Netts networks pick out. Play it, pause it, or click a step.

0
Segments
0
Candidates
0
Rejected
0
Tracks found
Step 1 / 6
Collision

A 10.6 GeV electron beam hits a 5 cm liquid-hydrogen target. This event has an electron and two pions – one of the reactions the paper analysed.

+10–15%
tracking efficiency
35%
faster tracking
+15–35%
events in two- and three-particle reactions

Source: G. Gavalian et al., CLAS12 Track Reconstruction with Artificial Intelligence (arXiv:2202.06869) – detector layout, network, two-pass workflow, Table 1, run conditions. The event drawn is illustrative.

Why tracking was the bottleneck

Jefferson Lab, a US Department of Energy laboratory in Newport News, Virginia, runs an electron accelerator called CEBAF. In its Hall B stands CLAS12, a large detector that studies what protons and neutrons look like inside.

The idea is simple: fire a tiny, well-understood particle – an electron – into a proton and watch what comes out. Which particles appear, in which directions and how fast tells physicists about the proton's inner structure. The data here come from standard running: a 10.6 GeV electron beam at 45 nA hitting a 5 cm cell of liquid hydrogen.

One collision, step by step

  1. Collision

    An electron hits a proton in the hydrogen target.

  2. Particles fly out

    For example the scattered electron and one or two pions.

  3. The magnet bends them

    A six-coil magnet curves charged particles; + and − bend opposite ways.

  4. Drift chambers

    Each particle crosses three regions of wire chambers in its sector.

  5. Wires fire

    Wires next to its path give a small signal – the raw data.

Six sectors, six superlayers

The magnet's six coils split the detector into six wedge-shaped sectors, and a particle stays inside one of them – so each sector is reconstructed on its own. On its way a particle crosses six chambers called superlayers; each is 6 layers of 112 wires.

S1S2S3S4S5S6blue = beam, dark = magnet coils, violet = a track
Looking along the beam. Each sector has its own drift chambers. Simplified.

From wires to segments

Inside one superlayer a particle lights up about one wire per layer, in a slanted row. Neighbouring fired wires are grouped into a segment, and each segment is summed up in one number: its average wire position. A full track is therefore just six numbers.

L1L2L3L4L5L6wire 30wire 69segment, mean wire 44.0
One superlayer, 40 of its 112 wires. Blue: wires the particle lit; grey: background. Wire numbers illustrative.

The puzzle: which segments belong together?

Every event leaves many segments – from real particles and from background. To build a track the software takes one segment from each superlayer and has to decide whether that combination is real. The number of combinations grows very fast. Click through the steps:

SL1SL2SL3SL4SL5SL6
21
segments
1,728
possible tracks
2
real tracks

What the chambers see

Each superlayer reports short pieces of track, called segments. Two of them belong to real particles; the rest is background from the intense beam. At this point the software cannot tell which is which.

One sector, simplified; positions illustrative.

It gets worse exactly when physicists want more data. A stronger beam gives more collisions per second, but also more background – more combinations, and more good tracks lost among them. Tracks with one segment missing, about 10% of all tracks before, suffer most.

Where Deep Netts fits in

The team replaced one step – deciding which candidates are real tracks – with two neural networks. Everything before and after stays the same, including the precise fits that compute each particle's momentum and direction.

  1. ClusteringFired wires become segments. Unchanged.
  2. CandidatesOne segment per superlayer. Unchanged.
  3. Deep NettsClassifierScores every 6-segment candidate: positive, negative or false track.
  4. Deep NettsAuto-encoderFills in the missing segment of 5-segment candidates.
  5. Precise fitsOnly the chosen tracks are fitted. Unchanged.
The networks don't replace physics.They answer one question very fast – is this combination of segments a real particle? – so the expensive, exact physics code only runs on the right candidates.

Pass 1: complete tracks

  1. BuildEvery 6-segment candidate in the sector.
  2. Deep NettsScoreThe classifier rates each one.
  3. Keep the bestTake the top candidate, drop every rival that shares a segment with it, repeat.

Pass 2: one segment missing

  1. Build5-segment candidates from what pass 1 left.
  2. Deep NettsFill the gapThe auto-encoder adds the missing segment.
  3. Deep NettsScore againThe same classifier picks the good ones.

To measure the gain fairly, the reconstruction ran two branches on the same data – one choosing tracks the conventional way, one with the networks – and both fed the same fitting code. Every difference in the output comes from the track choice alone.

The two networks

1. The classifier

The team compared three kinds of models on CLAS12 data – a convolutional network, extremely randomized trees and a multi-layer perceptron. The plain feed-forward network (MLP) won on speed and accuracy.

  • In: 6 numbers – the average wire position of the segment in each superlayer.
  • Inside: three hidden layers of 12 neurons.
  • Out: 3 scores – positive track, negative track, false track.

Why it works: a charged particle in a magnetic field draws a smooth curve, so its six positions follow a smooth pattern – bending one way for positive charge, the other for negative. A random mix of segments breaks the pattern, and the network learns to see that.

Input (6)Hidden (12)Hidden (12)Hidden (12)Output (3)SL1 mean wireSL2 mean wireSL3 mean wireSL4 mean wireSL5 mean wireSL6 mean wirepositive tracknegative trackfalse track
The classifier from the paper: 6 → 12 → 12 → 12 → 3, built with Deep Netts in Java.

It was trained on real experimental data already processed by the conventional tracking: well-fitted tracks that lead back to the target were the positive and negative examples; six-segment combinations the conventional code did not accept were the false ones. According to the authors, it keeps improving with more training on new data.

Sketch: the classifier's shape in the Deep Netts API
FeedForwardNetwork classifier = FeedForwardNetwork.builder()        .addInputLayer(6)                                   // mean wire, SL1..SL6        .addFullyConnectedLayer(12, ActivationType.TANH)        .addFullyConnectedLayer(12, ActivationType.TANH)        .addFullyConnectedLayer(12, ActivationType.TANH)        .addOutputLayer(3, ActivationType.SOFTMAX)          // positive, negative, false        .lossFunction(LossType.CROSS_ENTROPY)        .build(); classifier.train(trainingSet);                              // tracks from conventional reconstructionfloat[] scores = classifier.predict(meanWires);             // e.g. [0.93, 0.01, 0.06]

Layer sizes from the paper; activation functions and names are illustrative – the paper does not list them.

2. The auto-encoder

An auto-encoder is a network trained to give back the same numbers it receives. That sounds useless – until you damage the input on purpose. The team took good tracks, set one of the six values to zero at random, and trained the network to return all six correctly. It learns to fill the gap with a value that fits the other five.

On tracks it had never seen, its guess was on average 0.36 wires from the true position – less than half the gap between two neighbouring wires – and equally good whichever superlayer was missing.

Mean wire position in superlayers 1 … 6

41.243.0?47.950.653.1

↓ auto-encoder: 6 in, 6 out ↓

41.243.045.447.950.653.1
It learned from complete tracks what a real track looks like, so it can repair one. Numbers illustrative.

Results

Measured on real CLAS12 data at 45 nA, with both branches running on the same events.

Track typeConventionalWith Deep NettsGain
6 superlayers242,145256,175+5.8%
5 superlayers (one missing)24,15552,839×2.19
All tracks267,339309,058+15.6%
Table 1 of the paper. Typically 3–6% more 6-superlayer tracks and 70–120% more 5-superlayer tracks; single-particle tracking efficiency rises by 10–12%.

The biggest win is in the hardest case – tracks with a missing segment, where the combinations are most numerous. The more candidates there are, the more the network gains over trying them one by one.

Better as the beam gets stronger

Across runs from 5 to 70 nA, conventional tracking lost about 0.40% of its efficiency per nA of beam current; with Deep Netts it lost only 0.22% per nA.

100%90%80%70%010203040506070beam current (nA) – more current, more collisions and more background45 nA, productionWith Deep Netts: −0.22% per nAConventional: −0.40% per nA
Fitted lines as reported in the paper, assuming 100% at zero current. The paper's summary gives the conventional slope as 0.37% per nA.

More events for physics

Physicists measure reactions by counting events. In two reactions with a missing nucleon, the networks found many more events – evenly across the distribution, so the physics is not distorted.

Electron + π⁺, a neutron missingH(e,e′π⁺X)
+15%
Electron + π⁺ + π⁻, a proton missingH(e,e′π⁺π⁻X)
+30–35%

events with conventional tracking extra events with Deep Netts, same data

Increase in events in the nucleon peak (paper, Figure 10).

What it means

  • 35% faster tracking: far fewer weak candidates reach the precise fit only to fail there.
  • Shorter experiments: the same statistical precision in less beam time, or at a higher beam current.
  • Old data gains value: data already collected can be re-processed for up to 35% more statistics.
  • Simpler code: the authors describe a very small codebase – build the candidates, hand them to the networks.
  • Next: other CLAS12 tracking detectors and other Jefferson Lab experiments.

Why Java and Deep Netts

CLAS12 reconstruction runs on CLARA, a framework of Java microservices – one per detector. The lab's analysis and plotting tools are Java too.

The first prototypes were written in Python with Keras and TensorFlow. For production the networks had to live inside the Java reconstruction, so both were built with the Deep Netts community edition. The paper calls Deep Netts lightweight, with minimal dependencies – portable code, without a large number of platform-dependent packages.

In his article for Deep Netts, Dr. Gavalian adds that the most popular alternative needed native libraries for every platform – over 1 GB to link to their code – while others were incomplete or poorly documented. Deep Netts' documented API let the team build and test prototype networks quickly.

Where it runs.The networks were designed, trained and implemented with Deep Netts in Java; the reconstruction services evaluate them with EJML, a pure Java matrix library. No Python and no native libraries in the production chain.

Sources

Glossary (18 terms)
CEBAF
Continuous Electron Beam Accelerator Facility – Jefferson Lab's electron accelerator.
GeV
Giga-electronvolt, a unit of energy. At 10.6 GeV the electrons move at almost the speed of light.
nA, beam current
Nanoamperes – how many electrons per second hit the target. More current: more collisions, more background.
Luminosity
How many collisions per second the setup can produce; grows with beam current.
Nucleon
A proton or a neutron.
Pion (π⁺, π⁻)
A light particle often produced in these collisions; + or − is its charge.
Event
One recorded collision with everything that came out of it.
Sector
One of six wedge-shaped parts of the forward detector, between the magnet's coils.
Drift chamber
A gas-filled box with thin wires; wires near a charged particle's path give a signal.
Superlayer
A chamber of 6 layers × 112 wires. A particle crosses six of them.
Segment (cluster)
Neighbouring fired wires in one superlayer – a short piece of track.
Track candidate
One segment from each superlayer joined into a possible path.
χ² (chi-squared)
How well a fitted curve matches the hits; used to pick high-quality training tracks.
Kalman filter
A precise step-by-step fit that refines a track with the drift times of its hits.
Missing mass
The mass of the undetected particle, computed from everything detected; real reactions show a peak.
MLP, feed-forward network
The classic neural network: numbers in, layers of neurons, scores out.
Auto-encoder
A network trained to reproduce its input; trained on damaged inputs, it learns to repair them.
Inference
Using a trained network to get an answer, as opposed to training it.

Keep reading