aboutsummaryrefslogtreecommitdiff
path: root/src/zdab_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/zdab_utils.h')
-rw-r--r--src/zdab_utils.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/zdab_utils.h b/src/zdab_utils.h
index 666d2d9..f70482a 100644
--- a/src/zdab_utils.h
+++ b/src/zdab_utils.h
@@ -18,6 +18,17 @@
#define SWAP_INT16(a,b)
#endif
+/* Status bits for the MC Vertex bank.
+ *
+ * See http://www.lip.pt/~barros/SNO/doc/snoman/companion_frames.html. */
+#define KMCVX_SRC 0x00000001 /* Source */
+#define KMCVX_BOU 0x00000002 /* Boundary */
+#define KMCVX_INT 0x00000004 /* Interaction */
+#define KMCVX_SNK 0x00000008 /* Sink */
+#define KMCVX_PSC 0x00000010 /* Pre-source */
+#define KMCVX_CRE 0x00000100 /* Creation i.e. vertex creates new particle (ignoring Cerenkov photon). */
+#define KMCVX_IPM 0x00000200 /* Indirect MCPM. The MCPM hit comes indirectly from the vertex. */
+
/* Status bits for the MC Track bank.
*
* Bits 4-17 are used to store the "history" of Cerenkov photons. The bit
@@ -52,6 +63,38 @@
#define KPF_NO_CAL 0x08000000
#define KPF_BAD_CAL 0x10000000
+typedef struct MCVXBank {
+ /* Class: = 1 Source, = 2 Boundary, = 3 Interaction, = 4 Sink
+ = 5 Pre-source. */
+ uint32_t cls;
+ /* Interaction code. */
+ uint32_t inc;
+ /* Position X. */
+ float x;
+ /* Position Y. */
+ float y;
+ /* Position Z. */
+ float z;
+ /* Time in ns since MC Generation time (in MC bank). */
+ double tim;
+ /* First region code. */
+ uint32_t rgn;
+ /* First physical media code. */
+ uint32_t idm;
+ /* Second region code. */
+ uint32_t rg2;
+ /* Second physical media code. */
+ uint32_t im2;
+ /* Boundary normal X (only defined if boundary status bit set). */
+ float bnx;
+ /* Boundary normal Y (only defined if boundary status bit set). */
+ float bny;
+ /* Boundary normal Z (only defined if boundary status bit set). */
+ float bnz;
+ /* Number of Cerenkov photons. Only non-zero for CBV vertex. */
+ uint32_t cer;
+} MCVXBank;
+
typedef struct MCTKBank {
/* Particle id code. */
uint32_t idp;
@@ -239,6 +282,7 @@ typedef struct PMTBank {
uint32_t qrc;
} PMTBank;
+void unpack_mcvx(uint32_t *data, MCVXBank *b);
void unpack_mctk(uint32_t *data, MCTKBank *b);
void unpack_ev(uint32_t *data, EVBank *b);
void unpack_pmt(uint32_t *data, PMTBank *b);