18. Reconstruction#

This package contains code for some posttracking reconstruction tasks, as well as scripts to run the official reconstruction for Belle II. Dedicated modules are included for determinations of ionization energy loss (dE/dx) in the CDC and VXD as well as for KLID. Data objects for combined reconstruction information such as PID and event T0, as well as the general mDST structure, are defined here as well. While the reconstruction script defines the methods used for default reconstruction, most of the modules that run reconstruction tasks are defined in dedicated packages.

18.1. Functions in reconstructions.py#

reconstruction.add_arich_modules(path, components=None)[source]#

Add the ARICH reconstruction to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_cdst_output(path, mc=True, filename='cdst.root', additionalBranches=None, dataDescription=None, ignoreInputModulesCheck=False)[source]#

This function adds the RootOutput module to a path with the settings needed to produce a cDST output. The actual cDST output content depends on the value of the parameter mc: * if mc is False (default setting), the cDST content is raw + tracking dataobjects; * if mc is True, the cDST content is digits + MCParticles + tracking dataobjects.

Parameters
  • path – Path to add modules to.

  • mc – Define the type of cDST output content: False for raw + tracking dataobjects, True for digits + MCParticles + tracking dataobjects.

  • filename – Output file name.

  • additionalBranches – Additional objects/arrays of event durability to save

  • dataDescription – Additional key->value pairs to be added as data description fields to the output FileMetaData.

  • ignoreInputModulesCheck – If True, do not enforce check on missing PXD modules in the input path. Needed when a conditional path is passed as input.

reconstruction.add_cluster_expert_modules(path, components=None)[source]#

Add the KLMExpert and ClusterMatcher modules to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_cosmics_reconstruction(path, components=None, pruneTracks=True, skipGeometryAdding=False, eventTimingExtraction=True, addClusterExpertModules=True, merge_tracks=True, use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=False, posttracking=True, eventt0_combiner_mode='prefer_cdc', legacy_ecl_charged_pid=False)[source]#

This function adds the standard reconstruction modules for cosmic data to a path. Consists of tracking and the functionality provided by add_posttracking_reconstruction(), plus the modules to calculate the software trigger cuts.

Parameters
  • path – Add the modules to this path.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • pruneTracks – Delete all hits except the first and last of the tracks after the dEdX modules.

  • skipGeometryAdding – Advances flag: The tracking modules need the geometry module and will add it, if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not determine, if the geometry is already loaded. This flag can be used to just turn off the geometry adding at all (but you will have to add it on your own then).

  • eventTimingExtraction – extract the event time

  • addClusterExpertModules – Add the cluster expert modules in the KLM and ECL. Turn this off to reduce execution time.

  • merge_tracks – The upper and lower half of the tracks should be merged together in one track

  • use_second_cdc_hits – If true, the second hit information will be used in the CDC track finding.

  • add_muid_hits – Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.

  • reconstruct_cdst – run only the minimal reconstruction needed to produce the cdsts (raw+tracking+dE/dx)

  • posttracking – run reconstruction for outer detectors.

  • eventt0_combiner_mode – Mode to combine the t0 values of the sub-detectors

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

reconstruction.add_dedx_modules(path, components=None)[source]#

Add the dE/dX reconstruction modules to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ecl_chargedpid_module(path, components=None, legacyMode=False)[source]#

Add the ECL charged PID module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

  • legacyMode – Uses the simple E/p based charged PID instead of the MVA based charged PID.

reconstruction.add_ecl_cluster_properties_modules(path, components=None)[source]#

Add the ECL cluster properties module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ecl_finalizer_module(path, components=None)[source]#

Add the ECL finalizer module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ecl_mc_matcher_module(path, components=None)[source]#

Add the ECL MC matcher module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ecl_modules(path, components=None)[source]#

Add the ECL reconstruction modules to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ecl_track_brem_finder(path, components=None)[source]#

Add the bremsstrahlung finding module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ecl_track_cluster_modules(path, components=None)[source]#

Add the ECL track cluster matching module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_ext_module(path, components=None)[source]#

Add the extrapolation module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_klm_mc_matcher_module(path, components=None)[source]#

