The types below capture the GRETA data types, and a listing of the type IDs assigned to auxiliary systems. However, we will not try to keep the format for these aux. system payloads updated. Instead, please contact the owners of the devices for these details as needed.
struct routingHdr {
uint8_t version; /* protocol version */
uint8_t flags; /* for future use, e.g. debugging */
uint8_t type; /* [0..4] ge waveform, scalar digest */
uint8_t subtype; /* message sub-type, e.g. crystal ID for waveform messages */
uint16_t length; /* length of payload */
uint16_t seqnum; /* sequence number */
int64_t timestamp; /* generated by trigger (10ns clock) */
int64_t checksum; /* integrity checksum */
};
We have two sample data files (short files) available - these are not for physics, but for testing your unpacking codes.
testFRIB_1079_Type2_Crystal5.dat
This is a short Type=2 (decomposed GRETA data) file, including data from crystals 5 only. These are 60Co source data.
testFRIB_667_Type4_Crystal112.dat
This is a short Type=4 (compressed raw GRETA data) file, including data from crystal 112 only. These are also 60Co source data (not calibrated).
This data type is the decomposed GRETA data (mode 2) format. Mode 2 data is output from the signal decomposition process, and gives interaction points and energies from a single crystal.
Decomposed GRETA Data format, GRETA January 2025 - present (at the moment, the length of vector<intPtFit> is always 1):
#define NUMCHAN 40
struct intPt {
int16_t ir, ip, iz, seg; /* r, phi, z and segment hit information */
float_t x, y, z, e; /* crystal coordinate x, y, z positions (in mm) and intpt energy */
float_t dx, dy, dz, de; /* uncertainties - for future use */
};
struct intPtFit {
int16_t fit_type; /* type of fit - for future use */
int16_t fit_flags; /* informational flags */
int16_t num_interactions; /* number of intPt structs in payload */
int16_t errorCode; /* error flag for unsuccessful fit */
float_t chisq; /* chi2 of fit */
float_t norm_chisq; /* normalized chi2 value */
float_t fit_t0; /* t0 value for this fit */
uint32_t pad; /* pad for byte alignment */
vector<intPt> intpts;
};
struct gretaIntPtMsg {
uint8_t version; /* protocol version = 0x1 for initial version */
int8_t id; /* crystal id */
uint16_t trig_src; /* information from trigger */
int16_t num_fits; /* number of intPtFits structs in payload */
uint16_t pad; /* pad to 8-byte alignment */
uint64_t basisHash; /* unique ID tied to the basis used in decomp */
int64_t timestamp; /* timestamp of first sample */
uint64_t pileup; /* pileup flags for filter 1 */
int16_t t0; /* time offset for decomp (if available) */
int16_t sub_t0; /* sub-tick time offset for decomp (if available) */
int16_t hist_corr[2][2]; /* energy/time pairis of preceeding 2 events */
int16_t t_led_core; /* time offset for core LED */
int16_t t_cfd_core; /* time offset for core CFD */
int16_t t_led_first; /* time offset for LED of first hit */
int16_t t_postpileup; /* time offset for post pileup */
int16_t t_ovfl; /* time offset since last overflow */
int16_t t_rst; /* time offset since last reset */
int32_t ener[NUM_CHAN]; /* energy given by filter 1, in eV */
vector<intPtFit> intPtFits;
};
This data type is the raw GRETA waveform data (mode 3) format. Mode 3 data is output from the signal filter boards per crystal and includes waveforms for all cores and segments.
Uncompressed Raw GRETA Data format, GRETA January 2025 - present:
#define NUMCHAN 40
struct gretaWaveformMsg {
uint8_t version; /* protocol version = 0x1 for initial waveform version */
int8_t id; /* crystal id */
uint16_t tr_len; /* trace length (in 2-byte words) */
uint16_t trig_src; /* info from trigger */
uint16_t pad; /* pad to 8-byte alignment */
int64_t timestamp; /* timestamp of first sample */
uint64_t pileup; /* pileup flags for filter 1 */
int16_t hist_corr[2][2]; /* energy/time pairis of preceeding 2 events */
int16_t t0; /* time offset for decomp (if available) */
int16_t sub_t0; /* sub-tick time offset for decomp (if available) */
int16_t t_led_core; /* time offset for core LED */
int16_t t_cfd_core; /* time offset for core CFD */
int16_t t_led_first; /* time offset for LED of first hit */
int16_t t_postpileup; /* time offset for post pileup */
int16_t t_ovfl; /* time offset since last overflow */
int16_t t_rst; /* time offset since last reset */
int32_t ener[NUM_CHAN]; /* energy given by filter 1, in eV */
uint16_t wfLength[NUM_CHAN]; /* waveform lengths - for uncompressed will all be = tr_len */
int16_t tr[NUM_CHAN][tr_len]; /* waveform samples - tr_len samples for each channel */
};
This data type is the raw GRETA waveform data (mode 3) format. Mode 3 data is output from the signal filter boards per crystal and includes waveforms for all cores and segments. With compression, only the waveforms are compressed based on the DPTC algorithm.
Details on DPTC Algorithm:
Code: http://fy.chalmers.se/subatom/dptc/
Article: https://doi.org/10.1109/TCSI.2019.2945179
Compressed Raw GRETA Data format, GRETA January 2025 - present:
#define NUMCHAN 40
struct gretaWaveformMsg {
uint8_t version; /* protocol version = 0x1 for initial waveform version */
int8_t id; /* crystal id */
uint16_t tr_len; /* trace length (in 2-byte words) */
uint16_t trig_src; /* info from trigger */
uint16_t pad; /* pad to 8-byte alignment */
int64_t timestamp; /* timestamp of first sample */
uint64_t pileup; /* pileup flags for filter 1 */
int16_t hist_corr[2][2]; /* energy/time pairis of preceeding 2 events */
int16_t t0; /* time offset for decomp (if available) */
int16_t sub_t0; /* sub-tick time offset for decomp (if available) */
int16_t t_led_core; /* time offset for core LED */
int16_t t_cfd_core; /* time offset for core CFD */
int16_t t_led_first; /* time offset for LED of first hit */
int16_t t_postpileup; /* time offset for post pileup */
int16_t t_ovfl; /* time offset since last overflow */
int16_t t_rst; /* time offset since last reset */
int32_t ener[NUM_CHAN]; /* energy given by filter 1, in eV */
uint16_t wfLength[NUM_CHAN]; /* waveform lengths for channels in compressed tr payload that follows */
int16_t tr[NUM_CHAN][]; /* waveform samples - compressed length varies, given by wfLength array */
};
As we don't want to press our luck, no real data will be assigned type 13.