Skip to content
Snippets Groups Projects

Signal generation

Closed Carl Gwilliam requested to merge gwilliam/calypso:signal_generation into master
4 files
+ 57
30
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -333,8 +333,8 @@ class FlukaReader(EvgenAlg):
plt.figure()
ebins = np.linspace(0, 5000, 50)
plt.xlabel("Energy")
plt.hist(self.before["E"], bins=ebins, histtype='step', color = "g", fill = False, label = "before")
plt.hist(self.after["E"], bins = ebins, histtype='step', color = "r", fill = False, label = "after")
plt.hist(self.before["E"], bins=ebins, weights = np.array(self.before["w"])/self.nsamples, histtype='step', color = "g", fill = False, label = "before")
plt.hist(self.after["E"], bins = ebins, weights = np.array(self.after["w"])/self.nsamples, histtype='step', color = "r", fill = False, label = "after")
plt.gca().set_yscale('log')
plt.legend()
plt.savefig("energy.png")
@@ -344,8 +344,8 @@ class FlukaReader(EvgenAlg):
thetaX = np.pi/2. - np.arccos(np.array(self.before["cosX"]))
thetaXout = np.pi/2. - np.arccos(np.array(self.after["cosX"]))
tbins = np.linspace(-0.5, 0.5, 100)
plt.hist(thetaX, bins = tbins, histtype='step', color = "g", fill = False, label = "before")
plt.hist(thetaXout, bins = tbins, histtype='step', color = "r", fill = False, label = "after")
plt.hist(thetaX, bins = tbins, weights = np.array(self.before["w"])/self.nsamples, histtype='step', color = "g", fill = False, label = "before")
plt.hist(thetaXout, bins = tbins, weights = np.array(self.after["w"])/self.nsamples, histtype='step', color = "r", fill = False, label = "after")
plt.gca().set_yscale('log')
plt.legend()
plt.savefig("thetaX.png")
@@ -354,8 +354,8 @@ class FlukaReader(EvgenAlg):
plt.xlabel("Angle to beam in Y dir")
thetaY = np.pi/2. - np.arccos(np.array(self.before["cosY"]))
thetaYout = np.pi/2. - np.arccos(np.array(self.after["cosY"]))
plt.hist(thetaY, bins = tbins, histtype='step', color = "g", fill = False, label = "before")
plt.hist(thetaYout, bins = tbins, histtype='step', color = "r", fill = False, label = "after")
plt.hist(thetaY, bins = tbins, weights = np.array(self.before["w"])/self.nsamples, histtype='step', color = "g", fill = False, label = "before")
plt.hist(thetaYout, bins = tbins, weights = np.array(self.after["w"])/self.nsamples, histtype='step', color = "r", fill = False, label = "after")
plt.gca().set_yscale('log')
plt.legend()
plt.savefig("thetaY.png")
@@ -363,16 +363,16 @@ class FlukaReader(EvgenAlg):
plt.figure()
plt.xlabel("Dispacement in X dir")
xbins = np.linspace(-300, 300, 100)
plt.hist(self.before["x"], bins = xbins, histtype='step', color = "g", fill = False, label = "before")
plt.hist(self.after["x"], bins = xbins, histtype='step', color = "r", fill = False, label = "after")
plt.hist(self.before["x"], bins = xbins, weights = np.array(self.before["w"])/self.nsamples, histtype='step', color = "g", fill = False, label = "before")
plt.hist(self.after["x"], bins = xbins, weights = np.array(self.after["w"])/self.nsamples, histtype='step', color = "r", fill = False, label = "after")
plt.gca().set_yscale('log')
plt.legend()
plt.savefig("x.png")
plt.figure()
plt.xlabel("Dispacement in Y dir")
plt.hist(self.before["y"], bins = xbins, histtype='step', color = "g", fill = False, label = "before")
plt.hist(self.after["y"], bins = xbins, histtype='step', color = "r", fill = False, label = "after")
plt.hist(self.before["y"], bins = xbins, weights = np.array(self.before["w"])/self.nsamples, histtype='step', color = "g", fill = False, label = "before")
plt.hist(self.after["y"], bins = xbins, weights = np.array(self.after["w"])/self.nsamples, histtype='step', color = "r", fill = False, label = "after")
plt.gca().set_yscale('log')
plt.legend()
plt.savefig("y.png")
Loading