diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 10:08:27 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-08-14 10:08:27 -0500 |
commit | 24c8bcfe7f76b20124e2862ea050f815c0f768e7 (patch) | |
tree | e5bdbd638a2c7f38f1c094cc9e95cbdfe05b9481 /zdab_utils.h | |
parent | 0b7f199c0d93074484ea580504485a32dc29f5e2 (diff) | |
download | sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.gz sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.tar.bz2 sddm-24c8bcfe7f76b20124e2862ea050f815c0f768e7.zip |
move everything to src directory
Diffstat (limited to 'zdab_utils.h')
-rw-r--r-- | zdab_utils.h | 202 |
1 files changed, 0 insertions, 202 deletions
diff --git a/zdab_utils.h b/zdab_utils.h deleted file mode 100644 index c5fc2c0..0000000 --- a/zdab_utils.h +++ /dev/null @@ -1,202 +0,0 @@ -#ifndef ZDAB_UTILS -#define ZDAB_UTILS - -#include "Record_Info.h" -#include <stdint.h> -#include <stdlib.h> /* for size_t */ - -// the builder won't put out events with NHIT > 10000 -// (note that these are possible due to hardware problems) -// but XSNOED can write an event with up to 10240 channels -#define MAX_NHIT 10240 - -#ifdef SWAP_BYTES -#define SWAP_INT32(a,b) swap_int32((int32_t *)(a),(b)) -#define SWAP_INT16(a,b) swap_int16((int16_t *)(a),(b)) -#else -#define SWAP_INT32(a,b) -#define SWAP_INT16(a,b) -#endif - -/* Bit masks for the PMT flags field in the PMT bank. */ -#define KPF_DIS 0x00000001 -#define KPF_NOI 0x00000004 -#define KPF_PRP 0x00000008 -#define KPF_AFP 0x00000010 -#define KPF_FECD 0x00000020 -#define KPF_FT_MASK1 0x00000040 -#define KPF_XT 0x04000000 -#define KPF_NO_CAL 0x08000000 -#define KPF_BAD_CAL 0x10000000 - -typedef struct EVBank { - /* Run number. */ - uint32_t run; - /* Event number. */ - uint32_t evn; - /* Data type. */ - uint32_t dtp; - /* Julian date. */ - uint32_t jdy; - /* Universal time (seconds). */ - uint32_t ut1; - /* Universal time (nanoseconds). */ - uint32_t ut2; - /* Date (format: yyyymmdd) */ - uint32_t dte; - /* Time (format: hhmmsscc - cc is centisec). */ - uint32_t hmsc; - /* Global trigger time in nsec (first word). */ - uint32_t gtr1; - /* Second word. */ - uint32_t gtr2; - /* Number of PMTs that fired. */ - uint32_t npm; - /* Integrated charge in the event. */ - uint32_t nph; - /* Sub-run number, or -1 if unknown. Only defined for run number >= 10614. */ - uint32_t sub_run; - /* Packed word. */ - uint32_t mc_pck; - /* ZDAB input/output record type, e.g. PMT, NCD, CMA, RUN, etc. */ - uint32_t rec; - /* ZDAB_PMT format number (x10). */ - uint32_t vpck; - /* Global trigger ID. */ - uint32_t gtr_id; - /* Trigger word. */ - uint32_t trg_type; - /* Digitized peak of analog sum. */ - uint32_t peak; - /* Analog sum derivative. */ - uint32_t diff; - /* Digitized integral of analog sum. */ - uint32_t integral; - /* Trigger error bits plus spares. */ - uint32_t err; - /* Data splitter blindness word. */ - uint32_t data_set; - uint32_t spare1[3]; - uint32_t ncd_status; - /* Number of multiplexer global records. */ - uint32_t num_muxg; - /* Number of multiplexer records. */ - uint32_t num_mux; - /* Number of scope records. */ - uint32_t num_scope; - uint32_t spare2[5]; - /* Upper 24 bits of flock */ - uint32_t ncd_clk_up; - /* Lower clock register (32 bits). */ - uint32_t ncd_clk_lw; - /* Latch register id. */ - uint32_t ncd_reg; - /* GTID. */ - uint32_t ncd_gtid; - /* Sync clear error. */ - uint32_t ncd_sync; - uint32_t spare3[10]; -} EVBank; - -/* PMT Bank struct. This is a struct which mimics the PMT data bank in SNOMAN. - * The fields and comments were taken from the SNOMAN companion. */ -typedef struct PMTBank { - /* Tube number. For FECD, which has no associated tube number, this word is - * a copy of PIN. */ - uint32_t pn; - /* Set of 1-bit flags. All undefined bits are set to zero. The following - * bits are defined: - * - * 0 KPF_DIS Discard hit for all processing including fitting. - * 2 KPF_NOI Noise. - * 3 KPF_PRP Pre-pulse. - * 4 KPF_AFP After-pulse. - * 5 KPF_FECD Front-End Card Data i.e. non-PMT channel. - * Should only be set on the FECD bank. - * 6 KPF_FT_MASK+i Discarded by fitter method i (i = 1,2,..). - * For description of fitter methods see the FTx bank. - * 26 KPF_XT Crosstalk. - * 27 KPF_NO_CAL No calibration. - * 28 KPF_BAD_CAL Bad calibration. */ - uint32_t pf; - /* Time in nano-secs relative to event T0 - see EV. */ - float pt; - /* Integrated charge. */ - float phl; - /* Short-time integrated charge. */ - float phs; - /* Low-gain integrated charge. */ - float plx; - /* Time with the PMT jitter removed. */ - float pt0; - /* Set of n-bit flags for the ith hit in list. All undefined bits are set - * to zero. The following bits are defined: - * - * Bit Field DAQ Meaning - * 0-3 NCELL (CMOS Cell address 0 to 15) - * 4-5 FLAG1 Bit 4 = CGT ES16. - * Bit 5 = CGT ES24. - * 6-9 FLAG2 Bit 6 = Missed Count - * Bit 7 = NC/CC Flag - * Bit 8 = LGISELECT (1=long sample) - * Bit 9 = CMOS ES16. */ - uint32_t pif; - /* Uncalibrated times. */ - float pit; - /* Uncalibrated high-gain, long int. charge. */ - float pihl; - /* Uncalibrated high-gain, short int. charge. */ - float pihs; - /* Uncalibrated log-gain, long int. charge. */ - float pilx; - /* Uncalibrated unjittered time. */ - float pit0; - /* PMT channel cell number. */ - uint32_t cell; - /* CCC DAQ Circuit Number - * = 1024*card + 32*crate + channel. - * Before uncalibration it holds the tube no. */ - uint32_t pin; - /* TSLH of PMT. */ - uint32_t tslh; - /* HCA information. */ - uint32_t hca; - /* ECA validation status word. */ - uint32_t eca_val; - /* PCA validation status word. */ - uint32_t pca_val; - /* ANXX validation status word. */ - uint32_t anxx; - /* ECA calibrated time (nsec). */ - uint32_t ept; - /* ECA calibrated QHL (pedestal subtracted). */ - uint32_t ehl; - /* ECA calibrated QHS (pedestal subtracted). */ - uint32_t ehs; - /* ECA calibrated QLX (pedestal subtracted). */ - uint32_t elx; - /* Non-walk corrected PMT time. */ - uint32_t pt1; - /* Multiphoton PCA time. */ - uint32_t ptm; - /* Multiphoton PCA PMT transit time RMS. */ - uint32_t ptms; - /* Best charge (either QHS or QLX). */ - uint32_t qm; - /* Best charge status word. */ - uint32_t qms; - /* Charge correction for rate-dependent shifting. */ - uint32_t qrc; -} PMTBank; - -void unpack_ev(uint32_t *data, EVBank *b); -void unpack_pmt(uint32_t *data, PMTBank *b); - -int isOrphan(aPmtEventRecord *pmtRecord); -void swap_int32(int32_t *val_pt, int count); -void swap_int16(int16_t *val_pt, int count); -int swap_PmtRecord(aPmtEventRecord *aPmtRecord, size_t size); -void swap_TrigRecord(struct TriggerInfo *aTrigRecord); -void swap_RunRecord(struct RunRecord *aRunRecord); - -#endif |