14 os.environ[
'OMP_THREAD_LIMIT'] =
"1"
18 from geometry
import check_components
20 from svd
import add_svd_reconstruction
21 from pxd
import add_pxd_reconstruction
23 from rawdata
import add_unpackers
27 from tracking
import (
28 add_mc_tracking_reconstruction,
29 add_prefilter_tracking_reconstruction,
30 add_postfilter_tracking_reconstruction,
31 add_cr_tracking_reconstruction,
36 add_filter_software_trigger,
37 add_skim_software_trigger
41 CDST_TRACKING_OBJECTS = (
42 'EventLevelTrackingInfo',
49 'SVDShaperDigitsFromTracks',
50 'PXDClustersFromTracks',
70 def default_event_abort(module, condition, error_flag):
71 """Default event abort outside of HLT: Ignore the error flag and just stop
72 processing by giving an empty path"""
74 module.if_value(condition, p, basf2.AfterConditionPath.END)
77 def add_reconstruction(path, components=None, pruneTracks=True, add_trigger_calculation=True, skipGeometryAdding=False,
78 trackFitHypotheses=None, addClusterExpertModules=True,
79 use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=None,
80 event_abort=default_event_abort, use_random_numbers_for_hlt_prescale=True,
81 pxd_filtering_offline=False, append_full_grid_cdc_eventt0=False,
82 legacy_ecl_charged_pid=False, emulate_HLT=False):
84 This function adds the standard reconstruction modules to a path.
85 Consists of clustering, tracking and the PID modules essentially in this structure:
87 | :func:`add_reconstruction()`
88 | ├── :func:`add_prefilter_reconstruction()`
89 | │ ├── :func:`add_prefilter_pretracking_reconstruction()` : Clustering
90 | │ ├── ``add_prefilter_tracking_reconstruction()`` : Tracking essential for HLT filter calculation
91 | │ └── :func:`add_prefilter_posttracking_reconstruction()` : PID and clustering essential for HLT
92 | └── :func:`add_postfilter_reconstruction()`
93 | ├── ``add_postfilter_tracking_reconstruction()`` : Rest of the tracking
94 | └── :func:`add_postfilter_posttracking_reconstruction()` : Rest of PID and clustering
96 plus the modules to calculate the software trigger cuts.
98 :param path: Add the modules to this path.
99 :param components: list of geometry components to include reconstruction for, or None for all components.
100 :param pruneTracks: Delete all hits except the first and last of the tracks after the V0Finder modules.
101 :param skipGeometryAdding: Advances flag: The tracking modules need the geometry module and will add it,
102 if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not
103 determine, if the geometry is already loaded. This flag can be used to just turn off the geometry adding at
104 all (but you will have to add it on your own then).
105 :param trackFitHypotheses: Change the additional fitted track fit hypotheses. If no argument is given,
106 the fitted hypotheses are pion, muon and proton, i.e. [211, 321, 2212].
107 :param addClusterExpertModules: Add the cluster expert modules in the KLM and ECL. Turn this off to reduce
109 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
110 :param add_muid_hits: Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.
111 :param add_trigger_calculation: add the software trigger modules for monitoring (do not make any cut)
112 :param reconstruct_cdst: None for mdst, 'rawFormat' to reconstruct cdsts in rawFormat, 'fullFormat' for the
113 full (old) format. This parameter is needed when reconstructing cdsts, otherwise the
114 required PXD objects won't be added.
115 :param event_abort: A function to abort event processing at the given point. Should take three arguments: a module,
116 the condition and the error_flag to be set if these events are kept. If run on HLT this will not abort the event
117 but just remove all data except for the event information.
118 :param use_random_numbers_for_hlt_prescale: If True, the HLT filter prescales are applied using randomly
119 generated numbers, otherwise are applied using an internal counter.
120 :param pxd_filtering_offline: If True, PXD data reduction (ROI filtering) is applied during the track reconstruction.
121 The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.
122 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor is added to the path
123 and provides the CDC temporary EventT0.
124 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
125 MVA based charged particle ID (false).
126 :param emulate_HLT: if True, it runs the reconstruction as it is run on HLT (e.g. without PXD).
127 If you want to use this flag on raw data, you should also exclude the following branches from RootInput: ROIs, ROIpayload
132 if reconstruct_cdst ==
'rawFormat':
133 append_full_grid_cdc_eventt0 =
True
136 components = DEFAULT_HLT_COMPONENTS
139 add_prefilter_reconstruction(path,
140 components=components,
141 add_modules_for_trigger_calculation=add_trigger_calculation,
142 skipGeometryAdding=skipGeometryAdding,
143 trackFitHypotheses=trackFitHypotheses,
144 use_second_cdc_hits=use_second_cdc_hits,
145 add_muid_hits=add_muid_hits,
146 reconstruct_cdst=reconstruct_cdst,
147 event_abort=event_abort,
148 pxd_filtering_offline=pxd_filtering_offline,
149 append_full_grid_cdc_eventt0=append_full_grid_cdc_eventt0)
152 if add_trigger_calculation
and (
not components
or (
"CDC" in components
and "ECL" in components
and "KLM" in components)):
153 add_filter_software_trigger(path,
154 use_random_numbers_for_prescale=use_random_numbers_for_hlt_prescale)
157 add_postfilter_reconstruction(path,
158 components=components,
159 pruneTracks=pruneTracks,
160 addClusterExpertModules=addClusterExpertModules,
161 reconstruct_cdst=reconstruct_cdst,
162 legacy_ecl_charged_pid=legacy_ecl_charged_pid)
165 if add_trigger_calculation
and (
not components
or (
"CDC" in components
and "ECL" in components
and "KLM" in components)):
166 add_skim_software_trigger(path)
169 def add_prefilter_reconstruction(path,
171 add_modules_for_trigger_calculation=True,
172 skipGeometryAdding=False,
173 trackFitHypotheses=None,
174 use_second_cdc_hits=False,
176 reconstruct_cdst=None,
177 event_abort=default_event_abort,
178 pxd_filtering_offline=False,
179 append_full_grid_cdc_eventt0=False):
181 This function adds only the reconstruction modules required to calculate HLT filter decision to a path.
182 Consists of essential tracking and the functionality provided by :func:`add_prefilter_posttracking_reconstruction()`.
184 :param path: Add the modules to this path.
185 :param components: list of geometry components to include reconstruction for, or None for all components.
186 :param add_modules_for_trigger_calculation: add the modules necessary for computing the software trigger decision
187 during later stages (do not make any cut), relevant only when reconstruct_cdst is not None.
188 :param skipGeometryAdding: Advances flag: The tracking modules need the geometry module and will add it,
189 if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not
190 determine, if the geometry is already loaded. This flag can be used to just turn off the geometry adding at
191 all (but you will have to add it on your own then).
192 :param trackFitHypotheses: Change the additional fitted track fit hypotheses. If no argument is given,
193 the fitted hypotheses are pion, muon and proton, i.e. [211, 321, 2212].
194 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
195 :param add_muid_hits: Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.
196 :param reconstruct_cdst: None for mdst, 'rawFormat' to reconstruct cdsts in rawFormat, 'fullFormat' for the
197 full (old) format. This parameter is needed when reconstructing cdsts, otherwise the
198 required PXD objects won't be added.
199 :param event_abort: A function to abort event processing at the given point. Should take three arguments: a module,
200 the condition and the error_flag to be set if these events are kept. If run on HLT this will not abort the event
201 but just remove all data except for the event information.
202 :param pxd_filtering_offline: If True, PXD data reduction (ROI filtering) is applied during the track reconstruction.
203 The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.
204 :param append_full_grid_cdc_eventt0: If True, the module FullGridChi2TrackTimeExtractor is added to the path
205 and provides the CDC temporary EventT0.
209 from ROOT
import Belle2
212 check_components(components)
215 doom = path.add_module(
"EventsOfDoomBuster")
216 event_abort(doom,
">=1", Belle2.EventMetaData.c_ReconstructionAbort)
217 path.add_module(
'StatisticsSummary').set_name(
'Sum_EventsofDoomBuster')
220 add_prefilter_pretracking_reconstruction(path, components=components)
223 add_prefilter_tracking_reconstruction(path,
224 components=components,
225 mcTrackFinding=
False,
226 skipGeometryAdding=skipGeometryAdding,
227 trackFitHypotheses=trackFitHypotheses,
228 use_second_cdc_hits=use_second_cdc_hits,
229 pxd_filtering_offline=pxd_filtering_offline,
230 append_full_grid_cdc_eventt0=append_full_grid_cdc_eventt0)
233 path.add_module(
'StatisticsSummary').set_name(
'Sum_Prefilter_Tracking')
237 add_special_vxd_modules(path, components=components)
238 if reconstruct_cdst ==
'rawFormat' and not add_modules_for_trigger_calculation:
242 add_prefilter_posttracking_reconstruction(path,
243 components=components,
244 add_muid_hits=add_muid_hits)
247 path.add_module(
'StatisticsSummary').set_name(
'Sum_Prefilter_PostTracking')
250 def add_postfilter_reconstruction(path,
253 addClusterExpertModules=True,
254 reconstruct_cdst=None,
255 legacy_ecl_charged_pid=False):
257 This function adds the reconstruction modules not required to calculate HLT filter decision to a path.
259 :param path: Add the modules to this path.
260 :param components: list of geometry components to include reconstruction for, or None for all components.
261 :param pruneTracks: Delete all hits expect the first and the last from the found tracks.
262 :param addClusterExpertModules: Add the cluster expert modules in the KLM and ECL. Turn this off to
263 reduce execution time.
264 :param reconstruct_cdst: None for mdst, 'rawFormat' to reconstruct cdsts in rawFormat, 'fullFormat' for the
265 full (old) format. This parameter is needed when reconstructing cdsts, otherwise the
266 required PXD objects won't be added.
267 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
268 MVA based charged particle ID (false).
272 add_postfilter_tracking_reconstruction(path, components=components, pruneTracks=
False)
274 path.add_module(
'StatisticsSummary').set_name(
'Sum_Postfilter_Tracking')
277 if reconstruct_cdst ==
'rawFormat':
278 add_dedx_modules(path, components=components)
280 add_prune_tracks(path, components)
284 add_postfilter_posttracking_reconstruction(path,
285 components=components,
286 addClusterExpertModules=addClusterExpertModules,
287 legacy_ecl_charged_pid=legacy_ecl_charged_pid)
290 add_prune_tracks(path, components)
293 path.add_module(
'StatisticsSummary').set_name(
'Sum_Postfilter_PostTracking')
296 def add_cosmics_reconstruction(
300 skipGeometryAdding=False,
301 eventTimingExtraction=True,
302 addClusterExpertModules=True,
304 use_second_cdc_hits=False,
306 reconstruct_cdst=False,
308 eventt0_combiner_mode="prefer_cdc",
309 legacy_ecl_charged_pid=False,
312 This function adds the standard reconstruction modules for cosmic data to a path.
313 Consists of tracking and the functionality provided by :func:`add_posttracking_reconstruction()`,
314 plus the modules to calculate the software trigger cuts.
316 :param path: Add the modules to this path.
317 :param components: list of geometry components to include reconstruction for, or None for all components.
318 :param pruneTracks: Delete all hits except the first and last of the tracks after the dEdX modules.
319 :param skipGeometryAdding: Advances flag: The tracking modules need the geometry module and will add it,
320 if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not
321 determine, if the geometry is already loaded. This flag can be used to just turn off the geometry adding at
322 all (but you will have to add it on your own then).
324 :param eventTimingExtraction: extract the event time
325 :param addClusterExpertModules: Add the cluster expert modules in the KLM and ECL. Turn this off to reduce
328 :param merge_tracks: The upper and lower half of the tracks should be merged together in one track
329 :param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
331 :param add_muid_hits: Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.
333 :param reconstruct_cdst: run only the minimal reconstruction needed to produce the cdsts (raw+tracking+dE/dx)
334 :param posttracking: run reconstruction for outer detectors.
335 :param eventt0_combiner_mode: Mode to combine the t0 values of the sub-detectors
336 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
337 MVA based charged particle ID (false).
341 check_components(components)
344 add_prefilter_pretracking_reconstruction(path,
345 components=components)
348 add_cr_tracking_reconstruction(path,
349 components=components,
351 skip_geometry_adding=skipGeometryAdding,
352 event_time_extraction=eventTimingExtraction,
353 merge_tracks=merge_tracks,
354 use_second_cdc_hits=use_second_cdc_hits)
357 path.add_module(
'StatisticsSummary').set_name(
'Sum_Tracking')
361 add_special_vxd_modules(path, components=components)
362 add_dedx_modules(path, components=components)
363 add_prune_tracks(path, components=components)
367 add_posttracking_reconstruction(path,
368 components=components,
369 pruneTracks=pruneTracks,
370 addClusterExpertModules=addClusterExpertModules,
371 add_muid_hits=add_muid_hits,
373 eventt0_combiner_mode=eventt0_combiner_mode,
374 legacy_ecl_charged_pid=legacy_ecl_charged_pid)
377 def add_mc_reconstruction(path, components=None, pruneTracks=True, addClusterExpertModules=True,
378 use_second_cdc_hits=False, add_muid_hits=False, legacy_ecl_charged_pid=False):
380 This function adds the standard reconstruction modules with MC tracking
383 @param components list of geometry components to include reconstruction for, or None for all components.
384 @param use_second_cdc_hits: If true, the second hit information will be used in the CDC track finding.
385 :param add_muid_hits: Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.
386 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
387 MVA based charged particle ID (false).
391 add_prefilter_pretracking_reconstruction(path,
392 components=components)
395 add_mc_tracking_reconstruction(path,
396 components=components,
398 use_second_cdc_hits=use_second_cdc_hits)
401 path.add_module(
'StatisticsSummary').set_name(
'Sum_MC_Tracking')
404 add_posttracking_reconstruction(path,
405 components=components,
406 pruneTracks=pruneTracks,
407 add_muid_hits=add_muid_hits,
408 addClusterExpertModules=addClusterExpertModules,
409 legacy_ecl_charged_pid=legacy_ecl_charged_pid)
412 def add_prefilter_pretracking_reconstruction(path, components=None):
414 This function adds the standard reconstruction modules BEFORE tracking
417 :param path: The path to add the modules to.
418 :param components: list of geometry components to include reconstruction for, or None for all components.
421 add_ecl_modules(path, components)
424 path.add_module(
'StatisticsSummary').set_name(
'Sum_Clustering')
427 def add_prefilter_posttracking_reconstruction(path,
430 for_cdst_analysis=False,
431 add_eventt0_combiner_for_cdst=False,
432 eventt0_combiner_mode="prefer_svd"):
434 This function adds to the path the standard reconstruction modules after prefilter tracking
435 whoose outputs are also needed in the filter.
437 :param path: The path to add the modules to.
438 :param components: list of geometry components to include reconstruction for, or None for all components.
439 :param add_muid_hits: Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.
440 :param for_cdst_analysis: if True, EventT0Combiner is not added to path.
441 This is only needed by prepare_cdst_analysis().
442 :param add_eventt0_combiner_for_cdst: if True, the EventT0Combiner module is added to the path even if
443 for_cdst_analysis is False. This is useful for validation purposes for avoiding to run the full
444 add_reconstruction(). Note that, with the default settings (for_cdst_analysis=False and
445 add_eventt0_combiner_for_cdst=False), the EventT0Combiner module is added to the path.
446 :param eventt0_combiner_mode: Mode to combine the t0 values of the sub-detectors
449 add_ext_module(path, components)
452 if not for_cdst_analysis
or add_eventt0_combiner_for_cdst:
453 path.add_module(
"EventT0Combiner", combinationLogic=eventt0_combiner_mode)
454 add_ecl_finalizer_module(path, components)
455 add_ecl_mc_matcher_module(path, components)
456 add_klm_modules(path, components)
457 add_klm_mc_matcher_module(path, components)
458 add_muid_module(path, add_hits_to_reco_track=add_muid_hits, components=components)
459 add_ecl_track_cluster_modules(path, components)
460 add_ecl_cluster_properties_modules(path, components)
463 def add_postfilter_posttracking_reconstruction(path,
465 addClusterExpertModules=True,
467 for_cdst_analysis=False,
468 legacy_ecl_charged_pid=False):
470 This function adds to the path the standard reconstruction modules whoose outputs are not needed in the filter.
472 :param path: The path to add the modules to.
473 :param components: list of geometry components to include reconstruction for, or None for all components.
474 :param addClusterExpertModules: Add the cluster expert modules in the KLM and ECL. Turn this off to reduce
476 :param cosmics: if True, steer TOP for cosmic reconstruction.
477 :param for_cdst_analysis: if True, the OnlineEventT0Creator module is not added to the path.
478 This is only needed by prepare_cdst_analysis().
479 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
480 MVA based charged particle ID (false).
484 if not for_cdst_analysis:
485 add_dedx_modules(path, components)
487 add_top_modules(path, components, cosmics=cosmics)
488 add_arich_modules(path, components)
491 if not for_cdst_analysis:
492 path.add_module(
"OnlineEventT0Creator")
494 add_ecl_chargedpid_module(path, components, legacy_ecl_charged_pid)
495 add_pid_module(path, components)
497 if addClusterExpertModules:
499 add_cluster_expert_modules(path, components)
501 add_ecl_track_brem_finder(path, components)
504 def add_posttracking_reconstruction(path,
507 addClusterExpertModules=True,
510 for_cdst_analysis=False,
511 add_eventt0_combiner_for_cdst=False,
512 eventt0_combiner_mode="prefer_svd",
513 legacy_ecl_charged_pid=False):
515 This function adds the standard reconstruction modules after tracking
518 :param path: The path to add the modules to.
519 :param components: list of geometry components to include reconstruction for, or None for all components.
520 :param pruneTracks: Delete all hits except the first and last after the post-tracking modules.
521 :param addClusterExpertModules: Add the cluster expert modules in the KLM and ECL. Turn this off to reduce
523 :param add_muid_hits: Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.
524 :param cosmics: if True, steer TOP for cosmic reconstruction.
525 :param for_cdst_analysis: if True, the dEdx and PruneTracks modules are not added to the path, as well
526 as all EventT0 related modules.
527 This is only needed by prepare_cdst_analysis().
528 :param add_eventt0_combiner_for_cdst: if True, the EventT0Combiner module is added to the path even if
529 for_cdst_analysis is True. This is useful for validation purposes for avoiding to run the full
530 add_reconstruction(). Note that, with the default settings (for_cdst_analysis=False and
531 add_eventt0_combiner_for_cdst=False), the EventT0Combiner module is added to the path.
532 :param eventt0_combiner_mode: Mode to combine the t0 values of the sub-detectors
533 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
534 MVA based charged particle ID (false).
537 add_prefilter_posttracking_reconstruction(path,
538 components=components,
539 add_muid_hits=add_muid_hits,
540 for_cdst_analysis=for_cdst_analysis,
541 add_eventt0_combiner_for_cdst=add_eventt0_combiner_for_cdst,
542 eventt0_combiner_mode=eventt0_combiner_mode)
544 add_postfilter_posttracking_reconstruction(path,
545 components=components,
546 addClusterExpertModules=addClusterExpertModules,
548 for_cdst_analysis=for_cdst_analysis,
549 legacy_ecl_charged_pid=legacy_ecl_charged_pid)
553 if not for_cdst_analysis:
555 add_prune_tracks(path, components)
557 path.add_module(
'StatisticsSummary').set_name(
'Sum_Posttracking_Reconstruction')
560 def add_mdst_output(*args, **kwargs):
562 .. deprecated:: release-08-00-00
564 This function simply returns a FATAL message.
566 Please use the equivalent function from the mdst package if you want to store
567 the output in a mDST file:
569 .. code-block:: python
572 mdst.add_mdst_output(path=mypath)
575 basf2.B2FATAL(
"This function is deprecated and it will be removed in release-09.\n"
576 "Please use the equivalent function from the mdst package.")
579 def add_cdst_output(path,
581 filename='cdst.root',
582 additionalBranches=None,
583 dataDescription=None,
584 ignoreInputModulesCheck=False):
586 This function adds the `RootOutput` module to a path with the settings needed to produce a cDST output.
587 The actual cDST output content depends on the value of the parameter `mc`:
588 * if `mc` is `False` (default setting), the cDST content is raw + tracking dataobjects;
589 * if `mc` is `True`, the cDST content is digits + MCParticles + tracking dataobjects.
591 @param path Path to add modules to.
592 @param mc Define the type of cDST output content: `False` for raw + tracking dataobjects, `True` for digits +
593 MCParticles + tracking dataobjects.
594 @param filename Output file name.
595 @param additionalBranches Additional objects/arrays of event durability to save
596 @param dataDescription Additional key->value pairs to be added as data description
597 fields to the output FileMetaData.
598 @param ignoreInputModulesCheck If True, do not enforce check on missing PXD modules in the input path.
599 Needed when a conditional path is passed as input.
602 branches = list(CDST_TRACKING_OBJECTS)
603 persistentBranches = [
'FileMetaData']
606 branches += ALWAYS_SAVE_OBJECTS + RAWDATA_OBJECTS
608 branches += list(DIGITS_OBJECTS) + [
610 'EventLevelTriggerTimeInfo',
611 'SoftwareTriggerResult',
613 persistentBranches += [
'BackgroundInfo']
615 if not ignoreInputModulesCheck
and "PXDClustersFromTracks" not in [module.name()
for module
in path.modules()]:
616 basf2.B2ERROR(
"PXDClustersFromTracks is required in CDST output but its module is not found in the input path!")
618 if dataDescription
is None:
620 dataDescription.setdefault(
"dataLevel",
"cdst")
622 if additionalBranches
is not None:
623 branches += additionalBranches
625 return path.add_module(
"RootOutput", outputFileName=filename, branchNames=branches,
626 branchNamesPersistent=persistentBranches, additionalDataDescription=dataDescription)
629 def add_arich_modules(path, components=None):
631 Add the ARICH reconstruction to the path.
633 :param path: The path to add the modules to.
634 :param components: The components to use or None to use all standard components.
636 if components
is None or 'ARICH' in components:
637 path.add_module(
'ARICHFillHits')
638 path.add_module(
'ARICHReconstructor',
642 def add_top_modules(path, components=None, cosmics=False):
644 Add the TOP reconstruction to the path.
646 :param path: The path to add the modules to.
647 :param components: The components to use or None to use all standard components.
648 :param cosmics: if True, steer TOP for cosmic reconstruction
650 if components
is None or 'TOP' in components:
651 path.add_module(
'TOPChannelMasker')
653 path.add_module(
'TOPCosmicT0Finder')
655 path.add_module(
'TOPBunchFinder')
656 path.add_module(
'TOPReconstructor')
659 def add_cluster_expert_modules(path, components=None):
661 Add the KLMExpert and ClusterMatcher modules to the path.
663 :param path: The path to add the modules to.
664 :param components: The components to use or None to use all standard components.
666 if components
is None or (
'KLM' in components
and 'ECL' in components):
667 path.add_module(
'KLMExpert')
668 path.add_module(
'ClusterMatcher')
671 def add_pid_module(path, components=None):
673 Add the PID modules to the path.
675 :param path: The path to add the modules to.
676 :param components: The components to use or None to use all standard components.
678 if components
is None or 'SVD' in components
or 'CDC' in components:
679 path.add_module(
'MdstPID')
682 def add_klm_modules(path, components=None):
684 Add the KLM reconstruction modules to the path.
686 :param path: The path to add the modules to.
687 :param components: The components to use or None to use all standard components.
689 if components
is None or 'KLM' in components:
690 path.add_module(
'KLMReconstructor')
691 path.add_module(
'KLMClustersReconstructor')
694 def add_klm_mc_matcher_module(path, components=None):
696 Add the KLM mc matcher module to the path.
698 :param path: The path to add the modules to.
699 :param components: The components to use or None to use all standard components.
701 if components
is None or 'KLM' in components:
702 path.add_module(
'MCMatcherKLMClusters')
705 def add_muid_module(path, add_hits_to_reco_track=False, components=None):
707 Add the MuID module to the path.
709 :param path: The path to add the modules to.
710 :param add_hits_to_reco_track: Add the found KLM hits also to the RecoTrack. Make sure to refit the track afterwards.
711 :param components: The components to use or None to use all standard components.
714 if components
is None or (
'CDC' in components
and 'ECL' in components
and 'KLM' in components):
715 path.add_module(
'Muid',
716 addHitsToRecoTrack=add_hits_to_reco_track)
717 if components
is not None and 'CDC' in components:
718 if (
'ECL' not in components
and 'KLM' in components):
719 basf2.B2WARNING(
'You added KLM to the components list but not ECL: the module Muid, that is necessary '
720 'for correct muonID computation, will not be added to your reconstruction path. '
721 'Make sure that this is fine for your purposes, otherwise please include also ECL.')
722 if (
'ECL' in components
and 'KLM' not in components):
723 basf2.B2WARNING(
'You added ECL to the components list but not KLM: the module Muid, that is necessary '
724 'for correct ECLCluster-Track matching, will not be added to your reconstruction path. '
725 ' Make sure that this is fine for your purposes, otherwise please include also KLM.')
728 def add_ecl_modules(path, components=None):
730 Add the ECL reconstruction modules to the path.
732 :param path: The path to add the modules to.
733 :param components: The components to use or None to use all standard components.
735 if components
is None or 'ECL' in components:
736 path.add_module(
'ECLWaveformFit')
737 path.add_module(
'ECLDigitCalibrator')
738 path.add_module(
'ECLEventT0')
739 path.add_module(
'ECLCRFinder')
740 path.add_module(
'ECLLocalMaximumFinder')
741 path.add_module(
'ECLSplitterN1')
742 path.add_module(
'ECLSplitterN2')
743 path.add_module(
'ECLShowerCorrector')
744 path.add_module(
'ECLShowerCalibrator')
745 path.add_module(
'ECLShowerShape')
746 path.add_module(
'ECLClusterPSD')
747 path.add_module(
'ECLCovarianceMatrix')
751 def add_ecl_finalizer_module(path, components=None):
753 Add the ECL finalizer module to the path.
755 :param path: The path to add the modules to.
756 :param components: The components to use or None to use all standard components.
759 if components
is None or 'ECL' in components:
760 path.add_module(
'ECLFinalizer')
763 def add_ecl_track_cluster_modules(path, components=None):
765 Add the ECL track cluster matching module to the path.
767 :param path: The path to add the modules to.
768 :param components: The components to use or None to use all standard components.
770 if components
is None or (
'ECL' in components
and (
'PXD' in components
or 'SVD' in components
or 'CDC' in components)):
771 path.add_module(
'ECLTrackClusterMatching')
774 def add_ecl_cluster_properties_modules(path, components=None):
776 Add the ECL cluster properties module to the path.
778 :param path: The path to add the modules to.
779 :param components: The components to use or None to use all standard components.
781 if components
is None or (
'ECL' in components
and (
'PXD' in components
or 'SVD' in components
or 'CDC' in components)):
782 path.add_module(
'ECLClusterProperties')
785 def add_ecl_track_brem_finder(path, components=None):
787 Add the bremsstrahlung finding module to the path.
789 :param path: The path to add the modules to.
790 :param components: The components to use or None to use all standard components.
792 if components
is None or (
'ECL' in components
and (
'PXD' in components
or 'SVD' in components)):
793 path.add_module(
'ECLTrackBremFinder')
796 def add_ecl_chargedpid_module(path, components=None, legacyMode=False):
798 Add the ECL charged PID module to the path.
800 :param path: The path to add the modules to.
801 :param components: The components to use or None to use all standard components.
802 :param legacyMode: Uses the simple E/p based charged PID instead of the MVA based charged PID.
804 if components
is None or 'ECL' in components:
807 path.add_module(
'ECLChargedPID')
809 path.add_module(
'ECLChargedPIDMVA')
812 def add_ecl_mc_matcher_module(path, components=None):
814 Add the ECL MC matcher module to the path.
816 :param path: The path to add the modules to.
817 :param components: The components to use or None to use all standard components.
819 if components
is None or 'ECL' in components:
820 path.add_module(
'MCMatcherECLClusters')
823 def add_ext_module(path, components=None):
825 Add the extrapolation module to the path.
827 :param path: The path to add the modules to.
828 :param components: The components to use or None to use all standard components.
830 if components
is None or 'CDC' in components:
831 path.add_module(
'Ext')
834 def add_dedx_modules(path, components=None):
836 Add the dE/dX reconstruction modules to the path.
838 :param path: The path to add the modules to.
839 :param components: The components to use or None to use all standard components.
842 if components
is None or 'CDC' in components:
843 path.add_module(
'CDCDedxPID')
846 if components
is None or 'SVD' in components:
847 path.add_module(
'VXDDedxPID')
850 def add_special_vxd_modules(path, components=None):
852 Add two modules that are not part of the standard reconstruction.
854 :param path: The path to add the modules to.
855 :param components: The components to use or None to use all standard components.
858 if not components
or (
'PXD' in components):
859 path.add_module(
"PXDClustersFromTracks")
860 if not components
or (
'SVD' in components):
861 path.add_module(
"SVDShaperDigitsFromTracks")
864 def prepare_cdst_analysis(path, components=None, mc=False, add_eventt0_combiner=False, legacy_ecl_charged_pid=False):
866 Adds to a (analysis) path all the modules needed to analyse a cDST file in the raw+tracking format
867 for collisions/cosmics data or in the digits+tracking format for MC data.
869 :param path: The path to add the modules to.
870 :param components: The components to use or None to use all standard components.
871 :param mc: Are we running over MC data or not? If so, do not run the unpackers.
872 :param add_eventt0_combiner: If True, it adds the EventT0Combiner module when the post-tracking
873 reconstruction is run. This must NOT be used during the calibration, but it may be necessary
874 for validation purposes or for the user analyses.
875 :param legacy_ecl_charged_pid: Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or
876 MVA based charged particle ID (false).
882 components=components)
884 check_components(components)
885 path.add_module(
'Gearbox')
886 path.add_module(
'Geometry')
889 add_prefilter_pretracking_reconstruction(path,
890 components=components)
893 if components
is None or 'SVD' in components:
894 add_svd_reconstruction(path)
895 if components
is None or 'PXD' in components:
896 add_pxd_reconstruction(path)
899 path.add_module(
'SetupGenfitExtrapolation',
900 energyLossBrems=
False,
904 add_posttracking_reconstruction(path,
905 components=components,
906 for_cdst_analysis=
True,
907 add_eventt0_combiner_for_cdst=add_eventt0_combiner,
908 legacy_ecl_charged_pid=legacy_ecl_charged_pid)
911 def prepare_user_cdst_analysis(path, components=None, mc=False):
913 Adds to a (analysis) path all the modules needed to analyse a cDST file in the raw+tracking format
914 for collisions/cosmics data or in the digits+tracking format for MC data.
915 Differently from prepare_cdst_analysis(), this function add the EventT0Combiner module to the path,
916 which makes this function suitable for all the users and not only for the calibration expertes.
917 Note that the EventT0Combiner module is necessary for applying the proper EventT0 correction to
920 :param path: The path to add the modules to.
921 :param components: The components to use or None to use all standard components.
922 :param mc: Are we running over MC data or not? If so, do not run the unpackers.
924 prepare_cdst_analysis(path=path, components=components, mc=mc, add_eventt0_combiner=
True)