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 pathsimulator.py.in
More file actions
111 lines (95 loc) · 4.28 KB
/
Copy pathsimulator.py.in
File metadata and controls
111 lines (95 loc) · 4.28 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
"""Package to help configure the simulation
Defines a derived class from ldmxcfg.Producer
with several helpful member functions.
"""
from @PYTHON_PACKAGE_NAME@.Framework.ldmxcfg import Producer
class simulator(Producer):
"""A instance of the simulation configuration
This class is derived from ldmxcfg.Producer and is mainly
focused on providing helper functions that can be used instead
of accessing the parameters member directly.
The parameters that are lists ('preInitCommands', 'postInitCommands', 'actions', and 'generators')
are initialized as empty lists so that we can append to them later.
The ECal hit conbtibutions are enabled and compressed by default.
Parameters
----------
instance_name : str
Name of this instance of the Simulator
Attributes
----------
generators : list of PrimaryGenerator
Generators to use to make primaries
detector : str
Full path to detector description gdml (suggested to use setDetector)
validate_detector : bool, optional
Should we have Geant4 validate that the gdml is correctly formatted?
description : str
Describe this run in a human-readable way
scoringPlanes : str, optional
Full path to the scoring planes gdml (suggested to use setDetector)
beamSpotSmear : list of float, optional
2 (x,y) or 3 (x,y,z) widths to smear ALL primary vertices by [mm]
time_shift_primaries : bool
Should we shift the times of primaries so that z=0mm corresponds to t=0ns?
enableHitContribs : bool, optional
Should the simulation save contributions to Ecal sim hits?
compressHitContribs : bool, optional
Should the simulation compress contributions to Ecal sim hits by PDG ID?
preInitCommands : list of str, optional
Geant4 commands to run before the run is initialized
postInitCommands : list of str, optional
Geant4 commands to run after run is initialized (but before run starts)
actions : list of UserAction, optional
Special User-defined actions to take during the simulation
biasing_operators : list of XsecBiasingOperators, optional
Operators for biasing specific particles to undergo specific processes
dark_brem : DarkBrem
Configuration options for dark brem process
logging_prefix : str, optional
Prefix to prepend any Geant4 logging files
rootPrimaryGenUseSeed : bool, optional
Use the seed stored in the EventHeader for random generation
verbosity : int, optional
Verbosity level to print
"""
def __init__(self, instance_name ) :
super().__init__( instance_name , "simcore::Simulator" , "SimCore" )
#######################################################################
#Required Parameters
self.generators = [ ]
self.detector = ''
self.description = ''
#######################################################################
#Optional Parameters(with helpful defaults)
self.scoringPlanes = ''
self.beamSpotSmear = [ ]
self.time_shift_primaries = True
self.enableHitContribs = True
self.compressHitContribs = True
self.preInitCommands = [ ]
self.postInitCommands = [ ]
self.actions = [ ]
self.biasing_operators = [ ]
self.logging_prefix = ''
self.rootPrimaryGenUseSeed = False
self.validate_detector = False
self.verbosity = 0
#Dark Brem stuff
from LDMX.SimCore import dark_brem
self.dark_brem = dark_brem.DarkBrem()
def setDetector(self, det_name , include_scoring_planes = False ) :
"""Set the detector description with the option to include the scoring planes
Parameters
----------
det_name : str
name of a detector in the Detectors module
include_scoring_planes : bool
True if you want to import and use scoring planes
See Also
--------
@PYTHON_PACKAGE_NAME@.Detectors.makePath for definitions of the path making functions.
"""
from @PYTHON_PACKAGE_NAME@.Detectors import makePath as mP
self.detector = mP.makeDetectorPath( det_name )
if include_scoring_planes :
self.scoringPlanes = mP.makeScoringPlanesPath( det_name )