ATLAS Offline Software
Loading...
Searching...
No Matches
readDatabase Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ getOrderedWeights()

readDatabase.getOrderedWeights ( dsid)

Definition at line 45 of file readDatabase.py.

45def 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
void print(char *figname, TCanvas *c1)

◆ getWeights()

readDatabase.getWeights ( dsid)

Definition at line 22 of file readDatabase.py.

22def 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
double getWeights(TH1D *h)
Definition Resplot.cxx:78

◆ main()

readDatabase.main ( argv)

Definition at line 62 of file readDatabase.py.

62def 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
int main()
Definition hello.cxx:18

Variable Documentation

◆ SystToolsPath

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

Definition at line 11 of file readDatabase.py.