aboutsummaryrefslogtreecommitdiff
path: root/src/zdab_utils.h
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-01-15 01:08:54 -0600
committertlatorre <tlatorre@uchicago.edu>2019-01-15 01:08:54 -0600
commit9c910abe7a0359018677a874822d8742d0e616b9 (patch)
tree52dda30fd3c5b0eb78050dee4dec10bdf8557ed7 /src/zdab_utils.h
parent272d793cda5456fb8a69d3e2a407bf24d3600cd4 (diff)
downloadsddm-9c910abe7a0359018677a874822d8742d0e616b9.tar.gz
sddm-9c910abe7a0359018677a874822d8742d0e616b9.tar.bz2
sddm-9c910abe7a0359018677a874822d8742d0e616b9.zip
update zebra library to be able to use links
This commit updates the zebra library files zebra.{c,h} so that it's now possible to traverse the data structure using links! This was originally motivated by wanting to figure out which MC particles were generated from the MCGN bank (from which it's only possible to access the tracks and vertices using structural links). I've also added a new test to test-zebra which checks the consistency of all of the next/up/orig, structural, and reference links in a zebra file.
Diffstat (limited to 'src/zdab_utils.h')
-rw-r--r--src/zdab_utils.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/zdab_utils.h b/src/zdab_utils.h
index f70482a..8d8badc 100644
--- a/src/zdab_utils.h
+++ b/src/zdab_utils.h
@@ -18,6 +18,74 @@
#define SWAP_INT16(a,b)
#endif
+/* Links for the MCVX bank. */
+#define KMCVX_MCVXG 4
+#define KMCVX_MCPM 3
+#define KMCVX_MCTKI 2
+#define KMCVX_MCTK 1
+
+/* Links for the MC bank. */
+#define KMC_MCNS 6
+#define KMC_MCNH 5
+#define KMC_MCPM 4
+#define KMC_EGS4 3
+#define KMC_MCVX 2
+#define KMC_MCGN 1
+
+/* Links for the EV bank. */
+#define KEV_NPFA 32
+#define KEV_NECL 31
+#define KEV_NPA 30
+#define KEV_NEMG_PAR 29
+#define KEV_NEMG 28
+#define KEV_NES 27
+#define KEV_NESG 26
+#define KEV_RSP 25
+#define KEV_NECK 24
+#define KEV_BUTT 23
+#define KEV_ANAL 22
+#define KEV_FECD 21
+#define KEV_LG 20
+#define KEV_OWL 19
+#define KEV_PMT 18
+#define KEV_CL 17
+#define KEV_PIF 16
+#define KEV_PIT0 15
+#define KEV_PIT 14
+#define KEV_PIHS 13
+#define KEV_PIHL 12
+#define KEV_PILX 11
+#define KEV_PIN 10
+#define KEV_PT0 9
+#define KEV_PLX 8
+#define KEV_PHS 7
+#define KEV_ZDAB 6
+#define KEV_PF 5
+#define KEV_PN 4
+#define KEV_PHL 3
+#define KEV_PT 2
+#define KEV_FT 1
+
+/* Links for the MAST bank. */
+#define KMAST_RLOG 25 /* Runlog data. */
+#define KMAST_RLAI 24 /* Runlog analysis data. */
+#define KMAST_LABL 12 /* Tape label information. */
+#define KMAST_CAAC 11 /* AV Status. */
+#define KMAST_CAST 10 /* Manipulator status. */
+#define KMAST_SOSF 9 /* LED status. */
+#define KMAST_SOSX 8 /* Manipulator source status. */
+#define KMAST_TRIG 7 /* Trigger information bank. */
+#define KMAST_EPED 6 /* Electronics calibration pedestal bank. */
+#define KMAST_RHDR 5 /* Top level run header bank. */
+#define KMAST_ANAL 4 /* Analysis top level bank. */
+#define KMAST_DSML 3 /* Data structure manager log bank. */
+#define KMAST_MC 2 /* Monte carlo top level bank. */
+#define KMAST_EV 1 /* First event trigger bank. */
+
+/* MAST bank data words. */
+#define KMAST_SNOMAN_VER 1
+#define KMAST_SNOMAN_VER_ORG 2
+
/* Status bits for the MC Vertex bank.
*
* See http://www.lip.pt/~barros/SNO/doc/snoman/companion_frames.html. */
@@ -63,6 +131,46 @@
#define KPF_NO_CAL 0x08000000
#define KPF_BAD_CAL 0x10000000
+/* Links for the MCGN bank. */
+#define KMCGN_MCTK 1
+
+/* Links for the MCTK bank. */
+#define KMCTK_MCVX 1
+
+typedef struct MCGNBank {
+ /* Particle id. */
+ uint32_t id;
+ /* Number of outgoing particles generated. */
+ uint32_t num;
+ /* Radiative process if any. */
+ uint32_t radcor_proc;
+ /* +1 particle brems and produces a gamma.
+ * -1 particle is a gamma produced by brem. */
+ uint32_t radcor_made_gamma;
+ /* Spares. */
+ uint32_t spare5;
+ uint32_t spare6;
+ uint32_t spare7;
+ uint32_t spare8;
+ uint32_t spare9;
+ uint32_t spare10;
+ /* Correction to total cross sections. */
+ float radcor_xtot;
+ /* Correction to differential cross sections. */
+ float radcor_xdif;
+ /* Value of exponential parameter used for generating particle start times,
+ * if time type IDTEX1 was selected. */
+ float gentim_xpar;
+ /* More spares. */
+ float spare14;
+ float spare15;
+ float spare16;
+ float spare17;
+ float spare18;
+ float spare19;
+ float spare20;
+} MCGNBank;
+
typedef struct MCVXBank {
/* Class: = 1 Source, = 2 Boundary, = 3 Interaction, = 4 Sink
= 5 Pre-source. */
@@ -282,6 +390,7 @@ typedef struct PMTBank {
uint32_t qrc;
} PMTBank;
+void unpack_mcgn(uint32_t *data, MCGNBank *b);
void unpack_mcvx(uint32_t *data, MCVXBank *b);
void unpack_mctk(uint32_t *data, MCTKBank *b);
void unpack_ev(uint32_t *data, EVBank *b);