1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
|