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
f248ab84
Commit
f248ab84
authored
9 years ago
by
Andre Sailer
Browse files
Options
Downloads
Patches
Plain Diff
DDSim: Add reading of particle.tbl file, needs DD4hep revision 2058
Adapt to the new way the rangeCut is added
parent
4dad464c
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
DDSim/Helper/Physics.py
+83
-9
83 additions, 9 deletions
DDSim/Helper/Physics.py
with
83 additions
and
9 deletions
DDSim/Helper/Physics.py
+
83
−
9
View file @
f248ab84
"""
Helper object for physicslist properties
"""
import
os
from
DDSim.Helper.ConfigHelper
import
ConfigHelper
from
SystemOfUnits
import
mm
...
...
@@ -7,15 +9,87 @@ class Physics( ConfigHelper ):
"""
Configuration for the PhysicsList
"""
def
__init__
(
self
):
super
(
Physics
,
self
).
__init__
()
self
.
rangecut
=
0.7
*
mm
self
.
_
rangecut
=
0.7
*
mm
self
.
list
=
"
FTFP_BERT
"
self
.
decays
=
True
self
.
_pdgfile
=
None
@property
def
rangecut
(
self
):
"""
The global geant4 rangecut for secondary production
Default is 0.7 mm as is the case in geant4 10
To disable this plugin and be absolutely sure to use the Geant4 default range cut use
"
None
"
Set printlevel to DEBUG to see a printout of all range cuts,
but this only works if range cut is not
"
None
"
"""
return
self
.
_rangecut
@rangecut.setter
def
rangecut
(
self
,
val
):
if
val
is
None
:
self
.
_rangecut
=
None
return
if
isinstance
(
val
,
basestring
):
if
val
==
"
None
"
:
self
.
_rangecut
=
None
return
self
.
_rangecut
=
val
@property
def
pdgfile
(
self
):
"""
location of particle.tbl file containing extra particles and their lifetime information
"""
return
self
.
_pdgfile
@pdgfile.setter
def
pdgfile
(
self
,
val
):
if
not
val
:
self
.
_pdgfile
=
None
return
if
not
os
.
path
.
exists
(
val
):
raise
RuntimeError
(
"
PDGFile: %s not found
"
%
os
.
path
.
abspath
(
val
)
)
self
.
_pdgfile
=
os
.
path
.
abspath
(
val
)
@property
def
pdgfile
(
self
):
"""
location of particle.tbl file containing extra particles and their lifetime information
"""
return
self
.
_pdgfile
@pdgfile.setter
def
pdgfile
(
self
,
val
):
if
not
val
:
self
.
_pdgfile
=
None
return
if
not
os
.
path
.
exists
(
val
):
raise
RuntimeError
(
"
PDGFile: %s not found
"
%
os
.
path
.
abspath
(
val
)
)
self
.
_pdgfile
=
os
.
path
.
abspath
(
val
)
def
setupPhysics
(
self
,
kernel
,
name
=
None
):
seq
=
kernel
.
physicsList
()
seq
.
extends
=
name
if
name
is
not
None
else
self
.
list
seq
.
decays
=
self
.
decays
seq
.
enableUI
()
seq
.
dump
()
from
DDG4
import
PhysicsList
# Add special particle types from specialized physics constructor
if
self
.
pdgfile
:
seq
=
kernel
.
physicsList
()
part
=
PhysicsList
(
kernel
,
'
Geant4ExtraParticles/ExtraParticles
'
)
part
.
enableUI
()
seq
.
adopt
(
part
)
part
.
pdgfile
=
self
.
pdgfile
# Add global range cut
if
self
.
rangecut
is
not
None
:
seq
=
kernel
.
physicsList
()
rg
=
PhysicsList
(
kernel
,
'
Geant4DefaultRangeCut/GlobalRangeCut
'
)
rg
.
enableUI
()
seq
.
adopt
(
rg
)
rg
.
RangeCut
=
self
.
rangecut
def
setupPhysics
(
self
,
kernel
,
name
=
None
):
phys
=
kernel
.
physicsList
()
phys
.
extends
=
name
if
name
is
not
None
else
self
.
list
phys
.
decays
=
self
.
decays
phys
.
rangecut
=
self
.
rangecut
phys
.
enableUI
()
phys
.
dump
()
return
phys
return
seq
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