Merge lp:~christopher-hunt08/maus/maus_scifi_updates into lp:maus/merge

Proposed by Christopher Hunt
Status: Merged
Merged at revision: 1114
Proposed branch: lp:~christopher-hunt08/maus/maus_scifi_updates
Merge into: lp:maus/merge
Diff against target: 359 lines (+111/-43)
6 files modified
bin/user/scifi/tracker_resolution_plots.py (+10/-10)
bin/utilities/data_tracker_verify.py (+70/-9)
src/common_cpp/Recon/SciFi/SciFiGeometryHelper.cc (+5/-1)
src/common_py/analysis/inspectors.py (+3/-1)
src/common_py/analysis/tools.py (+17/-19)
src/map/MapCppTrackerVirtualsDigitization/MapCppTrackerVirtualsDigitization.cc (+6/-3)
To merge this branch: bzr merge lp:~christopher-hunt08/maus/maus_scifi_updates
Reviewer Review Type Date Requested Status
MAUS Maintainers Pending
Review via email: mp+297830@code.launchpad.net

Description of the change

Straight track alignment fix.

To post a comment you must log in.
1069. By Christopher Hunt

Fixed Style tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/user/scifi/tracker_resolution_plots.py'
2--- bin/user/scifi/tracker_resolution_plots.py 2016-05-24 16:01:44 +0000
3+++ bin/user/scifi/tracker_resolution_plots.py 2016-06-20 10:16:19 +0000
4@@ -179,7 +179,7 @@
5
6
7 tracker_dict['residual_xy'] = ROOT.TH2F( tracker+'_residual_xy', \
8- 'Residual Position', 500, -50.0, 50.0, 500, -50.0, 50.0 )
9+ 'Residual Position', 800, -20.0, 20.0, 800, -20.0, 20.0 )
10
11 tracker_dict['residual_mxmy'] = ROOT.TH2F( tracker+'_residual_mxmy', \
12 'Residual Gradient', 500, -0.5, 0.5, 500, -0.5, 0.5 )
13@@ -252,13 +252,13 @@
14
15 tracker_dict['x_residual_p'] = ROOT.TH2F( \
16 tracker+'_x_residual_p', "X Residuals in p", \
17- PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
18+ PZ_BIN, PZ_MIN, PZ_MAX, 500, -20.0, 20.0 )
19 tracker_dict['y_residual_p'] = ROOT.TH2F( \
20 tracker+'_y_residual_p', "Y Residuals in p", \
21- PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
22+ PZ_BIN, PZ_MIN, PZ_MAX, 500, -20.0, 20.0 )
23 tracker_dict['r_residual_p'] = ROOT.TH2F( \
24 tracker+'_r_residual_p', "Radius Residuals in p", \
25- PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
26+ PZ_BIN, PZ_MIN, PZ_MAX, 500, 0.0, 50.0 )
27
28 tracker_dict['px_residual_p'] = ROOT.TH2F( \
29 tracker+'_px_residual_p', "p_{x} Residuals in p", \
30@@ -281,13 +281,13 @@
31
32 tracker_dict['x_residual_pt'] = ROOT.TH2F( \
33 tracker+'_x_residual_pt', "X Residuals in p_{t}", \
34- PT_BIN, PT_MIN, PT_MAX, 500, -50.0, 50.0 )
35+ PT_BIN, PT_MIN, PT_MAX, 500, -20.0, 20.0 )
36 tracker_dict['y_residual_pt'] = ROOT.TH2F( \
37 tracker+'_y_residual_pt', "Y Residuals in p_{t}", \
38- PT_BIN, PT_MIN, PT_MAX, 500, -50.0, 50.0 )
39+ PT_BIN, PT_MIN, PT_MAX, 500, -20.0, 20.0 )
40 tracker_dict['r_residual_pt'] = ROOT.TH2F( \
41 tracker+'_r_residual_pt', "Radius Residuals in p_{t}", \
42- PT_BIN, PT_MIN, PT_MAX, 500, -50.0, 50.0 )
43+ PT_BIN, PT_MIN, PT_MAX, 500, 0.0, 50.0 )
44
45 tracker_dict['px_residual_pt'] = ROOT.TH2F( \
46 tracker+'_px_residual_pt', "p_{x} Residuals in p_{t}", \
47@@ -310,13 +310,13 @@
48
49 tracker_dict['x_residual_pz'] = ROOT.TH2F( \
50 tracker+'_x_residual_pz', "X Residuals in p_{z}", \
51- PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
52+ PZ_BIN, PZ_MIN, PZ_MAX, 500, -20.0, 20.0 )
53 tracker_dict['y_residual_pz'] = ROOT.TH2F( \
54 tracker+'_y_residual_pz', "Y Residuals in p_{z}", \
55- PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
56+ PZ_BIN, PZ_MIN, PZ_MAX, 500, -20.0, 20.0 )
57 tracker_dict['r_residual_pz'] = ROOT.TH2F( \
58 tracker+'_r_residual_pz', "Radius Residuals in p_{z}", \
59- PZ_BIN, PZ_MIN, PZ_MAX, 500, -50.0, 50.0 )
60+ PZ_BIN, PZ_MIN, PZ_MAX, 500, 0.0, 50.0 )
61
62 tracker_dict['mx_residual_pz'] = ROOT.TH2F( \
63 tracker+'_mx_residual_pz', "m_{x} Residuals in p_{z}", \
64
65=== modified file 'bin/utilities/data_tracker_verify.py'
66--- bin/utilities/data_tracker_verify.py 2016-05-24 16:01:44 +0000
67+++ bin/utilities/data_tracker_verify.py 2016-06-20 10:16:19 +0000
68@@ -173,15 +173,26 @@
69 reco_plots['channels_cluster'] = ROOT.TH1F( 'channels_cluster', \
70 "Channels per Cluster", 50, 0.0, 50.0 )
71 reco_plots['spacepoints_station'] = ROOT.TH1F( "spacepoints_station", \
72- "Spacepoints Found in Each Station", 11, -5.0, 6.0 )
73+ "Spacepoints Found in Each Station", 11, -5.5, 5.5 )
74 reco_plots['2_hit_spacepoints_station'] = ROOT.TH1F( \
75 "2_hit_spacepoints_station", \
76- "Spacepoints Found in Each Station", 11, -5.0, 6.0 )
77+ "Spacepoints Found in Each Station", 11, -5.5, 5.5 )
78 reco_plots['3_hit_spacepoints_station'] = ROOT.TH1F( \
79 "3_hit_spacepoints_station", \
80- "Spacepoints Found in Each Station", 11, -5.0, 6.0 )
81+ "Spacepoints Found in Each Station", 11, -5.5, 5.5 )
82 reco_plots['clusters_plane'] = ROOT.TH1F( "clusters_plane", \
83- "Clusters Found in Each Plane", 31, -15.0, 16.0 )
84+ "Clusters Found in Each Plane", 31, -15.5, 15.5 )
85+ reco_plots['spacepoints_station_used'] = ROOT.TH1F( \
86+ "spacepoints_station_used", \
87+ "Spacepoints Found in Each Station", 11, -5.5, 5.5 )
88+ reco_plots['2_hit_spacepoints_station_used'] = ROOT.TH1F( \
89+ "2_hit_spacepoints_station_used", \
90+ "Spacepoints Found in Each Station", 11, -5.5, 5.5 )
91+ reco_plots['3_hit_spacepoints_station_used'] = ROOT.TH1F( \
92+ "3_hit_spacepoints_station_used", \
93+ "Spacepoints Found in Each Station", 11, -5.5, 5.5 )
94+ reco_plots['clusters_plane_used'] = ROOT.TH1F( "clusters_plane_used", \
95+ "Clusters Found in Each Plane", 31, -15.5, 15.5 )
96 reco_plots['spacepoints'] = ROOT.TH2F( 'spacepoints', \
97 "Spacepoint Positions", 200, -200.0, 200.0, 200, -200.0, 200.0 )
98 reco_plots['saturations_event'] = ROOT.TH1F( 'saturations_event', \
99@@ -268,6 +279,9 @@
100 200, -200.0, 200.0, 200, -200.0, 200.0 )
101 station_plots[dir_name]['kuno_plot'] = ROOT.TH1F( dir_name+'_kuno', \
102 "Kuno Plot: "+dir_name, 1001, -0.25, 500.25 )
103+ station_plots[dir_name]['kuno_plot_used'] = ROOT.TH1F( \
104+ dir_name+'_kuno_used', \
105+ "Kuno Plot: "+dir_name, 1001, -0.25, 500.25 )
106
107
108 plane_plots = {}
109@@ -290,6 +304,8 @@
110
111 plane_plots[dir_name]['channels_cluster'] = ROOT.TH1F( \
112 dir_name+'_channels_cluster', "Channels per Cluster", 50, 0.0, 50.0 )
113+ plane_plots[dir_name]['channels_cluster_used'] = ROOT.TH1F( \
114+ dir_name+'_channels_cluster_used', "Channels per Cluster", 50, 0.0, 50.0 )
115 plane_plots[dir_name]['npe_cluster'] = ROOT.TH1F( \
116 dir_name+'_npe_cluster', "NPE per Cluster", 75, 0.0, 75.0 )
117
118@@ -386,6 +402,7 @@
119 Examine a SciFi Event to see if it should be vetoed
120 """
121 digits = event.digits()
122+ tracks = event.scifitracks()
123 saturation_counter = 0
124
125 for digit in digits :
126@@ -394,8 +411,33 @@
127
128 if saturation_counter > 1000 :
129 return True
130- else :
131- return False
132+
133+ upstream_tracks = 0
134+ downstream_tracks = 0
135+ for track in tracks :
136+ if track.P_value() < P_VALUE_CUT :
137+ return True
138+
139+ if track.tracker() == 0 :
140+ upstream_tracks += 1
141+ else :
142+ downstream_tracks += 1
143+
144+ trackpoints = track.scifitrackpoints()
145+ count_trackpoints = 0
146+ for tp in trackpoints :
147+ if tp.has_data() :
148+ count_trackpoints += 1
149+ elif tools.calculate_plane_id( tp.tracker(), tp.station(), tp.plane()) \
150+ in IGNORE_PLANES :
151+ count_trackpoints += 1
152+ if count_trackpoints < MIN_NUM_TRACKPOINTS :
153+ return True
154+
155+ if (upstream_tracks != 1) or (downstream_tracks != 1) :
156+ return True
157+
158+ return False
159
160
161 def fill_plots_data(plot_dict, data_dict, event) :
162@@ -468,11 +510,15 @@
163 plot_dict['recon_plots']['saturations_event'].Fill( saturation_counter )
164
165 kuno_sums = {}
166+ kuno_sums_used = {}
167 for tracker in [ 0, 1 ] :
168 kuno_sums_stations = {}
169+ kuno_sums_stations_used = {}
170 for station in [ 1, 2, 3, 4, 5 ] :
171 kuno_sums_stations[ station ] = 0.0
172+ kuno_sums_stations_used[ station ] = 0.0
173 kuno_sums[tracker] = kuno_sums_stations
174+ kuno_sums_used[tracker] = kuno_sums_stations_used
175
176 for cluster in clusters :
177 tracker = cluster.get_tracker()
178@@ -488,6 +534,10 @@
179 ( -1.0 if tracker == 0 else 1.0 )
180 clus_digits = cluster.get_digits_pointers()
181 reco_plots['clusters_plane'].Fill(plane_id)
182+ if cluster.is_used() :
183+ kuno_sums_used[tracker][station] += cluster.get_channel()
184+ reco_plots['clusters_plane_used'].Fill(plane_id)
185+ plane_plots[dir_name]['channels_cluster_used'].Fill( len(clus_digits) )
186 reco_plots['channels_cluster'].Fill( len(clus_digits) )
187 plane_plots[dir_name]['channels_cluster'].Fill( len(clus_digits) )
188
189@@ -513,6 +563,8 @@
190 for station in [ 1, 2, 3, 4, 5 ] :
191 dir_name = str(tracker)+'.'+str(station)
192 station_plots[dir_name]['kuno_plot'].Fill( kuno_sums[tracker][station] )
193+ station_plots[dir_name]['kuno_plot_used'].Fill( \
194+ kuno_sums_used[tracker][station] )
195
196 for spacepoint in spacepoints :
197 tracker = spacepoint.get_tracker()
198@@ -520,6 +572,8 @@
199
200 station_id = station * ( -1.0 if tracker == 0 else 1.0 )
201 reco_plots['spacepoints_station'].Fill(station_id)
202+ if spacepoint.is_used() :
203+ reco_plots['spacepoints_station_used'].Fill(station_id)
204 reco_plots['spacepoints'].Fill( spacepoint.get_position().x(), \
205 spacepoint.get_position().y() )
206
207@@ -541,6 +595,13 @@
208 raise ValueError( "Unknown Number of spacepoints: " + \
209 str( sp_clusters ) )
210
211+ if spacepoint.is_used() :
212+ if len( sp_clusters ) == 2 :
213+ reco_plots['2_hit_spacepoints_station_used'].Fill( station_id )
214+ elif len( sp_clusters ) == 3 :
215+ reco_plots['3_hit_spacepoints_station_used'].Fill( station_id )
216+
217+
218 npe = 0.0
219 for cluster in sp_clusters :
220 clus_digits = cluster.get_digits_pointers()
221@@ -967,11 +1028,11 @@
222 ##### 3. Fill plots ###########################################################
223 if namespace.cut_tof and cut_tof_event( plot_dict, tof_event ) :
224 continue
225- if namespace.cut_scifi and \
226+ elif namespace.cut_scifi and \
227 cut_scifi_event( plot_dict, scifi_event ) :
228 continue
229-
230- fill_plots_data(plot_dict, data_dict, scifi_event)
231+ else :
232+ fill_plots_data(plot_dict, data_dict, scifi_event)
233
234 except ValueError as ex :
235 print "An Error Occured: " + str( ex )
236
237=== modified file 'src/common_cpp/Recon/SciFi/SciFiGeometryHelper.cc'
238--- src/common_cpp/Recon/SciFi/SciFiGeometryHelper.cc 2016-06-10 11:57:21 +0000
239+++ src/common_cpp/Recon/SciFi/SciFiGeometryHelper.cc 2016-06-20 10:16:19 +0000
240@@ -135,7 +135,11 @@
241
242 SciFiTrackerGeometry trackerGeo = _geometry_map[tracker_n];
243 trackerGeo.Position = referencePos;
244- trackerGeo.Rotation = trackerModule->globalRotation();
245+ if (UseActiveRotations == true) {
246+ trackerGeo.Rotation = trackerModule->globalRotation();
247+ } else {
248+ trackerGeo.Rotation = trackerModule->globalRotation().inverse();
249+ }
250 FieldValue(trackerModule, trackerGeo);
251 trackerGeo.Planes[plane_id] = this_plane;
252
253
254=== modified file 'src/common_py/analysis/inspectors.py'
255--- src/common_py/analysis/inspectors.py 2016-05-06 17:17:13 +0000
256+++ src/common_py/analysis/inspectors.py 2016-06-20 10:16:19 +0000
257@@ -106,7 +106,9 @@
258 def add_hit(self, hit) :
259 if self.momentum_bias is not None :
260 p = hit.get_p()
261- correction = 1.0 + (self.momentum_bias + self.momentum_correlation*p) / p
262+# correction = 1.0 + (self.momentum_bias + self.momentum_correlation*p) / p
263+ correction = ((p - self.momentum_bias) / \
264+ (1.0 - self.momentum_correlation)) / p
265 hit.set_px(hit.get_px()*correction)
266 hit.set_py(hit.get_py()*correction)
267 hit.set_pz(hit.get_pz()*correction)
268
269=== modified file 'src/common_py/analysis/tools.py'
270--- src/common_py/analysis/tools.py 2016-05-11 13:10:28 +0000
271+++ src/common_py/analysis/tools.py 2016-06-20 10:16:19 +0000
272@@ -102,23 +102,22 @@
273 projection = hist.ProjectionY( \
274 name+'_pro_'+str(i), i, i )
275 if projection.GetEntries() == 0 :
276- x_pos.append( 0.0 )
277- y_pos.append( 0.0 )
278- x_error.append( 0.0 )
279- y_error.append( 0.0 )
280+ continue
281
282 pro_mean, pro_mean_err, pro_std, pro_std_err = \
283 fit_gaussian( projection, fit_min, fit_max )
284
285 x_pos.append( hist.GetXaxis().GetBinCenter( i ) )
286 y_pos.append( pro_mean )
287- x_error.append( hist.GetXaxis().GetBinWidth( i ) )
288+ x_error.append( 0.5*hist.GetXaxis().GetBinWidth( i ) )
289 y_error.append( pro_mean_err )
290
291- profile = ROOT.TGraphErrors( len( x_pos ), x_pos, y_pos, x_error, y_error )
292- profile.SetName( name+'_profile' )
293-
294- return profile
295+ if len( x_pos ) < 1 :
296+ return None
297+ else :
298+ profile = ROOT.TGraphErrors( len( x_pos ), x_pos, y_pos, x_error, y_error )
299+ profile.SetName( name+'_profile' )
300+ return profile
301
302
303 def gaussian_profile_y(hist, fit_min=0, fit_max=0) :
304@@ -137,10 +136,7 @@
305 projection = hist.ProjectionX( \
306 name+'_pro_'+str(i), i, i )
307 if projection.GetEntries() == 0 :
308- x_pos.append( 0.0 )
309- y_pos.append( 0.0 )
310- x_error.append( 0.0 )
311- y_error.append( 0.0 )
312+ continue
313
314 pro_mean, pro_mean_err, pro_std, pro_std_err = \
315 fit_gaussian( projection, fit_min, fit_max )
316@@ -148,12 +144,14 @@
317 x_pos.append( pro_mean )
318 y_pos.append( hist.GetYaxis().GetBinCenter( i ) )
319 x_error.append( pro_mean_err )
320- y_error.append( hist.GetYaxis().GetBinWidth( i ) )
321-
322- profile = ROOT.TGraphErrors( len( x_pos ), x_pos, y_pos, x_error, y_error )
323- profile.SetName( name+'_profile' )
324-
325- return profile
326+ y_error.append( 0.5*hist.GetYaxis().GetBinWidth( i ) )
327+
328+ if len( x_pos ) < 1 :
329+ return None
330+ else :
331+ profile = ROOT.TGraphErrors( len( x_pos ), x_pos, y_pos, x_error, y_error )
332+ profile.SetName( name+'_profile' )
333+ return profile
334
335
336 def sort_arrays(array_lists, key_list=0, descending=True) :
337
338=== modified file 'src/map/MapCppTrackerVirtualsDigitization/MapCppTrackerVirtualsDigitization.cc'
339--- src/map/MapCppTrackerVirtualsDigitization/MapCppTrackerVirtualsDigitization.cc 2016-03-08 12:45:28 +0000
340+++ src/map/MapCppTrackerVirtualsDigitization/MapCppTrackerVirtualsDigitization.cc 2016-06-20 10:16:19 +0000
341@@ -443,12 +443,15 @@
342
343 ThreeVector vec = geometry.Direction.Orthogonal().Unit();
344 double alpha = position.Dot(vec);
345- int channelNumber = floor(0.5 + ((7.0 * geometry.CentralFibre) -
346- (2.0 * alpha / geometry.Pitch)) / 7.0);
347+ double channelNumber = 0.5 + ((7.0 * geometry.CentralFibre) -
348+ (2.0 * alpha / geometry.Pitch)) / 7.0;
349+
350+ channelNumber = floor(channelNumber*2.0) / 2.0; // Force half integer binning
351
352 double new_alpha;
353 if (_smear_value < 0.0) {
354- new_alpha = 3.5 * geometry.Pitch * static_cast<double>(geometry.CentralFibre - channelNumber);
355+ new_alpha = 3.5 * geometry.Pitch *
356+ (static_cast<double>(geometry.CentralFibre) - channelNumber);
357 } else {
358 double smear_amount = CLHEP::RandGauss::shoot(0.0, _smear_value);
359 new_alpha = alpha + smear_amount;

Subscribers

People subscribed via source and target branches