16 add_cdc_cr_track_finding,
17 add_cdc_track_finding,
18 add_cr_track_fit_and_track_creator,
19 add_eclcdc_track_finding,
21 add_hit_preparation_modules,
24 add_flipping_of_recoTracks,
25 add_pxd_cr_track_finding,
26 add_pxd_track_finding,
27 add_svd_track_finding,
28 add_track_fit_and_track_creator,
29 add_prefilter_track_fit_and_track_creator,
30 add_vxd_track_finding_vxdtf2,
31 add_svd_standalone_tracking,
39 from pxd
import add_pxd_reconstruction
42 def add_tracking_reconstruction(path, components=None, pruneTracks=False, skipGeometryAdding=False,
43 mcTrackFinding=False, trackFitHypotheses=None,
44 reco_tracks="RecoTracks", prune_temporary_tracks=True, fit_tracks=True,
45 use_second_cdc_hits=False, skipHitPreparerAdding=False,
46 svd_standalone_mode="VXDTF2",
47 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
48 add_cdcTrack_QI=True, add_vxdTrack_QI=False, add_recoTrack_QI=False,
49 pxd_filtering_offline=False, append_full_grid_cdc_eventt0=False,
50 v0_finding=True, flip_recoTrack=True):
52 This function adds the **standard tracking reconstruction** modules
55 #. first we find tracks using the CDC hits only, see :ref:`CDC Track Finding<tracking_trackFindingCDC>`
57 #. CDC tracks are extrapolated to SVD and SVD hits are attached, see :ref:`CDC to SVD CKF<tracking_cdc2svd_ckf>`
59 #. remaining SVD hits are used to find SVD tracks, see :ref:`SVD Track Finding<tracking_trackFindingSVD>`
61 #. SVD tracks are extrapolated to CDC to attach CDC hits, see :ref:`SVD to CDC CKF<tracking_svd2cdc_ckf>`
63 #. SVD and CDC tracks are merged and fitted, see :ref:`Track Fitting<tracking_trackFitting>`
65 #. merged SVD+CDC tracks are extrapolated to PXD to attach PXD hits, see :ref:`SVD to PXD CKF<tracking_svd2pxd_ckf>`
69 PXD hits are not available on HLT. At the end of the tracking chain on HLT we have the\
70 :ref:`PXD Region Of Interest Finding<tracking_pxdDataReduction>`, that consists of extrapolating\
71 the tracks on the PXD sensors and defining regions in which we expect to find the hit.\
72 Only fired pixels inside these regions reach Event Builder 2.
74 #. after all the tracks from the IP are found, we look for special classes of tracks,\
75 in particular we search for displaced vertices to reconstruct K-short, Lambda and\
76 photon-conversions, see :ref:`V0 Finding<tracking_v0Finding>`.
78 #. If the reconstruction uses PXD, we finally look for tracks with a wrong charge,\
79 flip and refit them to fix the charge, see :ref:`Flip&Refit<trk_flipNrefit>`.
83 :param path: the path to add the tracking reconstruction modules to
84 :param components: the list of geometry components in use or None for all components.
85 :param pruneTracks: if true, delete all hits except the first and the last in the found tracks.
86 :param skipGeometryAdding: (advanced flag) the tracking modules need the geometry module and will add it,
87 if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not
88 determine, if the geometry is already loaded. This flag can be used o just turn off the geometry adding at
89 all (but you will have to add it on your own then).
90 :param skipHitPreparerAdding: (advanced flag) if true, do not add the hit preparation (esp. VXD cluster creation
91 modules. This is useful if they have been added before already.
92 :param mcTrackFinding: if true, use the MC track finders instead of the realistic ones.
93 :param reco_tracks: name of the StoreArray where the reco tracks should be stored
94 :param prune_temporary_tracks: if false, store all information of the single CDC and VXD tracks before merging.
96 :param fit_tracks: if false, the final track find and the TrackCreator module will no be executed
97 :param use_second_cdc_hits: if true, the second hit information will be used in the CDC track finding.
98 :param trackFitHypotheses: which pdg hypothesis to fit. Defaults to [211, 321, 2212].
99 :param svd_standalone_mode: Which SVD standalone tracking is used.
100 Options are "VXDTF2", "SVDHough", "VXDTF2_and_SVDHough", and "SVDHough_and_VXDTF2".
102 :param use_svd_to_cdc_ckf: if true, add SVD to CDC CKF module.
103 :param use_ecl_to_cdc_ckf: if true, add ECL to CDC CKF module.
104 :param add_cdcTrack_QI: if true, add the MVA track quality estimation
105 to the path that sets the quality indicator property of the found CDC standalone tracks
106 :param add_vxdTrack_QI: if true, add the MVA track quality estimation
107 to the path that sets the quality indicator property of the found VXDTF2 tracks
108 (ATTENTION: Standard triplet QI of VXDTF2 is replaced in this case
109 -> setting this option to 'True' will have some influence on the final track collection)
110 :param add_recoTrack_QI: if true, add the MVA track quality estimation
111 to the path that sets the quality indicator property of all found reco tracks
112 (Both other QIs needed as input.)
113 :param pxd_filtering_offline: If True, PXD data reduction (ROI filtering) is applied during the track reconstruction.
114 The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.
115 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor is added to the path
116 and provides the CDC temporary EventT0.
117 :param v0_finding: if false, the V0Finder module is not executed
118 :param flip_recoTrack: if true, add the recoTracks flipping function in the postfilter (only if PXD is present)
121 add_prefilter_tracking_reconstruction(
123 components=components,
124 skipGeometryAdding=skipGeometryAdding,
125 mcTrackFinding=mcTrackFinding,
126 trackFitHypotheses=trackFitHypotheses,
127 reco_tracks=reco_tracks,
128 prune_temporary_tracks=prune_temporary_tracks,
129 fit_tracks=fit_tracks,
130 use_second_cdc_hits=use_second_cdc_hits,
131 skipHitPreparerAdding=skipHitPreparerAdding,
132 svd_standalone_mode=svd_standalone_mode,
133 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
134 use_ecl_to_cdc_ckf=use_ecl_to_cdc_ckf,
135 add_cdcTrack_QI=add_cdcTrack_QI,
136 add_vxdTrack_QI=add_vxdTrack_QI,
137 add_recoTrack_QI=add_recoTrack_QI,
138 pxd_filtering_offline=pxd_filtering_offline,
139 append_full_grid_cdc_eventt0=append_full_grid_cdc_eventt0)
141 add_postfilter_tracking_reconstruction(path,
142 components=components,
143 pruneTracks=pruneTracks,
144 reco_tracks=reco_tracks,
145 use_second_cdc_hits=use_second_cdc_hits,
146 prune_temporary_tracks=prune_temporary_tracks,
147 v0_finding=v0_finding,
148 flip_recoTrack=flip_recoTrack,
149 mcTrackFinding=mcTrackFinding)
152 def add_prefilter_tracking_reconstruction(path, components=None, skipGeometryAdding=False,
153 mcTrackFinding=False, trackFitHypotheses=None, reco_tracks="RecoTracks",
154 prune_temporary_tracks=True, fit_tracks=True,
155 use_second_cdc_hits=False, skipHitPreparerAdding=False,
156 svd_standalone_mode="VXDTF2",
157 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
158 add_cdcTrack_QI=True, add_vxdTrack_QI=False, add_recoTrack_QI=False,
159 pxd_filtering_offline=False, append_full_grid_cdc_eventt0=False):
161 This function adds the tracking reconstruction modules required to calculate HLT filter decision
164 :param path: The path to add the tracking reconstruction modules to
165 :param components: the list of geometry components in use or None for all components.
166 :param skipGeometryAdding: Advances flag: The tracking modules need the geometry module and will add it,
167 if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not
168 determine, if the geometry is already loaded. This flag can be used o just turn off the geometry adding at
169 all (but you will have to add it on your own then).
170 :param skipHitPreparerAdding: Advanced flag: do not add the hit preparation (esp. VXD cluster creation
171 modules. This is useful if they have been added before already.
172 :param mcTrackFinding: Use the MC track finders instead of the realistic ones.
173 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
174 :param prune_temporary_tracks: If false, store all information of the single CDC and VXD tracks before merging.
176 :param fit_tracks: If false, the final track find and the TrackCreator module will no be executed
177 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
178 :param trackFitHypotheses: Which pdg hypothesis to fit. Defaults to [211, 321, 2212].
179 :param svd_standalone_mode: Which SVD standalone tracking is used.
180 Options are "VXDTF2", "SVDHough", "VXDTF2_and_SVDHough", and "SVDHough_and_VXDTF2".
182 :param use_svd_to_cdc_ckf: if true, add SVD to CDC CKF module.
183 :param use_ecl_to_cdc_ckf: if true, add ECL to CDC CKF module.
184 :param add_cdcTrack_QI: If true, add the MVA track quality estimation
185 to the path that sets the quality indicator property of the found CDC standalone tracks
186 :param add_vxdTrack_QI: If true, add the MVA track quality estimation
187 to the path that sets the quality indicator property of the found VXDTF2 tracks
188 (ATTENTION: Standard triplet QI of VXDTF2 is replaced in this case
189 -> setting this option to 'True' will have some influence on the final track collection)
190 :param add_recoTrack_QI: If true, add the MVA track quality estimation
191 to the path that sets the quality indicator property of all found reco tracks
192 (Both other QIs needed as input.)
193 :param pxd_filtering_offline: If True, PXD data reduction (ROI filtering) is applied during the track reconstruction.
194 The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.
195 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor is added to the path
196 and provides the CDC temporary EventT0.
199 if not is_svd_used(components)
and not is_cdc_used(components):
202 if (add_cdcTrack_QI
or add_vxdTrack_QI
or add_recoTrack_QI)
and not fit_tracks:
203 b2.B2ERROR(
"MVA track qualiy indicator requires `fit_tracks` to be enabled. Turning all off.")
204 add_cdcTrack_QI =
False
205 add_vxdTrack_QI =
False
206 add_recoTrack_QI =
False
208 if add_recoTrack_QI
and (
not add_cdcTrack_QI
or not add_vxdTrack_QI):
209 b2.B2ERROR(
"RecoTrack qualiy indicator requires CDC and VXD QI as input. Turning it all of.")
210 add_cdcTrack_QI =
False
211 add_vxdTrack_QI =
False
212 add_recoTrack_QI =
False
214 if not skipGeometryAdding:
215 add_geometry_modules(path, components=components)
217 if not skipHitPreparerAdding:
218 add_hit_preparation_modules(path, components=components, pxd_filtering_offline=pxd_filtering_offline)
221 if 'SetupGenfitExtrapolation' not in path:
222 path.add_module(
'SetupGenfitExtrapolation',
223 energyLossBrems=
False, noiseBrems=
False)
226 add_mc_track_finding(path, components=components, reco_tracks=reco_tracks,
227 use_second_cdc_hits=use_second_cdc_hits)
229 add_track_finding(path, components=components, reco_tracks=reco_tracks,
230 prune_temporary_tracks=prune_temporary_tracks,
231 use_second_cdc_hits=use_second_cdc_hits,
232 svd_standalone_mode=svd_standalone_mode,
233 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
234 use_ecl_to_cdc_ckf=use_ecl_to_cdc_ckf,
235 add_cdcTrack_QI=add_cdcTrack_QI,
236 add_vxdTrack_QI=add_vxdTrack_QI,
237 pxd_filtering_offline=pxd_filtering_offline)
241 add_time_extraction(path, append_full_grid_cdc_eventt0, components=components)
244 add_prefilter_track_fit_and_track_creator(path,
245 trackFitHypotheses=trackFitHypotheses,
246 reco_tracks=reco_tracks,
247 add_mva_quality_indicator=add_recoTrack_QI)
250 def add_postfilter_tracking_reconstruction(path, components=None, pruneTracks=False, reco_tracks="RecoTracks",
251 use_second_cdc_hits=False, prune_temporary_tracks=True, v0_finding=True,
252 flip_recoTrack=True, mcTrackFinding=False):
254 This function adds the tracking reconstruction modules not required to calculate HLT filter
257 :param path: The path to add the tracking reconstruction modules to
258 :param components: the list of geometry components in use or None for all components.
259 :param pruneTracks: Delete all hits except the first and the last in the found tracks.
260 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
261 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
262 :param prune_temporary_tracks: If false, store all information of the single CDC and VXD tracks before merging.
264 :param v0_finding: If false, the V0 module will not be executed
265 :param flip_recoTrack: if true, add the recoTracks flipping function in the postfilter (only if PXD is present)
266 :param mcTrackFinding: Use the MC track finders instead of the realistic ones.
270 if components
and not (
'SVD' in components
or 'CDC' in components):
274 if flip_recoTrack
and not mcTrackFinding
and is_pxd_used(components):
275 add_flipping_of_recoTracks(path, reco_tracks=
"RecoTracks")
279 path.add_module(
'V0Finder', RecoTracks=reco_tracks, v0FitterMode=1)
282 path.add_module(
'TrackTimeEstimator')
284 add_mc_matcher(path, components=components, reco_tracks=reco_tracks,
285 use_second_cdc_hits=use_second_cdc_hits)
289 add_prune_tracks(path, components=components, reco_tracks=reco_tracks)
291 if prune_temporary_tracks
or pruneTracks:
292 path.add_module(
"PruneRecoHits")
295 def add_time_extraction(path, append_full_grid_cdc_eventt0=False, components=None):
297 Add time extraction components via tracking
299 :param path: The path to add the tracking reconstruction modules to
300 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor is added to the path
301 and provides the CDC temporary EventT0.
302 :param components: the list of geometry components in use or None for all components.
304 if is_svd_used(components):
305 path.add_module(
"SVDEventT0Estimator")
307 if is_cdc_used(components)
and append_full_grid_cdc_eventt0:
308 path.add_module(
"FullGridChi2TrackTimeExtractor")
311 def add_cr_tracking_reconstruction(path, components=None, prune_tracks=False,
312 skip_geometry_adding=False, event_time_extraction=True,
313 merge_tracks=True, use_second_cdc_hits=False):
315 This function adds the reconstruction modules for cr tracking to a path.
317 :param path: The path to which to add the tracking reconstruction modules
319 :param components: the list of geometry components in use or None for all components.
320 :param prune_tracks: Delete all hits except the first and the last in the found tracks.
322 :param skip_geometry_adding: Advanced flag: The tracking modules need the geometry module and will add it,
323 if it is not already present in the path. In a setup with multiple (conditional) paths however, it cannot
324 determine if the geometry is already loaded. This flag can be used to just turn off the geometry adding
325 (but you will have to add it on your own).
326 :param event_time_extraction: extract the event time
327 :param merge_tracks: The upper and lower half of the tracks should be merged together in one track
328 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
333 if not is_cdc_used(components):
336 if not skip_geometry_adding:
337 add_geometry_modules(path, components)
339 add_hit_preparation_modules(path, components=components)
342 if 'SetupGenfitExtrapolation' not in path:
343 path.add_module(
'SetupGenfitExtrapolation',
344 energyLossBrems=
False, noiseBrems=
False)
347 add_cr_track_finding(path, reco_tracks=
"RecoTracks", components=components,
348 merge_tracks=merge_tracks, use_second_cdc_hits=use_second_cdc_hits)
352 add_cr_track_fit_and_track_creator(path, components=components, prune_tracks=prune_tracks,
353 event_timing_extraction=event_time_extraction)
357 add_cr_track_fit_and_track_creator(path, components=components, prune_tracks=prune_tracks,
358 event_timing_extraction=
False,
359 reco_tracks=
"NonMergedRecoTracks", tracks=
"NonMergedTracks")
362 def add_mc_tracking_reconstruction(path, components=None, pruneTracks=False, use_second_cdc_hits=False):
364 This function adds the standard reconstruction modules for MC tracking
367 :param path: The path to add the tracking reconstruction modules to
368 :param components: the list of geometry components in use or None for all components.
369 :param pruneTracks: Delete all hits expect the first and the last from the found tracks.
370 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
372 add_tracking_reconstruction(path,
373 components=components,
374 pruneTracks=pruneTracks,
376 use_second_cdc_hits=use_second_cdc_hits)
379 def add_track_finding(path, components=None, reco_tracks="RecoTracks",
380 prune_temporary_tracks=True, use_second_cdc_hits=False,
381 use_mc_truth=False, svd_ckf_mode="SVD_after", add_both_directions=True,
382 svd_standalone_mode="VXDTF2",
383 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
384 add_cdcTrack_QI=True, add_vxdTrack_QI=False,
385 pxd_filtering_offline=False, use_HLT_ROIs=False):
387 Add the CKF to the path with all the track finding related to and needed for it.
388 :param path: The path to add the tracking reconstruction modules to
389 :param reco_tracks: The store array name where to output all tracks
390 :param use_mc_truth: Use the truth information in the CKF modules
391 :param svd_ckf_mode: how to apply the CKF (with or without SVD standalone tracking). Defaults to "SVD_after".
392 :param add_both_directions: Curlers may be found in the wrong orientation by the CDC track finder, so try to
393 extrapolate also in the other direction.
394 :param svd_standalone_mode: Which SVD standalone tracking is used.
395 Options are "VXDTF2", "SVDHough", "VXDTF2_and_SVDHough", and "SVDHough_and_VXDTF2".
397 :param use_second_cdc_hits: whether to use the secondary CDC hit during CDC track finding or not
398 :param components: the list of geometry components in use or None for all components.
399 :param prune_temporary_tracks: If false, store all information of the single CDC and VXD tracks before merging.
401 :param use_svd_to_cdc_ckf: if true, add SVD to CDC CKF module.
402 :param use_ecl_to_cdc_ckf: if true, add ECL to CDC CKF module.
403 :param add_cdcTrack_QI: If true, add the MVA track quality estimation
404 to the path that sets the quality indicator property of the found CDC standalone tracks
405 :param add_vxdTrack_QI: If true, add the MVA track quality estimation
406 to the path that sets the quality indicator property of the found VXDTF2 tracks
407 (ATTENTION: Standard triplet QI of VXDTF2 is replaced in this case
408 -> setting this option to 'True' will have some influence on the final track collection)
409 :param pxd_filtering_offline: If True, PXD data reduction (ROI filtering) is applied during the track reconstruction.
410 The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.
411 :param use_HLT_ROIs: Don't calculate the ROIs here but use the ones from the HLT (does obviously not work for simulation)
413 if not is_svd_used(components)
and not is_cdc_used(components):
416 if use_ecl_to_cdc_ckf
and not is_cdc_used(components):
417 b2.B2WARNING(
"ECL CKF cannot be used without CDC. Turning it off.")
418 use_ecl_to_cdc_ckf =
False
420 if use_ecl_to_cdc_ckf
and not is_ecl_used(components):
421 b2.B2ERROR(
"ECL CKF cannot be used without ECL. Turning it off.")
422 use_ecl_to_cdc_ckf =
False
425 if 'RegisterEventLevelTrackingInfo' not in path:
426 path.add_module(
'RegisterEventLevelTrackingInfo')
429 cdc_reco_tracks =
"CDCRecoTracks"
430 svd_cdc_reco_tracks =
"SVDCDCRecoTracks"
431 ecl_reco_tracks =
"ECLRecoTracks"
432 combined_ecl_reco_tracks =
"combinedECLRecoTracks"
435 svd_reco_tracks =
"SVDRecoTracks"
436 pxd_reco_tracks =
"PXDRecoTracks"
439 temporary_reco_track_list = []
442 latest_reco_tracks =
None
444 if not is_pxd_used(components):
445 if use_ecl_to_cdc_ckf
and is_cdc_used(components):
446 combined_ecl_reco_tracks = reco_tracks
447 elif (
not use_ecl_to_cdc_ckf)
and is_svd_used(components):
448 svd_cdc_reco_tracks = reco_tracks
449 elif (
not use_ecl_to_cdc_ckf)
and (
not is_svd_used(components))
and is_cdc_used(components):
450 cdc_reco_tracks = reco_tracks
452 if is_cdc_used(components):
453 add_cdc_track_finding(path, use_second_hits=use_second_cdc_hits, output_reco_tracks=cdc_reco_tracks,
454 add_mva_quality_indicator=add_cdcTrack_QI)
455 temporary_reco_track_list.append(cdc_reco_tracks)
456 latest_reco_tracks = cdc_reco_tracks
458 if is_svd_used(components):
459 add_svd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
460 output_reco_tracks=svd_cdc_reco_tracks, use_mc_truth=use_mc_truth,
461 temporary_reco_tracks=svd_reco_tracks,
462 svd_ckf_mode=svd_ckf_mode, add_both_directions=add_both_directions,
463 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf, prune_temporary_tracks=prune_temporary_tracks,
464 add_mva_quality_indicator=add_vxdTrack_QI,
465 svd_standalone_mode=svd_standalone_mode)
466 temporary_reco_track_list.append(svd_reco_tracks)
467 temporary_reco_track_list.append(svd_cdc_reco_tracks)
468 latest_reco_tracks = svd_cdc_reco_tracks
470 if use_ecl_to_cdc_ckf
and is_cdc_used(components):
471 add_eclcdc_track_finding(path, components=components, output_reco_tracks=ecl_reco_tracks,
472 prune_temporary_tracks=prune_temporary_tracks)
476 path.add_module(
"RecoTrackStoreArrayCombiner",
477 Temp1RecoTracksStoreArrayName=latest_reco_tracks,
478 Temp2RecoTracksStoreArrayName=ecl_reco_tracks,
479 recoTracksStoreArrayName=combined_ecl_reco_tracks)
480 temporary_reco_track_list.append(ecl_reco_tracks)
481 temporary_reco_track_list.append(combined_ecl_reco_tracks)
482 latest_reco_tracks = combined_ecl_reco_tracks
484 if is_pxd_used(components):
485 if pxd_filtering_offline:
488 path.add_module(
"DAFRecoFitter", recoTracksStoreArrayName=latest_reco_tracks)
490 roiName =
"ROIs_offline"
491 add_roiFinder(path, reco_tracks=latest_reco_tracks, roiName=roiName)
493 pxd_digifilter = b2.register_module(
'PXDdigiFilter')
494 pxd_digifilter.param(
'ROIidsName', roiName)
495 pxd_digifilter.param(
'PXDDigitsName',
'PXDDigits')
496 pxd_digifilter.param(
'PXDDigitsInsideROIName',
'PXDDigits')
497 pxd_digifilter.param(
'overrideDB',
True)
498 pxd_digifilter.param(
'usePXDDataReduction',
True)
499 path.add_module(pxd_digifilter)
501 add_pxd_reconstruction(path)
503 add_pxd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
504 use_mc_truth=use_mc_truth, output_reco_tracks=reco_tracks,
505 temporary_reco_tracks=pxd_reco_tracks,
506 add_both_directions=add_both_directions)
507 temporary_reco_track_list.append(pxd_reco_tracks)
509 if prune_temporary_tracks:
510 for temporary_reco_track_name
in temporary_reco_track_list:
511 if temporary_reco_track_name != reco_tracks:
512 path.add_module(
'PruneRecoTracks', storeArrayName=temporary_reco_track_name)
515 def add_cr_track_finding(path, reco_tracks="RecoTracks", components=None,
516 merge_tracks=True, use_second_cdc_hits=False):
519 if 'RegisterEventLevelTrackingInfo' not in path:
520 path.add_module(
'RegisterEventLevelTrackingInfo')
522 if not is_cdc_used(components):
523 b2.B2FATAL(
"CDC must be in components")
525 reco_tracks_from_track_finding = reco_tracks
527 reco_tracks_from_track_finding =
"NonMergedRecoTracks"
529 cdc_reco_tracks =
"CDCRecoTracks"
530 if not is_pxd_used(components)
and not is_svd_used(components):
531 cdc_reco_tracks = reco_tracks_from_track_finding
533 svd_cdc_reco_tracks =
"SVDCDCRecoTracks"
534 if not is_pxd_used(components):
535 svd_cdc_reco_tracks = reco_tracks_from_track_finding
537 full_reco_tracks = reco_tracks_from_track_finding
540 add_cdc_cr_track_finding(path, merge_tracks=
False, use_second_cdc_hits=use_second_cdc_hits,
541 output_reco_tracks=cdc_reco_tracks)
543 latest_reco_tracks = cdc_reco_tracks
545 if is_svd_used(components):
546 add_svd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
547 output_reco_tracks=svd_cdc_reco_tracks,
548 svd_ckf_mode=
"cosmics", add_both_directions=
True, svd_standalone_mode=
"VXDTF2")
549 latest_reco_tracks = svd_cdc_reco_tracks
551 if is_pxd_used(components):
552 add_pxd_cr_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
553 output_reco_tracks=full_reco_tracks, add_both_directions=
True)
557 path.add_module(
"CosmicsTrackMerger", inputRecoTracks=reco_tracks_from_track_finding,
558 outputRecoTracks=reco_tracks)
561 def add_mc_track_finding(path, components=None, reco_tracks="RecoTracks", use_second_cdc_hits=False):
563 Add the MC based TrackFinder to the path.
565 :param path: The path to add the tracking reconstruction modules to
566 :param components: the list of geometry components in use or None for all components.
567 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
568 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
570 if is_cdc_used(components)
or is_pxd_used(components)
or is_svd_used(components):
572 path.add_module(
'TrackFinderMCTruthRecoTracks',
573 RecoTracksStoreArrayName=reco_tracks,
574 UseSecondCDCHits=use_second_cdc_hits,
575 UsePXDHits=is_pxd_used(components),
576 UseSVDHits=is_svd_used(components),
577 UseCDCHits=is_cdc_used(components))
580 def add_tracking_for_PXDDataReduction_simulation(path, components, svd_cluster='__ROIsvdClusters'):
582 This function adds the standard reconstruction modules for tracking to be used for the simulation of PXD data
585 :param path: The path to add the tracking reconstruction modules to
586 :param components: the list of geometry components in use or None for all components, always exclude the PXD.
589 if not is_svd_used(components):
593 if 'SetupGenfitExtrapolation' not in path:
594 material_effects = b2.register_module(
'SetupGenfitExtrapolation')
595 material_effects.set_name(
596 'SetupGenfitExtrapolationForPXDDataReduction')
597 path.add_module(material_effects)
600 svd_reco_tracks =
"__ROIsvdRecoTracks"
603 add_svd_standalone_tracking(path, components=[
'SVD'], reco_tracks=svd_reco_tracks, suffix=
"__ROI",
604 svd_clusters=svd_cluster)
607 dafRecoFitter = b2.register_module(
"DAFRecoFitter")
608 dafRecoFitter.set_name(
"SVD-only DAFRecoFitter")
609 dafRecoFitter.param(
'recoTracksStoreArrayName', svd_reco_tracks)
610 dafRecoFitter.param(
'svdHitsStoreArrayName', svd_cluster)
611 path.add_module(dafRecoFitter)
614 def add_roiFinder(path, reco_tracks="RecoTracks", roiName="ROIs"):
616 Add the ROI finding to the path creating ROIs out of reco tracks by extrapolating them to the PXD volume.
617 :param path: Where to add the module to.
618 :param reco_tracks: Which tracks to use in the extrapolation step.
619 :param roiName: Name of the produced/stored ROIs.
622 pxdDataRed = b2.register_module(
'PXDROIFinder')
624 'recoTrackListName': reco_tracks,
625 'PXDInterceptListName':
'PXDIntercepts',
626 'ROIListName': roiName,
628 pxdDataRed.param(param_pxdDataRed)
629 path.add_module(pxdDataRed)
632 def add_vxd_standalone_cosmics_finder(
634 reco_tracks="RecoTracks",
635 pxd_spacepoints_name="PXDSpacePoints",
636 svd_spacepoints_name="SVDSpacePoints",
641 Convenience function for adding VXD standalone cosmics track finding for B = 0 Tesla
644 The result is a StoreArray with name @param reco_tracks containing one or zero reco tracks per event.
645 This track candidates have an arbitrary but large momentum seed in the direction of the fitted line.
646 The position and momentum seed is obtained using a principal component analysis method.
648 :param path: basf2 path
649 :param reco_tracks: Name of the output RecoTracks; defaults to RecoTracks.
650 :param spacepoints_name: name of store array containing the spacepoints; defaults to SpacePoints
651 :param quality_cut: Cut on the chi squared value of the line fit; candidates with values above the cut will be
652 rejected; defaults to 0.0001
653 :param min_sps: Minimal number of SpacePoints required to build a track candidate; defaults to 3;
654 :param max_rejected_sps: Maximal number of retries to refit a track after the worst spacepoint was removed;
659 if 'RegisterEventLevelTrackingInfo' not in path:
660 path.add_module(
'RegisterEventLevelTrackingInfo')
662 if "PXDSpacePointCreator" not in [m.name()
for m
in path.modules()]:
663 path.add_module(
'PXDSpacePointCreator', SpacePoints=pxd_spacepoints_name)
667 track_finder = b2.register_module(
'TrackFinderVXDCosmicsStandalone')
668 track_finder.param(
'SpacePointTrackCandArrayName',
"")
669 track_finder.param(
'SpacePoints', [pxd_spacepoints_name, svd_spacepoints_name])
670 track_finder.param(
'QualityCut', quality_cut)
671 track_finder.param(
'MinSPs', min_sps)
672 track_finder.param(
'MaxRejectedSPs', max_rejected_sps)
673 path.add_module(track_finder)
675 converter = b2.register_module(
'SPTC2RTConverter')
676 converter.param(
'recoTracksStoreArrayName', reco_tracks)
677 path.add_module(converter)