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
f62e3eb5
Commit
f62e3eb5
authored
9 years ago
by
Andre Sailer
Browse files
Options
Downloads
Patches
Plain Diff
Add the Action.py file for the Sensitive Actions
parent
93c18d60
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDSim/Helper/Action.py
+57
-0
57 additions, 0 deletions
DDSim/Helper/Action.py
with
57 additions
and
0 deletions
DDSim/Helper/Action.py
0 → 100644
+
57
−
0
View file @
f62e3eb5
"""
Helper object for SD Actions
"""
from
DDSim.Helper.ConfigHelper
import
ConfigHelper
class
Action
(
ConfigHelper
):
"""
Action holding all gun properties
"""
def
__init__
(
self
):
super
(
Action
,
self
).
__init__
()
self
.
_tracker
=
'
Geant4TrackerAction
'
self
.
_calo
=
'
Geant4ScintillatorCalorimeterAction
'
self
.
_mapActions
=
dict
()
@property
def
tracker
(
self
):
"""
set the default tracker action
"""
return
self
.
_tracker
@tracker.setter
def
tracker
(
self
,
val
):
self
.
_tracker
=
val
@property
def
calo
(
self
):
"""
set the default calorimeter action
"""
return
self
.
_calo
@calo.setter
def
calo
(
self
,
val
):
self
.
_calo
=
val
@property
def
mapActions
(
self
):
"""
create a map of patterns and actions to be applied to sensitive detectors
e.g. tpc --> TPCSDAction
"""
return
self
.
_mapActions
@mapActions.setter
def
mapActions
(
self
,
val
):
"""
check if the argument is a dict, then we just update mapActions
if it is a string or list, we use pairs as patters --> Action
"""
if
isinstance
(
val
,
dict
):
self
.
_mapActions
.
update
(
val
)
return
if
isinstance
(
val
,
basestring
):
vals
=
val
.
split
(
"
"
)
elif
isinstance
(
val
,
list
):
vals
=
val
if
len
(
vals
)
%
2
!=
0
:
raise
RuntimeError
(
"
Not enough parameters for mapActions
"
)
for
index
in
xrange
(
0
,
len
(
vals
),
2
):
self
.
_mapActions
[
vals
[
index
]]
=
vals
[
index
+
1
]
def
clearMapActions
(
self
):
"""
empty the mapActions
"""
self
.
_mapActions
=
dict
()
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