Add the KLM mc matcher module to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_klm_modules(path, components=None)[source]#

Add the KLM reconstruction modules to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_mc_reconstruction(path, components=None, pruneTracks=True, addClusterExpertModules=True, use_second_cdc_hits=False, add_muid_hits=False, legacy_ecl_charged_pid=False)[source]#

This function adds the standard reconstruction modules with MC tracking to a path.

Parameters
  • components – list of geometry components to include reconstruction for, or None for all components.

  • use_second_cdc_hits – If true, the second hit information will be used in the CDC track finding.

  • add_muid_hits – Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

reconstruction.add_mdst_output(*args, **kwargs)[source]#

Deprecated since version release-08-00-00.

This function simply returns a FATAL message.

Please use the equivalent function from the mdst package if you want to store the output in a mDST file:

import mdst
mdst.add_mdst_output(path=mypath)
reconstruction.add_muid_module(path, add_hits_to_reco_track=False, components=None)[source]#

Add the MuID module to the path.

Parameters
  • path – The path to add the modules to.

  • add_hits_to_reco_track – Add the found KLM hits also to the RecoTrack. Make sure to refit the track afterwards.

  • components – The components to use or None to use all standard components.

reconstruction.add_pid_module(path, components=None)[source]#

Add the PID modules to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_postfilter_posttracking_reconstruction(path, components=None, addClusterExpertModules=True, cosmics=False, for_cdst_analysis=False, legacy_ecl_charged_pid=False)[source]#

This function adds to the path the standard reconstruction modules whoose outputs are not needed in the filter.

Parameters
  • path – The path to add the modules to.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • addClusterExpertModules – Add the cluster expert modules in the KLM and ECL. Turn this off to reduce execution time.

  • cosmics – if True, steer TOP for cosmic reconstruction.

  • for_cdst_analysis – if True, the OnlineEventT0Creator module is not added to the path. This is only needed by prepare_cdst_analysis().

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

reconstruction.add_postfilter_reconstruction(path, components=None, pruneTracks=False, addClusterExpertModules=True, reconstruct_cdst=None, legacy_ecl_charged_pid=False)[source]#

This function adds the reconstruction modules not required to calculate HLT filter decision to a path.

Parameters
  • path – Add the modules to this path.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • pruneTracks – Delete all hits expect the first and the last from the found tracks.

  • addClusterExpertModules – Add the cluster expert modules in the KLM and ECL. Turn this off to reduce execution time.

  • reconstruct_cdst – None for mdst, ‘rawFormat’ to reconstruct cdsts in rawFormat, ‘fullFormat’ for the full (old) format. This parameter is needed when reconstructing cdsts, otherwise the required PXD objects won’t be added.

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

reconstruction.add_posttracking_reconstruction(path, components=None, pruneTracks=True, addClusterExpertModules=True, add_muid_hits=False, cosmics=False, for_cdst_analysis=False, add_eventt0_combiner_for_cdst=False, eventt0_combiner_mode='prefer_svd', legacy_ecl_charged_pid=False)[source]#

This function adds the standard reconstruction modules after tracking to a path.

Parameters
  • path – The path to add the modules to.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • pruneTracks – Delete all hits except the first and last after the post-tracking modules.

  • addClusterExpertModules – Add the cluster expert modules in the KLM and ECL. Turn this off to reduce execution time.

  • add_muid_hits – Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.

  • cosmics – if True, steer TOP for cosmic reconstruction.

  • for_cdst_analysis – if True, the dEdx and PruneTracks modules are not added to the path, as well as all EventT0 related modules. This is only needed by prepare_cdst_analysis().

  • add_eventt0_combiner_for_cdst – if True, the EventT0Combiner module is added to the path even if for_cdst_analysis is True. This is useful for validation purposes for avoiding to run the full add_reconstruction(). Note that, with the default settings (for_cdst_analysis=False and add_eventt0_combiner_for_cdst=False), the EventT0Combiner module is added to the path.

  • eventt0_combiner_mode – Mode to combine the t0 values of the sub-detectors

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

