17. 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.

17.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=[], dataDescription=None, rawFormat=True, ignoreInputModulesCheck=False)[source]

This function adds the RootOutput module to a path with the settings needed to produce a cDST output.

Parameters
  • path – Path to add modules to.

  • mc – Save Monte Carlo quantities? (MCParticles and corresponding relations)

  • 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

  • rawFormat – Saves the cDST file in the raw+tracking format if mc=False, otherwise saves the cDST file in the digits+tracking format.

  • 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)[source]

This function adds the standard reconstruction modules for cosmic data to a path. Consists of tracking and the functionality provided by add_prefilter_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.

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)[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.

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)[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.

reconstruction.add_mdst_output(path, mc=True, filename='mdst.root', additionalBranches=[], dataDescription=None)[source]

This function adds the MDST output modules to a path, saving only objects defined as part of the MDST data format.

Parameters
  • path – Path to add modules to

  • mc – Save Monte Carlo quantities? (MCParticles and corresponding relations)

  • 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

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_reconstruction(path, components=None, pruneTracks=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.

reconstruction.add_prefilter_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)[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, dEdx, EventT0 and PruneTracks modules are not added to the 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.

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, addClusterExpertModules=True, pruneTracks=True, event_abort=<function default_event_abort>, use_random_numbers_for_hlt_prescale=True)[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.

  • 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.

  • 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.

  • 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.

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

  • pruneTracks – Delete all hits except the first and last of the tracks (it must be set to False if the post-filter reconstruction is also run).

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)[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
└── add_postfilter_tracking_reconstruction() : Rest of the tracking

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.

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)[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.

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.