aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-01-15 01:08:54 -0600
committertlatorre <tlatorre@uchicago.edu>2019-01-15 01:08:54 -0600
commit9c910abe7a0359018677a874822d8742d0e616b9 (patch)
tree52dda30fd3c5b0eb78050dee4dec10bdf8557ed7 /utils
parent272d793cda5456fb8a69d3e2a407bf24d3600cd4 (diff)
downloadsddm-9c910abe7a0359018677a874822d8742d0e616b9.tar.gz
sddm-9c910abe7a0359018677a874822d8742d0e616b9.tar.bz2
sddm-9c910abe7a0359018677a874822d8742d0e616b9.zip
update zebra library to be able to use links
This commit updates the zebra library files zebra.{c,h} so that it's now possible to traverse the data structure using links! This was originally motivated by wanting to figure out which MC particles were generated from the MCGN bank (from which it's only possible to access the tracks and vertices using structural links). I've also added a new test to test-zebra which checks the consistency of all of the next/up/orig, structural, and reference links in a zebra file.
Diffstat (limited to 'utils')
-rwxr-xr-xutils/plot16
-rwxr-xr-xutils/plot-fit-results16
2 files changed, 16 insertions, 16 deletions
diff --git a/utils/plot b/utils/plot
index 59eb4c2..d671016 100755
--- a/utils/plot
+++ b/utils/plot
@@ -75,7 +75,7 @@ if __name__ == '__main__':
psi = []
for event in data['data']:
# get the particle ID
- id = event['mctk'][-1]['id']
+ id = event['mcgn'][0]['id']
if 'ev' not in event:
continue
@@ -88,24 +88,24 @@ if __name__ == '__main__':
mass = SNOMAN_MASS[id]
# for some reason it's the *second* track which seems to contain the
# initial energy
- true_energy = event['mctk'][-1]['energy']
+ true_energy = event['mcgn'][0]['energy']
# The MCTK bank has the particle's total energy (except for neutrons)
# so we need to convert it into kinetic energy
ke = true_energy - mass
energy = fit[id]['energy']
dT.append(energy-ke)
- true_posx = event['mcvx'][0]['posx']
+ true_posx = event['mcgn'][0]['posx']
posx = fit[id]['posx']
dx.append(posx-true_posx)
- true_posy = event['mcvx'][0]['posy']
+ true_posy = event['mcgn'][0]['posy']
posy = fit[id]['posy']
dy.append(posy-true_posy)
- true_posz = event['mcvx'][0]['posz']
+ true_posz = event['mcgn'][0]['posz']
posz = fit[id]['posz']
dz.append(posz-true_posz)
- dirx = event['mctk'][-1]['dirx']
- diry = event['mctk'][-1]['diry']
- dirz = event['mctk'][-1]['dirz']
+ dirx = event['mcgn'][0]['dirx']
+ diry = event['mcgn'][0]['diry']
+ dirz = event['mcgn'][0]['dirz']
true_dir = [dirx,diry,dirz]
true_dir = np.array(true_dir)/np.linalg.norm(true_dir)
theta = fit[id]['theta']
diff --git a/utils/plot-fit-results b/utils/plot-fit-results
index 48d922a..c3d3f16 100755
--- a/utils/plot-fit-results
+++ b/utils/plot-fit-results
@@ -84,7 +84,7 @@ if __name__ == '__main__':
for i, event in enumerate(data['data']):
# get the particle ID
- id = event['mctk'][-1]['id']
+ id = event['mcgn'][0]['id']
a[i]['id'] = id
@@ -95,7 +95,7 @@ if __name__ == '__main__':
mass = SNOMAN_MASS[id]
# for some reason it's the *second* track which seems to contain the
# initial energy
- true_energy = event['mctk'][-1]['energy']
+ true_energy = event['mcgn'][0]['energy']
# The MCTK bank has the particle's total energy (except for neutrons)
# so we need to convert it into kinetic energy
ke = true_energy - mass
@@ -107,21 +107,21 @@ if __name__ == '__main__':
a[i]['dT'] = energy-ke
# store the fit position residuals
- true_posx = event['mcvx'][0]['posx']
+ true_posx = event['mcgn'][0]['posx']
posx = fit[id]['posx']
a[i]['dx'] = posx-true_posx
- true_posy = event['mcvx'][0]['posy']
+ true_posy = event['mcgn'][0]['posy']
posy = fit[id]['posy']
a[i]['dy'] = posy-true_posy
- true_posz = event['mcvx'][0]['posz']
+ true_posz = event['mcgn'][0]['posz']
posz = fit[id]['posz']
a[i]['dz'] = posz-true_posz
# compute the angle between the fit direction and the true
# direction
- dirx = event['mctk'][-1]['dirx']
- diry = event['mctk'][-1]['diry']
- dirz = event['mctk'][-1]['dirz']
+ dirx = event['mcgn'][0]['dirx']
+ diry = event['mcgn'][0]['diry']
+ dirz = event['mcgn'][0]['dirz']
true_dir = [dirx,diry,dirz]
true_dir = np.array(true_dir)/np.linalg.norm(true_dir)
theta = fit[id]['theta']