diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-11-14 11:44:10 -0600 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-11-14 11:44:10 -0600 |
commit | 4eace55dd4053afc2fb40f73bc2eee0ca5a05aa3 (patch) | |
tree | 79de32f93d8b2789e58b94115e90f17f25be5022 | |
parent | 724d30d535749855fc04ece9193b54a4de07cf77 (diff) | |
download | sddm-4eace55dd4053afc2fb40f73bc2eee0ca5a05aa3.tar.gz sddm-4eace55dd4053afc2fb40f73bc2eee0ca5a05aa3.tar.bz2 sddm-4eace55dd4053afc2fb40f73bc2eee0ca5a05aa3.zip |
update yaml format to store fit results as a dictionary indexed by the particle id
-rw-r--r-- | src/fit.c | 3 | ||||
-rwxr-xr-x | utils/plot.py | 12 |
2 files changed, 7 insertions, 8 deletions
@@ -5580,8 +5580,7 @@ int main(int argc, char **argv) long long elapsed = (tv_stop.tv_sec - tv_start.tv_sec)*1000 + (tv_stop.tv_usec - tv_start.tv_usec)/1000; if (fout) { - fprintf(fout, " -\n"); - fprintf(fout, " id: %i\n", particles[i]); + fprintf(fout, " %i:\n", particles[i]); fprintf(fout, " energy: %.2f\n", xopt[0]); fprintf(fout, " posx: %.2f\n", xopt[1]); fprintf(fout, " posy: %.2f\n", xopt[2]); diff --git a/utils/plot.py b/utils/plot.py index 83b384e..a7dfa6d 100755 --- a/utils/plot.py +++ b/utils/plot.py @@ -68,24 +68,24 @@ if __name__ == '__main__': # 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 = event['ev'][0]['fit'][0]['energy'] + energy = event['ev'][0]['fit'][id]['energy'] dT.append(energy-ke) true_posx = event['mcvx'][0]['posx'] - posx = event['ev'][0]['fit'][0]['posx'] + posx = event['ev'][0]['fit'][id]['posx'] dx.append(posx-true_posx) true_posy = event['mcvx'][0]['posy'] - posy = event['ev'][0]['fit'][0]['posy'] + posy = event['ev'][0]['fit'][id]['posy'] dy.append(posy-true_posy) true_posz = event['mcvx'][0]['posz'] - posz = event['ev'][0]['fit'][0]['posz'] + posz = event['ev'][0]['fit'][id]['posz'] dz.append(posz-true_posz) dirx = event['mctk'][-1]['dirx'] diry = event['mctk'][-1]['diry'] dirz = event['mctk'][-1]['dirz'] true_dir = [dirx,diry,dirz] true_dir = np.array(true_dir)/np.linalg.norm(true_dir) - theta = event['ev'][0]['fit'][0]['theta'] - phi = event['ev'][0]['fit'][0]['phi'] + theta = event['ev'][0]['fit'][id]['theta'] + phi = event['ev'][0]['fit'][id]['phi'] dir = [np.sin(theta)*np.cos(phi),np.sin(theta)*np.sin(phi),np.cos(theta)] dir = np.array(dir)/np.linalg.norm(dir) thetas.append(np.degrees(np.arccos(np.dot(true_dir,dir)))) |