2 from RecoBTag.CTagging.trainingvars
import get_var_pset
3 import xml.etree.ElementTree
as ET
4 from pdb
import set_trace
7 'mimics edm.FileInPath behavior'
8 search_env = os.environ.get(
'CMSSW_SEARCH_PATH',
'')
10 raise RuntimeError(
'The environmental variable CMSSW_SEARCH_PATH must be set')
11 search_paths = search_env.split(
':')
12 for spath
in search_paths:
13 full_path = os.path.join(spath, file_in_path)
14 if os.path.isfile(full_path):
16 raise RuntimeError(
'No suitable path found for %s' % file_in_path)
19 full_path =
get_path(xml_path)
if useFileInPath
else xml_path
20 xml_tree = ET.parse(full_path)
21 root = xml_tree.getroot()
24 if i.tag ==
'Variables':
28 raise RuntimeError(
'Could not find Variables inside the xml weights')
30 var_names = [i.attrib[
'Title']
for i
in variables]