ATLAS Offline Software
Classes | Functions | Variables
python.TrigValSteering.Input Namespace Reference

Classes

class  TrigValInput
 

Functions

def load_input_json ()
 
def is_input_defined (keyword)
 
def get_input (keyword)
 

Variables

 input_json
 

Function Documentation

◆ get_input()

def python.TrigValSteering.Input.get_input (   keyword)
Common getter function to retrieve inputs by keyword

Definition at line 96 of file Input.py.

96 def get_input(keyword):
97  '''Common getter function to retrieve inputs by keyword'''
98 
99  log = get_logger()
100 
101  data = load_input_json()
102  if keyword not in data.keys():
103  log.error('Failed to find keyword "%s" in input JSON %s',
104  keyword, input_json)
105  return None
106 
107  data_object = data[keyword]
108 
109  result = TrigValInput(
110  keyword,
111  data_object["source"],
112  data_object["format"],
113  data_object["paths"]
114  )
115 
116  if result.is_valid():
117  return result
118  else:
119  log.error('Failed to create a valid input object')
120  return None

◆ is_input_defined()

def python.TrigValSteering.Input.is_input_defined (   keyword)
Checks if the keyword exists in the input json file

Definition at line 90 of file Input.py.

90 def is_input_defined(keyword):
91  '''Checks if the keyword exists in the input json file'''
92  data = load_input_json()
93  return keyword in data
94 
95 

◆ load_input_json()

def python.TrigValSteering.Input.load_input_json ( )
Reads the json file with input definitions and returns the data as dictionary

Definition at line 75 of file Input.py.

75 def load_input_json():
76  '''Reads the json file with input definitions and returns the data as dictionary'''
77 
78  log = get_logger()
79 
80  input_json_fullpath = find_file_in_path(input_json, 'DATAPATH')
81  if not input_json_fullpath:
82  log.error('Failed to determine full path for input JSON %s', input_json)
83  return None
84 
85  log.debug('Reading %s', input_json_fullpath)
86  with open(input_json_fullpath) as data_file:
87  return json.load(data_file)
88 
89 

Variable Documentation

◆ input_json

python.TrigValSteering.Input.input_json

Definition at line 17 of file Input.py.

python.TrigValSteering.Input.get_input
def get_input(keyword)
Definition: Input.py:96
python.TrigValSteering.Common.find_file_in_path
def find_file_in_path(filename, path_env_var)
Definition: Common.py:66
python.TrigValSteering.Input.is_input_defined
def is_input_defined(keyword)
Definition: Input.py:90
python.TrigValSteering.Input.load_input_json
def load_input_json()
Definition: Input.py:75
Trk::open
@ open
Definition: BinningType.h:40
python.TrigValSteering.Common.get_logger
def get_logger()
Definition: Common.py:33