Repository navigation
Fix CMS SteppingAction for new approach in CMSSW - #710
SeverinDiederichs merged 2 commits into
Conversation
…tion exactly The CMS stepping action had hardcoded cuts and only approximated the CMSSW Phase2SteppingAction: it killed tracks beyond |z| = 50 m only when they were also out of time, applied the dead-region and vacuum cuts to very forward tracks, and deposited the kinetic energy of killed tracks, which Phase2SteppingAction does not. Mirror the track-level kills exactly: in the very forward region only the forward time cut applies, central tracks are killed in dead regions and beyond the central time cut, the e-/e+ vacuum cut uses an inclusive density comparison, and kills no longer deposit energy. The cuts come from CMSSW through a new CMSSteppingActionConfig (g4integration) set via AdePTConfiguration::SetCMSSteppingActionConfig. Its device-copyable part is the CMSSteppingActionParams (transport/config), whose fields now name the CMSSW parameters they mirror; in CMS builds it is the parameter type selected at build time that the transport configuration already carries to the kernels. AddDeadRegionName is kept for source compatibility and feeds the same configuration. The defaults reproduce the previous behavior when no configuration is set, and builds with other stepping actions are unchanged. Assisted-by: Claude Code (Claude Fable 5)
CMSSW applies its Phase2TrackFilter to the secondaries of the replayed GPU steps and erases (and deletes) the ones it kills, although they are placement-new'd pool objects that are already transported on the GPU, so any filter mismatch corrupts the replay storage. The GPU therefore takes the same decisions before a secondary is created: the CMS ClassifySecondary kills secondaries in dead regions, out of time, below the gamma threshold and low-energy ones in the low-density regions, and plays the per-region gamma Russian roulette, all without depositing the energy of a rejected secondary, exactly as the filter does. The ECAL roulette only applies to gammas whose generator particle is not a gamma or an e+-; this is evaluated on the host for every track handed to the GPU and inherited by its descendants, which is exact because the generator particle id never changes along an EM shower. Roulette survivors keep a weight above one so that CMSSW does not play again; survival probabilities so close to one that the float weight would not stay above one are rejected at initialization. A track that the user stepping action kills on a GPU-to-CPU hand-over now ends in that step instead of being resurrected on the CPU, matching Geant4 semantics and the CMSSW kills on replayed steps. Assisted-by: Claude Code (Claude Fable 5)
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
/run-test |
|
As the automatic AI review is broken: manual AI review with Codex 6.1 SoL ultra found no issues with the PR. |
The CMS stepping action had hardcoded cuts and were outdated due to the new CMSSW Phase2SteppingAction.
The new Phase2SteppingAction revealed a real problem: if CMSSW decides to kill a track that was just returned from the GPU, it would be erased and the hostTrackData would be corrupted, and then, if the track returns more steps from the GPU, it would lead to corrupted memory access. Therefore, it is fundamental, that AdePT kills all particles on GPU exactly as CMSSW on CPU. That way, no particle that from the GPU comes to the CPU must be killed by CMSSW.
This includes propagating a flag whether a Russian Roulette is applicable to a particle (it is excluded only in the ECAL if the ancestor particle is an electron, positron or gamma). Luckily, the flag was in the padding and does not increase the track size.
Note that not depositing the energy of killed tracks changes the energy deposition by ~0.5%, but is consistent with CMSSW now.
Assisted-by: Claude Code (Claude Fable 5)