Relax the Geant4 field epsilons outside the muon spectrometer and support local field parameters - #15852
Open
sawenzel wants to merge 2 commits into
Open
Relax the Geant4 field epsilons outside the muon spectrometer and support local field parameters#15852sawenzel wants to merge 2 commits into
sawenzel wants to merge 2 commits into
Conversation
This moves the O2 Geant4 VMC run configuration out of FastSim, so that other features can extend it. - G4RunConfiguration is now o2::g4config::G4RunConfiguration in Detectors/gconfig, built into G4Setup. - FastSim provides the fast simulation and its regions through createFastSimulation() and createFastSimRegionConstruction(). - The behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This relaxes the Geant4 field-integration epsilons, keeps them tight as local fields in the muon spectrometer, and adds the support for local field parameters. - The tight epsilons from ALIROOT-7121 do not affect the 1/pT bias; only deltaIntersection does, and it stays at 1e-5 mm. - minimumEpsilon controls the long steps; relaxing it to 1e-4 moves nothing in the barrel, but it would move MCH positions, so YOUT1, DDIP and YOUT2 keep the tight values. - G4LocalFieldConstruction attaches the global field to every volume given its own parameters with /mcDet/createMagFieldParameters, so that the /mcMagField/<vol>/ settings take effect. - A volume whose subtree contains zero-field media is refused, since Geant4 VMC forces a local field onto all daughters. - This saves about 10% of the transport CPU time in pp. https://its.cern.ch/jira/browse/O2-7198 https://alice.its.cern.ch/jira/browse/ALIROOT-7121 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
@sawenzel to be sure: the last plot on relative pT bias shows a purely circular fit w/o e-loss correction? |
Collaborator
Author
@shahor02 : Yes, it is a purely geometric circle fit of the TrackRef positions in the transverse plane (uniform 5 kG field, no e-loss or MS correction, no vertex constraint), compared with the radius from the generated pT at the vertex. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR takes a look at the Geant4 field integration parameters with the goal to achieve faster CPU while maintaining the current physics output.
The PR relaxes the minimum epsilon of the Geant4 field integration, keeps the tight value in the muon spectrometer through local fields, and adds the O2 support that local field parameters need. It reduces the transport CPU time in pp by 10%, while the tracking accuracy stays unchanged.
The current tight settings in
g4config.ingo back to the ALIROOT-7121 Geant4 validation of 2018. There,deltaIntersectionand both epsilons were tightened together to remove a 1/pT bias of the TrackRef refit. With Geant4 11.2 the bias is still present at the defaultdeltaIntersection, but onlydeltaIntersectioncontrols it. The epsilons do not affect it. Geant4 uses for each step ε = deltaOneStep / L, clamped to [ε_min, ε_max] (G4PropagatorInField::ComputeStep), so ε_max governs short steps and ε_min governs long steps. The long steps in the air of the muon spectrometer need the tight ε_min; nothing else does.Field-integration parameters
The bias was measured as in ALIROOT-7121. Single 100 GeV tracks were simulated in a uniform 0.5 T field, and the ITS and TPC TrackRefs were refitted with a circle. At
deltaIntersection = 1e-3 mm(Geant4 default), the ITS+TPC 1/pT is shifted by −0.3% for μ± and by −0.68% for charged geantinos. At1e-5 mmthe shift is compatible with zero, and it is identical for every ε_max in {1e-5, 1e-4, 1e-3}.In the barrel, the epsilons have no measurable effect. Geantinos between 0.3 and 100 GeV were compared track by track with an ultra-tight uncached reference in the real field map, and with the exact helix in a uniform field. With the settings of this PR, and even with ε_min = ε_max = 1e-3, all TrackRef positions agree with the current ones (median deviation from the exact helix 0.02–0.16 µm in the ITS). Full-physics μ± at 1, 10 and 100 GeV give results identical to the current settings.
In the muon arm, the bias was measured as its counterpart there: the displacement at the last MCH station along the dipole deflection, relative to that deflection, which corresponds to the relative momentum shift. A relaxed ε_min moves the positions by about 45 µm (median, against 6–9 µm now) and shifts the momentum scale by up to −120 ppm. The volumes
YOUT1,DDIPandYOUT2therefore keep the tight epsilons as local fields. With ε_min = 1e-4 elsewhere, the median momentum-scale shift is below 35 ppm and its rms about 100 ppm (currently 45 ppm), negligible against the momentum resolution of the muon spectrometer. Relaxing ε_max alone changes nothing, neither in accuracy nor in CPU time.Local field parameters
Geant4 VMC builds a local field only for a TGeo volume that carries a field. O2 attaches the field only globally, so the per-volume parameters created with
/mcDet/createMagFieldParametershad no effect. The Geant4 run configuration is moved fromFastSimtoDetectors/gconfigaso2::g4config::G4RunConfiguration; fast simulation now provides its parts through two factory functions, with unchanged behaviour. The newG4LocalFieldConstructionattaches the global field to every volume that has its own parameter directory/mcMagField/<vol>/and switches on local fields in Geant4 VMC. The configuration therefore lives entirely ing4config.in, and the step does nothing when no volume has local parameters.Geant4 VMC forces a local field onto all daughters of a volume, which would switch the field on inside zero-field media. A volume whose subtree contains a medium with
ifield = 0is therefore refused with a warning. Local fields are built only with TGeo navigation; withG4.navmode=kG4a warning is issued, and the global field applies everywhere.Where the field is evaluated
In pp, 74% of all evaluations of
o2::field::MagneticField::Fieldoccur on the A side at z = 4–8.5 m and small radius, in the fringe field of the solenoid, where no detector needs tracking precision. About 20% occur in the central barrel and 3% in the muon arm. The relaxed ε_min removes 26% of all evaluations, mostly on the A side.Performance and validation
The timings come from pp at 13.6 TeV (512 events,
-j 32, EPYC 7552), with the runs alternated with the baseline on an otherwise idle node. For the physics check, 3000 pp events per configuration were simulated in a uniform field with two seeds, and compared event by event against the current settings. A null configuration, which changes only the random sequence, sets the scale for the fluctuations. The hit counts in all detectors and the TrackRef 1/pT refit of charged primaries stay within that spread. The change was tested as an overlay oflibO2FastSimandlibO2G4SetuponMC-prod-2026-v12-1; pp events are reproducible run to run with local fields.Further gains are followed up separately: the DormandPrince745 stepper and ε_min = 1e-3 would bring −15%, but they displace a small fraction of muon-arm tracks that cross the edge of the dipole field map, which drops from 7 kG to zero at a polar angle of 9.7°.
Overall, the field-integration settings now keep only the tightening that the ALIROOT-7121 bias requires, plus a tight ε_min where the muon arm needs it, and O2 can set field parameters per volume.
https://its.cern.ch/jira/browse/O2-7198
https://alice.its.cern.ch/jira/browse/ALIROOT-7121
Assisted by Claude Code.