Definition at line 7 of file CPBaseRunner.py.
◆ __init__()
def python.CPBaseRunner.CPBaseRunner.__init__ |
( |
|
self | ) |
|
Definition at line 8 of file CPBaseRunner.py.
9 self.logger = logging.getLogger(
"CPBaseRunner")
11 self._inputList =
None
12 self.parser = self._defaultParseArguments()
◆ _defaultFlagsInitialization()
def python.CPBaseRunner.CPBaseRunner._defaultFlagsInitialization |
( |
|
self | ) |
|
|
private |
Definition at line 56 of file CPBaseRunner.py.
56 def _defaultFlagsInitialization(self):
57 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
59 flags.Input.Files = self.inputList
60 flags.Exec.MaxEvents = self.args.max_events
◆ _defaultParseArguments()
def python.CPBaseRunner.CPBaseRunner._defaultParseArguments |
( |
|
self | ) |
|
|
private |
Definition at line 63 of file CPBaseRunner.py.
63 def _defaultParseArguments(self):
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')
◆ _parseInputFileList()
def python.CPBaseRunner.CPBaseRunner._parseInputFileList |
( |
|
path | ) |
|
|
private |
Definition at line 91 of file CPBaseRunner.py.
91 def _parseInputFileList(path):
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]
◆ _readYamlConfig()
def python.CPBaseRunner.CPBaseRunner._readYamlConfig |
( |
|
self | ) |
|
|
private |
Definition at line 79 of file CPBaseRunner.py.
79 def _readYamlConfig(self):
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)
◆ addCustomArguments()
def python.CPBaseRunner.CPBaseRunner.addCustomArguments |
( |
|
self | ) |
|
◆ args()
def python.CPBaseRunner.CPBaseRunner.args |
( |
|
self | ) |
|
◆ inputList()
def python.CPBaseRunner.CPBaseRunner.inputList |
( |
|
self | ) |
|
Definition at line 22 of file CPBaseRunner.py.
23 if self._inputList
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:
27 self._inputList = [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.')
31 return self._inputList
◆ makeAlgSequence()
def python.CPBaseRunner.CPBaseRunner.makeAlgSequence |
( |
|
self | ) |
|
◆ printAvailableArguments()
def python.CPBaseRunner.CPBaseRunner.printAvailableArguments |
( |
|
self | ) |
|
Definition at line 108 of file CPBaseRunner.py.
108 def printAvailableArguments(self):
109 self.parser.description =
'CPRunScript available arguments'
110 self.parser.usage = argparse.SUPPRESS
111 self.parser.print_help()
◆ printFlags()
def python.CPBaseRunner.CPBaseRunner.printFlags |
( |
|
self | ) |
|
Definition at line 33 of file CPBaseRunner.py.
34 self.logger.
info(
"="*73)
35 self.logger.
info(
"="*20 +
"FLAG CONFIGURATION" +
"="*20)
36 self.logger.
info(
"="*73)
37 self.logger.
info(
" Input files: %s", self.flags.Input.isMC)
38 self.logger.
info(
" RunNumber: %s", self.flags.Input.RunNumbers)
39 self.logger.
info(
" MCCampaign: %s", self.flags.Input.MCCampaign)
40 self.logger.
info(
" GeneratorInfo: %s", self.flags.Input.GeneratorsInfo)
41 self.logger.
info(
"="*73)
◆ run()
def python.CPBaseRunner.CPBaseRunner.run |
( |
|
self | ) |
|
◆ setup()
def python.CPBaseRunner.CPBaseRunner.setup |
( |
|
self | ) |
|
Definition at line 103 of file CPBaseRunner.py.
105 self.config = self._readYamlConfig()
106 self.flags = self._defaultFlagsInitialization()
◆ _args
python.CPBaseRunner.CPBaseRunner._args |
|
private |
◆ _inputList
python.CPBaseRunner.CPBaseRunner._inputList |
|
private |
◆ config
python.CPBaseRunner.CPBaseRunner.config |
◆ flags
python.CPBaseRunner.CPBaseRunner.flags |
◆ logger
python.CPBaseRunner.CPBaseRunner.logger |
◆ parser
python.CPBaseRunner.CPBaseRunner.parser |
The documentation for this class was generated from the following file: