File indexing completed on 2025-01-30 09:14:57
0001 import csv
0002 import matplotlib.pyplot as plt
0003 import numpy as np
0004
0005
0006 ptDict = {}
0007
0008
0009 with open("output.log", mode="r") as csv_file:
0010 csv_reader = csv.reader(csv_file, delimiter=",")
0011
0012 for csv_row in csv_reader:
0013 if len(csv_row) > 1:
0014
0015 jobID = csv_row[0]
0016
0017 etabin = float(csv_row[1])
0018 ptvalue = float(csv_row[2])
0019 exectime = float(csv_row[3])
0020
0021
0022 try:
0023 pdict = ptDict[ptvalue]
0024 except:
0025 ptDict[ptvalue] = {}
0026 pdict = ptDict[ptvalue]
0027
0028
0029 try:
0030 vpdict = pdict[etabin]
0031 except:
0032 pdict[etabin] = []
0033 vpdict = pdict[etabin]
0034
0035 vpdict += [exectime]
0036
0037
0038 plt.figure(figsize=(7, 5))
0039
0040 ax = plt.subplot(111)
0041 plt.loglog(
0042 ptDict.keys(),
0043 [i[0][0] for i in np.array(list(ptDict.values()))],
0044 ".-",
0045 label="0<$\eta$<0.5",
0046 )
0047 plt.loglog(
0048 ptDict.keys(),
0049 [i[1][0] for i in np.array(list(ptDict.values()))],
0050 ".-",
0051 label="0.5<$\eta$<1.0",
0052 )
0053 plt.loglog(
0054 ptDict.keys(),
0055 [i[2][0] for i in np.array(list(ptDict.values()))],
0056 ".-",
0057 label="1.0<$\eta$<1.5",
0058 )
0059 plt.loglog(
0060 ptDict.keys(),
0061 [i[3][0] for i in np.array(list(ptDict.values()))],
0062 ".-",
0063 label="1.5<$\eta$<2.0",
0064 )
0065 plt.loglog(
0066 ptDict.keys(),
0067 [i[4][0] for i in np.array(list(ptDict.values()))],
0068 ".-",
0069 label="2.0<$\eta$<2.5",
0070 )
0071 ax.set_xlabel("$p_T$ [GeV/c]")
0072 ax.set_ylabel("time/track [sec]")
0073 plt.yscale("log")
0074 ax.set_xlim((0.09, 105))
0075 plt.legend(numpoints=1)
0076
0077 plt.suptitle("KF timing vs. $p_T$")
0078
0079 plt.show()