Skip to content

Commit 5146d4c

Browse files
docs: document Fatras barcode identifiers
1 parent 36a4a51 commit 5146d4c

2 files changed

Lines changed: 138 additions & 0 deletions

File tree

docs/groups/fatras.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
@defgroup fatras Fatras
2+
@brief Fast track simulation on ACTS tracking geometries.
3+
4+
# Fatras
5+
6+
Fatras is the ACTS fast track simulation package. It uses the
7+
@ref Acts::Propagator and a reconstruction-oriented @ref Acts::TrackingGeometry
8+
to transport particles through the detector and to produce simulated hits on
9+
sensitive surfaces. It is intended for fast algorithm validation and detector
10+
studies that do not require a full, detailed detector simulation.
11+
12+
Fatras uses parametrized material interactions, including multiple scattering,
13+
Bethe-Bloch energy loss, Bethe-Heitler energy loss, and photon conversion. Since
14+
it operates on tracking surfaces rather than a full volumetric detector model,
15+
it is faster than a detailed Geant4 simulation but also less complete.
16+
17+
## Barcode identifiers {#fatras_barcode_identifiers}
18+
19+
Fatras labels simulated particles and hits with @ref ActsFatras::Barcode. A
20+
barcode is the event-local particle identifier used by Fatras and by the ACTS
21+
examples framework for truth matching. It is not a geometry identifier; it
22+
answers "which simulated particle produced this object?".
23+
24+
The barcode stores five integer components:
25+
26+
| Component | Meaning |
27+
| --------- | ------- |
28+
| primary vertex | The primary interaction vertex. Ordinary simulated particles use a non-zero primary vertex. |
29+
| secondary vertex | A secondary vertex below the primary vertex. Zero means the particle comes directly from the primary vertex. |
30+
| particle | The particle number within the selected primary and secondary vertex. |
31+
| generation | The descendant generation. Particles produced at the vertex use generation zero. |
32+
| sub-particle | The particle number within a non-zero generation. Particles produced at the vertex use sub-particle zero. |
33+
34+
The default-constructed barcode has all components set to zero and represents an
35+
invalid, missing, or unknown particle identifier. This value is useful as a
36+
sentinel, but it should not be used for ordinary simulated particles.
37+
38+
For example, a particle from primary vertex `2` with particle number `14` is
39+
encoded as:
40+
41+
```text
42+
vp=2|vs=0|p=14|g=0|sp=0
43+
```
44+
45+
If a Fatras interaction creates two descendant particles from this particle, the
46+
new particles keep the same vertex and particle number. The generation is
47+
increased and the sub-particle number distinguishes the two descendants:
48+
49+
```text
50+
vp=2|vs=0|p=14|g=1|sp=0
51+
vp=2|vs=0|p=14|g=1|sp=1
52+
```
53+
54+
The preserved vertex and particle components make it cheap to recover the
55+
initial simulated particle for truth matching, while the generation and
56+
sub-particle components distinguish particles created during the simulation.
57+
58+
## Creating and reducing barcodes
59+
60+
@ref ActsFatras::Barcode is immutable from the caller's point of view: modifier
61+
methods return a new barcode with one component changed. Typical construction
62+
therefore chains the `with...` methods:
63+
64+
```cpp
65+
auto particleId = ActsFatras::Barcode()
66+
.withVertexPrimary(1)
67+
.withVertexSecondary(0)
68+
.withParticle(42);
69+
```
70+
71+
Interactions that create descendants can call
72+
@ref ActsFatras::Barcode::makeDescendant to increase the generation and set the
73+
sub-particle number:
74+
75+
```cpp
76+
auto electronId = photonId.makeDescendant(0);
77+
auto positronId = photonId.makeDescendant(1);
78+
```
79+
80+
Two helper projections are commonly useful when grouping truth information:
81+
82+
- @ref ActsFatras::Barcode::vertexId drops the particle and sub-particle
83+
components so objects can be grouped by production vertex.
84+
- @ref ActsFatras::Barcode::withoutSubparticle drops only the sub-particle
85+
component so generated descendants can be grouped by original particle and
86+
generation.
87+
88+
Since barcodes are created locally by the code that produces particles, there is
89+
no global allocation service that stores the full decay tree. Independent
90+
interactions can therefore create overlapping descendant identifiers if they
91+
start from the same particle and generation. When the full set of particles is
92+
available, sub-particle numbers within a generation can be renumbered to make
93+
the identifiers unique.

docs/old/fatras/fatras.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,51 @@ The simulation will propagate each particle until it reaches the end of the dete
1717
Afterwards, the first secondary particle that might have been generated in the process will be propagated.
1818
This continues until all particles are transported.
1919

20+
## Barcode identifiers
21+
22+
Fatras labels simulated particles and hits with `ActsFatras::Barcode`.
23+
A barcode is the event-local particle identifier used by Fatras and by the ACTS examples framework for truth matching.
24+
It is not a geometry identifier; it answers which simulated particle produced a hit, particle state, or truth-matching entry.
25+
26+
The barcode stores five integer components:
27+
28+
| Component | Meaning |
29+
| --------- | ------- |
30+
| primary vertex | The primary interaction vertex. Ordinary simulated particles use a non-zero primary vertex. |
31+
| secondary vertex | A secondary vertex below the primary vertex. Zero means the particle comes directly from the primary vertex. |
32+
| particle | The particle number within the selected primary and secondary vertex. |
33+
| generation | The descendant generation. Particles produced at the vertex use generation zero. |
34+
| sub-particle | The particle number within a non-zero generation. Particles produced at the vertex use sub-particle zero. |
35+
36+
The default-constructed barcode has all components set to zero and represents an invalid, missing, or unknown particle identifier.
37+
This value is useful as a sentinel, but it should not be used for ordinary simulated particles.
38+
39+
For example, a particle from primary vertex `2` with particle number `14` is encoded as:
40+
41+
```text
42+
vp=2|vs=0|p=14|g=0|sp=0
43+
```
44+
45+
If a Fatras interaction creates two descendant particles from this particle, the new particles keep the same vertex and particle number.
46+
The generation is increased and the sub-particle number distinguishes the two descendants:
47+
48+
```text
49+
vp=2|vs=0|p=14|g=1|sp=0
50+
vp=2|vs=0|p=14|g=1|sp=1
51+
```
52+
53+
The preserved vertex and particle components make it cheap to recover the initial simulated particle for truth matching, while the generation and sub-particle components distinguish particles created during the simulation.
54+
Interactions that create descendants can use `ActsFatras::Barcode::makeDescendant` to increase the generation and set the sub-particle number.
55+
56+
Two helper projections are commonly useful when grouping truth information:
57+
58+
- `ActsFatras::Barcode::vertexId` drops the particle and sub-particle components so objects can be grouped by production vertex.
59+
- `ActsFatras::Barcode::withoutSubparticle` drops only the sub-particle component so generated descendants can be grouped by original particle and generation.
60+
61+
Since barcodes are created locally by the code that produces particles, there is no global allocation service that stores the full decay tree.
62+
Independent interactions can therefore create overlapping descendant identifiers if they start from the same particle and generation.
63+
When the full set of particles is available, sub-particle numbers within a generation can be renumbered to make the identifiers unique.
64+
2065
## Supported interactions
2166

2267
Fatras implements a few interactions

0 commit comments

Comments
 (0)