diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-03-07 16:31:34 -0600 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-03-07 16:31:34 -0600 |
commit | becc37649c55bf7d673efc2d96bb099824032f42 (patch) | |
tree | 8a78a68f85ab4533e0f4dadb712c6138f3e036f5 /src/fit.c | |
parent | a96111c8026d47147708796091ec7bef216aefd8 (diff) | |
download | sddm-becc37649c55bf7d673efc2d96bb099824032f42.tar.gz sddm-becc37649c55bf7d673efc2d96bb099824032f42.tar.bz2 sddm-becc37649c55bf7d673efc2d96bb099824032f42.zip |
update fit to automatically load DQXX file based on run number
Diffstat (limited to 'src/fit.c')
-rw-r--r-- | src/fit.c | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -5828,7 +5828,10 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) ev->pmt_hits[id].qhl = bpmt.phl; ev->pmt_hits[id].qhs = bpmt.phs; ev->pmt_hits[id].qlx = bpmt.plx; - ev->pmt_hits[id].flags |= bpmt.pf & KPF_DIS; + /* Clear the PMT_FLAG_DIS bit. */ + ev->pmt_hits[id].flags &= ~PMT_FLAG_DIS; + if (bpmt.pf & KPF_DIS) + ev->pmt_hits[id].flags |= PMT_FLAG_DIS; if (!b.next) break; @@ -5915,6 +5918,8 @@ int main(int argc, char **argv) size_t len; char tmp[256]; size_t nhit, min_nhit = 100; + int last_run; + char dqxx_file[256]; for (i = 1; i < argc; i++) { if (strlen(argv[i]) >= 2 && !strncmp(argv[i], "--", 2)) { @@ -5995,7 +6000,9 @@ int main(int argc, char **argv) init_charge(); dict *db = db_init(); - if (load_file(db, "DQXX_0000010000.dat")) { + last_run = 10000; + + if (load_file(db, "DQXX_0000010000.dat", 0)) { fprintf(stderr, "failed to load DQXX_0000010000.dat: %s\n", db_err); goto err; } @@ -6005,12 +6012,12 @@ int main(int argc, char **argv) goto err; } - if (load_file(db, "pmt_response_qoca_d2o_20060216.dat")) { + if (load_file(db, "pmt_response_qoca_d2o_20060216.dat", 0)) { fprintf(stderr, "failed to load pmt_response_qoca_d2o_20060216.dat: %s\n", db_err); goto err; } - if (load_file(db, "rsp_rayleigh.dat")) { + if (load_file(db, "rsp_rayleigh.dat", 0)) { fprintf(stderr, "failed to load rsp_rayleigh.dat: %s\n", db_err); goto err; } @@ -6171,6 +6178,23 @@ skip_mc: ev.run = bev.run; ev.gtid = bev.gtr_id; + if (ev.run != last_run) { + printf("loading DQXX file for run %010i\n", ev.run); + + sprintf(dqxx_file, "DQXX_%010i.dat", ev.run); + if (load_file(db, dqxx_file, 1)) { + fprintf(stderr, "failed to load %s: %s\n", dqxx_file, db_err); + goto err; + } + + if (dqxx_init(db, &ev)) { + fprintf(stderr, "failed to initialize DQXX bank: %s\n", dqxx_err); + goto err; + } + + last_run = ev.run; + } + rv = get_event(f,&ev,&b); nhit = get_nhit(&ev); |