/* Copyright (c) 2019, Anthony Latorre * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ #ifndef EVENT_H #define EVENT_H #include #include "pmt.h" /* Bitmasks for the various PMT flags. */ #define PMT_FLAG_DIS 0x1 #define PMT_FLAG_DQXX 0x2 #define PMT_FLAG_CHARGE 0x4 /* PMT charge status word is non-zero, which means both QHS and QLX are either bad or railed. */ /* Struct to hold all data from a single event used for fitting. */ typedef struct pmt_hit { /* Set to 1 if the PMT was hit. */ int hit; /* ECA calibrated time (ns). */ float ept; /* Time in nano-secs relative to event T0 (ns). */ float t; /* ECA calibrated QHL (pedestal subtracted). */ float ehl; /* ECA calibrated QHL (pedestal subtracted). */ float ehs; /* ECA calibrated QLX (pedestal subtracted). */ float elx; /* Best charge. */ float q; /* Integrated charge. */ float qhl; /* Short-time integrated charge. */ float qhs; /* Low-gain integrated charge. */ float qlx; /* Uncalibrated high-gain, long integration charge. */ uint16_t qihl; /* Uncalibrated high-gain, short integration charge. */ uint16_t qihs; /* Uncalibrated low-gain, long integration charge. */ uint16_t qilx; /* Bitmask used to disqualify hits from the likelihood calculation. See the * PMT_FLAG_* bitmasks above. */ int flags; /* Set of 1-bit PMT flags. See the KPF_* bitmasks in zdab_utils.h. */ int pf; /* Non-walk corrected PMT time. */ float pt1; } pmt_hit; typedef struct event { int run; /* Global trigger time in ns. */ double trigger_time; /* Number of hit PMTs without flags. */ int nhit; /* Global trigger ID. */ uint32_t gtid; /* Trigger word. See trigger_mask_bits.inc. */ uint32_t trigger_type; /* Date (format: yyyymmdd) */ uint32_t dte; /* Time (format: hhmmsscc - cc is centisec). */ uint32_t hmsc; pmt_hit pmt_hits[MAX_PMTS]; } event; #endif