reconstruction.add_prefilter_posttracking_reconstruction(path, components=None, add_muid_hits=False, for_cdst_analysis=False, add_eventt0_combiner_for_cdst=False, eventt0_combiner_mode='prefer_svd')[source]#

This function adds to the path the standard reconstruction modules after prefilter tracking whoose outputs are also needed in the filter.

Parameters
  • path – The path to add the modules to.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • add_muid_hits – Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.

  • for_cdst_analysis – if True, EventT0Combiner is not added to path. This is only needed by prepare_cdst_analysis().

  • add_eventt0_combiner_for_cdst – if True, the EventT0Combiner module is added to the path even if for_cdst_analysis is False. This is useful for validation purposes for avoiding to run the full add_reconstruction(). Note that, with the default settings (for_cdst_analysis=False and add_eventt0_combiner_for_cdst=False), the EventT0Combiner module is added to the path.

  • eventt0_combiner_mode – Mode to combine the t0 values of the sub-detectors

reconstruction.add_prefilter_pretracking_reconstruction(path, components=None)[source]#

This function adds the standard reconstruction modules BEFORE tracking to a path.

Parameters
  • path – The path to add the modules to.

  • components – list of geometry components to include reconstruction for, or None for all components.

reconstruction.add_prefilter_reconstruction(path, components=None, add_modules_for_trigger_calculation=True, skipGeometryAdding=False, trackFitHypotheses=None, use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=None, event_abort=<function default_event_abort>, pxd_filtering_offline=False, append_full_grid_cdc_eventt0=False)[source]#

This function adds only the reconstruction modules required to calculate HLT filter decision to a path. Consists of essential tracking and the functionality provided by add_prefilter_posttracking_reconstruction().

Parameters
  • path – Add the modules to this path.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • add_modules_for_trigger_calculation – add the modules necessary for computing the software trigger decision during later stages (do not make any cut), relevant only when reconstruct_cdst is not None.

  • skipGeometryAdding – Advances flag: The tracking modules need the geometry module and will add it, if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not determine, if the geometry is already loaded. This flag can be used to just turn off the geometry adding at all (but you will have to add it on your own then).

  • trackFitHypotheses – Change the additional fitted track fit hypotheses. If no argument is given, the fitted hypotheses are pion, muon and proton, i.e. [211, 321, 2212].

  • use_second_cdc_hits – If true, the second hit information will be used in the CDC track finding.

  • add_muid_hits – Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.

  • reconstruct_cdst – None for mdst, ‘rawFormat’ to reconstruct cdsts in rawFormat, ‘fullFormat’ for the full (old) format. This parameter is needed when reconstructing cdsts, otherwise the required PXD objects won’t be added.

  • event_abort – A function to abort event processing at the given point. Should take three arguments: a module, the condition and the error_flag to be set if these events are kept. If run on HLT this will not abort the event but just remove all data except for the event information.

  • pxd_filtering_offline – If True, PXD data reduction (ROI filtering) is applied during the track reconstruction. The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.

  • append_full_grid_cdc_eventt0 – If True, the module FullGridChi2TrackTimeExtractor is added to the path and provides the CDC temporary EventT0.

reconstruction.add_reconstruction(path, components=None, pruneTracks=True, add_trigger_calculation=True, skipGeometryAdding=False, trackFitHypotheses=None, addClusterExpertModules=True, use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=None, event_abort=<function default_event_abort>, use_random_numbers_for_hlt_prescale=True, pxd_filtering_offline=False, append_full_grid_cdc_eventt0=False, legacy_ecl_charged_pid=False, emulate_HLT=False)[source]#

This function adds the standard reconstruction modules to a path. Consists of clustering, tracking and the PID modules essentially in this structure:

│ ├── add_prefilter_tracking_reconstruction() : Tracking essential for HLT filter calculation
│ └── add_prefilter_posttracking_reconstruction() : PID and clustering essential for HLT
├── add_postfilter_tracking_reconstruction() : Rest of the tracking
└── add_postfilter_posttracking_reconstruction() : Rest of PID and clustering

plus the modules to calculate the software trigger cuts.

