Skip to content
Snippets Groups Projects

Make "process" a required input and configure pyconf functions globally once with user input

Merged Abhijit Mathad requested to merge AM_process into master
2 files
+ 54
26
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -11,32 +11,60 @@
from contextlib import contextmanager
from typing import Optional
from GaudiConf.LbExec import Options as DefaultOptions, ProcessTypes
from PyConf.reading import (upfront_decoder, reconstruction, get_stream,
from PyConf.reading import (upfront_decoder, reconstruction, get_tes_root,
get_odin, get_hlt_reports, get_mc_track_info)
class Options(DefaultOptions):
input_manifest_file: Optional[str]
metainfo_additional_tags: Optional[list]
annsvc_config: Optional[str]
process: ProcessTypes
stream: str = "default"
lumi: bool = False
evt_pre_filters: Optional[dict[str, str]] = None
enable_unpack: bool = True
write_fsr: bool = True
merge_genfsr: bool = False
"""
A class that holds the user-specified DaVinci options.
This class inherits from the default "GaudiConf.LbExec.Options".
@contextmanager
def apply_binds(self):
upfront_decoder.global_bind(process=self.process)
reconstruction.global_bind(process=self.process)
get_mc_track_info.global_bind(process=self.process)
get_stream.global_bind(process=self.process)
get_odin.global_bind(
process=self.process,
stream=self.stream,
input_raw_format=self.input_raw_format)
get_hlt_reports.global_bind(process=self.process, stream=self.stream)
with super().apply_binds():
yield
This class also configures the following PyConf functions, where their keyword
arugments are globally bound to the user-specified values.
This way users do not have to manually configure these functions themselves.
- upfont_decoder
- reconstruction
- get_tes_root
- get_odin
- get_hlt_reports
- get_mc_track_info
Four user-required parameters need to be set in this class:
- process (str): Process type, either 'Spruce' or 'Turbo' or 'Hlt2'
- input_manifest (str): Path to the input manifest file
- annsvc_config (str): Path to the configuration file from sprucing or Hlt2
- metainfo_additional_tags (str): List of additional tags to be added to the metainfo
The optional parameters that need to be set are :
- stream (str): Stream name. Default for "process=Hlt2" is an empty string and for "process=Spruce" it is 'default'.
- lumi (bool): Flag to store luminosity information. Default is False.
- evt_pre_filter (dict[str,str]): Event pre-filter code. Default is None.
- enable_unpack (bool): Flag to enable the unpacking of the input data. Default is True.
- write_fsr (bool): Flag to write full stream record. Default is True.
- merge_genfsr (bool): Flag to merge the full stream record. Default is False.
"""
input_manifest_file: Optional[str]
metainfo_additional_tags: Optional[list]
annsvc_config: Optional[str]
process: ProcessTypes
stream: str = "default" if process == "Spruce" else ""
lumi: bool = False
evt_pre_filters: Optional[dict[str, str]] = None
enable_unpack: bool = True
write_fsr: bool = True
merge_genfsr: bool = False
@contextmanager
def apply_binds(self):
upfront_decoder.global_bind(process=self.process)
reconstruction.global_bind(process=self.process)
get_mc_track_info.global_bind(process=self.process)
get_tes_root.global_bind(process=self.process)
get_odin.global_bind(
process=self.process,
stream=self.stream,
input_raw_format=self.input_raw_format)
get_hlt_reports.global_bind(process=self.process, stream=self.stream)
with super().apply_binds():
yield
Loading