4 from AnaAlgorithm.Logging
import logging
5 from abc
import ABC, abstractmethod
9 self.
logger = logging.getLogger(
"CPBaseRunner")
17 if self.
_args is None:
24 if self.
args.input_list.endswith(
'.txt'):
25 self.
_inputList = CPBaseRunner._parseInputFileList(self.
args.input_list)
26 elif ".root" in self.
args.input_list:
29 raise FileNotFoundError(f
'Input file list \"{self.args.input_list}\" is not supported!'
30 'Please provide a text file with a list of input files or a single root file.')
35 self.
logger.
info(
"="*20 +
"FLAG CONFIGURATION" +
"="*20)
57 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
60 flags.Exec.MaxEvents = self.
args.max_events
64 parser = argparse.ArgumentParser(
65 description=
'Runscript for CP Algorithm unit tests')
66 baseGroup = parser.add_argument_group(
'Base Script Options')
67 baseGroup.add_argument(
'--input-list', dest=
'input_list',
68 help=
'path to text file containing list of input files, or a single root file')
69 baseGroup.add_argument(
'--output-name', dest=
'output_name', default=
'output',
70 help=
'output name of the analysis root file')
71 baseGroup.add_argument(
'-e',
'--max-events', dest=
'max_events', type=int, default=-1,
72 help=
'Number of events to run')
73 baseGroup.add_argument(
'-t',
'--text-config', dest=
'text_config',
74 help=
'path to the YAML configuration file')
75 baseGroup.add_argument(
'--no-systematics', dest=
'no_systematics',
76 action=
'store_true', help=
'Disable systematics')
80 from ROOT
import PathResolver
82 self.
args.text_config,
"CALIBPATH", PathResolver.RecursiveSearch)
84 raise FileNotFoundError(f
'PathResolver failed to locate \"{self.args.text_config}\" config file!'
85 'Check if you have a typo in -t/--text-config argument or missing file in the analysis configuration sub-directory.')
86 self.
logger.
info(
"Setting up configuration based on YAML config:")
87 from AnalysisAlgorithmsConfig.ConfigText
import TextConfig
88 config = TextConfig(yamlconfig)
93 with open(path,
'r')
as inputText:
94 for line
in inputText.readlines():
96 if line.startswith(
'#')
or not line.strip():
98 files += line.split(
',')
100 files = [file.strip()
for file
in files]
109 self.
parser.description =
'CPRunScript available arguments'
110 self.
parser.usage = argparse.SUPPRESS