From 9c910abe7a0359018677a874822d8742d0e616b9 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Tue, 15 Jan 2019 01:08:54 -0600 Subject: 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. --- utils/plot | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'utils/plot') 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'] -- cgit