@@ -4,7 +4,8 @@ Replaces the detailed transport through the ALICE front absorber by a model, and
44compares the result against a full simulation of the same events.
55
66` run.sh ` runs both: a reference ` o2-sim ` with PIPE and ABSO only, and the same
7- setup with the fast simulation switched on.
7+ setup with the fast simulation switched on. Both use the same seed, so the two
8+ simulations see the same primaries and the comparison is paired.
89
910| file | |
1011| ---| ---|
@@ -16,102 +17,90 @@ setup with the fast simulation switched on.
1617The feature does nothing unless a model is named:
1718
1819```
19- --configKeyValues "G4.fastSimModels=toyAbsorber;G4.fastSimRegions=ABSO_AIR_ENVELOPE "
20+ --configKeyValues "G4.fastSimModels=toyAbsorber;G4.fastSimEnvelope=AFaM "
2021```
2122
22- ` G4.fastSimMinEnergy ` (GeV, default 1) is the threshold below which the detailed
23- transport still runs, because a surrogate below it would be extrapolating and
24- the transport there is cheap anyway .
23+ ` G4.fastSimEnvelope ` is the volume the model stands in for — here ` AFaM ` , the
24+ mother of the whole absorber. ` G4.fastSimMinEnergy ` (GeV, default 1) is the
25+ threshold below which the detailed transport still runs .
2526
2627## What the model does
2728
28- ` toyAbsorber ` is a placeholder. It returns the incident particle continuing in
29- its direction with the energy attenuated exponentially over the path through the
30- envelope — a real absorber turns one incident hadron into a shower, so the
31- numbers this produces are not physics. It is here so that the machinery can be
32- exercised end to end before a trained model exists.
29+ ` toyAbsorber ` is a placeholder: it returns the incident particle continuing in
30+ its direction with the energy attenuated exponentially over its path through the
31+ envelope. A real absorber turns one incident hadron into a shower, so these are
32+ not physics numbers.
3333
3434A model implements one function, ` sample() ` , which maps the particle that
3535entered the region to the particles that leave it
36- (` Detectors/FastSim/include/FastSim/FastSimModel.h ` ). Everything around it —
36+ (` Detectors/FastSim/include/FastSim/FastSimModel.h ` ). The surrounding work —
3737measuring the distance to the envelope surface, killing the incident particle,
38- stacking what comes back, booking the energy difference as a deposit — is shared
39- and does not have to be reimplemented.
38+ stacking what comes back, booking the energy difference as a deposit — is shared.
4039
41- ## Why the region is named ` ABSO_AIR_ENVELOPE `
40+ ## How the envelope and the regions relate
4241
43- Regions are selected by tracking medium, which Geant4-VMC maps to that medium's
44- material, adding every volume of that material to the region. A volume can
45- therefore only be addressed on its own if its material is its own, which is why
46- ` AFaM ` — the mother volume of the whole absorber — carries a dedicated air
47- material ( ` Detectors/Passive/src/Absorber.cxx ` ). Selecting it means "the
48- absorber", with all of its daughters inside .
42+ Geant4 consults a fast simulation model through * regions * , and in O2 a region can
43+ only ever be " every volume of a given material": the VMC special cuts make every
44+ logical volume a root of its own material's region, and Geant4 stops propagating
45+ a region at any such daughter. A region named after ` AFaM ` would therefore
46+ contain ` AFaM ` alone, which tracks skip entirely because its daughters touch its
47+ surface .
4948
50- Selection by volume is not available: the VMC special cuts already root every
51- logical volume in a per-material region, and Geant4 allows a logical volume in
52- exactly one region.
53-
54- ## Status: the model does not fire on the muon-arm path
55-
56- Measured on a real run, and it is a limitation of the region mechanism rather
57- than of the model.
58-
59- ` ABSO_AIR_ENVELOPE ` selects a region containing ` AFaM ` ** and nothing else** . The
60- VMC special cuts create one ` G4Region ` per material and make every logical volume
61- a root of its own, and Geant4 stops propagating a region down the tree at any
62- daughter that is itself a region root — so ` AFaMgRing ` is in ` ABSO_MAGNESIUM$ ` ,
63- ` AFaGraphiteConeO ` in ` ABSO_CARBON0$ ` , and the absorber's mother region covers
64- none of them. On top of that, ` AFaM ` 's daughters touch its surface, so a track
65- entering the absorber lands straight in a daughter and never has ` AFaM ` as its
66- volume at all.
67-
68- A 20 GeV muon fired into the muon-arm acceptance with ` /tracking/verbose 1 `
69- therefore steps through the absorber identically with and without the fast
70- simulation enabled:
49+ So the two jobs are separated. The regions are derived by walking the envelope's
50+ subtree and collecting its media, which for ` AFaM ` finds fourteen:
7151
7252```
73- 13 54.2 -0.238 -900 1.99e+04 0.0405 287 902 AFaMgRing Transportation
74- 14 55.5 -0.244 -920 1.99e+04 5.33 20 922 AFaGraphiteConeO Transportation
75- 15 56.7 -0.254 -940 1.99e+04 5.33 20.2 942 AFaGraphiteConeO muIoni
53+ fast simulation: model toyAbsorber covers 14 media found under 'AFaM'
54+ Adding fast simulation model toyAbsorber to regions ABSO_AIR0$ ABSO_AIR_ENVELOPE0$
55+ ABSO_CONCRETE2$ ABSO_POLYETHYLEN2$ ABSO_CARBON0$ ABSO_CARBON2$ ABSO_MAGNESIUM$
56+ ABSO_Ni-W-Cu0$ ABSO_Ni-W-Cu2$ ABSO_LEAD0$ ABSO_LEAD2$ ABSO_STAINLESS STEEL0$
57+ ABSO_STAINLESS STEEL2$
7658```
7759
78- Only ` muIoni ` , ` eIoni ` , ` Transportation ` and ` specialCutForElectron ` appear; no
79- fast-simulation process does.
80-
81- So a region in O2 can be "every volume of a given material" but not "this volume
82- and its daughters", and a surrogate for a whole module is not expressible through
83- this interface as it stands. The two ways forward are to name the absorber's
84- constituent materials and accept a per-piece envelope, or to change
85- ` TG4RegionsManager ` upstream so that the cuts regions do not claim every volume
86- as a root.
87-
88- ** Do not read the track counts below as a measurement of the model.** They come
89- from two runs whose random sequences diverge before the absorber is even reached
90- — visible in the beam pipe — so the difference is not attributable to the fast
91- simulation.
60+ What the model measures against is the envelope itself, read from the track's own
61+ touchable. ` ModelTrigger ` also requires geometric containment in it, which is
62+ what excludes the steel support cradle — it shares its material with the end
63+ plate, so no selection by material could separate them.
9264
9365## Measured
9466
95- Five pp minimum-bias events, Pythia8 and Geant4, ` -m PIPE ABSO ` , on one EPN node
96- against ` O2PDPSuite/daily-20260819-0000-1 ` :
67+ Five pp minimum-bias events, Pythia8 and Geant4, ` -m PIPE ABSO ` , same seed, one
68+ EPN node against ` O2PDPSuite/daily-20260819-0000-1 ` :
9769
9870| | full | fast |
9971| ---| ---| ---|
100- | tracks per event | 3544 | 3160 |
101- | transport real time | 29.8 s | 28.0 s |
72+ | tracks per event | 1547 | 1144 |
73+ | transport real time | 14.9 s | 14.2 s |
10274
103- geant4_vmc does report that the region resolved, which is necessary but, as
104- above, not sufficient :
75+ A 20 GeV muon fired into the muon-arm acceptance with ` /tracking/verbose 1 `
76+ shows what the model does to a single track :
10577
10678```
107- fast simulation is ENABLED for regions 'ABSO_AIR_ENVELOPE'
108- fast simulation: registering model toyAbsorber above 1 GeV
109- Adding fast simulation model toyAbsorber to regions ABSO_AIR_ENVELOPE0$
79+ 10 54.4 -0.137 -900 1.99e+04 0.0749 287 902 AFaMgRing Transportation
80+ 11 54.4 -0.137 -900 0 1.99e+04 4.1e+03 5e+03 AFaMgRing G4FastSimulationManagerProcess
11081```
11182
112- where the last line is the tracking medium having resolved to its material, which
113- is the step that silently does nothing if the medium name is wrong.
114-
115- ** These numbers are not a performance result and not a measurement of the
116- model** — see the section above. They are recorded only to show what the example
117- currently produces.
83+ One step of 4.1 m across the whole absorber, in place of roughly twenty ` muIoni `
84+ steps through graphite, concrete and steel.
85+
86+ ## What these numbers are not
87+
88+ ** Not a performance result.** A quarter fewer tracks buys only five percent of
89+ wall clock, because the tracks the absorber's shower contributes are cheap
90+ low-energy ones and most of the CPU in this setup is spent elsewhere. And with
91+ minimum-bias pp only the forward cone reaches the absorber at all. A CPU number
92+ worth quoting needs a workload where the absorber is on the critical path — a
93+ forward-biased generator, or the full detector where the muon arm is the point.
94+
95+ ** Not a physics validation.** The toy returns one particle where a real absorber
96+ returns a shower, so the track counts above say more about the placeholder than
97+ about the absorber. Comparing the outgoing multiplicity and spectrum against a
98+ full simulation is what a trained model has to pass, and that is the measurement
99+ this example is scaffolding for.
100+
101+ Two further caveats worth knowing when reading any output of this: a fast step
102+ does not call the sensitive detector, so its steps disappear from MCStepLogger
103+ (harmless for a passive envelope, which has no hits); and secondaries the model
104+ creates carry ` TMCProcess ` ` kPNull ` , the code geant4_vmc gives to everything it
105+ has no VMC equivalent for, so they cannot be told apart from other tracks by
106+ process alone.
0 commit comments