-
Notifications
You must be signed in to change notification settings - Fork 16
/
target.py
244 lines (178 loc) · 7.55 KB
/
target.py
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
"""Example configurations for producing biased interactions in the target.
Example
-------
from LDMX.Biasing import target
"""
from LDMX.SimCore import generators
from LDMX.SimCore import simulator
from LDMX.SimCore import bias_operators
from LDMX.Biasing import filters
from LDMX.Biasing import util
from LDMX.Biasing import include as includeBiasing
def electro_nuclear( detector, generator ) :
"""Example configuration for producing electro-nuclear reactions in the target.
In this particular example, 4 GeV electrons are fired upstream of the
tagger tracker. TargetENFilter filters out events that don't see an
electro-nuclear reaction take places in the target.
Parameters
----------
detector : str
Path to the detector
Returns
-------
Instance of the sim configured for target electro-nuclear.
Example
-------
target_en_sim = target.electro_nuclear('ldmx-det-v12')
"""
# Instantiate the sim.
sim = simulator.simulator("target_electronNuclear")
# Set the path to the detector to use.
# Also tell the simulator to include scoring planes
sim.setDetector( detector , True )
# Set run parameters
sim.description = "Target electron-nuclear, xsec bias 1e8"
sim.beamSpotSmear = [20., 80., 0.] #mm
sim.generators.append(generator)
# Enable and configure the biasing
sim.biasing_operators = [ bias_operators.ElectroNuclear('target',1e8) ]
# the following filters are in a library that needs to be included
includeBiasing.library()
# Configure the sequence in which user actions should be called.
sim.actions.extend([
filters.TaggerVetoFilter(),
filters.TargetENFilter(2500.),
util.TrackProcessFilter.electro_nuclear()
])
return sim
def photo_nuclear( detector, generator ) :
"""Example configuration for producing photo-nuclear reactions in the ECal.
In this particular example, 4 GeV electrons are fired upstream of the
tagger tracker. The TargetBremFilter filters out all events that don't
produced a brem in the target with an energy greater than 2.5 GeV.
TargetBremFilter filters out events that don't see the brem photon undergo
a photo-nuclear reaction in the target.
Parameters
----------
detector : str
Path to the detector
Returns
-------
Instance of the sim configured for target photo-nuclear.
Example
-------
target_pn_sim = target.photo_nuclear('ldmx-det-v12')
"""
# Instantiate the sim.
sim = simulator.simulator("target_photonNuclear")
# Set the path to the detector to use.
# Also tell the simulator to include scoring planes
sim.setDetector( detector , True )
# Set run parameters
sim.description = "ECal photo-nuclear, xsec bias 450"
sim.beamSpotSmear = [20., 80., 0.]
sim.generators.append(generator)
# Enable and configure the biasing
sim.biasing_operators = [ bias_operators.PhotoNuclear('target',450.,2500.,only_children_of_primary=True) ]
# the following filters are in a library that needs to be included
includeBiasing.library()
# Configure the sequence in which user actions should be called.
sim.actions.extend([
filters.TaggerVetoFilter(),
# Only consider events where a hard brem occurs
filters.TargetBremFilter(),
filters.TargetPNFilter(),
# Tag all photo-nuclear tracks to persist them to the event.
util.TrackProcessFilter.photo_nuclear()
])
return sim
def gamma_mumu( detector, generator ) :
"""Example configuration for biasing gamma to mu+ mu- conversions in the target.
In this particular example, 4 GeV electrons are fired upstream of the
tagger tracker. The TargetBremFilter filters out all events that don't
produced a brem in the target with an energy greater than 2.5 GeV.
Parameters
----------
detector : str
Path to the detector
Returns
-------
Instance of the sim configured for target gamma to muon conversions.
Example
-------
target_mumu_sim = target.gamma_mumu('ldmx-det-v12')
"""
# Instantiate the sim.
sim = simulator.simulator("target_gammamumu")
# Set the path to the detector to use.
# Also tell the simulator to include scoring planes
sim.setDetector( detector , True )
# Set run parameters
sim.description = "gamma -> mu+ mu-, xsec bias 10e9"
sim.beamSpotSmear = [20., 80., 0.]
sim.generators.append(generator)
# Enable and configure the biasing
sim.biasing_operators = [ bias_operators.GammaToMuPair('target', 1.E4, 2500.) ]
# the following filters are in a library that needs to be included
includeBiasing.library()
# Configure the sequence in which user actions should be called.
sim.actions.extend([
# Only consider events where a hard brem occurs
filters.TaggerVetoFilter(),
filters.TargetBremFilter(),
filters.TargetGammaMuMuFilter(),
util.TrackProcessFilter.gamma_mumu()
])
return sim
def dark_brem( ap_mass , lhe, detector) :
"""Example configuration for producing dark brem interactions in the target.
This configures the sim to fire a 4 GeV electron upstream of the
tagger tracker. The dark-photon production cross-section is biased up in
the target. Only events that result in a dark-photon being produced in the
target are kept.
Parameters
----------
ap_mass : float
The mass of the A' in MeV.
lhe : str
The path to the directory containing LHE files to use as events of the dark brem.
detector : str
Name of detector to simulate in
Return
------
Instance of the sim configured for dark-brem production in the target.
Example
-------
Here we use the example vertex library. This should not be used
for large (>50k) event samples.
from LDMX.SimCore import makePath
target_ap_sim = target.dark_brem(1000., makePath.makeLHEPath(1000.), 'ldmx-det-v12')
In general, the second argument should be the full path to the LHE event library.
target_ap_sim = target.dark_brem(1000, 'path/to/lhe', 'ldmx-det-v12')
"""
sim = simulator.simulator( "target_dark_brem_" + str(ap_mass) + "_MeV" )
sim.description = "One e- fired far upstream with Dark Brem turned on and biased up in target"
sim.setDetector( detector , True )
sim.generators.append( generators.single_8gev_e_upstream_tagger() )
sim.beamSpotSmear = [ 20., 80., 0. ] #mm
#Activiate dark bremming with a certain A' mass and LHE library
from LDMX.SimCore import dark_brem
db_model = dark_brem.G4DarkBreMModel(lhe)
db_model.threshold = 4. #GeV - minimum energy electron needs to have to dark brem
db_model.epsilon = 0.01 #decrease epsilon from one to help with Geant4 biasing calculations
sim.dark_brem.activate( ap_mass , db_model )
import math
mass_power = max(math.log10(sim.dark_brem.ap_mass), 2.)
#Biasing dark brem up inside of the target
sim.biasing_operators = [
bias_operators.DarkBrem.target(sim.dark_brem.ap_mass**mass_power / db_model.epsilon**2)
]
sim.actions.extend([
#make sure electron reaches target with 3.5GeV
filters.TaggerVetoFilter(7000.),
#make sure dark brem occurs in the target where A' has at least 2GeV
filters.TargetDarkBremFilter(4000.),
#keep all prodcuts of dark brem(A' and recoil electron)
util.TrackProcessFilter.dark_brem()
])
return sim