-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathepid.phasespace.electronspect.py
executable file
·47 lines (34 loc) · 1.61 KB
/
epid.phasespace.electronspect.py
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
#!/usr/bin/env python
import argparse,numpy as np,matplotlib,dump,plot
parser = argparse.ArgumentParser(description='Plot 2D hist from ROOT TTree.')
parser.add_argument('files', nargs='*')
args = parser.parse_args()
rootfiles = args.files
panelsize = 210. #mm
numpix = 256
pixsize = panelsize/numpix #mm
for rootfile in rootfiles:
#Z because patient rotated
fpos_e = dump.scaletreefast(rootfile,['X','Z'],ParticleName='not_gamma')
fE_e = dump.scaletreefast(rootfile,'Ekine',ParticleName='not_gamma')
#pos_e = dump.scaletree2hist(rootfile,['X','Z'],ParticleName='not_gamma',xbins=(-panelsize/2.,panelsize/2.,numpix),ybins=(-panelsize/2.,panelsize/2.,numpix))
E_e = dump.scaletree2hist(rootfile,'Ekine',xbins=(0,10,100),ParticleName='not_gamma')
f, ((ax1 ,ax2),(ax3 ,ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False)#,figsize=(28,10))
f.subplots_adjust(hspace=.5,wspace=.5)
ax1.set_title("Positions")
ax2.set_title("Energy")
xbins = np.linspace(-panelsize/2.,panelsize/2.,numpix+1)
ybins = xbins
xbins2 = plot.chopcentral(xbins,5)
ybins2 = xbins2
xbins3 = np.linspace(-5,5,10+1)
ybins3 = xbins3
xbins4 = np.linspace(-10,0,10+1)
ybins4 = xbins4
plot.plot2dhist( ax1, fpos_e['X'], fpos_e['Z'], xbins=xbins,ybins=ybins, log=True)
plot.plot1dhist( ax2, fE_e,count=True)
#ax3.pcolormesh(pos_e[0], pos_e[1], pos_e[2].T)#, log=True)
#ax3.pcolormesh(pos_e[0], pos_e[1], pos_e[2])#, log=True)
ax4.step(E_e[0][:-1],E_e[1])
f.savefig(rootfile+'.pdf', bbox_inches='tight')
plot.close('all')