Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

From points to particles to interactions

A first SPINE analysis · 20 minutes · Python and NumPy basics

Explore a reconstructed simulation event, inspect its particles, and build a small interaction selection. You will learn to distinguish points, particles, and interactions, and to interpret SPINE’s particle labels and primary flags.

Try the guided experience: use ▶ Listen for explanations and exercises, and Ask SPINE whenever you have a question. Choose Open in Colab to edit and run the examples in your browser. Narration and chat are optional.

Before you begin

Use Open in Colab at the top of this page to run and edit the lesson in your browser. Sign in with a Google account, then run the setup cell followed by the lesson cells. No local installation or GPU is needed.

To run the notebook in your usual Jupyter or VS Code environment, install SPINE with its visualization tools:

pip install "spine[viz]"

The examples are tested with SPINE 1.4.1. Use the notebook download at the top of this page to run them yourself. The website shows the executed results. For environment setup or the full reconstruction runtime in Docker, see the SPINE installation guide. No GPU or model weights are needed here: reconstruction has already been run.

We use a small generic-simulation sample hosted by S3DF. It contains six entries and is about 1.6 MB. This setup cell downloads it once and reuses the local copy on subsequent runs. The checksum checks that we are all working with the same sample.

SPINE 1.4.1; sample ready

1. Read an event: what are you looking at?

An entry is one recorded example in this file. Its points describe the spatial activity supplied to reconstruction. Reconstructed particles group points into candidates; reconstructed interactions associate those candidates. One entry can contain more than one reconstructed interaction.

The reader loads the stored objects. BuildManager then restores their links to the shared point arrays and to each other. Here it is loading existing reconstruction output, not running a neural network or finding new clusters.

Pause and inspect

Predict: does one entry necessarily mean one interaction?

Run the next cell in your notebook, or inspect its saved output here. Identify the number of entries in the file and the number of reconstructed interactions in entry 0. Explain to yourself why those are different counts.

Entries in file: 6
Points in entry 0: 2228
Reconstructed particles: 9
Reconstructed interactions: 3

What those counts mean

The file contains six entries. We opened only entry 0: 2,228 points, nine reconstructed particles, and three reconstructed interactions. The three interactions are associations made by reconstruction within this entry; they are not the number of entries in the file.

Being reconstructed does not make an object a ground-truth statement. The file also contains simulation truth, but this lesson starts with the reconstructed objects. We will use their labels as candidate classifications, not as proof of particle identity or interaction type.

Check your understanding: if you wanted the points belonging to just one particle, would you inspect the whole event array or that particle’s membership? Continue when you can explain the distinction. You can also read on without audio.

Continue →

2. Inspect one particle, including its units

Choose particle ID 4, a primary muon candidate in this entry. Its index selects rows from the event’s point array. Its points holds those coordinates. Its size counts points; it does not measure physical length.

{'id': np.int64(4), 'label': 'Muon', 'size': 872, 'units': 'cm', 'primary': True, 'interaction_id': np.int64(1)}

SPINE’s pid is a class index, not a PDG code. Use MUON_PID and PID_LABELS instead of assuming that a muon is stored as 13. The is_primary flag is a reconstructed classification, not a certification of the particle’s generator history.

The coordinates in this sample are in centimeters. We will plot positions; interpreting deposited energy requires additional knowledge of the simulation and reconstruction configuration. SPINE’s Drawer builds an interactive Plotly figure directly from the event objects. Drag to rotate, scroll to zoom, and hover over a particle to inspect its properties. Click a legend entry to hide it; double-click one to isolate that particle. This view shows points assigned to reconstructed particles, which need not include every point in the event.

Loading...

View static image if the interactive display is unavailable. It shows the same particle candidates and colors in three coordinate projections, with distances in centimeters. Rotation, hover information, and particle toggling require the interactive view.

Try: choose a different particle ID in the previous cell. Compare its size and label with particle 4. Does the plotted geometry alone establish its species? The labels are reconstruction outputs, even when a shape looks familiar.

Continue →

3. Follow the particle to its interaction

Find the interaction associated with particle 4. Its particles collection contains all its reconstructed constituents, not only its primary particles.

Interaction ID: 1
Particle IDs: [1, 2, 3, 4, 6, 7]
Primary IDs: [4, 6, 7]
Particle count: 6
Primary topology: 1mu1pi1p
Particle 1: Electron, 16 points, primary=False
Particle 2: Electron, 8 points, primary=False
Particle 3: Electron, 1 points, primary=False
Particle 4: Muon, 872 points, primary=True
Particle 6: Pion, 500 points, primary=True
Particle 7: Proton, 89 points, primary=True

With particle 4 selected, this is interaction 1: six particles, three of them primary. Its 1mu1pi1p topology describes valid primary candidates classified as one muon, one pion, and one proton. It does not describe every constituent and is not an interaction-mode classification.

Here, valid (is_valid) means a particle counts toward the interaction topology. It is not a guarantee that the reconstruction or particle label is correct. The sample stores this flag; its production configuration applies kinetic-energy thresholds of 50 MeV for protons and 25 MeV for other particle types. This notebook reads those stored decisions rather than recalculating them.

Try: identify the three non-primary particles in the output. Predict how counting every constituent instead of only primaries would change your summary.

Continue →

4. Turn inspection into a small selection

Now select interactions containing exactly one valid primary muon candidate. The three conditions are separate: is_valid applies the topology eligibility explained above, is_primary selects primary candidates, and pid == MUON_PID selects candidates classified as muons.

Selected interaction IDs: [np.int64(1)]

Exercise: remove only the primary requirement. Predict which additional interaction will pass, then check. Explain what changed in your selection: the stored points, labels, and associations have not changed.

You have followed points into particles, particles into interactions, and interaction properties into a selection. This is a reconstructed selection; checking its relationship to simulation truth is a separate analysis step.

References and next steps


SPINE Learn v0.1.0-dev · Changelog