aboutsummaryrefslogtreecommitdiff
path: root/src/zdab_utils.c
AgeCommit message (Collapse)Author
2020-11-16add jdy, ut1, ut2, dte, and hmsc to hdf5 output filetlatorre
2019-11-20update PMT types for PMTs which disagree between snoman.ratdb and the PMT banktlatorre
This commit updates how we handle PMTs whose type is different in the snoman.ratdb file and the SNOMAN bank again. In particular, we now trust the snoman.ratdb type *only* for the NCD runs and mark the PMT as invalid for the D2O and salt phases. This was spurred by noticing that with the current code GTID 9228 in run 10,000 was being marked as a neck event even though it was clearly a muon and XSNOED only showed one neck hit. It was marked as a neck event because there were 2 neck PMT hits in the event: 3/15/9 and 13/15/0. After reading Stan's email more carefully I realized that 3/15/9 was only installed as a neck PMT in the NCD phase. I don't really know what type of PMT it was in the D2O and salt phases (maybe an OWL), but in any case since I don't know the PMT position I don't think we can use this PMT for these phases.
2019-11-18clear any flags except for PMT_FLAG_DQXX in get_event()tlatorre
This commit updates get_event() to clear any PMT flags except for PMT_FLAG_DQXX from all PMT hits before loading the event. Although I *was* previously clearing the other flags for hit PMTs, I was not clearing flags for PMTs which were *not* hit. This was causing non deterministic behaviour, i.e. I was getting different results depending on if I ran the fitter over a whole file or just a single event.
2019-11-18switch to using pt1 instead of the ptmtlatorre
This commit updates the likelihood function to use the PMT hit time without the time walk correction applied (when the charge is greater than 1.5 PE) instead of the multiphoton PCA time. The reason is that after talking with Chris Kyba I realized that the multiphoton PCA time was calibrated to give the mean PMT hit time when mulitiple photons hit at the same time instead of the time when the first photon hits which is what I assume in my likelihood function. Therefore I now use the regular PMT hit time without time walk correction applied which should be closer to the first order statistic.
2019-09-30write out run header info to the hdf5 filetlatorre
2019-09-23add sub_run variable to the events array in the HDF5 filetlatorre
This commit adds the sub_run variable to the ev array in the HDF5 output file and updates plot-energy to order the events using the run and sub_run variables. This fixes a potential issue where I was sorting by GTID before, but the GTID can wrap around and so isn't guaranteed to put the events in the right order.
2019-09-21update definition of nhittlatorre
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.
2019-09-10add best_uncal_q to the pmt_hit struct and use it in the muon cuttlatorre
This commit adds a field to the pmt_hit struct called best_uncal_q which represents the best ECA calibrated charge (in units of QHS counts above pedestals). This is then used in the muon data cleaning cut.
2019-09-09add a first draft of a data cleaning cut to detect breakdown eventstlatorre
2019-09-09add math header file to zdab_utils.c for fmin() and fmax()tlatorre
2019-09-09update get_event() to use the PMT types from the snoman.ratdb filetlatorre
This commit updates get_event() to assume the PMT type is correct in the pmt.txt file instead of assuming the SNOMAN bank is correct. The reason for this is that according to the email from Stan 3/15/9 should be a neck PMT (at least in the NCD phase) and that is what the pmt.txt file says it should be. In addition, the changes that Stan said were needed in ccc_type.for never got made.
2019-09-09reset the PMT_FLAG_CHARGE bit in get_event()tlatorre
2019-09-09uncalibrate MC times and charges in get_event()tlatorre
This commit updates get_event() to fill in the uncalibrated charge and time info from the calibrated charge and time. The ECA calibrated time and ECA + PCA without walk correction times (ept and pt1) are just set to the calibrated time. The uncalibrated charges are set by multiplying the calibrated charge by the mean high-half point and adding a constant offset, and the ECA calibrated charges are set by taking the uncalibrated charges and subtracting the offset. The reason for filling these in is so that we can test the data cleaning cuts on MC. Although it would be better if these were filled in by the MC, this is better than nothing.
2019-07-29use standard PCA time for MCtlatorre
2019-07-29flag PMT charges below qlotlatorre
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.
2019-07-29switch to using the multiphoton PCA timetlatorre
This commit updates the likelihood to use the multiphoton PCA time instead of the usual pt time. When looking at the reconstruction of muons in run 10,000 I noticed that the PMT hit times for the PMTs which had really high charge was all over the place. There were PMTs that were very close to each other with hit times differing by ~ 20 ns. I'm still not entirely sure what causes this (is it some hardware issue with the discriminator or is it a problem with the charge walk correction which always assumes a single PE?), but the multiphoton PCA times looked a lot more reasonable. Eventually I need to look into the ptms variable which is the multiphoton PCA transit time RMS.
2019-07-16update neck tube cut to include time difference changes due to cable changestlatorre
2019-07-16use QLX if QHS is railedtlatorre
2019-07-12don't flag PMT hits based on the uncalibrated QHS for MCtlatorre
2019-07-11switch from YAML output to HDF5 to speed things uptlatorre
2019-06-20update zdab-cat to output 50 MHz clock time and trigger typetlatorre
2019-06-19add FTP, RSP, and FTK results to the output filetlatorre
2019-06-16fix type of nph in ev banktlatorre
2019-06-16check the KPF_NO_CAL and KPF_BAD_CAL bits in get_event()tlatorre
2019-06-14fix parsing of global trigger time from EV bank (it's stored as a double)tlatorre
2019-06-14add comment about why we assume that SNOMAN gets the PMT types righttlatorre
2019-06-14update flasher cut to use pt1 instead of epttlatorre
Small update to the flasher cut to use the non-walk corrected time instead of just the ECA calibrated time. Also added some comments to the variables in the event structure.
2019-06-14flag hits with bad or railed chargetlatorre
This commit updates the get_event() function to flag any hits which have a non-zero best charge status word. This essentially gets set when *both* QHS and QLX are either bad or railed. I also set this bit if *just* QHS is railed or below 300 since the current charge model was only set up for QHS. In the future, it would be nice to instead use the best charge (either QHS or QLX) in the likelihood function. To do that I need to double check how QLX is normalized and if the current charge model would work for QLX too.
2019-06-13add a data cleaning cut to tag incoming muonstlatorre
This commit adds a data cleaning cut to tag incoming muons by looking for early OWL hits. It also significantly updates the flasher cut to catch more flashers. In particular, the flasher cut now does the following: - loops over *all* paddle cards with at least 4 hits instead of just the paddle cards with the most hits - uses QLX to look for charge outliers in the paddle card - fixes a few bugs (for example, uninitialized values in the charge array) - adds a check to to see if the given slot is early with respect to all PMTs within 4 meters to catch the case where the flashing channel is missing from the event
2019-06-10add a bunch of SNO data quality cutstlatorre
This commit adds the following data quality cuts used in SNOMAN: - neck - qvnhit - crate isotropy - junk Still need to test these.
2019-06-10update get_event() to include all PMT typestlatorre
This commit updates get_event() to include OWL, LG, FECD, BUTT, and NECK tubes.
2019-05-23add zdab-cattlatorre
This commit adds a new program called zdab-cat which is kind of like fit, but just produces the YAML output without actually fitting anything.
2019-03-16add GPLv3 licensetlatorre
2019-03-08fix some int -> floats in the PMT banktlatorre
2019-01-15update zebra library to be able to use linkstlatorre
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.
2018-09-19change output file format to YAMLtlatorre
2018-09-17add MC Track bank to zdab_utilstlatorre
2018-08-14move everything to src directorytlatorre