11 SystToolsPath =
"/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PMGTools/SystematicsDatabase/"
12 if os.path.exists(SystToolsPath +
"DSID_Database.yaml"):
14 elif 'SYSTTOOLSPATH' in os.environ.keys():
15 print(
"[WARNING] Could not find syst tools path on cvfms, defaulting to one in %s/data/" % os.environ[
'SYSTTOOLSPATH'])
16 SystToolsPath =
'/data/' + os.environ[
'SYSTTOOLSPATH']
18 print(
"[ERROR] Environment variable SYSTTOOLSPATH is not set. It should be set to the systematics-tools directory. Use setupSystematicsTool.sh")
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))
30 if keys == [
'nominal']:
31 info.update({
"nominal":
"nominal"})
33 with open(
'%s/Weight_Database.yaml' % SystToolsPath)
as d:
34 weight_data = yaml.load(d)
36 if key
in weight_data.keys():
37 info.update({key: weight_data.get(key)})
39 print(key +
' key for ' +
str(dsid) +
' not in Weight Databse')
41 print((
str(dsid) +
' not in Database'))
47 for fn
in os.listdir(
"%s/Weight_files" % SystToolsPath):
50 with open(
"%s/Weight_files/%s" % (SystToolsPath, fn))
as f:
52 for line
in f.readlines():
58 print((
str(dsid) +
' not in Database'))
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()
71 if __name__ ==
"__main__":