This repository was archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimcfg.py.in
More file actions
164 lines (125 loc) · 4.64 KB
/
Copy pathsimcfg.py.in
File metadata and controls
164 lines (125 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
"""Internal configuration module for simulation objects
The simulation requires a lot more detailed configuration than
the other processors, so we have two extra objects that require
their own python classes.
"""
class UserAction:
"""Object that stores parameters for a UserAction
Parameters
----------
instance_name : str
Unique name for this particular instance of a UserAction
class_name : str
Name of C++ class that this UserAction should be
"""
def __init__(self, instance_name, class_name):
self.class_name = class_name
self.instance_name = instance_name
def __str__(self):
"""Stringify this UserAction
Returns
-------
str
A human-readable version of this UserAction printing all its attributes
"""
string = "UserAction (" + self.__repr__() + ")\n"
string += " Parameters: \n"
for k, v in self.__dict__.items():
string += " %s : %s \n" % (k, v)
return string
def __repr__(self):
"""A shorter string representation of this UserAction
Returns
-------
str
Just printing its instance and class names
"""
return '%s of class %s' % (self.instance_name, self.class_name)
class PrimaryGenerator:
"""Object that stores parameters for a PrimaryGenerator
Parameters
----------
instance_name : str
Unique name for this particular instance of a PrimaryGenerator
class_name : str
Name of C++ class that this PrimaryGenerator should be
module_name : str, optional
Name of C++ library that this primary generator is compiled into
"""
def __init__(self, instance_name, class_name, module_name = 'SimCore_Generators'):
self.class_name = class_name
self.instance_name = instance_name
from @PYTHON_PACKAGE_NAME@.Framework import ldmxcfg
ldmxcfg.Process.addModule(module_name)
def __str__(self):
"""Stringify this PrimaryGenerator
Returns
-------
str
A human-readable version of this PrimaryGenerator printing all its attributes
"""
string = "PrimaryGenerator (" + self.__repr__() + ")\n"
string += " Parameters: \n"
for k, v in self.__dict__.items():
string += " %s : %s \n" % (k, v)
return string
def __repr__(self):
"""A shorter string representation of this PrimaryGenerator
Returns
-------
str
Just printing its instance and class names
"""
return '%s of class %s' % (self.instance_name, self.class_name)
class SensitiveDetector:
"""Configuration for a sensitive detector we want to load
Parameters
----------
instance_name : str
Unique name for this particular instance of a PrimaryGenerator
class_name : str
Name of C++ class that this PrimaryGenerator should be
module_name : str
Name of C++ library that this primary generator is compiled into
"""
def __init__(self, instance_name, class_name, module_name):
self.class_name = class_name
self.instance_name = instance_name
from @PYTHON_PACKAGE_NAME@.Framework import ldmxcfg
ldmxcfg.Process.addModule(module_name)
def __str__(self):
"""Stringify this SensitiveDetector
Returns
-------
str
A human-readable version of this SensitiveDetector printing all its attributes
"""
string = "SensitiveDetector (" + self.__repr__() + ")\n"
string += " Parameters: \n"
for k, v in self.__dict__.items():
string += " %s : %s \n" % (k, v)
return string
def __repr__(self):
"""A shorter string representation of this SensitiveDetector
Returns
-------
str
Just printing its instance and class names
"""
return '%s of class %s' % (self.instance_name, self.class_name)
class PhotoNuclearModel():
"""Configuration for a photonuclear model that we want to load
Parameters
----------
instance_name : str
Unique name for this particular instance of a PhotoNuclear Model
class_name : str
Name of C++ class that this PhotoNuclear model should be
module_name : str
Name of C++ library that this PhotoNuclear model is compiled into
"""
def __init__(self, instance_name, class_name, module_name ):
self.class_name = class_name
self.instance_name = instance_name
from @PYTHON_PACKAGE_NAME@.Framework import ldmxcfg
ldmxcfg.Process.addModule(module_name)