aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-09-21 18:13:13 -0500
committertlatorre <tlatorre@uchicago.edu>2019-09-21 18:13:13 -0500
commitc171a7b4147669b6d8f3b6c4197610ad4c7c0bb4 (patch)
tree5c4e6f3d894c2f072957a7552ded1700dfe7248c /src
parentf7eacbb52db769634e6de5f36b9b2f4f9c84c6f2 (diff)
downloadsddm-c171a7b4147669b6d8f3b6c4197610ad4c7c0bb4.tar.gz
sddm-c171a7b4147669b6d8f3b6c4197610ad4c7c0bb4.tar.bz2
sddm-c171a7b4147669b6d8f3b6c4197610ad4c7c0bb4.zip
update definition of nhit
This commit updates the ev.nhit variable to represent the total number of normal PMTs hit in the event, regardless of if the calibration failed. I added a new variable ev.nhit_cal which now stores the total number of normal PMTs hit without any flags.
Diffstat (limited to 'src')
-rw-r--r--src/event.h4
-rw-r--r--src/zdab_utils.c27
-rw-r--r--src/zdab_utils.h1
3 files changed, 9 insertions, 23 deletions
diff --git a/src/event.h b/src/event.h
index 4776527..88fcbe1 100644
--- a/src/event.h
+++ b/src/event.h
@@ -75,8 +75,10 @@ typedef struct event {
int run;
/* Global trigger time in ns. */
double trigger_time;
- /* Number of hit PMTs without flags. */
+ /* Number of normal hit PMTs. */
int nhit;
+ /* Number of normal hit PMTs without flags. */
+ int nhit_cal;
/* Global trigger ID. */
uint32_t gtid;
/* Trigger word. See trigger_mask_bits.inc. */
diff --git a/src/zdab_utils.c b/src/zdab_utils.c
index c4b04ea..cf1a01c 100644
--- a/src/zdab_utils.c
+++ b/src/zdab_utils.c
@@ -49,25 +49,6 @@ static double TAC_OFFSET = 300.0;
* a plot of QHS vs QLX. */
static double QLX_TO_QHS = 12.0;
-size_t get_nhit(event *ev)
-{
- /* Returns the number of PMT hits in event `ev`.
- *
- * Note: Only hits on normal PMTs which aren't flagged are counted. */
- size_t i, nhit;
-
- nhit = 0;
- for (i = 0; i < MAX_PMTS; i++) {
- if (ev->pmt_hits[i].flags || pmts[i].pmt_type != PMT_NORMAL) continue;
-
- if (!ev->pmt_hits[i].hit) continue;
-
- nhit++;
- }
-
- return nhit;
-}
-
/* Returns 1 if the EV is produced by MC, otherwise zero.
*
* Data type = 10*(1=real, 2=MC)
@@ -128,6 +109,8 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev)
ev->dte = ev_bank.dte;
ev->hmsc = ev_bank.hmsc;
+ ev->nhit = 0;
+ ev->nhit_cal = 0;
for (i = 0; i < LEN(pmt_links); i++) {
if (bev->links[pmt_links[i]-1] == 0) continue;
@@ -349,6 +332,10 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev)
warned[id] = 1;
}
+ ev->nhit += 1;
+
+ if (!ev->pmt_hits[id].flags) ev->nhit_cal += 1;
+
if (!b.next) break;
rv = zebra_get_bank(f,&b,b.next);
@@ -360,8 +347,6 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev)
}
}
- ev->nhit = get_nhit(ev);
-
return 0;
}
diff --git a/src/zdab_utils.h b/src/zdab_utils.h
index 043e185..ce3661c 100644
--- a/src/zdab_utils.h
+++ b/src/zdab_utils.h
@@ -676,7 +676,6 @@ void unpack_mctk(uint32_t *data, MCTKBank *b);
void unpack_ev(uint32_t *data, EVBank *b);
void unpack_pmt(uint32_t *data, PMTBank *b);
-size_t get_nhit(event *ev);
int get_event(zebraFile *f, event *ev, zebraBank *bev);
int isOrphan(aPmtEventRecord *pmtRecord);
void swap_int32(int32_t *val_pt, int count);