Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
5814988f
Commit
5814988f
authored
3 years ago
by
Andre Sailer
Browse files
Options
Downloads
Patches
Plain Diff
DDSim.Physics: add machineri for user Physics setup
parent
8a37cde8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDG4/python/DDSim/Helper/Physics.py
+26
-0
26 additions, 0 deletions
DDG4/python/DDSim/Helper/Physics.py
with
26 additions
and
0 deletions
DDG4/python/DDSim/Helper/Physics.py
+
26
−
0
View file @
5814988f
...
...
@@ -19,6 +19,7 @@ class Physics(ConfigHelper):
self
.
_pdgfile
=
None
self
.
_rejectPDGs
=
{
1
,
2
,
3
,
4
,
5
,
6
,
21
,
23
,
24
,
25
}
self
.
_zeroTimePDGs
=
{
11
,
13
,
15
,
17
}
self
.
_userFunctions
=
[]
@property
def
rejectPDGs
(
self
):
...
...
@@ -131,4 +132,29 @@ class Physics(ConfigHelper):
seq
.
adopt
(
rg
)
rg
.
RangeCut
=
self
.
rangecut
for
func
in
self
.
_userFunctions
:
func
(
kernel
)
return
seq
def
setupUserPhysics
(
self
,
userFunction
):
"""
Add a function to setup physics plugins.
The function must take the DDG4.Kernel() object as the only argument.
For example::
def setupCerenkov(kernel):
from DDG4 import PhysicsList
seq = kernel.physicsList()
cerenkov = PhysicsList(kernel,
'
Geant4CerenkovPhysics/CerenkovPhys
'
)
cerenkov.MaxNumPhotonsPerStep = 10
cerenkov.MaxBetaChangePerStep = 10.0
cerenkov.TrackSecondariesFirst = True
cerenkov.VerboseLevel = 2
cerenkov.enableUI()
return None
SIM.physics.setupUserPhysics(setupCerenkov)
"""
self
.
_userFunctions
.
append
(
userFunction
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment