diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-09-20 12:30:48 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-09-20 12:30:48 -0500 |
commit | 3e3b1fd21437a08554f59086cd201dfc48c3ffed (patch) | |
tree | 5415c9c9fbdbc375b18daeeae8d389430c431725 /src/fit.c | |
parent | 92f48c17da6b8ce33a54d662a46b766ec1cc18c4 (diff) | |
download | sddm-3e3b1fd21437a08554f59086cd201dfc48c3ffed.tar.gz sddm-3e3b1fd21437a08554f59086cd201dfc48c3ffed.tar.bz2 sddm-3e3b1fd21437a08554f59086cd201dfc48c3ffed.zip |
add git SHA1 hash to output file
Diffstat (limited to 'src/fit.c')
-rw-r--r-- | src/fit.c | 62 |
1 files changed, 35 insertions, 27 deletions
@@ -20,6 +20,10 @@ #include "vector.h" #include "pmt_response.h" #include <signal.h> /* for signal() */ +#include "release.h" + +char *GitSHA1(void); +char *GitDirty(void); static int stop = 0; static nlopt_opt opt; @@ -5428,6 +5432,10 @@ int main(int argc, char **argv) fprintf(stderr, "failed to open '%s': %s\n", output, strerror(errno)); return 1; } + + fprintf(fout, "git_sha1: %s\n", GitSHA1()); + fprintf(fout, "git_dirty: %s\n", GitDirty()); + fprintf(fout, "data:\n"); } load_pmt_info(); @@ -5485,7 +5493,7 @@ int main(int argc, char **argv) switch (b.name) { case MAST_RECORD: /* New event. */ - if (fout) fprintf(fout, "-\n"); + if (fout) fprintf(fout, " -\n"); first_ev = 1; first_mctk = 1; first_mcvx = 1; @@ -5494,11 +5502,11 @@ int main(int argc, char **argv) /* New MC vertex. */ unpack_mcvx(b.data, &bmcvx); if (fout) { - if (first_mcvx) fprintf(fout, " mcvx:\n"); - fprintf(fout, " -\n"); - fprintf(fout, " posx: %.2f\n", bmcvx.x); - fprintf(fout, " posy: %.2f\n", bmcvx.y); - fprintf(fout, " posz: %.2f\n", bmcvx.z); + if (first_mcvx) fprintf(fout, " mcvx:\n"); + fprintf(fout, " -\n"); + fprintf(fout, " posx: %.2f\n", bmcvx.x); + fprintf(fout, " posy: %.2f\n", bmcvx.y); + fprintf(fout, " posz: %.2f\n", bmcvx.z); } first_mcvx = 0; break; @@ -5506,12 +5514,12 @@ int main(int argc, char **argv) /* New MC track. */ unpack_mctk(b.data, &bmctk); if (fout) { - if (first_mctk) fprintf(fout, " mctk:\n"); - fprintf(fout, " -\n"); - fprintf(fout, " energy: %.2f\n", bmctk.ene); - fprintf(fout, " dirx: %.4f\n", bmctk.drx); - fprintf(fout, " diry: %.4f\n", bmctk.dry); - fprintf(fout, " dirz: %.4f\n", bmctk.drz); + if (first_mctk) fprintf(fout, " mctk:\n"); + fprintf(fout, " -\n"); + fprintf(fout, " energy: %.2f\n", bmctk.ene); + fprintf(fout, " dirx: %.4f\n", bmctk.drx); + fprintf(fout, " diry: %.4f\n", bmctk.dry); + fprintf(fout, " dirz: %.4f\n", bmctk.drz); } first_mctk = 0; break; @@ -5534,21 +5542,21 @@ 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) { - if (first_ev) fprintf(fout, " ev:\n"); - fprintf(fout, " - gtid: %i\n", ev.gtid); - fprintf(fout, " fit:\n"); - fprintf(fout, " -\n"); - fprintf(fout, " energy: %.2f\n", xopt[0]); - fprintf(fout, " posx: %.2f\n", xopt[1]); - fprintf(fout, " posy: %.2f\n", xopt[2]); - fprintf(fout, " posz: %.2f\n", xopt[3]); - fprintf(fout, " theta: %.4f\n", xopt[4]); - fprintf(fout, " phi: %.4f\n", xopt[5]); - fprintf(fout, " t0: %.2f\n", xopt[6]); - fprintf(fout, " z1: %.2f\n", xopt[7]); - fprintf(fout, " z2: %.2f\n", xopt[8]); - fprintf(fout, " fmin: %.2f\n", fmin); - fprintf(fout, " time: %lld\n", elapsed); + if (first_ev) fprintf(fout, " ev:\n"); + fprintf(fout, " - gtid: %i\n", ev.gtid); + fprintf(fout, " fit:\n"); + fprintf(fout, " -\n"); + fprintf(fout, " energy: %.2f\n", xopt[0]); + fprintf(fout, " posx: %.2f\n", xopt[1]); + fprintf(fout, " posy: %.2f\n", xopt[2]); + fprintf(fout, " posz: %.2f\n", xopt[3]); + fprintf(fout, " theta: %.4f\n", xopt[4]); + fprintf(fout, " phi: %.4f\n", xopt[5]); + fprintf(fout, " t0: %.2f\n", xopt[6]); + fprintf(fout, " z1: %.2f\n", xopt[7]); + fprintf(fout, " z2: %.2f\n", xopt[8]); + fprintf(fout, " fmin: %.2f\n", fmin); + fprintf(fout, " time: %lld\n", elapsed); fflush(fout); } |