diff --git a/tools/liveEventDisplay.py b/tools/liveEventDisplay.py index edec1eeb..f8e2570f 100644 --- a/tools/liveEventDisplay.py +++ b/tools/liveEventDisplay.py @@ -95,6 +95,18 @@ sys.exit(1) os.remove(localMDFFileName) +# postprocess the json file to drop events with no VP tracks +import json +content = json.load(open(phoenixFileName, 'rb')) +newcontent = {} +for event in content: + if len(content[event]['Tracks']['VeloTracks']) > 0: + newcontent[event] = content[event] + else: + print ("No VP track in %s, dropping event" % event) +# overwrite file with remaining event +json.dump(newcontent, open(phoenixFileName, 'w')) + # some sanity checks try: size = os.path.getsize(phoenixFileName) @@ -109,7 +121,7 @@ # zip resulting file import zipfile _, zippedPhoenixFileName = tempfile.mkstemp(suffix=".json.zip") -zipfile.ZipFile(zippedPhoenixFileName, mode='w').write(phoenixFileName) +zipfile.ZipFile(zippedPhoenixFileName, mode='w', compression=zipfile.ZIP_DEFLATED, compresslevel=9).write(phoenixFileName) os.unlink(phoenixFileName) # move resulting file to EOS