-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotEnergyMiddle.py
More file actions
48 lines (38 loc) · 1.16 KB
/
PlotEnergyMiddle.py
File metadata and controls
48 lines (38 loc) · 1.16 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from root_numpy import tree2array
from ROOT import *
import sys
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
import pylandau
from scipy.optimize import curve_fit
import matplotlib
rc('font', **{'family': 'serif', 'serif': ['Computer Modern'],'monospace': ['Computer Modern Typewriter']})
rc('text', usetex=True)
matplotlib.rcParams.update({'font.size': 20})
f=TFile(sys.argv[1])
t = f.Get("phase")
energymid = []
for event in phase:
if(event.EnergyMid>0):
#print event.part_name, event.EnergyMid
energymid.append(event.EnergyMid)
print np.mean(energymid), np.sum(energymid)/10000
#array = tree2array(t, branches=['EnergyMid'])
"""
fig, ax = plt.subplots(figsize=[9,9])
#n, bins = np.histogram(Elist,bins=100)
ax.set_yscale('log')
ax.minorticks_on()
ax.yaxis.set_ticks_position('both')
ax.xaxis.set_ticks_position('both')
ax.tick_params('both', direction='in', length=4, width=1, which='minor')
ax.tick_params('both', direction='in', length=10, width=1, which='major')
ax.grid(alpha=0.5)
ax.set_ylabel(r"count/bin [-]")
ax.set_xlabel(r"Energy loss [MeV]")
plt.legend(frameon=False)
plt.tight_layout()
plt.show()
plt.show()
"""