4 import matplotlib.pyplot
as plt
13 if filename.endswith(
".bz2"):
14 fp = bz2.BZ2File(filename)
17 jdat = json.loads(fp.read())
19 for jdepo
in jdat[
"depos"]:
20 depo = tuple([jdepo[key]
for key
in depo_keys])
24 return numpy.asarray(depos)
30 h = numpy.histogram(dEdX, 1000, (0,10))
31 plt.clf(); plt.plot(h[1][:-1], h[0])
32 plt.savefig(
"g4tuple-dedx.pdf")
40 h = numpy.histogram(dNdX, 150, (5.0e4,2.0e5))
41 plt.clf(); plt.semilogy(h[1][:-1], h[0])
42 plt.savefig(
"g4tuple-dndx.pdf")
46 "Plot colz number as X vs Z (transverse)" 52 xedges = numpy.linspace(90, 120.0, 300)
53 zedges = numpy.linspace(10, 70.0, 600)
57 ax = fig.add_subplot(111)
58 ax.set_title(
"Electrons per mm$^2$")
63 h = ax.hist2d(x,z,bins=(xedges, zedges), weights=n)
64 ax.set_xlabel(
"X [cm]")
65 ax.set_ylabel(
"Z [cm]")
66 plt.colorbar(h[3], ax=ax)
67 fig.savefig(
"g4tuple-nxz.pdf")
70 if '__main__' == __name__:
int open(const char *, int)
Opens a file descriptor.