def addCoordinates(fileName, coordString):
    import json
    import re
    coordDict = json.loads(coordString)
    jsonFileName = fileName.split('/')[(- 1)]
    jsonFileName = jsonFileName.replace('.root', '__1_harvest_list.json')
    data = json.load(open(jsonFileName))
    for (i, hypo_test) in enumerate(data):
        for key in coordDict:
            total = eval(re.sub('\\b([a-zA-Z]+[0-9]*)\\b', 'hypo_test["\\g<1>"]', key))
            hypo_test[coordDict[key]] = total
    with open(jsonFileName, 'w') as f:
        f.write(json.dumps(data))
def addCoordinates(fileName, coordString):
    import json
    import re
    coordDict = json.loads(coordString)
    jsonFileName = fileName.split('/')[(- 1)]
    jsonFileName = jsonFileName.replace('.root', '__1_harvest_list.json')
    data = json.load(open(jsonFileName))
    for (i, hypo_test) in enumerate(data):
        for key in coordDict:
            total = eval(re.sub('\\b([a-zA-Z]+[0-9]*)\\b', 'hypo_test["\\g<1>"]', key))
            hypo_test[coordDict[key]] = total
    with open(jsonFileName, 'w') as f:
        f.write(json.dumps(data))