15 add_cdc_cr_track_finding,
16 add_cdc_track_finding,
17 add_cr_track_fit_and_track_creator,
18 add_eclcdc_track_finding,
20 add_hit_preparation_modules,
23 add_flipping_of_recoTracks,
24 add_pxd_cr_track_finding,
25 add_pxd_track_finding,
26 add_svd_track_finding,
27 add_track_fit_and_track_creator,
28 add_prefilter_track_fit_and_track_creator,
29 add_vxd_track_finding_vxdtf2,
30 add_svd_standalone_tracking,
38from pxd
import add_pxd_reconstruction
41def add_tracking_reconstruction(path, components=None, pruneTracks=False, skipGeometryAdding=False,
42 mcTrackFinding=False, trackFitHypotheses=None,
43 reco_tracks="RecoTracks", prune_temporary_tracks=True, fit_tracks=True,
44 use_second_cdc_hits=False, skipHitPreparerAdding=False,
45 svd_standalone_mode="VXDTF2",
46 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
47 add_cdcTrack_QI=True, add_vxdTrack_QI=False, add_recoTrack_QI=False,
48 pxd_filtering_offline=False,
49 create_intercepts_for_pxd_ckf=False,
50 append_full_grid_cdc_eventt0=True,
51 v0_finding=True, flip_recoTrack=True,
52 skip_full_grid_cdc_eventt0_if_svd_time_present=True):
54 This function adds the **standard tracking reconstruction** modules
64 :ref:`CDC to SVD CKF<tracking_cdc2svd_ckf>` are combined
with SVD standalone tracks found
in the previous step using the \
65 :ref:`CDC to SVD Seed CKF<tracking_svdcdc_merger_ckf>`
75 PXD hits are
not available on HLT. At the end of the tracking chain on HLT we have the\
76 :ref:`PXD Region Of Interest Finding<tracking_pxdDataReduction>`, that consists of extrapolating\
77 the tracks on the PXD sensors
and defining regions
in which we expect to find the hit.\
78 Only fired pixels inside these regions reach Event Builder 2.
81 in particular we search
for displaced vertices to reconstruct K-short, Lambda
and\
82 photon-conversions, see :ref:`V0 Finding<tracking_v0Finding>`.
85 flip
and refit them to fix the charge, see :ref:`Flip&Refit<trk_flipNrefit>`.
89 :param path: the path to add the tracking reconstruction modules to
90 :param components: the list of geometry components
in use
or None for all components.
91 :param pruneTracks:
if true, delete all hits
except the first
and the last
in the found tracks.
92 :param skipGeometryAdding: (advanced flag) the tracking modules need the geometry module
and will add it,
93 if it
is not already present
in the path. In a setup
with multiple (conditional) paths however, it can
not
94 determine,
if the geometry
is already loaded. This flag can be used o just turn off the geometry adding at
95 all (but you will have to add it on your own then).
96 :param skipHitPreparerAdding: (advanced flag)
if true, do
not add the hit preparation (esp. VXD cluster creation
97 modules. This
is useful
if they have been added before already.
98 :param mcTrackFinding:
if true, use the MC track finders instead of the realistic ones.
99 :param reco_tracks: name of the StoreArray where the reco tracks should be stored
100 :param prune_temporary_tracks:
if false, store all information of the single CDC
and VXD tracks before merging.
102 :param fit_tracks:
if false, the final track find
and the TrackCreator module will no be executed
103 :param use_second_cdc_hits:
if true, the second hit information will be used
in the CDC track finding.
104 :param trackFitHypotheses: which pdg hypothesis to fit. Defaults to [211, 321, 2212].
105 :param svd_standalone_mode: Which SVD standalone tracking
is used.
106 Options are
"VXDTF2",
"SVDHough",
"VXDTF2_and_SVDHough",
and "SVDHough_and_VXDTF2".
108 :param use_svd_to_cdc_ckf:
if true, add SVD to CDC CKF module.
109 :param use_ecl_to_cdc_ckf:
if true, add ECL to CDC CKF module.
110 :param add_cdcTrack_QI:
if true, add the MVA track quality estimation
111 to the path that sets the quality indicator property of the found CDC standalone tracks
112 :param add_vxdTrack_QI:
if true, add the MVA track quality estimation
113 to the path that sets the quality indicator property of the found VXDTF2 tracks
114 (ATTENTION: Standard triplet QI of VXDTF2
is replaced
in this case
115 -> setting this option to
'True' will have some influence on the final track collection)
116 :param add_recoTrack_QI:
if true, add the MVA track quality estimation
117 to the path that sets the quality indicator property of all found reco tracks
118 (Both other QIs needed
as input.)
119 :param pxd_filtering_offline: If
True, PXD data reduction (ROI filtering)
is applied during the track reconstruction.
120 The reconstructed SVD/CDC tracks are used to define the ROIs
and reject all PXD clusters outside of these.
121 :param create_intercepts_for_pxd_ckf: If
True, the PXDROIFinder
is added to the path to create PXDIntercepts to be used
122 for hit filtering when creating the CKF relations. This independent of the offline PXD digit filtering which
is
123 steered by
'pxd_filtering_offline'. This can be applied
for both data
and MC.
124 :param append_full_grid_cdc_eventt0: If
True, the module FullGridChi2TrackTimeExtractor
is added to the path
125 and provides the CDC temporary EventT0.
126 :param v0_finding:
if false, the V0Finder module
is not executed
127 :param flip_recoTrack:
if true, add the recoTracks flipping function
in the postfilter (only
if PXD
is present)
128 :param skip_full_grid_cdc_eventt0_if_svd_time_present:
if true,
and if also append_full_grid_cdc_eventt0
is true, the
129 FullGridChi2TrackTimeExtractor
is only executed
in the events where no SVD-based EventT0
is found. If false, but
130 append_full_grid_cdc_eventt0
is true, FullGridChi2TrackTimeExtractor will be executed
in each event regardless of
131 SVD EventT0 being present. Has no effect
if append_full_grid_cdc_eventt0
is false. Default: true
134 add_prefilter_tracking_reconstruction(
136 components=components,
137 skipGeometryAdding=skipGeometryAdding,
138 mcTrackFinding=mcTrackFinding,
139 trackFitHypotheses=trackFitHypotheses,
140 reco_tracks=reco_tracks,
141 prune_temporary_tracks=prune_temporary_tracks,
142 fit_tracks=fit_tracks,
143 use_second_cdc_hits=use_second_cdc_hits,
144 skipHitPreparerAdding=skipHitPreparerAdding,
145 svd_standalone_mode=svd_standalone_mode,
146 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
147 use_ecl_to_cdc_ckf=use_ecl_to_cdc_ckf,
148 add_cdcTrack_QI=add_cdcTrack_QI,
149 add_vxdTrack_QI=add_vxdTrack_QI,
150 add_recoTrack_QI=add_recoTrack_QI,
151 pxd_filtering_offline=pxd_filtering_offline,
152 create_intercepts_for_pxd_ckf=create_intercepts_for_pxd_ckf,
153 append_full_grid_cdc_eventt0=append_full_grid_cdc_eventt0,
154 skip_full_grid_cdc_eventt0_if_svd_time_present=skip_full_grid_cdc_eventt0_if_svd_time_present)
156 add_postfilter_tracking_reconstruction(path,
157 components=components,
158 pruneTracks=pruneTracks,
159 reco_tracks=reco_tracks,
160 use_second_cdc_hits=use_second_cdc_hits,
161 prune_temporary_tracks=prune_temporary_tracks,
162 v0_finding=v0_finding,
163 flip_recoTrack=flip_recoTrack,
164 mcTrackFinding=mcTrackFinding)
167def add_prefilter_tracking_reconstruction(path, components=None, skipGeometryAdding=False,
168 mcTrackFinding=False, trackFitHypotheses=None, reco_tracks="RecoTracks",
169 prune_temporary_tracks=True, fit_tracks=True,
170 use_second_cdc_hits=False, skipHitPreparerAdding=False,
171 svd_standalone_mode="VXDTF2",
172 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
173 add_cdcTrack_QI=True, add_vxdTrack_QI=False, add_recoTrack_QI=False,
174 pxd_filtering_offline=False,
175 create_intercepts_for_pxd_ckf=False,
176 append_full_grid_cdc_eventt0=True,
177 skip_full_grid_cdc_eventt0_if_svd_time_present=True):
179 This function adds the tracking reconstruction modules required to calculate HLT filter decision
182 :param path: The path to add the tracking reconstruction modules to
183 :param components: the list of geometry components in use
or None for all components.
184 :param skipGeometryAdding: Advances flag: The tracking modules need the geometry module
and will add it,
185 if it
is not already present
in the path. In a setup
with multiple (conditional) paths however, it can
not
186 determine,
if the geometry
is already loaded. This flag can be used o just turn off the geometry adding at
187 all (but you will have to add it on your own then).
188 :param skipHitPreparerAdding: Advanced flag: do
not add the hit preparation (esp. VXD cluster creation
189 modules. This
is useful
if they have been added before already.
190 :param mcTrackFinding: Use the MC track finders instead of the realistic ones.
191 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
192 :param prune_temporary_tracks: If false, store all information of the single CDC
and VXD tracks before merging.
194 :param fit_tracks: If false, the final track find
and the TrackCreator module will no be executed
195 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
196 :param trackFitHypotheses: Which pdg hypothesis to fit. Defaults to [211, 321, 2212].
197 :param svd_standalone_mode: Which SVD standalone tracking
is used.
198 Options are
"VXDTF2",
"SVDHough",
"VXDTF2_and_SVDHough",
and "SVDHough_and_VXDTF2".
200 :param use_svd_to_cdc_ckf:
if true, add SVD to CDC CKF module.
201 :param use_ecl_to_cdc_ckf:
if true, add ECL to CDC CKF module.
202 :param add_cdcTrack_QI: If true, add the MVA track quality estimation
203 to the path that sets the quality indicator property of the found CDC standalone tracks
204 :param add_vxdTrack_QI: If true, add the MVA track quality estimation
205 to the path that sets the quality indicator property of the found VXDTF2 tracks
206 (ATTENTION: Standard triplet QI of VXDTF2
is replaced
in this case
207 -> setting this option to
'True' will have some influence on the final track collection)
208 :param add_recoTrack_QI: If true, add the MVA track quality estimation
209 to the path that sets the quality indicator property of all found reco tracks
210 (Both other QIs needed
as input.)
211 :param pxd_filtering_offline: If
True, PXD data reduction (ROI filtering)
is applied during the track reconstruction.
212 The reconstructed SVD/CDC tracks are used to define the ROIs
and reject all PXD clusters outside of these.
213 :param create_intercepts_for_pxd_ckf: If
True, the PXDROIFinder
is added to the path to create PXDIntercepts to be used
214 for hit filtering when creating the CKF relations. This independent of the offline PXD digit filtering which
is
215 steered by
'pxd_filtering_offline'. This can be applied
for both data
and MC.
216 :param append_full_grid_cdc_eventt0: If
True, the module FullGridChi2TrackTimeExtractor
is added to the path
217 and provides the CDC temporary EventT0.
218 :param skip_full_grid_cdc_eventt0_if_svd_time_present:
if true,
and if also append_full_grid_cdc_eventt0
is true, the
219 FullGridChi2TrackTimeExtractor
is only executed
in the events where no SVD-based EventT0
is found. If false, but
220 append_full_grid_cdc_eventt0
is true, FullGridChi2TrackTimeExtractor will be executed
in each event regardless of
221 SVD EventT0 being present. Has no effect
if append_full_grid_cdc_eventt0
is false. Default: true
224 if not is_svd_used(components)
and not is_cdc_used(components):
227 if (add_cdcTrack_QI
or add_vxdTrack_QI
or add_recoTrack_QI)
and not fit_tracks:
228 b2.B2ERROR(
"MVA track qualiy indicator requires `fit_tracks` to be enabled. Turning all off.")
229 add_cdcTrack_QI =
False
230 add_vxdTrack_QI =
False
231 add_recoTrack_QI =
False
233 if add_recoTrack_QI
and (
not add_cdcTrack_QI
or not add_vxdTrack_QI):
234 b2.B2ERROR(
"RecoTrack qualiy indicator requires CDC and VXD QI as input. Turning it all of.")
235 add_cdcTrack_QI =
False
236 add_vxdTrack_QI =
False
237 add_recoTrack_QI =
False
239 if not skipGeometryAdding:
240 add_geometry_modules(path, components=components)
242 if not skipHitPreparerAdding:
243 add_hit_preparation_modules(path,
244 components=components,
245 pxd_filtering_offline=pxd_filtering_offline,
246 create_intercepts_for_pxd_ckf=create_intercepts_for_pxd_ckf)
249 if 'SetupGenfitExtrapolation' not in path:
250 path.add_module(
'SetupGenfitExtrapolation',
251 energyLossBrems=
False, noiseBrems=
False)
254 add_mc_track_finding(path, components=components, reco_tracks=reco_tracks,
255 use_second_cdc_hits=use_second_cdc_hits)
257 add_track_finding(path, components=components, reco_tracks=reco_tracks,
258 prune_temporary_tracks=prune_temporary_tracks,
259 use_second_cdc_hits=use_second_cdc_hits,
260 svd_standalone_mode=svd_standalone_mode,
261 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
262 use_ecl_to_cdc_ckf=use_ecl_to_cdc_ckf,
263 add_cdcTrack_QI=add_cdcTrack_QI,
264 add_vxdTrack_QI=add_vxdTrack_QI,
265 pxd_filtering_offline=pxd_filtering_offline,
266 create_intercepts_for_pxd_ckf=create_intercepts_for_pxd_ckf)
270 add_time_extraction(path, append_full_grid_cdc_eventt0, components=components,
271 skip_full_grid_cdc_eventt0_if_svd_time_present=skip_full_grid_cdc_eventt0_if_svd_time_present)
274 add_prefilter_track_fit_and_track_creator(path,
275 trackFitHypotheses=trackFitHypotheses,
276 reco_tracks=reco_tracks,
277 add_mva_quality_indicator=add_recoTrack_QI)
280def add_postfilter_tracking_reconstruction(path, components=None, pruneTracks=False, reco_tracks="RecoTracks",
281 use_second_cdc_hits=False, prune_temporary_tracks=True, v0_finding=True,
282 flip_recoTrack=True, mcTrackFinding=False, kink_finding=True):
284 This function adds the tracking reconstruction modules not required to calculate HLT filter
287 :param path: The path to add the tracking reconstruction modules to
288 :param components: the list of geometry components
in use
or None for all components.
289 :param pruneTracks: Delete all hits
except the first
and the last
in the found tracks.
290 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
291 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
292 :param prune_temporary_tracks: If false, store all information of the single CDC
and VXD tracks before merging.
294 :param v0_finding: If false, the V0 module will
not be executed
295 :param flip_recoTrack:
if true, add the recoTracks flipping function
in the postfilter (only
if PXD
is present)
296 :param mcTrackFinding: Use the MC track finders instead of the realistic ones.
300 if components
and not (
'SVD' in components
or 'CDC' in components):
303 flip_and_refit_temporary_RecoTracks =
"RecoTracks_flipped"
304 v0finder_temporary_RecoTracks =
"CopiedRecoTracks"
305 kinkfinder_temporary_RecoTracks =
"RecoTracksKinkTmp"
306 temporary_reco_track_list = []
309 if flip_recoTrack
and not mcTrackFinding
and is_pxd_used(components):
310 add_flipping_of_recoTracks(path, reco_tracks=
"RecoTracks", reco_tracks_flipped=flip_and_refit_temporary_RecoTracks)
311 temporary_reco_track_list.append(flip_and_refit_temporary_RecoTracks)
315 path.add_module(
'V0Finder', RecoTracks=reco_tracks, v0FitterMode=1, CopiedRecoTracks=v0finder_temporary_RecoTracks)
316 temporary_reco_track_list.append(v0finder_temporary_RecoTracks)
320 path.add_module(
'KinkFinder', RecoTracks=reco_tracks, CopiedRecoTracks=kinkfinder_temporary_RecoTracks)
321 temporary_reco_track_list.append(kinkfinder_temporary_RecoTracks)
324 path.add_module(
'TrackTimeEstimator')
326 add_mc_matcher(path, components=components, reco_tracks=reco_tracks,
327 use_second_cdc_hits=use_second_cdc_hits)
331 add_prune_tracks(path, components=components, reco_tracks=reco_tracks)
333 if prune_temporary_tracks
or pruneTracks:
334 path.add_module(
"PruneRecoHits")
336 if prune_temporary_tracks:
337 for temporary_reco_tracks
in temporary_reco_track_list:
338 path.add_module(
'PruneRecoTracks', storeArrayName=temporary_reco_tracks)
341def add_time_extraction(path, append_full_grid_cdc_eventt0=False, components=None,
342 skip_full_grid_cdc_eventt0_if_svd_time_present=True):
344 Add time extraction components via tracking
346 :param path: The path to add the tracking reconstruction modules to
347 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor
is added to the path
348 and provides the CDC temporary EventT0.
349 :param components: the list of geometry components
in use
or None for all components.
350 :param skip_full_grid_cdc_eventt0_if_svd_time_present:
if true,
and if also append_full_grid_cdc_eventt0
is true, the
351 FullGridChi2TrackTimeExtractor
is only executed
in the events where no SVD-based EventT0
is found. If false, but
352 append_full_grid_cdc_eventt0
is true, FullGridChi2TrackTimeExtractor will be executed
in each event regardless of
353 SVD EventT0 being present. Has no effect
if append_full_grid_cdc_eventt0
is false. Default: true
357 if is_svd_used(components):
358 path.add_module(
"SVDEventT0Estimator")
360 if is_cdc_used(components)
and append_full_grid_cdc_eventt0:
361 path.add_module(
"FullGridChi2TrackTimeExtractor",
362 skipIfSVDEventT0Present=skip_full_grid_cdc_eventt0_if_svd_time_present)
365def add_cr_tracking_reconstruction(path, components=None, prune_tracks=False,
366 skip_geometry_adding=False, event_time_extraction=True,
367 merge_tracks=True, use_second_cdc_hits=False):
369 This function adds the reconstruction modules for cr tracking to a path.
371 :param path: The path to which to add the tracking reconstruction modules
373 :param components: the list of geometry components
in use
or None for all components.
374 :param prune_tracks: Delete all hits
except the first
and the last
in the found tracks.
376 :param skip_geometry_adding: Advanced flag: The tracking modules need the geometry module
and will add it,
377 if it
is not already present
in the path. In a setup
with multiple (conditional) paths however, it cannot
378 determine
if the geometry
is already loaded. This flag can be used to just turn off the geometry adding
379 (but you will have to add it on your own).
380 :param event_time_extraction: extract the event time
381 :param merge_tracks: The upper
and lower half of the tracks should be merged together
in one track
382 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
390 if not is_cdc_used(components):
393 if not skip_geometry_adding:
394 add_geometry_modules(path, components)
396 add_hit_preparation_modules(path, components=components, create_intercepts_for_pxd_ckf=
False)
399 if 'SetupGenfitExtrapolation' not in path:
400 path.add_module(
'SetupGenfitExtrapolation',
401 energyLossBrems=
False, noiseBrems=
False)
404 add_cr_track_finding(path, reco_tracks=
"RecoTracks", components=components,
405 merge_tracks=merge_tracks, use_second_cdc_hits=use_second_cdc_hits)
409 add_cr_track_fit_and_track_creator(path, components=components, prune_tracks=prune_tracks,
410 event_timing_extraction=event_time_extraction)
414 add_cr_track_fit_and_track_creator(path, components=components, prune_tracks=prune_tracks,
415 event_timing_extraction=
False,
416 reco_tracks=
"NonMergedRecoTracks", tracks=
"NonMergedTracks")
419def add_mc_tracking_reconstruction(path, components=None, pruneTracks=False, use_second_cdc_hits=False):
421 This function adds the standard reconstruction modules for MC tracking
424 :param path: The path to add the tracking reconstruction modules to
425 :param components: the list of geometry components
in use
or None for all components.
426 :param pruneTracks: Delete all hits expect the first
and the last
from the found tracks.
427 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
429 add_tracking_reconstruction(path,
430 components=components,
431 pruneTracks=pruneTracks,
433 use_second_cdc_hits=use_second_cdc_hits)
436def add_track_finding(path, components=None, reco_tracks="RecoTracks",
437 prune_temporary_tracks=True, use_second_cdc_hits=False,
438 use_mc_truth=False, svd_ckf_mode="SVD_after", add_both_directions=True,
439 svd_standalone_mode="VXDTF2",
440 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
441 add_cdcTrack_QI=True, add_vxdTrack_QI=False,
442 pxd_filtering_offline=False, use_HLT_ROIs=False,
443 create_intercepts_for_pxd_ckf=False):
445 Add the CKF to the path with all the track finding related to
and needed
for it.
446 :param path: The path to add the tracking reconstruction modules to
447 :param reco_tracks: The store array name where to output all tracks
448 :param use_mc_truth: Use the truth information
in the CKF modules
449 :param svd_ckf_mode: how to apply the CKF (
with or without SVD standalone tracking). Defaults to
"SVD_after".
450 :param add_both_directions: Curlers may be found
in the wrong orientation by the CDC track finder, so
try to
451 extrapolate also
in the other direction.
452 :param svd_standalone_mode: Which SVD standalone tracking
is used.
453 Options are
"VXDTF2",
"SVDHough",
"VXDTF2_and_SVDHough",
and "SVDHough_and_VXDTF2".
455 :param use_second_cdc_hits: whether to use the secondary CDC hit during CDC track finding
or not
456 :param components: the list of geometry components
in use
or None for all components.
457 :param prune_temporary_tracks: If false, store all information of the single CDC
and VXD tracks before merging.
459 :param use_svd_to_cdc_ckf:
if true, add SVD to CDC CKF module.
460 :param use_ecl_to_cdc_ckf:
if true, add ECL to CDC CKF module.
461 :param add_cdcTrack_QI: If true, add the MVA track quality estimation
462 to the path that sets the quality indicator property of the found CDC standalone tracks
463 :param add_vxdTrack_QI: If true, add the MVA track quality estimation
464 to the path that sets the quality indicator property of the found VXDTF2 tracks
465 (ATTENTION: Standard triplet QI of VXDTF2
is replaced
in this case
466 -> setting this option to
'True' will have some influence on the final track collection)
467 :param pxd_filtering_offline: If
True, PXD data reduction (ROI filtering)
is applied during the track reconstruction.
468 The reconstructed SVD/CDC tracks are used to define the ROIs
and reject all PXD clusters outside of these.
469 :param use_HLT_ROIs: Don
't calculate the ROIs here but use the ones from the HLT (does obviously not work for simulation) :param create_intercepts_for_pxd_ckf: If True, the PXDROIFinder
is added to the path to create PXDIntercepts to be used
470 for hit filtering when creating the CKF relations. This independent of the offline PXD digit filtering which
is
471 steered by
'pxd_filtering_offline'. This can be applied
for both data
and MC.
473 if not is_svd_used(components)
and not is_cdc_used(components):
476 if use_ecl_to_cdc_ckf
and not is_cdc_used(components):
477 b2.B2WARNING(
"ECL CKF cannot be used without CDC. Turning it off.")
478 use_ecl_to_cdc_ckf =
False
480 if use_ecl_to_cdc_ckf
and not is_ecl_used(components):
481 b2.B2ERROR(
"ECL CKF cannot be used without ECL. Turning it off.")
482 use_ecl_to_cdc_ckf =
False
485 if 'RegisterEventLevelTrackingInfo' not in path:
486 path.add_module(
'RegisterEventLevelTrackingInfo')
489 cdc_reco_tracks =
"CDCRecoTracks"
490 svd_cdc_reco_tracks =
"SVDCDCRecoTracks"
491 ecl_reco_tracks =
"ECLRecoTracks"
492 combined_ecl_reco_tracks =
"combinedECLRecoTracks"
495 svd_reco_tracks =
"SVDRecoTracks"
496 pxd_reco_tracks =
"PXDRecoTracks"
499 temporary_reco_track_list = []
502 latest_reco_tracks =
None
504 if not is_pxd_used(components):
505 if use_ecl_to_cdc_ckf
and is_cdc_used(components):
506 combined_ecl_reco_tracks = reco_tracks
507 elif (
not use_ecl_to_cdc_ckf)
and is_svd_used(components):
508 svd_cdc_reco_tracks = reco_tracks
509 elif (
not use_ecl_to_cdc_ckf)
and (
not is_svd_used(components))
and is_cdc_used(components):
510 cdc_reco_tracks = reco_tracks
512 if is_cdc_used(components):
513 add_cdc_track_finding(path, use_second_hits=use_second_cdc_hits, output_reco_tracks=cdc_reco_tracks,
514 add_mva_quality_indicator=add_cdcTrack_QI)
515 temporary_reco_track_list.append(cdc_reco_tracks)
516 latest_reco_tracks = cdc_reco_tracks
518 if is_svd_used(components):
519 add_svd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
520 output_reco_tracks=svd_cdc_reco_tracks, use_mc_truth=use_mc_truth,
521 temporary_reco_tracks=svd_reco_tracks,
522 svd_ckf_mode=svd_ckf_mode, add_both_directions=add_both_directions,
523 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf, prune_temporary_tracks=prune_temporary_tracks,
524 add_mva_quality_indicator=add_vxdTrack_QI,
525 svd_standalone_mode=svd_standalone_mode)
526 temporary_reco_track_list.append(svd_reco_tracks)
527 temporary_reco_track_list.append(svd_cdc_reco_tracks)
528 latest_reco_tracks = svd_cdc_reco_tracks
530 if use_ecl_to_cdc_ckf
and is_cdc_used(components):
531 add_eclcdc_track_finding(path, components=components, output_reco_tracks=ecl_reco_tracks,
532 prune_temporary_tracks=prune_temporary_tracks)
536 path.add_module(
"RecoTrackStoreArrayCombiner",
537 Temp1RecoTracksStoreArrayName=latest_reco_tracks,
538 Temp2RecoTracksStoreArrayName=ecl_reco_tracks,
539 recoTracksStoreArrayName=combined_ecl_reco_tracks)
540 temporary_reco_track_list.append(ecl_reco_tracks)
541 temporary_reco_track_list.append(combined_ecl_reco_tracks)
542 latest_reco_tracks = combined_ecl_reco_tracks
544 if is_pxd_used(components):
546 In case we want to use offline PXD hit filtering ('pxd_filtering_offline == True'), we can decide to either use ROIs
547 created by HLT (
'use_HLT_ROIs == True')
or to create ROIs on the fly (
'use_HLT_ROIs == False').
548 In addition, we can also just run the ROI finder to create PXDIntercepts (
'create_intercepts_for_pxd_ckf == True')
549 that can be used
in the ToPXDCKF relation filters to reduce the number of relations that are created. In this case
550 there
is no need to apply the ROI filtering.
552 if pxd_filtering_offline
or create_intercepts_for_pxd_ckf:
554 intercepts_name =
"PXDIntercepts"
555 if not use_HLT_ROIs
or create_intercepts_for_pxd_ckf:
556 path.add_module(
"DAFRecoFitter", recoTracksStoreArrayName=latest_reco_tracks)
558 roiName =
"ROIs_offline"
559 intercepts_name =
"CKF" + intercepts_name
561 reco_tracks=latest_reco_tracks,
562 intercepts_name=intercepts_name,
565 if pxd_filtering_offline:
566 pxd_digifilter = b2.register_module(
'PXDdigiFilter')
567 pxd_digifilter.param(
'ROIidsName', roiName)
568 pxd_digifilter.param(
'PXDDigitsName',
'PXDDigits')
569 pxd_digifilter.param(
'PXDDigitsInsideROIName',
'PXDDigits')
570 pxd_digifilter.param(
'overrideDB',
True)
571 pxd_digifilter.param(
'usePXDDataReduction',
True)
572 path.add_module(pxd_digifilter)
574 if pxd_filtering_offline
or create_intercepts_for_pxd_ckf:
575 add_pxd_reconstruction(path)
577 add_pxd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
578 use_mc_truth=use_mc_truth, output_reco_tracks=reco_tracks,
579 temporary_reco_tracks=pxd_reco_tracks,
580 add_both_directions=add_both_directions)
581 temporary_reco_track_list.append(pxd_reco_tracks)
583 if prune_temporary_tracks:
584 for temporary_reco_track_name
in temporary_reco_track_list:
585 if temporary_reco_track_name != reco_tracks:
586 path.add_module(
'PruneRecoTracks', storeArrayName=temporary_reco_track_name)
589def add_cr_track_finding(path, reco_tracks="RecoTracks", components=None,
590 merge_tracks=True, use_second_cdc_hits=False):
593 if 'RegisterEventLevelTrackingInfo' not in path:
594 path.add_module(
'RegisterEventLevelTrackingInfo')
596 if not is_cdc_used(components):
597 b2.B2FATAL(
"CDC must be in components")
599 reco_tracks_from_track_finding = reco_tracks
601 reco_tracks_from_track_finding =
"NonMergedRecoTracks"
603 cdc_reco_tracks =
"CDCRecoTracks"
604 if not is_pxd_used(components)
and not is_svd_used(components):
605 cdc_reco_tracks = reco_tracks_from_track_finding
607 svd_cdc_reco_tracks =
"SVDCDCRecoTracks"
608 if not is_pxd_used(components):
609 svd_cdc_reco_tracks = reco_tracks_from_track_finding
611 full_reco_tracks = reco_tracks_from_track_finding
614 add_cdc_cr_track_finding(path, merge_tracks=
False, use_second_cdc_hits=use_second_cdc_hits,
615 output_reco_tracks=cdc_reco_tracks)
617 latest_reco_tracks = cdc_reco_tracks
619 if is_svd_used(components):
620 add_svd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
621 output_reco_tracks=svd_cdc_reco_tracks,
622 svd_ckf_mode=
"cosmics", add_both_directions=
True, svd_standalone_mode=
"VXDTF2")
623 latest_reco_tracks = svd_cdc_reco_tracks
625 if is_pxd_used(components):
626 add_pxd_cr_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
627 output_reco_tracks=full_reco_tracks, add_both_directions=
True)
631 path.add_module(
"CosmicsTrackMerger", inputRecoTracks=reco_tracks_from_track_finding,
632 outputRecoTracks=reco_tracks)
635def add_mc_track_finding(path, components=None, reco_tracks="RecoTracks", use_second_cdc_hits=False):
637 Add the MC based TrackFinder to the path.
639 :param path: The path to add the tracking reconstruction modules to
640 :param components: the list of geometry components in use
or None for all components.
641 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
642 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
644 if is_cdc_used(components)
or is_pxd_used(components)
or is_svd_used(components):
646 path.add_module(
'TrackFinderMCTruthRecoTracks',
647 RecoTracksStoreArrayName=reco_tracks,
648 UseSecondCDCHits=use_second_cdc_hits,
649 UsePXDHits=is_pxd_used(components),
650 UseSVDHits=is_svd_used(components),
651 UseCDCHits=is_cdc_used(components))
654def add_tracking_for_PXDDataReduction_simulation(path, components, svd_cluster='__ROIsvdClusters'):
656 This function adds the standard reconstruction modules for tracking to be used
for the simulation of PXD data
659 :param path: The path to add the tracking reconstruction modules to
660 :param components: the list of geometry components
in use
or None for all components, always exclude the PXD.
663 if not is_svd_used(components):
667 if 'SetupGenfitExtrapolation' not in path:
668 material_effects = b2.register_module(
'SetupGenfitExtrapolation')
669 material_effects.set_name(
670 'SetupGenfitExtrapolationForPXDDataReduction')
671 path.add_module(material_effects)
674 svd_reco_tracks =
"__ROIsvdRecoTracks"
677 add_svd_standalone_tracking(path, components=[
'SVD'], reco_tracks=svd_reco_tracks, suffix=
"__ROI",
678 svd_clusters=svd_cluster)
681 dafRecoFitter = b2.register_module(
"DAFRecoFitter")
682 dafRecoFitter.set_name(
"SVD-only DAFRecoFitter")
683 dafRecoFitter.param(
'recoTracksStoreArrayName', svd_reco_tracks)
684 dafRecoFitter.param(
'svdHitsStoreArrayName', svd_cluster)
685 path.add_module(dafRecoFitter)
688def add_roiFinder(path, reco_tracks="RecoTracks", intercepts_name="PXDIntercepts", roiName="ROIs"):
690 Add the ROI finding to the path creating ROIs out of reco tracks by extrapolating them to the PXD volume.
691 :param path: Where to add the module to.
692 :param reco_tracks: Which tracks to use in the extrapolation step.
693 :param roiName: Name of the produced/stored ROIs.
696 pxdDataRed = b2.register_module('PXDROIFinder')
698 'recoTrackListName': reco_tracks,
699 'PXDInterceptListName': intercepts_name,
700 'ROIListName': roiName,
702 pxdDataRed.param(param_pxdDataRed)
703 path.add_module(pxdDataRed)
706def add_vxd_standalone_cosmics_finder(
708 reco_tracks="RecoTracks",
709 pxd_spacepoints_name="PXDSpacePoints",
710 svd_spacepoints_name="SVDSpacePoints",
715 Convenience function for adding VXD standalone cosmics track finding
for B = 0 Tesla
718 The result
is a StoreArray
with name
@param reco_tracks containing one
or zero reco tracks per event.
719 This track candidates have an arbitrary but large momentum seed
in the direction of the fitted line.
720 The position
and momentum seed
is obtained using a principal component analysis method.
722 :param path: basf2 path
723 :param reco_tracks: Name of the output RecoTracks; defaults to RecoTracks.
724 :param spacepoints_name: name of store array containing the spacepoints; defaults to SpacePoints
725 :param quality_cut: Cut on the chi squared value of the line fit; candidates
with values above the cut will be
726 rejected; defaults to 0.0001
727 :param min_sps: Minimal number of SpacePoints required to build a track candidate; defaults to 3;
728 :param max_rejected_sps: Maximal number of retries to refit a track after the worst spacepoint was removed;
733 if 'RegisterEventLevelTrackingInfo' not in path:
734 path.add_module(
'RegisterEventLevelTrackingInfo')
736 if "PXDSpacePointCreator" not in [m.name()
for m
in path.modules()]:
737 path.add_module(
'PXDSpacePointCreator', SpacePoints=pxd_spacepoints_name)
741 track_finder = b2.register_module(
'TrackFinderVXDCosmicsStandalone')
742 track_finder.param(
'SpacePointTrackCandArrayName',
"")
743 track_finder.param(
'SpacePoints', [pxd_spacepoints_name, svd_spacepoints_name])
744 track_finder.param(
'QualityCut', quality_cut)
745 track_finder.param(
'MinSPs', min_sps)
746 track_finder.param(
'MaxRejectedSPs', max_rejected_sps)
747 path.add_module(track_finder)
749 converter = b2.register_module(
'SPTC2RTConverter')
750 converter.param(
'recoTracksStoreArrayName', reco_tracks)
751 path.add_module(converter)