ATLAS Offline Software
Functions | Variables
readDatabase Namespace Reference

Functions

def getWeights (dsid)
 
def getOrderedWeights (dsid)
 
def main (argv)
 

Variables

string SystToolsPath = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PMGTools/SystematicsDatabase/"
 

Function Documentation

◆ getOrderedWeights()

def readDatabase.getOrderedWeights (   dsid)

Definition at line 45 of file readDatabase.py.

45 def getOrderedWeights(dsid):
46  res = {}
47  for fn in os.listdir("%s/Weight_files" % SystToolsPath):
48  print(fn, str(dsid), (str(dsid) in fn))
49  if str(dsid) in fn:
50  with open("%s/Weight_files/%s" % (SystToolsPath, fn)) as f:
51  counter = 0
52  for line in f.readlines():
53  line = line.strip()
54  res[line] = counter
55  counter += 1
56  break
57  if len(res) == 0:
58  print((str(dsid) + ' not in Database'))
59  return res
60 
61 

◆ getWeights()

def readDatabase.getWeights (   dsid)

Definition at line 22 of file readDatabase.py.

22 def getWeights(dsid):
23  info = {}
24  keys = []
25  with open("%s/DSID_Database.yaml" % SystToolsPath) as f:
26  database = yaml.load(f)
27  if any(str(dsid) == k for k in database.keys()):
28  keys = database.get(str(dsid))
29  # print(keys)
30  if keys == ['nominal']:
31  info.update({"nominal": "nominal"})
32  else:
33  with open('%s/Weight_Database.yaml' % SystToolsPath) as d:
34  weight_data = yaml.load(d)
35  for key in keys:
36  if key in weight_data.keys():
37  info.update({key: weight_data.get(key)})
38  else:
39  print(key + ' key for ' + str(dsid) + ' not in Weight Databse')
40  else:
41  print((str(dsid) + ' not in Database'))
42  return info, keys
43 
44 

◆ main()

def readDatabase.main (   argv)

Definition at line 62 of file readDatabase.py.

62 def main(argv):
63  parser = argparse.ArgumentParser(description='Variation string needed')
64  parser.add_argument('-d', '--dsid', default=410425, type=int, help='six digit DSID')
65  args = parser.parse_args()
66  dictionary, keys = getWeights(args.dsid)
67  print(keys)
68  print(dictionary)
69 
70 

Variable Documentation

◆ SystToolsPath

string readDatabase.SystToolsPath = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PMGTools/SystematicsDatabase/"

Definition at line 11 of file readDatabase.py.

readDatabase.main
def main(argv)
Definition: readDatabase.py:62
Trk::open
@ open
Definition: BinningType.h:40
readDatabase.getOrderedWeights
def getOrderedWeights(dsid)
Definition: readDatabase.py:45
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
readDatabase.getWeights
def getWeights(dsid)
Definition: readDatabase.py:22