diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-07-29 12:33:59 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-07-29 12:33:59 -0500 |
commit | 1c8051e72f3c00384cb3e5b07d22b325ddcd2273 (patch) | |
tree | fd74797ad46e7741841138f0d63921a222a419d9 /src | |
parent | c00d326e4951e0384fa7b26861e1b89535c1e288 (diff) | |
download | sddm-1c8051e72f3c00384cb3e5b07d22b325ddcd2273.tar.gz sddm-1c8051e72f3c00384cb3e5b07d22b325ddcd2273.tar.bz2 sddm-1c8051e72f3c00384cb3e5b07d22b325ddcd2273.zip |
flag PMT charges below qlo
This commit updates get_event() to flag PMT charges below qlo, which is the
minimum charge value that we compute the charge PDFs for. This is to prevent
the likelihood from returning nan.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/sno_charge.c | 10 | ||||
-rw-r--r-- | src/sno_charge.h | 2 | ||||
-rw-r--r-- | src/zdab_utils.c | 7 |
4 files changed, 20 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile index e5ca1cd..7787558 100644 --- a/src/Makefile +++ b/src/Makefile @@ -38,7 +38,7 @@ test-find-peaks: test-find-peaks.o zebra.o likelihood.o pmt.o vector.o misc.o mu calculate-csda-range: calculate-csda-range.o -zdab-cat: zdab-cat.o zebra.o pmt.o vector.o misc.o zdab_utils.o pack2b.o db.o dqxx.o dict.o siphash.o release.o dc.o sort.o util.o hdf5_utils.o +zdab-cat: zdab-cat.o zebra.o pmt.o vector.o misc.o zdab_utils.o pack2b.o db.o dqxx.o dict.o siphash.o release.o dc.o sort.o util.o hdf5_utils.o sno_charge.o install: @mkdir -p $(INSTALL_BIN) diff --git a/src/sno_charge.c b/src/sno_charge.c index 17e4ebc..f36bfb5 100644 --- a/src/sno_charge.c +++ b/src/sno_charge.c @@ -106,6 +106,16 @@ static double QSMEAR_ADC = 3.61; /* Mean of simulated threshold distribution. */ static double MEAN_THRESH = 8.5; +double get_qlo(void) +{ + return qlo; +} + +double get_qhi(void) +{ + return qhi; +} + static double nlopt_log_pq(unsigned int n, const double *x, double *grad, void *params) { int i; diff --git a/src/sno_charge.h b/src/sno_charge.h index 549ca2c..7c6513d 100644 --- a/src/sno_charge.h +++ b/src/sno_charge.h @@ -17,6 +17,8 @@ #ifndef SNO_CHARGE_H #define SNO_CHARGE_H +double get_qlo(void); +double get_qhi(void); double get_most_likely_mean_pe(double q); void init_charge(void); double get_log_pq(double q, int n); diff --git a/src/zdab_utils.c b/src/zdab_utils.c index a7669fa..d4e3215 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -23,6 +23,7 @@ #include "event.h" #include "zebra.h" #include "misc.h" +#include "sno_charge.h" char zdab_err[256]; @@ -196,6 +197,12 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) ev->pmt_hits[id].flags |= PMT_FLAG_CHARGE; } + /* Flag PMTs with charges below qlo, since otherwise the negative + * log likelihood will be nan. */ + if (ev->pmt_hits[id].q < get_qlo()) { + ev->pmt_hits[id].flags |= PMT_FLAG_CHARGE; + } + if (pmts[id].pmt_type != pmt_types[i]) { get_pmt_type_string(pmts[id].pmt_type,pmt_type_string); fprintf(stderr, "%i/%i/%i has PMT type %s but expected %s based on bank\n", crate, card, channel, pmt_type_string, pmt_names[i]); |