Parameters
  • path – Add the modules to this path.

  • components – list of geometry components to include reconstruction for, or None for all components.

  • pruneTracks – Delete all hits except the first and last of the tracks after the V0Finder modules.

  • skipGeometryAdding – Advances flag: The tracking modules need the geometry module and will add it, if it is not already present in the path. In a setup with multiple (conditional) paths however, it can not determine, if the geometry is already loaded. This flag can be used to just turn off the geometry adding at all (but you will have to add it on your own then).

  • trackFitHypotheses – Change the additional fitted track fit hypotheses. If no argument is given, the fitted hypotheses are pion, muon and proton, i.e. [211, 321, 2212].

  • addClusterExpertModules – Add the cluster expert modules in the KLM and ECL. Turn this off to reduce execution time.

  • use_second_cdc_hits – If true, the second hit information will be used in the CDC track finding.

  • add_muid_hits – Add the found KLM hits to the RecoTrack. Make sure to refit the track afterwards.

  • add_trigger_calculation – add the software trigger modules for monitoring (do not make any cut)

  • reconstruct_cdst – None for mdst, ‘rawFormat’ to reconstruct cdsts in rawFormat, ‘fullFormat’ for the full (old) format. This parameter is needed when reconstructing cdsts, otherwise the required PXD objects won’t be added.

  • event_abort – A function to abort event processing at the given point. Should take three arguments: a module, the condition and the error_flag to be set if these events are kept. If run on HLT this will not abort the event but just remove all data except for the event information.

  • use_random_numbers_for_hlt_prescale – If True, the HLT filter prescales are applied using randomly generated numbers, otherwise are applied using an internal counter.

  • pxd_filtering_offline – If True, PXD data reduction (ROI filtering) is applied during the track reconstruction. The reconstructed SVD/CDC tracks are used to define the ROIs and reject all PXD clusters outside of these.

  • append_full_grid_cdc_eventt0 – If True, the module FullGridChi2TrackTimeExtractor is added to the path and provides the CDC temporary EventT0.

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

  • emulate_HLT – if True, it runs the reconstruction as it is run on HLT (e.g. without PXD). If you want to use this flag on raw data, you should also exclude the following branches from RootInput: ROIs, ROIpayload

reconstruction.add_special_vxd_modules(path, components=None)[source]#

Add two modules that are not part of the standard reconstruction.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

reconstruction.add_top_modules(path, components=None, cosmics=False)[source]#

Add the TOP reconstruction to the path.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

  • cosmics – if True, steer TOP for cosmic reconstruction

reconstruction.default_event_abort(module, condition, error_flag)[source]#

Default event abort outside of HLT: Ignore the error flag and just stop processing by giving an empty path

reconstruction.prepare_cdst_analysis(path, components=None, mc=False, add_eventt0_combiner=False, legacy_ecl_charged_pid=False)[source]#

Adds to a (analysis) path all the modules needed to analyse a cDST file in the raw+tracking format for collisions/cosmics data or in the digits+tracking format for MC data.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

  • mc – Are we running over MC data or not? If so, do not run the unpackers.

  • add_eventt0_combiner – If True, it adds the EventT0Combiner module when the post-tracking reconstruction is run. This must NOT be used during the calibration, but it may be necessary for validation purposes or for the user analyses.

  • legacy_ecl_charged_pid – Bool denoting whether to use the legacy EoP based charged particleID in the ECL (true) or MVA based charged particle ID (false).

reconstruction.prepare_user_cdst_analysis(path, components=None, mc=False)[source]#

Adds to a (analysis) path all the modules needed to analyse a cDST file in the raw+tracking format for collisions/cosmics data or in the digits+tracking format for MC data. Differently from prepare_cdst_analysis(), this function add the EventT0Combiner module to the path, which makes this function suitable for all the users and not only for the calibration expertes. Note that the EventT0Combiner module is necessary for applying the proper EventT0 correction to our data.

Parameters
  • path – The path to add the modules to.

  • components – The components to use or None to use all standard components.

  • mc – Are we running over MC data or not? If so, do not run the unpackers.