Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow etaMin, etaMax bounds in Geant4IsotropeGenerator and DDSim/Helper/Gun.py #1072

Closed
2 tasks done
wdconinc opened this issue Mar 4, 2023 · 5 comments · Fixed by #1075 or #1145
Closed
2 tasks done

Allow etaMin, etaMax bounds in Geant4IsotropeGenerator and DDSim/Helper/Gun.py #1072

wdconinc opened this issue Mar 4, 2023 · 5 comments · Fixed by #1075 or #1145
Assignees

Comments

@wdconinc
Copy link
Contributor

wdconinc commented Mar 4, 2023

Just ran a lot of simulations with sim.gun.etaMin = -1 and sim.gun.etaMax = +1... which turned out to not be a setting that exists in DD4hep, but DDSim didn't complain about it.

This issue reports two aspects:

  • using a steering file with non-existent settings did not lead to complaints (not sure how dd4hep would find out),
  • I'm going to be contributing etaMin and etaMax as a PR (which is why I picked "new feature" as category).

To reproduce:

cat << EOF > gamma_10GeV_eta.steer
from DDSim.DD4hepSimulation import DD4hepSimulation
from g4units import mm, GeV, MeV, degree
SIM = DD4hepSimulation()
SIM.gun.energy = 10*GeV
SIM.gun.particle = "gamma"
SIM.gun.position = (0.0, 0.0, 0.0)
SIM.gun.direction = (0.0, 0.0, 1.0)
SIM.gun.distribution = "uniform"
SIM.gun.etaMin = -1.0
SIM.gun.etaMax = +1.0
EOF
ddsim --compactFile $DD4hepINSTALL/DDDetectors/compact/SiD.xml -G -N 10 --steeringFile gamma_10GeV_eta.steer 
@andresailer
Copy link
Member

andresailer commented Mar 20, 2023

Dynamically adding properties to instances is of course a core python feature. We can probably prevent this with __slots__?

@wdconinc
Copy link
Contributor Author

__slots__ seems to have a clunky interface compared to __dict__. Can we compare the length of __dict__ immediately after the definition of the Helper with the length after parsing options? If it is different, we must have used an unsupported variable name. ConfigHelper would do the initial count.

@MarkusFrankATcernch
Copy link
Contributor

Can we close this issue?

@andresailer
Copy link
Member

Still work to do.

@andresailer
Copy link
Member

I implemented a check for unknown properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants