aboutsummaryrefslogtreecommitdiff
path: root/utils/plot-muons
diff options
context:
space:
mode:
Diffstat (limited to 'utils/plot-muons')
-rwxr-xr-xutils/plot-muons12
1 files changed, 8 insertions, 4 deletions
diff --git a/utils/plot-muons b/utils/plot-muons
index e80d0af..128eaa2 100755
--- a/utils/plot-muons
+++ b/utils/plot-muons
@@ -154,13 +154,15 @@ if __name__ == '__main__':
fig = plt.figure()
plt.subplot(2,1,1)
plt.hist(muons.ke.values, bins=np.logspace(3,7,100), histtype='step', color='C0', label="Data")
- plt.hist(muons_mc.ke.values, bins=np.logspace(3,7,100), histtype='step', color='C1', label="Monte Carlo")
+ norm = len(muons.ke.values)/len(muons_mc.ke.values)
+ plt.hist(muons_mc.ke.values, weights=np.tile(norm,len(muons_mc.ke.values)), bins=np.logspace(3,7,100), histtype='step', color='C1', label="Monte Carlo")
plt.legend()
plt.xlabel("Energy (MeV)")
plt.gca().set_xscale("log")
plt.subplot(2,1,2)
plt.hist(np.cos(muons.theta.values), bins=np.linspace(-1,1,100), histtype='step', color='C0', label="Data")
- plt.hist(np.cos(muons_mc.theta.values), bins=np.linspace(-1,1,100), histtype='step', color='C1', label="Monte Carlo")
+ norm = len(muons.theta.values)/len(muons_mc.theta.values)
+ plt.hist(np.cos(muons_mc.theta.values), weights=np.tile(norm,len(muons_mc.ke.values)), bins=np.linspace(-1,1,100), histtype='step', color='C1', label="Monte Carlo")
plt.legend()
despine(fig,trim=True)
plt.xlabel(r"$\cos(\theta)$")
@@ -197,13 +199,15 @@ if __name__ == '__main__':
fig = plt.figure()
plt.subplot(2,1,1)
plt.hist(stopping_muons.ke.values, bins=np.logspace(3,7,100), histtype='step', color='C0', label="Data")
- plt.hist(stopping_muons_mc.ke.values, bins=np.logspace(3,7,100), histtype='step', color='C1', label="Monte Carlo")
+ norm = len(stopping_muons.ke.values)/len(stopping_muons_mc.ke.values)
+ plt.hist(stopping_muons_mc.ke.values, weights=np.tile(norm,len(stopping_muons_mc.ke.values)), bins=np.logspace(3,7,100), histtype='step', color='C1', label="Monte Carlo")
plt.legend()
plt.xlabel("Energy (MeV)")
plt.gca().set_xscale("log")
plt.subplot(2,1,2)
plt.hist(np.cos(stopping_muons.theta.values), bins=np.linspace(-1,1,100), histtype='step', color='C0', label="Data")
- plt.hist(np.cos(stopping_muons_mc.theta.values), bins=np.linspace(-1,1,100), histtype='step', color='C1', label="Monte Carlo")
+ norm = len(stopping_muons.theta.values)/len(stopping_muons_mc.theta.values)
+ plt.hist(np.cos(stopping_muons_mc.theta.values), weights=np.tile(norm,len(stopping_muons_mc.theta.values)), bins=np.linspace(-1,1,100), histtype='step', color='C1', label="Monte Carlo")
plt.legend()
despine(fig,trim=True)
plt.xlabel(r"$\cos(\theta)$")