aboutsummaryrefslogtreecommitdiff
path: root/src/hdf5_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hdf5_utils.h')
-rw-r--r--src/hdf5_utils.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/hdf5_utils.h b/src/hdf5_utils.h
new file mode 100644
index 0000000..4f6ad32
--- /dev/null
+++ b/src/hdf5_utils.h
@@ -0,0 +1,85 @@
+#ifndef HDF5_UTILS
+#define HDF5_UTILS
+
+#include <stdint.h>
+#include <stdlib.h> /* for size_t */
+
+/* Struct to hold information for each triggered event (similar to the EV bank,
+ * but with some reconstructed information).
+ *
+ * This is the struct that is written out to the 'ev' dataset in the HDF5 file.
+ *
+ * Note: If there is no FTP, FTK, or RSP info in the zdab file these values
+ * will be set to nan. */
+typedef struct HDF5Event {
+ int run;
+ int evn;
+ double gtr;
+ int nhit;
+ uint32_t gtid;
+ uint32_t trg_type;
+ uint32_t dc;
+ double ftp_x;
+ double ftp_y;
+ double ftp_z;
+ double ftk_energy;
+ double rsp_energy;
+} HDF5Event;
+
+/* Struct to hold information for each primary seed tracks that is written out
+ * as the `mcgn` dataset in the HDF5 file. To figure out which track
+ * corresponds to a given GTID you can match them up based on the evn column,
+ * which is filled with the MC event number in both datasets. */
+typedef struct HDF5MCGN {
+ int run;
+ int evn;
+ int id;
+ double energy;
+ double x;
+ double y;
+ double z;
+ double dirx;
+ double diry;
+ double dirz;
+ double time;
+} HDF5MCGN;
+
+/* Struct to hold information for each fit that is written out
+ * as the `fits` dataset in the HDF5 file.
+ *
+ * Note that the energy2, theta2, phi2 fields will only be filled in for fits
+ * with 2 tracks and similarly for energy3, theta3, and phi3 for 3 track fits. */
+typedef struct HDF5Fit {
+ int run;
+ uint32_t gtid;
+ double x;
+ double y;
+ double z;
+ double t0;
+
+ /* Number of tracks. */
+ int n;
+
+ int id1;
+ double energy1;
+ double theta1;
+ double phi1;
+
+ int id2;
+ double energy2;
+ double theta2;
+ double phi2;
+
+ int id3;
+ double energy3;
+ double theta3;
+ double phi3;
+
+ double fmin;
+ double time;
+ double psi;
+} HDF5Fit;
+
+int save_output(const char *output, HDF5Event *hdf5_events, size_t nevents, HDF5MCGN *hdf5_mcgn, size_t nmcgn, HDF5Fit *hdf5_fits, size_t nfits);
+
+#endif