Merge lp:~m-a-uchida/maus/GlobalDevelopment into lp:maus/merge
- GlobalDevelopment
- Merge into merge
Proposed by
Adam Dobbs
Status: | Merged |
---|---|
Merged at revision: | 1201 |
Proposed branch: | lp:~m-a-uchida/maus/GlobalDevelopment |
Merge into: | lp:maus/merge |
Diff against target: |
335 lines (+39/-199) 7 files modified
bin/Global/SampleDataCards/datacard_mu_plus_batch.py (+0/-104) bin/Global/SampleDataCards/datacard_mu_plus_through_tracks.py (+0/-65) bin/Global/pid_example_datacard.py (+8/-9) bin/Global/process_datacard.py (+8/-8) doc/workbook/MausWorkBook.tex (+2/-0) src/common_py/ConfigurationDefaults.py (+8/-8) src/map/MapCppGlobalPID/MapCppGlobalPID.cc (+13/-5) |
To merge this branch: | bzr merge lp:~m-a-uchida/maus/GlobalDevelopment |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
MAUS release managers | Pending | ||
Review via email: mp+323932@code.launchpad.net |
This proposal supersedes a proposal from 2017-05-11.
Commit message
Description of the change
To post a comment you must log in.
- 1201. By Adam Dobbs
-
Merge: global recon updates
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed file 'bin/Global/SampleDataCards/datacard_mu_plus_batch.py' |
2 | --- bin/Global/SampleDataCards/datacard_mu_plus_batch.py 2017-01-18 14:20:43 +0000 |
3 | +++ bin/Global/SampleDataCards/datacard_mu_plus_batch.py 1970-01-01 00:00:00 +0000 |
4 | @@ -1,104 +0,0 @@ |
5 | -""" |
6 | -Datacard to run with simulation of 200MeV/c muons |
7 | -""" |
8 | -# pylint: disable=C0103, W0611 |
9 | - |
10 | -import os |
11 | -job_number = int(os.getenv("LSB_JOBINDEX", 100)) |
12 | -input_root_file_name = "200MeV_mu_plus_hypothesis_Global_Recon" + \ |
13 | - str(job_number) + ".root" |
14 | -output_root_file_name = "200MeV_mu_plus_hypothesis_Global_Recon" + \ |
15 | - str(job_number) + ".root" |
16 | -output_json_file_name = "200MeV_mu_plus_hypothesis_Global_Recon" + \ |
17 | - str(job_number) + ".json" |
18 | -output_json_file_type = "text" |
19 | -input_json_file_name = "200MeV_mu_plus_hypothesis_Global_Recon" + \ |
20 | - str(job_number) + ".json" |
21 | -Ntuples_filename = "ntuples" + str(job_number) + ".root" |
22 | -efficiency_filename = "efficiency" + str(job_number) + ".csv" |
23 | -# Used by MapPyRemoveTracks. |
24 | -keep_only_muon_tracks = False |
25 | - |
26 | -# Used by MapCppSimulation |
27 | -keep_tracks = True # set to true to keep start and end point of every track |
28 | -keep_steps = False # set to true to keep start and end point of every track and |
29 | - # every step point |
30 | -simulation_geometry_filename = \ |
31 | - '%s/files/geometry/download/run7469/ParentGeometryFile.dat' \ |
32 | - % os.environ.get("MAUS_ROOT_DIR") |
33 | -reconstruction_geometry_filename = \ |
34 | - '%s/files/geometry/download/run7469/ParentGeometryFile.dat' \ |
35 | - % os.environ.get("MAUS_ROOT_DIR") |
36 | -maximum_number_of_steps = 100000000 |
37 | -simulation_reference_particle = { |
38 | - "position":{"x":0.0, "y":-0.0, "z":5200.0}, # 5200 |
39 | - "momentum":{"x":0.0, "y":0.0, "z":1.0}, |
40 | - "particle_id":-13, "energy":244.3, "time":0.0, "random_seed":job_number |
41 | -} |
42 | - |
43 | -#266.2 muon -13, 281.4 pion 211, 244.3 positron -11 |
44 | - |
45 | -muon_half_life = 1.e24 |
46 | -# used by InputPySpillGenerator to determine the number of empty spills that |
47 | -# will be generated by the simulation |
48 | -spill_generator_number_of_spills = 1000 |
49 | -# used by MapPyBeamMaker to generate input particle data |
50 | -# This is a sample beam distribution based on guesses by Chris Rogers of what |
51 | -# an optimised beam might look like |
52 | -beam = { |
53 | - "particle_generator":"counter", # routine for generating empty primaries |
54 | - "random_seed":job_number, # random seed for beam generation; controls also |
55 | - # how the MC seeds are generated |
56 | - "definitions":[ |
57 | - { |
58 | - "reference":simulation_reference_particle, # reference particle |
59 | - "random_seed_algorithm":"incrementing_random", # algorithm for seeding MC |
60 | - "n_particles_per_spill":1, # probability of generating a particle |
61 | - "transverse":{ |
62 | - "transverse_mode":"twiss", |
63 | - "beta_x":1000., |
64 | - "alpha_x":0., |
65 | - "emittance_x":6.0, # 4d emittance |
66 | - #~ "emittance_x":0.0001, |
67 | - "beta_y":8000., |
68 | - "alpha_y":0.5, |
69 | - "emittance_y":6.0, |
70 | - #~ "emittance_y":0.0001, |
71 | - }, |
72 | - #~ "transverse":{ |
73 | - #~ "transverse_mode":"constant_solenoid", # transverse distribution |
74 | - #matched to constant solenoid field |
75 | - #~ "emittance_4d":1., # 4d emittance |
76 | - #~ "normalised_angular_momentum":0.1, # angular momentum from diffuser |
77 | - #~ "bz":4.e-3 # magnetic field strength for angular p calculation |
78 | - #~ }, |
79 | - "longitudinal":{"longitudinal_mode":"sawtooth_time", |
80 | - "momentum_variable":"p", |
81 | - "sigma_p":25., # RMS total momentum |
82 | - "t_start":-1.e6, # start time of sawtooth |
83 | - "t_end":+1.e6}, # end time of sawtooth |
84 | - "coupling":{"coupling_mode":"none"} # no dispersion |
85 | - }] |
86 | -} |
87 | - |
88 | -particle_decay = True |
89 | -physics_processes = "standard" |
90 | -#~ physics_processes = "mean_energy_loss" |
91 | -TOF_calib_by = "date" |
92 | -TOF_calib_date_from = "2013-10-01 00:00:00" |
93 | -#~ header_and_footer_mode = "dont_append" |
94 | -verbose_level = 0 |
95 | -track_matching_pid_hypothesis = "kMuPlus" |
96 | -track_matching_energy_loss = True |
97 | -track_matching_tolerances = { |
98 | - "TOF0t":2.0, |
99 | - "TOF1x":50.0, |
100 | - "TOF1y":50.0, |
101 | - "TOF2x":50.0, |
102 | - "TOF2y":50.0, |
103 | - "KLy":42.0, |
104 | - "EMRx":1.5, # Multiplier for standard tolerance which is recon error*sqrt(12) |
105 | - "EMRy":1.5, |
106 | - "TOF12maxSpeed":1.0, # fraction of c between TOFs for through matching |
107 | - "TOF12minSpeed":0.5, |
108 | -} |
109 | |
110 | === removed file 'bin/Global/SampleDataCards/datacard_mu_plus_through_tracks.py' |
111 | --- bin/Global/SampleDataCards/datacard_mu_plus_through_tracks.py 2016-12-06 12:47:51 +0000 |
112 | +++ bin/Global/SampleDataCards/datacard_mu_plus_through_tracks.py 1970-01-01 00:00:00 +0000 |
113 | @@ -1,65 +0,0 @@ |
114 | -""" |
115 | -Datacard to run with simulation of 200MeV/c muons |
116 | -""" |
117 | -# pylint: disable=C0103, W0611 |
118 | - |
119 | -import os |
120 | -job_number = int(os.getenv("LSB_JOBINDEX", 10)) |
121 | - |
122 | -output_json_file_name = "200MeV_mu_plus_through" + str(job_number) + ".json" |
123 | -output_json_file_type = "text" |
124 | -efficiency_filename = "efficiency" + str(job_number) + ".csv" |
125 | -# Used by MapPyRemoveTracks. |
126 | -keep_only_muon_tracks = False |
127 | - |
128 | -# Used by MapCppSimulation |
129 | -keep_tracks = True # set to true to keep start and end point of every track |
130 | -keep_steps = False # set to true to keep start and end point of every track and |
131 | - # every step point |
132 | -simulation_geometry_filename = "Stage4_NoField.dat" |
133 | -maximum_number_of_steps = 10000 |
134 | -simulation_reference_particle = { |
135 | - "position":{"x":0.0, "y":-0.0, "z":10500.0}, |
136 | - "momentum":{"x":0.0, "y":0.0, "z":1.0}, |
137 | - "particle_id":-13, "energy":266.0, "time":0.0, "random_seed":job_number |
138 | -} |
139 | - |
140 | -muon_half_life = 1.e24 |
141 | -# used by InputPySpillGenerator to determine the number of empty spills that |
142 | -# will be generated by the simulation |
143 | -spill_generator_number_of_spills = 100 |
144 | -# used by MapPyBeamMaker to generate input particle data |
145 | -# This is a sample beam distribution based on guesses by Chris Rogers of what |
146 | -# an optimised beam might look like |
147 | -beam = { |
148 | - "particle_generator":"counter", # routine for generating empty primaries |
149 | - "random_seed":job_number, # random seed for beam generation; controls also |
150 | - # how the MC seeds are generated |
151 | - "definitions":[ |
152 | - { |
153 | - "reference":simulation_reference_particle, # reference particle |
154 | - "random_seed_algorithm":"incrementing_random", # algorithm for seeding MC |
155 | - "n_particles_per_spill":1, # probability of generating a particle |
156 | - "transverse":{ |
157 | - "transverse_mode":"twiss", |
158 | - "beta_x":8000., |
159 | - "alpha_x":1., |
160 | - "emittance_x":3.0, # 4d emittance |
161 | - "beta_y":8000., |
162 | - "alpha_y":1.0, |
163 | - "emittance_y":3.0, |
164 | - }, |
165 | - "longitudinal":{"longitudinal_mode":"sawtooth_time", |
166 | - "momentum_variable":"p", |
167 | - "sigma_p":25., # RMS total momentum |
168 | - "t_start":-1.e6, # start time of sawtooth |
169 | - "t_end":+1.e6}, # end time of sawtooth |
170 | - "coupling":{"coupling_mode":"none"} # no dispersion |
171 | - }] |
172 | -} |
173 | - |
174 | -particle_decay = True |
175 | -physics_processes = "mean_energy_loss" |
176 | -TOF_calib_by = "date" |
177 | -TOF_calib_date_from = "2013-10-01 00:00:00" |
178 | -SciFiPRHelicalOn = False |
179 | |
180 | === modified file 'bin/Global/pid_example_datacard.py' |
181 | --- bin/Global/pid_example_datacard.py 2016-12-06 12:47:51 +0000 |
182 | +++ bin/Global/pid_example_datacard.py 2017-05-11 16:29:09 +0000 |
183 | @@ -19,7 +19,7 @@ |
184 | input_root_file_name = "maus_output.root" |
185 | |
186 | # Output root file with track pid information included |
187 | -output_root_file_name = "output_Global_PID.json" |
188 | +output_root_file_name = "output_Global_PID.root" |
189 | |
190 | # Path to PDF file. The one currently listed (on 16/02/2016) is outdated |
191 | # and will be replaced, and this card updated. |
192 | @@ -60,11 +60,10 @@ |
193 | # competing pid hypotheses before they are selected as the correct hypothesis |
194 | pid_confidence_level = 10 |
195 | |
196 | -# PID track selection- select which tracks from TrackMatching to perform PID on. |
197 | -# Can perform PID on all tracks by setting to "all", or on all downstream tracks |
198 | -# (set to "DS"), all upstream (set to "US"), through tracks (set to "Through"), |
199 | -# or the upstream or downstream components of the throught track (set to |
200 | -# "Through_US" or "Through_DS" respectively). Or a combination of the above can |
201 | -# be used, entered as a space separated list, |
202 | -# e.g. "Through Through_US Through_DS" |
203 | -pid_track_selection = "Through" |
204 | +# PID track selection- select which tracks from TrackMatching to perform PID on. |
205 | +# Can perform PID on all tracks by setting to "all" which will give you PID'd |
206 | +# through and unmatched US and DS tracks, |
207 | +# on "through" tracks only (constituent tracks will be PID'd, so this excludes orphans) |
208 | +# with through or on all upstream and downstream tracks (ignoring whether tracks have |
209 | +# been through-matched) with "us\_and\_ds" |
210 | +pid_track_selection = "all" |
211 | |
212 | === modified file 'bin/Global/process_datacard.py' |
213 | --- bin/Global/process_datacard.py 2017-02-17 14:32:36 +0000 |
214 | +++ bin/Global/process_datacard.py 2017-05-11 16:29:09 +0000 |
215 | @@ -43,14 +43,14 @@ |
216 | # When editing, keep in mind the fundamental limit imposed by detector |
217 | # resolution. |
218 | track_matching_tolerances = { |
219 | - "TOF0t":2.0, |
220 | - "TOF1x":40.0, |
221 | - "TOF1y":40.0, |
222 | - "TOF2x":40.0, |
223 | - "TOF2y":40.0, |
224 | - "KLy":32.0, # KL only reconstructs y position |
225 | - "EMRx":40.0, # Multiplier for the standard tolerance which is the |
226 | - "EMRy":40.0, # reconstructed error*sqrt(12) |
227 | + "TOF0t":2.0, #ns between actual and expected TOF0-1 Delta t |
228 | + "TOF1x":60.0, |
229 | + "TOF1y":60.0, |
230 | + "TOF2x":50.0, |
231 | + "TOF2y":50.0, |
232 | + "KLy":50.0, # KL only reconstructs y position |
233 | + "EMRx":75.0, # Multiplier for the standard tolerance which is the |
234 | + "EMRy":75.0, # reconstructed error*sqrt(12) |
235 | "TOF12maxSpeed":1.0, # fraction of c to calculate travel time between TOFs |
236 | "TOF12minSpeed":0.5, # for through matching |
237 | } |
238 | |
239 | === modified file 'doc/workbook/MausWorkBook.tex' |
240 | --- doc/workbook/MausWorkBook.tex 2017-02-14 10:26:17 +0000 |
241 | +++ doc/workbook/MausWorkBook.tex 2017-05-11 16:29:09 +0000 |
242 | @@ -546,7 +546,9 @@ |
243 | \item{set \texttt{input\_root\_file\_name to trackmatched\_data.root}.} |
244 | \item{change \texttt{PID\_PDFs\_file} to point to \texttt{single\_PDF\_filename.root} from above.} |
245 | \item{\texttt{pid\_config}, \texttt{pid\_beam\_setting} and \texttt{pid\_beamline\_polarity} must also be set (to match those set when the PDFs were made).} |
246 | +\item{Set \texttt{pid\_track\_selection} to select which tracks from TrackMatching to perform PID on. Can perform PID on all tracks by setting to ``all'' which will give you PID'd Through and unmatched US and DS tracks, on through tracks only (constituent tracks will be PID'd, so this excludes orphans) with ``through'' or on all upstream and downstream tracks (ignoring whether tracks have been through-matched) with "us\_and\_ds"} |
247 | \end{enumerate} |
248 | + |
249 | \item At the command line, run: |
250 | \begin{lstlisting} |
251 | python GlobalPID.py --configuration_file edited_pid_example_datacard.py |
252 | |
253 | === modified file 'src/common_py/ConfigurationDefaults.py' |
254 | --- src/common_py/ConfigurationDefaults.py 2017-05-02 16:26:10 +0000 |
255 | +++ src/common_py/ConfigurationDefaults.py 2017-05-11 16:29:09 +0000 |
256 | @@ -796,7 +796,7 @@ |
257 | # PID track selection- select which tracks from TrackMatching to perform PID on. Can perform PID on all tracks by |
258 | # setting to "all", on through tracks only (constituent tracks will be PID'd, so this excludes orphans) with |
259 | # "through" or on all upstream and downstream tracks (ignoring whether tracks have been through-matched) with |
260 | -# "constituents" |
261 | +# "us_and_ds" |
262 | pid_track_selection = "all" |
263 | |
264 | # Determines for which pid hypotheses track matching should be attempted. Default is "all" |
265 | @@ -810,13 +810,13 @@ |
266 | # so a multiplier is used. |
267 | track_matching_tolerances = { |
268 | "TOF0t":2.0, # ns between actual and expected TOF0-1 Delta t |
269 | - "TOF1x":40.0, |
270 | - "TOF1y":40.0, |
271 | - "TOF2x":40.0, |
272 | - "TOF2y":40.0, |
273 | - "KLy":32.0, |
274 | - "EMRx":40.0, # Multiplier for the standard tolerance which is the reconstructed error*sqrt(12) |
275 | - "EMRy":40.0, |
276 | + "TOF1x":60.0, |
277 | + "TOF1y":60.0, |
278 | + "TOF2x":50.0, |
279 | + "TOF2y":50.0, |
280 | + "KLy":50.0, |
281 | + "EMRx":75.0, # Multiplier for the standard tolerance which is the reconstructed error*sqrt(12) |
282 | + "EMRy":75.0, |
283 | "TOF12maxSpeed":1.0, # fraction of c to calculate travel time between TOFs for through matching |
284 | "TOF12minSpeed":0.5, |
285 | } |
286 | |
287 | === modified file 'src/map/MapCppGlobalPID/MapCppGlobalPID.cc' |
288 | --- src/map/MapCppGlobalPID/MapCppGlobalPID.cc 2017-02-16 17:44:47 +0000 |
289 | +++ src/map/MapCppGlobalPID/MapCppGlobalPID.cc 2017-05-11 16:29:09 +0000 |
290 | @@ -140,7 +140,7 @@ |
291 | _pid_track_selection = _configJSON["pid_track_selection"].asString(); |
292 | |
293 | if (_pid_track_selection != "all" and _pid_track_selection != "through" |
294 | - and _pid_track_selection != "constituents") { |
295 | + and _pid_track_selection != "us_and_ds") { |
296 | throw MAUS::Exceptions::Exception(Exceptions::recoverable, |
297 | "Invalid pid_track_selection set in configuration", "MapCppGlobalPID::birth"); |
298 | } |
299 | @@ -316,8 +316,16 @@ |
300 | if (!global_event) { |
301 | continue; |
302 | } |
303 | - // Regardless of whether we PID through tracks or not, we first have to PID the constituents |
304 | - if (_pid_track_selection == "all" or _pid_track_selection == "constituents") { |
305 | + |
306 | + // For comissioning, we ignore pid_track_selection as PIDing us_and_ds doesn't make sense |
307 | + // due to cross-channel PID variables |
308 | + if (_pid_config == "commissioning") { |
309 | + PerformPID(global_event->GetThroughPrimaryChains(), global_event); |
310 | + continue; |
311 | + } |
312 | + |
313 | + // Regardless of whether we PID through tracks or not, we first have to PID the us_and_ds |
314 | + if (_pid_track_selection == "all" or _pid_track_selection == "us_and_ds") { |
315 | PerformPID(global_event->GetNonThroughPrimaryChains(), global_event); |
316 | } else if (_pid_track_selection == "through") { |
317 | PerformPID(global_event->GetUSPrimaryChains(), global_event); |
318 | @@ -427,7 +435,7 @@ |
319 | std::vector<const MAUS::DataStructure::Global::Track*> constituent_tracks = |
320 | through_track->GetConstituentTracks(); |
321 | // Make sure that we have an intact through-constituent set. There should be exactly two |
322 | - // constituents and the through track should have all the detectors the constituents have |
323 | + // us_and_ds and the through track should have all the detectors the us_and_ds have |
324 | // with no overlaps |
325 | if (!(constituent_tracks.size() == 2 and |
326 | (constituent_tracks.at(0)->get_detectorpoints() + |
327 | @@ -441,7 +449,7 @@ |
328 | constituent_tracks.at(1)->get_pid_logL_values(); |
329 | if (!(pairs_0.size() == 3 and pairs_1.size() == 3)) { |
330 | Squeak::mout(Squeak::error) << "Through PID failed due to incorrect number of PIDLogLPairs " |
331 | - << "in constituents. MapCppGlobalPID::ThroughPID()" << std::endl; |
332 | + << "in us_and_ds. MapCppGlobalPID::ThroughPID()" << std::endl; |
333 | return; |
334 | } |
335 | // Assemble all logL pairs into a single vector so we can iterate over it |