15 add_default_cdc_svd_tracking_chain,
16 add_inverted_svd_cdc_tracking_chain,
17 add_cdc_cr_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_prefilter_track_fit_and_track_creator,
29 add_svd_standalone_tracking,
36from pxd
import add_pxd_reconstruction
39def add_tracking_reconstruction(path, components=None, pruneTracks=False, skipGeometryAdding=False,
40 mcTrackFinding=False, trackFitHypotheses=None,
41 reco_tracks="RecoTracks", prune_temporary_tracks=True, fit_tracks=True,
42 use_second_cdc_hits=False, skipHitPreparerAdding=False,
43 svd_standalone_mode="VXDTF2",
44 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
45 add_cdcTrack_QI=True, add_vxdTrack_QI=False, add_recoTrack_QI=False,
46 pxd_filtering_offline=False,
47 create_intercepts_for_pxd_ckf=False,
48 append_full_grid_cdc_eventt0=True,
49 v0_finding=True, flip_recoTrack=True,
50 skip_full_grid_cdc_eventt0_if_svd_time_present=True,
51 inverted_tracking=False):
53 This function adds the **standard tracking reconstruction** modules
63 :ref:`CDC to SVD CKF<tracking_cdc2svd_ckf>` are combined
with SVD standalone tracks found
in the previous step using the \
64 :ref:`CDC to SVD Seed CKF<tracking_svdcdc_merger_ckf>`
74 PXD hits are
not available on HLT. At the end of the tracking chain on HLT we have the\
75 :ref:`PXD Region Of Interest Finding<tracking_pxdDataReduction>`, that consists of extrapolating\
76 the tracks on the PXD sensors
and defining regions
in which we expect to find the hit.\
77 Only fired pixels inside these regions reach Event Builder 2.
80 in particular we search
for displaced vertices to reconstruct K-short, Lambda
and\
81 photon-conversions, see :ref:`V0 Finding<tracking_v0Finding>`.
84 flip
and refit them to fix the charge, see :ref:`Flip&Refit<trk_flipNrefit>`.
88 :param path: the path to add the tracking reconstruction modules to
89 :param components: the list of geometry components
in use
or None for all components.
90 :param pruneTracks:
if true, delete all hits
except the first
and the last
in the found tracks.
91 :param skipGeometryAdding: (advanced flag) the tracking modules need the geometry module
and will add it,
92 if it
is not already present
in the path. In a setup
with multiple (conditional) paths however, it can
not
93 determine,
if the geometry
is already loaded. This flag can be used o just turn off the geometry adding at
94 all (but you will have to add it on your own then).
95 :param skipHitPreparerAdding: (advanced flag)
if true, do
not add the hit preparation (esp. VXD cluster creation
96 modules. This
is useful
if they have been added before already.
97 :param mcTrackFinding:
if true, use the MC track finders instead of the realistic ones.
98 :param reco_tracks: name of the StoreArray where the reco tracks should be stored
99 :param prune_temporary_tracks:
if false, store all information of the single CDC
and VXD tracks before merging.
101 :param fit_tracks:
if false, the final track find
and the TrackCreator module will no be executed
102 :param use_second_cdc_hits:
if true, the second hit information will be used
in the CDC track finding.
103 :param trackFitHypotheses: which pdg hypothesis to fit. Defaults to [211, 321, 2212].
104 :param svd_standalone_mode: Which SVD standalone tracking
is used.
105 Options are
"VXDTF2",
"SVDHough",
"VXDTF2_and_SVDHough",
and "SVDHough_and_VXDTF2".
107 :param use_svd_to_cdc_ckf:
if true, add SVD to CDC CKF module.
108 :param use_ecl_to_cdc_ckf:
if true, add ECL to CDC CKF module.
109 :param add_cdcTrack_QI:
if true, add the MVA track quality estimation
110 to the path that sets the quality indicator property of the found CDC standalone tracks
111 :param add_vxdTrack_QI:
if true, add the MVA track quality estimation
112 to the path that sets the quality indicator property of the found VXDTF2 tracks
113 (ATTENTION: Standard triplet QI of VXDTF2
is replaced
in this case
114 -> setting this option to
'True' will have some influence on the final track collection)
115 :param add_recoTrack_QI:
if true, add the MVA track quality estimation
116 to the path that sets the quality indicator property of all found reco tracks
117 (Both other QIs needed
as input.)
118 :param pxd_filtering_offline: If
True, PXD data reduction (ROI filtering)
is applied during the track reconstruction.
119 The reconstructed SVD/CDC tracks are used to define the ROIs
and reject all PXD clusters outside of these.
120 :param create_intercepts_for_pxd_ckf: If
True, the PXDROIFinder
is added to the path to create PXDIntercepts to be used
121 for hit filtering when creating the CKF relations. This independent of the offline PXD digit filtering which
is
122 steered by
'pxd_filtering_offline'. This can be applied
for both data
and MC.
123 :param append_full_grid_cdc_eventt0: If
True, the module FullGridChi2TrackTimeExtractor
is added to the path
124 and provides the CDC temporary EventT0.
125 :param v0_finding:
if false, the V0Finder module
is not executed
126 :param flip_recoTrack:
if true, add the recoTracks flipping function
in the postfilter (only
if PXD
is present)
127 :param skip_full_grid_cdc_eventt0_if_svd_time_present:
if true,
and if also append_full_grid_cdc_eventt0
is true, the
128 FullGridChi2TrackTimeExtractor
is only executed
in the events where no SVD-based EventT0
is found. If false, but
129 append_full_grid_cdc_eventt0
is true, FullGridChi2TrackTimeExtractor will be executed
in each event regardless of
130 SVD EventT0 being present. Has no effect
if append_full_grid_cdc_eventt0
is false. Default: true
131 :param inverted_tracking: If true, start tracking
with SVD standalone track finding, followed by ToCDCCKF,
132 the CDC standalone tracking, a CKF-based merger to merge the standalone RecoTracks,
and finally the
133 CDCToSVDSpacePointCKF to add SVD hits to all CDC tracks that don
't have SVD hits attached to them. ATTENTION: The inverted tracking chain is neither optimised nor guaranteed to be bug free.
134 One known issue
is a reduced hit efficiency when using the full chain.
135 Please remove this comment once the inverted tracking has been optimised
and is assumed to be bug-free.
138 add_prefilter_tracking_reconstruction(
140 components=components,
141 skipGeometryAdding=skipGeometryAdding,
142 mcTrackFinding=mcTrackFinding,
143 trackFitHypotheses=trackFitHypotheses,
144 reco_tracks=reco_tracks,
145 prune_temporary_tracks=prune_temporary_tracks,
146 fit_tracks=fit_tracks,
147 use_second_cdc_hits=use_second_cdc_hits,
148 skipHitPreparerAdding=skipHitPreparerAdding,
149 svd_standalone_mode=svd_standalone_mode,
150 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
151 use_ecl_to_cdc_ckf=use_ecl_to_cdc_ckf,
152 add_cdcTrack_QI=add_cdcTrack_QI,
153 add_vxdTrack_QI=add_vxdTrack_QI,
154 add_recoTrack_QI=add_recoTrack_QI,
155 pxd_filtering_offline=pxd_filtering_offline,
156 create_intercepts_for_pxd_ckf=create_intercepts_for_pxd_ckf,
157 append_full_grid_cdc_eventt0=append_full_grid_cdc_eventt0,
158 skip_full_grid_cdc_eventt0_if_svd_time_present=skip_full_grid_cdc_eventt0_if_svd_time_present,
159 inverted_tracking=inverted_tracking)
161 add_postfilter_tracking_reconstruction(path,
162 components=components,
163 pruneTracks=pruneTracks,
164 reco_tracks=reco_tracks,
165 use_second_cdc_hits=use_second_cdc_hits,
166 prune_temporary_tracks=prune_temporary_tracks,
167 v0_finding=v0_finding,
168 flip_recoTrack=flip_recoTrack,
169 mcTrackFinding=mcTrackFinding)
172def add_prefilter_tracking_reconstruction(path, components=None, skipGeometryAdding=False,
173 mcTrackFinding=False, trackFitHypotheses=None, reco_tracks="RecoTracks",
174 prune_temporary_tracks=True, fit_tracks=True,
175 use_second_cdc_hits=False, skipHitPreparerAdding=False,
176 svd_standalone_mode="VXDTF2",
177 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
178 add_cdcTrack_QI=True, add_vxdTrack_QI=False, add_recoTrack_QI=False,
179 pxd_filtering_offline=False,
180 create_intercepts_for_pxd_ckf=False,
181 append_full_grid_cdc_eventt0=True,
182 skip_full_grid_cdc_eventt0_if_svd_time_present=True,
183 inverted_tracking=False):
185 This function adds the tracking reconstruction modules required to calculate HLT filter decision
188 :param path: The path to add the tracking reconstruction modules to
189 :param components: the list of geometry components in use
or None for all components.
190 :param skipGeometryAdding: Advances flag: The tracking modules need the geometry module
and will add it,
191 if it
is not already present
in the path. In a setup
with multiple (conditional) paths however, it can
not
192 determine,
if the geometry
is already loaded. This flag can be used o just turn off the geometry adding at
193 all (but you will have to add it on your own then).
194 :param skipHitPreparerAdding: Advanced flag: do
not add the hit preparation (esp. VXD cluster creation
195 modules. This
is useful
if they have been added before already.
196 :param mcTrackFinding: Use the MC track finders instead of the realistic ones.
197 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
198 :param prune_temporary_tracks: If false, store all information of the single CDC
and VXD tracks before merging.
200 :param fit_tracks: If false, the final track find
and the TrackCreator module will no be executed
201 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
202 :param trackFitHypotheses: Which pdg hypothesis to fit. Defaults to [211, 321, 2212].
203 :param svd_standalone_mode: Which SVD standalone tracking
is used.
204 Options are
"VXDTF2",
"SVDHough",
"VXDTF2_and_SVDHough",
and "SVDHough_and_VXDTF2".
206 :param use_svd_to_cdc_ckf:
if true, add SVD to CDC CKF module.
207 :param use_ecl_to_cdc_ckf:
if true, add ECL to CDC CKF module.
208 :param add_cdcTrack_QI: If true, add the MVA track quality estimation
209 to the path that sets the quality indicator property of the found CDC standalone tracks
210 :param add_vxdTrack_QI: If true, add the MVA track quality estimation
211 to the path that sets the quality indicator property of the found VXDTF2 tracks
212 (ATTENTION: Standard triplet QI of VXDTF2
is replaced
in this case
213 -> setting this option to
'True' will have some influence on the final track collection)
214 :param add_recoTrack_QI: If true, add the MVA track quality estimation
215 to the path that sets the quality indicator property of all found reco tracks
216 (Both other QIs needed
as input.)
217 :param pxd_filtering_offline: If
True, PXD data reduction (ROI filtering)
is applied during the track reconstruction.
218 The reconstructed SVD/CDC tracks are used to define the ROIs
and reject all PXD clusters outside of these.
219 :param create_intercepts_for_pxd_ckf: If
True, the PXDROIFinder
is added to the path to create PXDIntercepts to be used
220 for hit filtering when creating the CKF relations. This independent of the offline PXD digit filtering which
is
221 steered by
'pxd_filtering_offline'. This can be applied
for both data
and MC.
222 :param append_full_grid_cdc_eventt0: If
True, the module FullGridChi2TrackTimeExtractor
is added to the path
223 and provides the CDC temporary EventT0.
224 :param skip_full_grid_cdc_eventt0_if_svd_time_present:
if true,
and if also append_full_grid_cdc_eventt0
is true, the
225 FullGridChi2TrackTimeExtractor
is only executed
in the events where no SVD-based EventT0
is found. If false, but
226 append_full_grid_cdc_eventt0
is true, FullGridChi2TrackTimeExtractor will be executed
in each event regardless of
227 SVD EventT0 being present. Has no effect
if append_full_grid_cdc_eventt0
is false. Default: true
228 :param inverted_tracking: If true, start tracking
with SVD standalone track finding, followed by ToCDCCKF,
229 the CDC standalone tracking, a CKF-based merger to merge the standalone RecoTracks,
and finally the
230 CDCToSVDSpacePointCKF to add SVD hits to all CDC tracks that don
't have SVD hits attached to them.
231 ATTENTION: The inverted tracking chain is neither optimised nor guaranteed to be bug free.
232 One known issue
is a reduced hit efficiency when using the full chain.
233 Please remove this comment once the inverted tracking has been optimised
and is assumed to be bug-free.
236 if not is_svd_used(components)
and not is_cdc_used(components):
239 if (add_cdcTrack_QI
or add_vxdTrack_QI
or add_recoTrack_QI)
and not fit_tracks:
240 b2.B2ERROR(
"MVA track qualiy indicator requires `fit_tracks` to be enabled. Turning all off.")
241 add_cdcTrack_QI =
False
242 add_vxdTrack_QI =
False
243 add_recoTrack_QI =
False
245 if add_recoTrack_QI
and (
not add_cdcTrack_QI
or not add_vxdTrack_QI):
246 b2.B2ERROR(
"RecoTrack qualiy indicator requires CDC and VXD QI as input. Turning it all of.")
247 add_cdcTrack_QI =
False
248 add_vxdTrack_QI =
False
249 add_recoTrack_QI =
False
251 if not skipGeometryAdding:
252 add_geometry_modules(path, components=components)
254 if not skipHitPreparerAdding:
255 add_hit_preparation_modules(path,
256 components=components,
257 pxd_filtering_offline=pxd_filtering_offline,
258 create_intercepts_for_pxd_ckf=create_intercepts_for_pxd_ckf)
261 if 'SetupGenfitExtrapolation' not in path:
262 path.add_module(
'SetupGenfitExtrapolation',
263 energyLossBrems=
False, noiseBrems=
False)
266 add_mc_track_finding(path, components=components, reco_tracks=reco_tracks,
267 use_second_cdc_hits=use_second_cdc_hits)
269 add_track_finding(path, components=components, reco_tracks=reco_tracks,
270 prune_temporary_tracks=prune_temporary_tracks,
271 use_second_cdc_hits=use_second_cdc_hits,
272 svd_standalone_mode=svd_standalone_mode,
273 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
274 use_ecl_to_cdc_ckf=use_ecl_to_cdc_ckf,
275 add_cdcTrack_QI=add_cdcTrack_QI,
276 add_vxdTrack_QI=add_vxdTrack_QI,
277 pxd_filtering_offline=pxd_filtering_offline,
278 create_intercepts_for_pxd_ckf=create_intercepts_for_pxd_ckf,
279 inverted_tracking=inverted_tracking)
283 add_time_extraction(path, append_full_grid_cdc_eventt0, components=components,
284 skip_full_grid_cdc_eventt0_if_svd_time_present=skip_full_grid_cdc_eventt0_if_svd_time_present)
287 add_prefilter_track_fit_and_track_creator(path,
288 trackFitHypotheses=trackFitHypotheses,
289 reco_tracks=reco_tracks,
290 add_mva_quality_indicator=add_recoTrack_QI)
293def add_postfilter_tracking_reconstruction(path, components=None, pruneTracks=False, reco_tracks="RecoTracks",
294 use_second_cdc_hits=False, prune_temporary_tracks=True, v0_finding=True,
295 flip_recoTrack=True, mcTrackFinding=False, kink_finding=True):
297 This function adds the tracking reconstruction modules not required to calculate HLT filter
300 :param path: The path to add the tracking reconstruction modules to
301 :param components: the list of geometry components
in use
or None for all components.
302 :param pruneTracks: Delete all hits
except the first
and the last
in the found tracks.
303 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
304 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
305 :param prune_temporary_tracks: If false, store all information of the single CDC
and VXD tracks before merging.
307 :param v0_finding: If false, the V0 module will
not be executed
308 :param flip_recoTrack:
if true, add the recoTracks flipping function
in the postfilter (only
if PXD
is part of
309 the ``components``). This flag
is automatically set to false on HLT
and ExpressReco.
310 :param mcTrackFinding: Use the MC track finders instead of the realistic ones.
311 :param kink_finding:
if true, add the ``KinkFinder`` module to the path. This flag
is automatically set to false
312 on HLT
and ExpressReco.
316 if components
and not (
'SVD' in components
or 'CDC' in components):
319 flip_and_refit_temporary_RecoTracks =
"RecoTracks_flipped"
320 v0finder_temporary_RecoTracks =
"CopiedRecoTracks"
321 kinkfinder_temporary_RecoTracks =
"RecoTracksKinkTmp"
322 temporary_reco_track_list = []
325 if flip_recoTrack
and not mcTrackFinding
and is_pxd_used(components):
326 add_flipping_of_recoTracks(path, reco_tracks=
"RecoTracks", reco_tracks_flipped=flip_and_refit_temporary_RecoTracks)
327 temporary_reco_track_list.append(flip_and_refit_temporary_RecoTracks)
331 path.add_module(
'V0Finder', RecoTracks=reco_tracks, v0FitterMode=1, CopiedRecoTracks=v0finder_temporary_RecoTracks)
332 temporary_reco_track_list.append(v0finder_temporary_RecoTracks)
336 path.add_module(
'KinkFinder', RecoTracks=reco_tracks, CopiedRecoTracks=kinkfinder_temporary_RecoTracks)
337 temporary_reco_track_list.append(kinkfinder_temporary_RecoTracks)
340 path.add_module(
'TrackTimeEstimator')
342 add_mc_matcher(path, components=components, reco_tracks=reco_tracks,
343 use_second_cdc_hits=use_second_cdc_hits)
347 add_prune_tracks(path, components=components, reco_tracks=reco_tracks)
349 if prune_temporary_tracks
or pruneTracks:
350 path.add_module(
"PruneRecoHits")
352 if prune_temporary_tracks:
353 for temporary_reco_tracks
in temporary_reco_track_list:
356 storeArrayName=temporary_reco_tracks).set_name(
358 temporary_reco_tracks)
361def add_time_extraction(path, append_full_grid_cdc_eventt0=False, components=None,
362 skip_full_grid_cdc_eventt0_if_svd_time_present=True):
364 Add time extraction components via tracking
366 :param path: The path to add the tracking reconstruction modules to
367 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor
is added to the path
368 and provides the CDC temporary EventT0.
369 :param components: the list of geometry components
in use
or None for all components.
370 :param skip_full_grid_cdc_eventt0_if_svd_time_present:
if true,
and if also append_full_grid_cdc_eventt0
is true, the
371 FullGridChi2TrackTimeExtractor
is only executed
in the events where no SVD-based EventT0
is found. If false, but
372 append_full_grid_cdc_eventt0
is true, FullGridChi2TrackTimeExtractor will be executed
in each event regardless of
373 SVD EventT0 being present. Has no effect
if append_full_grid_cdc_eventt0
is false. Default: true
377 if is_svd_used(components):
378 path.add_module(
"SVDEventT0Estimator")
380 if is_cdc_used(components)
and append_full_grid_cdc_eventt0:
381 path.add_module(
"FullGridChi2TrackTimeExtractor",
382 skipIfSVDEventT0Present=skip_full_grid_cdc_eventt0_if_svd_time_present)
385def add_cr_tracking_reconstruction(path, components=None, prune_tracks=False,
386 skip_geometry_adding=False, event_time_extraction=True,
387 merge_tracks=True, use_second_cdc_hits=False):
389 This function adds the reconstruction modules for cr tracking to a path.
391 :param path: The path to which to add the tracking reconstruction modules
393 :param components: the list of geometry components
in use
or None for all components.
394 :param prune_tracks: Delete all hits
except the first
and the last
in the found tracks.
396 :param skip_geometry_adding: Advanced flag: The tracking modules need the geometry module
and will add it,
397 if it
is not already present
in the path. In a setup
with multiple (conditional) paths however, it cannot
398 determine
if the geometry
is already loaded. This flag can be used to just turn off the geometry adding
399 (but you will have to add it on your own).
400 :param event_time_extraction: extract the event time
401 :param merge_tracks: The upper
and lower half of the tracks should be merged together
in one track
402 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
410 if not is_cdc_used(components):
413 if not skip_geometry_adding:
414 add_geometry_modules(path, components)
416 add_hit_preparation_modules(path, components=components, create_intercepts_for_pxd_ckf=
False)
419 if 'SetupGenfitExtrapolation' not in path:
420 path.add_module(
'SetupGenfitExtrapolation',
421 energyLossBrems=
False, noiseBrems=
False)
424 add_cr_track_finding(path, reco_tracks=
"RecoTracks", components=components,
425 merge_tracks=merge_tracks, use_second_cdc_hits=use_second_cdc_hits)
429 add_cr_track_fit_and_track_creator(path, components=components, prune_tracks=prune_tracks,
430 event_timing_extraction=event_time_extraction)
434 add_cr_track_fit_and_track_creator(path, components=components, prune_tracks=prune_tracks,
435 event_timing_extraction=
False,
436 reco_tracks=
"NonMergedRecoTracks", tracks=
"NonMergedTracks")
439def add_mc_tracking_reconstruction(path, components=None, pruneTracks=False, use_second_cdc_hits=False):
441 This function adds the standard reconstruction modules for MC tracking
444 :param path: The path to add the tracking reconstruction modules to
445 :param components: the list of geometry components
in use
or None for all components.
446 :param pruneTracks: Delete all hits expect the first
and the last
from the found tracks.
447 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
449 add_tracking_reconstruction(path,
450 components=components,
451 pruneTracks=pruneTracks,
453 use_second_cdc_hits=use_second_cdc_hits)
456def add_track_finding(path, components=None, reco_tracks="RecoTracks",
457 prune_temporary_tracks=True, use_second_cdc_hits=False,
458 use_mc_truth=False, svd_ckf_mode="SVD_after", add_both_directions=True,
459 svd_standalone_mode="VXDTF2",
460 use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False,
461 add_cdcTrack_QI=True, add_vxdTrack_QI=False,
462 pxd_filtering_offline=False, use_HLT_ROIs=False,
463 create_intercepts_for_pxd_ckf=False,
464 inverted_tracking=False):
466 Add the track finding chain to the path. Depending on the parameters, different tracking chains can be defined and attached.
467 :param path: The path to add the tracking reconstruction modules to
468 :param reco_tracks: The store array name where to output all tracks
469 :param use_mc_truth: Use the truth information
in the CKF modules
470 :param svd_ckf_mode: how to apply the CKF (
with or without SVD standalone tracking). Defaults to
"SVD_after".
471 :param add_both_directions: Curlers may be found
in the wrong orientation by the CDC track finder, so
try to
472 extrapolate also
in the other direction.
473 :param svd_standalone_mode: Which SVD standalone tracking
is used.
474 Options are
"VXDTF2",
"SVDHough",
"VXDTF2_and_SVDHough",
and "SVDHough_and_VXDTF2".
476 :param use_second_cdc_hits: whether to use the secondary CDC hit during CDC track finding
or not
477 :param components: the list of geometry components
in use
or None for all components.
478 :param prune_temporary_tracks: If false, store all information of the single CDC
and VXD tracks before merging.
480 :param use_svd_to_cdc_ckf:
if true, add SVD to CDC CKF module.
481 :param use_ecl_to_cdc_ckf:
if true, add ECL to CDC CKF module.
482 :param add_cdcTrack_QI: If true, add the MVA track quality estimation
483 to the path that sets the quality indicator property of the found CDC standalone tracks
484 :param add_vxdTrack_QI: If true, add the MVA track quality estimation
485 to the path that sets the quality indicator property of the found VXDTF2 tracks
486 (ATTENTION: Standard triplet QI of VXDTF2
is replaced
in this case
487 -> setting this option to
'True' will have some influence on the final track collection)
488 :param pxd_filtering_offline: If
True, PXD data reduction (ROI filtering)
is applied during the track reconstruction.
489 The reconstructed SVD/CDC tracks are used to define the ROIs
and reject all PXD clusters outside of these.
490 :param use_HLT_ROIs: Don
't calculate the ROIs here but use the ones from the HLT (does obviously not work for simulation)
491 :param create_intercepts_for_pxd_ckf: If True, the PXDROIFinder
is added to the path to create PXDIntercepts to be used
492 for hit filtering when creating the CKF relations. This independent of the offline PXD digit filtering which
is
493 steered by
'pxd_filtering_offline'. This can be applied
for both data
and MC.
494 :param inverted_tracking: If true, start tracking
with SVD standalone track finding, followed by ToCDCCKF,
495 the CDC standalone tracking, a CKF-based merger to merge the standalone RecoTracks,
and finally the
496 CDCToSVDSpacePointCKF to add SVD hits to all CDC tracks that don
't have SVD hits attached to them.
497 ATTENTION: The inverted tracking chain is neither optimised nor guaranteed to be bug free.
498 One known issue
is a reduced hit efficiency when using the full chain.
499 Please remove this comment once the inverted tracking has been optimised
and is assumed to be bug-free.
501 if not is_svd_used(components)
and not is_cdc_used(components):
504 if use_ecl_to_cdc_ckf
and not is_cdc_used(components):
505 b2.B2WARNING(
"ECL CKF cannot be used without CDC. Turning it off.")
506 use_ecl_to_cdc_ckf =
False
508 if use_ecl_to_cdc_ckf
and not is_ecl_used(components):
509 b2.B2ERROR(
"ECL CKF cannot be used without ECL. Turning it off.")
510 use_ecl_to_cdc_ckf =
False
513 if 'RegisterEventLevelTrackingInfo' not in path:
514 path.add_module(
'RegisterEventLevelTrackingInfo')
517 cdc_reco_tracks =
"CDCRecoTracks"
518 svd_cdc_reco_tracks =
"SVDCDCRecoTracks"
519 ecl_reco_tracks =
"ECLRecoTracks"
520 combined_ecl_reco_tracks =
"combinedECLRecoTracks"
523 svd_reco_tracks =
"SVDRecoTracks"
524 pxd_reco_tracks =
"PXDRecoTracks"
527 temporary_reco_track_list = []
530 latest_reco_tracks =
None
532 if not is_pxd_used(components):
533 if use_ecl_to_cdc_ckf
and is_cdc_used(components):
534 combined_ecl_reco_tracks = reco_tracks
535 elif (
not use_ecl_to_cdc_ckf)
and is_svd_used(components):
536 svd_cdc_reco_tracks = reco_tracks
537 elif (
not use_ecl_to_cdc_ckf)
and (
not is_svd_used(components))
and is_cdc_used(components):
538 cdc_reco_tracks = reco_tracks
541 if not inverted_tracking:
542 latest_reco_tracks, tmp_reco_track_list = \
543 add_default_cdc_svd_tracking_chain(path,
544 components=components,
545 svd_reco_tracks=svd_reco_tracks,
546 cdc_reco_tracks=cdc_reco_tracks,
547 output_reco_tracks=svd_cdc_reco_tracks,
548 use_second_cdc_hits=use_second_cdc_hits,
549 add_cdcTrack_QI=add_cdcTrack_QI,
550 use_mc_truth=use_mc_truth,
551 svd_ckf_mode=svd_ckf_mode,
552 add_both_directions=add_both_directions,
553 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
554 svd_standalone_mode=svd_standalone_mode,
555 add_vxdTrack_QI=add_vxdTrack_QI,
556 prune_temporary_tracks=prune_temporary_tracks)
558 temporary_reco_track_list.extend(tmp_reco_track_list)
564 latest_reco_tracks, tmp_reco_track_list = \
565 add_inverted_svd_cdc_tracking_chain(path,
566 components=components,
567 svd_reco_tracks=svd_reco_tracks,
568 cdc_reco_tracks=cdc_reco_tracks,
569 svd_cdc_reco_tracks=svd_cdc_reco_tracks,
570 use_second_cdc_hits=use_second_cdc_hits,
571 add_cdcTrack_QI=add_cdcTrack_QI,
572 use_mc_truth=use_mc_truth,
573 svd_ckf_mode=svd_ckf_mode,
574 add_both_directions=add_both_directions,
575 use_svd_to_cdc_ckf=use_svd_to_cdc_ckf,
576 svd_standalone_mode=svd_standalone_mode,
577 add_vxdTrack_QI=add_vxdTrack_QI,
578 prune_temporary_tracks=prune_temporary_tracks)
580 temporary_reco_track_list.extend(tmp_reco_track_list)
582 if use_ecl_to_cdc_ckf
and is_cdc_used(components):
583 add_eclcdc_track_finding(path, components=components, output_reco_tracks=ecl_reco_tracks,
584 prune_temporary_tracks=prune_temporary_tracks)
588 path.add_module(
"RecoTrackStoreArrayCombiner",
589 Temp1RecoTracksStoreArrayName=latest_reco_tracks,
590 Temp2RecoTracksStoreArrayName=ecl_reco_tracks,
591 recoTracksStoreArrayName=combined_ecl_reco_tracks)
592 temporary_reco_track_list.append(ecl_reco_tracks)
593 temporary_reco_track_list.append(combined_ecl_reco_tracks)
594 latest_reco_tracks = combined_ecl_reco_tracks
596 if is_pxd_used(components):
598 In case we want to use offline PXD hit filtering ('pxd_filtering_offline == True'), we can decide to either use ROIs
599 created by HLT (
'use_HLT_ROIs == True')
or to create ROIs on the fly (
'use_HLT_ROIs == False').
600 In addition, we can also just run the ROI finder to create PXDIntercepts (
'create_intercepts_for_pxd_ckf == True')
601 that can be used
in the ToPXDCKF relation filters to reduce the number of relations that are created. In this case
602 there
is no need to apply the ROI filtering.
604 if pxd_filtering_offline
or create_intercepts_for_pxd_ckf:
606 intercepts_name =
"PXDIntercepts"
607 if not use_HLT_ROIs
or create_intercepts_for_pxd_ckf:
608 path.add_module(
"DAFRecoFitter", recoTracksStoreArrayName=latest_reco_tracks)
610 roiName =
"ROIs_offline"
611 intercepts_name =
"CKF" + intercepts_name
613 reco_tracks=latest_reco_tracks,
614 intercepts_name=intercepts_name,
617 if pxd_filtering_offline:
618 pxd_digifilter = b2.register_module(
'PXDdigiFilter')
619 pxd_digifilter.param(
'ROIidsName', roiName)
620 pxd_digifilter.param(
'PXDDigitsName',
'PXDDigits')
621 pxd_digifilter.param(
'PXDDigitsInsideROIName',
'PXDDigits')
622 pxd_digifilter.param(
'overrideDB',
True)
623 pxd_digifilter.param(
'usePXDDataReduction',
True)
624 path.add_module(pxd_digifilter)
626 if pxd_filtering_offline
or create_intercepts_for_pxd_ckf:
627 add_pxd_reconstruction(path)
629 add_pxd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
630 use_mc_truth=use_mc_truth, output_reco_tracks=reco_tracks,
631 temporary_reco_tracks=pxd_reco_tracks,
632 add_both_directions=add_both_directions)
633 temporary_reco_track_list.append(pxd_reco_tracks)
635 if prune_temporary_tracks:
636 for temporary_reco_track_name
in temporary_reco_track_list:
637 if temporary_reco_track_name != reco_tracks:
640 storeArrayName=temporary_reco_track_name).set_name(
642 temporary_reco_track_name)
645def add_cr_track_finding(path, reco_tracks="RecoTracks", components=None,
646 merge_tracks=True, use_second_cdc_hits=False):
649 if 'RegisterEventLevelTrackingInfo' not in path:
650 path.add_module(
'RegisterEventLevelTrackingInfo')
652 if not is_cdc_used(components):
653 b2.B2FATAL(
"CDC must be in components")
655 reco_tracks_from_track_finding = reco_tracks
657 reco_tracks_from_track_finding =
"NonMergedRecoTracks"
659 cdc_reco_tracks =
"CDCRecoTracks"
660 if not is_pxd_used(components)
and not is_svd_used(components):
661 cdc_reco_tracks = reco_tracks_from_track_finding
663 svd_cdc_reco_tracks =
"SVDCDCRecoTracks"
664 if not is_pxd_used(components):
665 svd_cdc_reco_tracks = reco_tracks_from_track_finding
667 full_reco_tracks = reco_tracks_from_track_finding
670 add_cdc_cr_track_finding(path, merge_tracks=
False, use_second_cdc_hits=use_second_cdc_hits,
671 output_reco_tracks=cdc_reco_tracks)
673 latest_reco_tracks = cdc_reco_tracks
675 if is_svd_used(components):
676 add_svd_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
677 output_reco_tracks=svd_cdc_reco_tracks,
678 svd_ckf_mode=
"cosmics", add_both_directions=
True, svd_standalone_mode=
"VXDTF2")
679 latest_reco_tracks = svd_cdc_reco_tracks
681 if is_pxd_used(components):
682 add_pxd_cr_track_finding(path, components=components, input_reco_tracks=latest_reco_tracks,
683 output_reco_tracks=full_reco_tracks, add_both_directions=
True)
687 path.add_module(
"CosmicsTrackMerger", inputRecoTracks=reco_tracks_from_track_finding,
688 outputRecoTracks=reco_tracks)
691def add_mc_track_finding(path, components=None, reco_tracks="RecoTracks", use_second_cdc_hits=False):
693 Add the MC based TrackFinder to the path.
695 :param path: The path to add the tracking reconstruction modules to
696 :param components: the list of geometry components in use
or None for all components.
697 :param reco_tracks: Name of the StoreArray where the reco tracks should be stored
698 :param use_second_cdc_hits: If true, the second hit information will be used
in the CDC track finding.
700 if is_cdc_used(components)
or is_pxd_used(components)
or is_svd_used(components):
702 path.add_module(
'TrackFinderMCTruthRecoTracks',
703 RecoTracksStoreArrayName=reco_tracks,
704 UseSecondCDCHits=use_second_cdc_hits,
705 UsePXDHits=is_pxd_used(components),
706 UseSVDHits=is_svd_used(components),
707 UseCDCHits=is_cdc_used(components))
710def add_tracking_for_PXDDataReduction_simulation(path, components, svd_cluster='__ROIsvdClusters'):
712 This function adds the standard reconstruction modules for tracking to be used
for the simulation of PXD data
715 :param path: The path to add the tracking reconstruction modules to
716 :param components: the list of geometry components
in use
or None for all components, always exclude the PXD.
719 if not is_svd_used(components):
723 if 'SetupGenfitExtrapolation' not in path:
724 material_effects = b2.register_module(
'SetupGenfitExtrapolation')
725 material_effects.set_name(
726 'SetupGenfitExtrapolationForPXDDataReduction')
727 path.add_module(material_effects)
730 svd_reco_tracks =
"__ROIsvdRecoTracks"
733 add_svd_standalone_tracking(path, components=[
'SVD'], reco_tracks=svd_reco_tracks, suffix=
"__ROI",
734 svd_clusters=svd_cluster)
737 dafRecoFitter = b2.register_module(
"DAFRecoFitter")
738 dafRecoFitter.set_name(
"SVD-only DAFRecoFitter")
739 dafRecoFitter.param(
'recoTracksStoreArrayName', svd_reco_tracks)
740 dafRecoFitter.param(
'svdHitsStoreArrayName', svd_cluster)
741 path.add_module(dafRecoFitter)
744def add_roiFinder(path, reco_tracks="RecoTracks", intercepts_name="PXDIntercepts", roiName="ROIs"):
746 Add the ROI finding to the path creating ROIs out of reco tracks by extrapolating them to the PXD volume.
747 :param path: Where to add the module to.
748 :param reco_tracks: Which tracks to use in the extrapolation step.
749 :param roiName: Name of the produced/stored ROIs.
751 path.add_module('PXDROIFinder', recoTrackListName=reco_tracks,
752 PXDInterceptListName=intercepts_name, ROIListName=roiName)
755def add_roi_payload_assembler(path, ignore_hlt_decision):
756 path.add_module(
'ROIPayloadAssembler',
757 ROIListName=
'ROIs', ROIpayloadName=
'ROIpayload',
758 SendAllDownscaler=0, SendROIsDownscaler=1,
759 AcceptAll=ignore_hlt_decision, NoRejectFlag=
False)
762def add_vxd_standalone_cosmics_finder(
764 reco_tracks="RecoTracks",
765 pxd_spacepoints_name="PXDSpacePoints",
766 svd_spacepoints_name="SVDSpacePoints",
771 Convenience function for adding VXD standalone cosmics track finding
for B = 0 Tesla
774 The result
is a StoreArray
with name
@param reco_tracks containing one
or zero reco tracks per event.
775 This track candidates have an arbitrary but large momentum seed
in the direction of the fitted line.
776 The position
and momentum seed
is obtained using a principal component analysis method.
778 :param path: basf2 path
779 :param reco_tracks: Name of the output RecoTracks; defaults to RecoTracks.
780 :param spacepoints_name: name of store array containing the spacepoints; defaults to SpacePoints
781 :param quality_cut: Cut on the chi squared value of the line fit; candidates
with values above the cut will be
782 rejected; defaults to 0.0001
783 :param min_sps: Minimal number of SpacePoints required to build a track candidate; defaults to 3;
784 :param max_rejected_sps: Maximal number of retries to refit a track after the worst spacepoint was removed;
789 if 'RegisterEventLevelTrackingInfo' not in path:
790 path.add_module(
'RegisterEventLevelTrackingInfo')
792 if "PXDSpacePointCreator" not in [m.name()
for m
in path.modules()]:
793 path.add_module(
'PXDSpacePointCreator', SpacePoints=pxd_spacepoints_name)
797 track_finder = b2.register_module(
'TrackFinderVXDCosmicsStandalone')
798 track_finder.param(
'SpacePointTrackCandArrayName',
"")
799 track_finder.param(
'SpacePoints', [pxd_spacepoints_name, svd_spacepoints_name])
800 track_finder.param(
'QualityCut', quality_cut)
801 track_finder.param(
'MinSPs', min_sps)
802 track_finder.param(
'MaxRejectedSPs', max_rejected_sps)
803 path.add_module(track_finder)
805 converter = b2.register_module(
'SPTC2RTConverter')
806 converter.param(
'recoTracksStoreArrayName', reco_tracks)
807 path.add_module(converter)