Blame view

Generation_distribution.py 834 Bytes
b5217158   Thomas Fitoussi   Python scripts to...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python

from sys import argv
import numpy as np
import matplotlib.pyplot as plt

if len(argv)<2:
   print "Please give at least 1 file id \n For example: 14 for Results.EGMF14 \n or 14 15 for EGMF14 and EGMF15"
   exit()

# figure: energy distribution
#=============================
nbBins = 8 
color=['b','g','r','c','m','y']

fig = plt.figure()
ax = fig.add_subplot(111)

ind = 0
for fileId in argv[1:]:
   weight,nbGen=np.loadtxt("Results_EGMF"+fileId+"/Results_extra",unpack=True,usecols=[2,3])

   plt.hist(nbGen,nbBins, weights=weight,range=[1,9],log=1,facecolor=color[ind],alpha=.5,
         label="$10^{-%.0f"%float(fileId)+"}$Gauss")
   ind=ind+1

xtick=np.arange(9)
ax.legend(loc='best')
ax.set_xticks(xtick+0.5)
ax.set_xticklabels(xtick)
ax.set_xlabel("Generation")
ax.set_ylabel("Number of events")

plt.show()