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 pathexamples.py.in
More file actions
144 lines (121 loc) · 4.84 KB
/
Copy pathexamples.py.in
File metadata and controls
144 lines (121 loc) · 4.84 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
"""Examples of using different primary generators"""
from @PYTHON_PACKAGE_NAME@.SimCore import generators
from @PYTHON_PACKAGE_NAME@.SimCore import simulator
def inclusive_single_e() :
"""Get a basic un-biased, inclusive single electron simulation
This function is mainly helpful for testing that your install
works with this primary generator. You can look at the
source code for this function for ideas on how to implement your own
verison.
Returns
-------
ldmxcfg.Producer
that will simulate un-biased, inclusive single electrons
fired from upstream of the tagger into the v12 ldmx geometry
Examples
--------
bkgd_sim = examples.inclusive_single_e()
"""
sim = simulator.simulator( "inclusive_single_e" )
sim.setDetector( "ldmx-det-v12" )
# Note: This example used to set the runNumber parameter for the simulator.
# The run number is managed by the process object directly so setting it for
# the simulator no longer does anything
sim.description = "One 4GeV electron shot from far upstream."
sim.generators.append(generators.single_4gev_e_upstream_tagger())
return sim
def lheExample( lheFile ) :
"""An example simulator of how to use the LHE generator
This function is mainly helpful for testing that your install
works with this primary generator. You can look at the
source code for this function for ideas on how to implement your own
verison.
Parameters
----------
lheFile : str
The LHE file to use a primary vertices
Returns
-------
ldmxcfg.Producer
that will simulate the v12 detector using the
input LHE file with high verbosity.
Example
-------
lhe_sim = examples.lheExample( thePathToMyLHEFile )
"""
sim = simulator.simulator( "lheSimulation" )
sim.setDetector( "ldmx-det-v12" )
# Note: This example used to set the runNumber parameter for the simulator.
# The run number is managed by the process object directly so setting it for
# the simulator no longer does anything
sim.description = "Example of how to use LHE generator"
sim.generators.append(generators.lhe( "LHEExample" , lheFile ))
return sim
def gpsExample( ) :
"""An example simulator of how to use the General Particle Source.
This function is mainly helpful for testing that your install
works with this primary generator. You can look at the
source code for this function for ideas on how to implement your own
verison.
Returns
-------
ldmxcfg.Producer
that will simulate the v12 detector with
high verbosity and an electron smeared across the target
with a cos angular dependence and a linear energy dependence
between 3 and 4 GeV.
Example
-------
gps_sim = examples.gpsExample()
"""
sim = simulator.simulator( "gpsExample" )
sim.setDetector( "ldmx-det-v12" )
# Note: This example used to set the runNumber parameter for the simulator.
# The run number is managed by the process object directly so setting it for
# the simulator no longer does anything
sim.description = "Example of how to use GPS generator"
gpsGen = generators.gps( "GPSExample" , [
"/gps/particle e-",
"/gps/pos/type Plane",
"/gps/pos/shape Square",
"/gps/pos/centre 0 0 0 mm",
"/gps/pos/halfx 40 mm",
"/gps/pos/halfy 80 mm",
"/gps/ang/type cos",
"/gps/ene/type Lin",
"/gps/ene/min 3 GeV",
"/gps/ene/max 4 GeV",
"/gps/ene/gradient 1",
"/gps/ene/intercept 1"
])
sim.generators.append(gpsGen)
return sim
def multiExample( ) :
"""An example simulator of how to use the Multi-Primary Particle Gun
This function is mainly helpful for testing that your install
works with this primary generator. You can look at the
source code for this function for ideas on how to implement your own
Returns
-------
ldmxcfg.Producer
Simulator in the v12 geometry with high verbosity and 4GeV electrons
fired from within the target where the number of electrons is
Poisson-distributed around an average of 2
Example
-------
mpg_sim = examples.multiExample()
"""
sim = ldmxcfg.Producer( "mpgExample" , "simcore::Simulator" )
sim.setDetector( "ldmx-det-v12" )
# Note: This example used to set the runNumber parameter for the simulator.
# The run number is managed by the process object directly so setting it for
# the simulator no longer does anything
sim.description = "Example of how to use MPG generator"
mpgGen = generators.multi( "MPGExample" )
mpgGen.vertex = [ 0., 0., 0. ] #mm
mpgGen.nParticles = 2
mpgGen.pdgID = 11
mpgGen.enablePoisson = True
mpgGen.momentum = [ 0., 0., 4000. ]#MeV
sim.generators.append(mpgGen)
return sim