-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcheckMissingRuns.py
executable file
·43 lines (31 loc) · 1.28 KB
/
checkMissingRuns.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
# A quick script to check for any runs that are present in a given
# input JSON file but not present in the normtag file.
# Usage: checkMissingRuns.py <normtag file> <input JSON file>
# The input JSON file, or both, can be omitted, in which case the
# script will use the defaults below.
# IMPORTANT NOTE: This only checks at the run level! No attempt
# is made to compare the consistency of the LSes within a run.
import sys
import json
normtagFileName = "/afs/cern.ch/user/c/cmsbril/public/2016normtags/normtag_BRIL.json"
jsonFileName = "/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/DCSOnly/json_DCSONLY.txt"
if (len(sys.argv) >= 2):
normtagFileName = sys.argv[1]
if (len(sys.argv) >= 3):
jsonFileName = sys.argv[2]
print "Normtag file: "+normtagFileName
print "JSON file: "+jsonFileName
jsonFile = open(jsonFileName, 'r')
parsedJSON = json.load(jsonFile)
normtagFile = open(normtagFileName, 'r')
parsedNormtag = json.load(normtagFile)
# Extract the list of runs from the normtag, since
# it's not quite in a convenient format.
normtagRuns = {}
for line in parsedNormtag:
normtagRuns.update(line[1])
# Now compare.
for run in sorted(parsedJSON.keys()):
if run not in normtagRuns:
print "Run", run, "missing in normtag file!"