File indexing completed on 2025-01-30 09:14:57
0001 import ROOT
0002 import csv
0003 import matplotlib.pyplot as plt
0004 import numpy as np
0005
0006
0007 dataDict = {}
0008
0009
0010 with open("output.log", mode="r") as csv_file:
0011 csv_reader = csv.reader(csv_file, delimiter=",")
0012
0013 for csv_row in csv_reader:
0014 if len(csv_row) > 1:
0015
0016 jobID = csv_row[0]
0017
0018 exectime = 0.0
0019 with open("timing_" + jobID + ".tsv") as tsv_file:
0020 tsv_reader = csv.reader(tsv_file, delimiter="\t")
0021 for tsv_row in tsv_reader:
0022 if str(tsv_row[0]) == "Algorithm:PropagationAlgorithm":
0023 exectime = float(tsv_row[2])
0024
0025 stepper = int(csv_row[1])
0026 ptvalue = float(csv_row[2])
0027
0028 rfile = ROOT.TFile("propagation_steps_" + str(jobID) + ".root")
0029 stree = rfile.Get("propagation_steps")
0030 stree.Draw("@g_x->size()>>h_steps")
0031 h_steps = ROOT.gDirectory.Get("h_steps")
0032 steps = h_steps.GetMean()
0033 stepsSpread = h_steps.GetMeanError()
0034
0035
0036 try:
0037 cdict = dataDict[ptvalue]
0038 except:
0039 dataDict[ptvalue] = {}
0040 cdict = dataDict[ptvalue]
0041
0042
0043 try:
0044 vdict = cdict[stepper]
0045 except:
0046 cdict[stepper] = []
0047 vdict = cdict[stepper]
0048
0049 vdict += [steps, stepsSpread, exectime, exectime / steps]
0050
0051
0052 plt.figure(figsize=(16, 5))
0053
0054 ax = plt.subplot(131)
0055 plt.loglog(
0056 dataDict.keys(),
0057 [i[0][0] for i in np.array(list(dataDict.values()))],
0058 "+",
0059 label="line",
0060 )
0061 plt.loglog(
0062 dataDict.keys(),
0063 [i[1][0] for i in np.array(list(dataDict.values()))],
0064 "*",
0065 label="eigen",
0066 )
0067 plt.loglog(
0068 dataDict.keys(),
0069 [i[2][0] for i in np.array(list(dataDict.values()))],
0070 "o",
0071 label="atlas",
0072 )
0073 ax.set_xlabel("$p_T$ [GeV]")
0074 ax.set_ylabel("#steps")
0075 ax.set_xlim((-10, 150))
0076 plt.legend(numpoints=1)
0077
0078 ax = plt.subplot(132)
0079 plt.loglog(dataDict.keys(), [i[0][2] for i in np.array(list(dataDict.values()))], "+")
0080 plt.loglog(dataDict.keys(), [i[1][2] for i in np.array(list(dataDict.values()))], "*")
0081 plt.loglog(dataDict.keys(), [i[2][2] for i in np.array(list(dataDict.values()))], "o")
0082 ax.set_xlabel("$p_T$ [GeV]")
0083 ax.set_ylabel("time [a.u.]")
0084 ax.set_xlim((-10, 150))
0085
0086
0087 ax = plt.subplot(133)
0088 plt.loglog(dataDict.keys(), [i[0][3] for i in np.array(list(dataDict.values()))], "+")
0089 plt.loglog(dataDict.keys(), [i[1][3] for i in np.array(list(dataDict.values()))], "*")
0090 plt.loglog(dataDict.keys(), [i[2][3] for i in np.array(list(dataDict.values()))], "o")
0091 ax.set_xlabel("$p_T$ [GeV]")
0092 ax.set_ylabel("time/steps [a.u.]")
0093 ax.set_xlim((-10, 150))
0094
0095
0096 plt.suptitle("Stepper comparison: Constant Field")
0097
0098 plt.show()