Skip to content

fix: adopt properties of underlying Geant4GeneratorAction in Geant4SharedGeneratorAction - #1440

Merged
MarkusFrankATcernch merged 2 commits into
AIDASoft:masterfrom
wdconinc:patch-8
Apr 8, 2025
Merged

fix: adopt properties of underlying Geant4GeneratorAction in Geant4SharedGeneratorAction#1440
MarkusFrankATcernch merged 2 commits into
AIDASoft:masterfrom
wdconinc:patch-8

Conversation

@wdconinc

@wdconinc wdconinc commented Apr 2, 2025

Copy link
Copy Markdown
Contributor

This PR addresses the issue outlined in #1240 (comment)

making the GeneratorAction shared with DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc%d" % index, shared=True) fails because the properties (Parameters, Input) that are subsequently set are [...] not exposed to the GeneratorAction handle gen.

This PR brings the handling of the Geant4SharedGeneratorAction in line with other shared actions. With this PR, the following diff functions without runtime exceptions now.

diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py
index 11ed0e83..9fe46eda 100644
--- a/DDG4/python/DDSim/DD4hepSimulation.py
+++ b/DDG4/python/DDSim/DD4hepSimulation.py
@@ -390,11 +390,11 @@ class DD4hepSimulation(object):
         gen.Input = "Geant4EventReaderHepEvtLong|" + inputFile
       elif inputFile.endswith(tuple([".hepmc"] + HEPMC3_SUPPORTED_EXTENSIONS)):
         if self.hepmc3.useHepMC3:
-          gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc%d" % index)
+          gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc%d" % index, shared=True)
           gen.Parameters = self.hepmc3.getParameters()
           gen.Input = "HEPMC3FileReader|" + inputFile
         else:
-          gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc%d" % index)
+          gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc%d" % index, shared=True)
           gen.Input = "Geant4EventReaderHepMC|" + inputFile

BEGINRELEASENOTES

  • adopt properties of underlying Geant4GeneratorAction in Geant4SharedGeneratorAction

ENDRELEASENOTES

@github-actions

github-actions Bot commented Apr 3, 2025

Copy link
Copy Markdown

Test Results

   16 files     16 suites   6h 49m 38s ⏱️
  371 tests   371 ✅ 0 💤 0 ❌
2 895 runs  2 895 ✅ 0 💤 0 ❌

Results for commit 7cd62d0.

@MarkusFrankATcernch

Copy link
Copy Markdown
Contributor

Thanks for spotting.
For the generator action this was mysteriously forgotten. All other shared actions share the properties.

@MarkusFrankATcernch
MarkusFrankATcernch enabled auto-merge (rebase) April 8, 2025 09:05
@MarkusFrankATcernch
MarkusFrankATcernch merged commit 3466ee7 into AIDASoft:master Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants