aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-06-14add trigger word and trigger time in ns to the YAML filetlatorre
2019-06-14fix parsing of global trigger time from EV bank (it's stored as a double)tlatorre
2019-06-14set the maximum kinetic energy in the fit dynamically based on particle IDtlatorre
The range and energy loss tables have different maximum values for electrons, muons, and protons so we have to dynamically set the maximum energy of the fit in order to avoid a GSL interpolation error. This commit adds {electron,muon,proton}_get_max_energy() functions to return the maximum energy in the tables and that is then used to set the maximum value in the fit.
2019-06-14add comment about why we assume that SNOMAN gets the PMT types righttlatorre
2019-06-14add a function to compute a data cleaning wordtlatorre
Also write out the data cleaning word to the YAML file.
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-14forgot to add event.htlatorre
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-14get rid of gcc warningtlatorre
2019-06-14set the starting energy to MAX_ENERGY if it's greatertlatorre
Also increase the maximum kinetic energy to 10^4 GeV which is approximately the maximum expected energy for cosmic muons at SNO.
2019-06-14add a function to compute the most likely number of PE given an observed chargetlatorre
Also, call this function when computing the psi parameter in nll_best().
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-06-06add --gtid command line argument to test-find-peakstlatorre
2019-06-06print out "loading DQXX ..." line to stderrtlatorre
2019-06-06update find_file() to use the environment variable DQXX_DIRtlatorre
2019-06-02fast_sqrt() -> sqrt()tlatorre
No reason to use fast_sqrt() in get_theta0_min() since the argument isn't guaranteed to be between 0 and 1.
2019-06-02add is_flasher field to outputtlatorre
2019-06-02update likelihood function to speed it uptlatorre
This commit makes a few small changes to try and reduce the number of divisions and multiplications done in get_expected_charge() to speed up the likelihood function.
2019-06-02update get_probability() to take sin(theta) as an argumenttlatorre
Since we already calculate sin(theta) in get_expected_charge() there's no reason to calculate it again in get_probability(). This *may* already be optimized out by the compiler.
2019-06-02update likelihood to use fast_sqrt()tlatorre
2019-06-02add a fast sqrt function for values in between 0 and 1tlatorre
2019-06-02update find_peaks() to only return unique peakstlatorre
This commit updates find_peaks() to only return peaks which are at least a certain number of degrees apart from each other. This is because I found that for many events the first few peaks would all be essentially the same direction and so the fit was taking a lot of time fitting essentially the same seed points. Since I now have to only try 3 peaks in order to get my grid jobs to run for less than a few hours it's necessary to make sure we aren't just fitting the same three directions for the "quick" minimization. I also updated the fit to only use a maximum of 3 seed directions.
2019-06-02add a test for fast_acos()tlatorre
2019-05-29update scattering.c to use interp2d() and interp1d() to speed things uptlatorre
2019-05-29add get_avg_index_{d2o,h2o} functionstlatorre
2019-05-29set step size on theta and phi to 0.1tlatorre
Also, update the step size for the energy during the final minimization to 10%.
2019-05-24add a script to concatenate output from grid jobstlatorre
2019-05-24add a script to submit jobs to the gridtlatorre
2019-05-24update sprintf_yaml_list()tlatorre
This commit changes the format specifier for the values in sprintf_yaml_list() from %.2g -> %.2f because YAML (at least the python parser) doesn't recognize values like 1e+03 as floats.
2019-05-24add a comment to get_theta0_min()tlatorre
Also, delete a check on cos_theta_pmt which isn't necessary.
2019-05-24several small updates to fit.ctlatorre
- set number of shower points to 10 for the main fit - set step size to 10% of the energy - set max number of evals during quick minimization phase to 1000
2019-05-24switch to using BOBYQA since it's fastertlatorre
2019-05-24change MAX_NPEAKS to 5tlatorre
I probably need to spend some time to optimize this along with the algorithm for guessing the peaks, but for now I am just lowering this from 10 -> 5 because with 10 the number of quick minimizations for 3 particles is too big and so the fits take way too long.
2019-05-24don't do fast fit during quick minimization phasetlatorre
When plotting the likelihood function I realized that the fast likelihood calculation was *very* noisy due to the way I calculated the shower and delta ray charge. Although it works well for single particles, it is not suitable for distinguishing which seed is the best when doing multi particle fits. Eventually I may be able to fix this, but for now we just do the normal likelihood calculation. I also decreased the number of shower points from 100 -> 10 to speed things up.
2019-05-24set THETA0_MIN to 1e-5tlatorre
Based on some testing it seems that when fitting muons the likelihood ratio and angular fits are better without a minimum theta0. I also determined during testing that the minimum value would cause a discontinuity in the derivative of the charge as a function of position which could cause the estimate of the direct charge to be worse.
2019-05-23write to stdout if no output file is specifiedtlatorre
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-05-23make float formatting consistent in sprintf_yaml_list()tlatorre
2019-05-23add 1e-10 to the angular pdfs to ensure that the CDF is strictly increasingtlatorre
2019-05-22fix a bug in previous committlatorre
Since we now calculate the expected charge from shower photons for muons we need to initialize the angular distribution and a few other things in particle_init().
2019-05-22add a function to compute the number of shower photons for muonstlatorre
Similarly to electrons, I fit an analytic form to the ratio of the number of photons produced via shower particles over the radiative energy loss. In this case, I chose the functional form: ratio = a*(1-exp(-T/b)) since the ratio seemed to reach a constant value after a certain energy. I then simulated a 10 GeV muon and it appears that the ratio might actually decrease after that, so for higher energies I may have to come up with a different fit function.
2019-05-22make sure theta0 is less than MAX_THETA0 in get_probability() to prevent a ↵tlatorre
gsl error
2019-05-22WATER_DENSITY -> HEAVY_WATER_DENSITYtlatorre
2019-05-14add --plot-likelihood option to fittlatorre
2019-05-13update method for calculating expected number of photons from shower and ↵tlatorre
delta rays This commit introduces a new method for integrating over the particle track to calculate the number of shower and delta ray photons expected at each PMT. The reason for introducing a new method was that the previous method of just using the trapezoidal rule was both inaccurate and not stable. By inaccurate I mean that the trapezoidal rule was not producing a very good estimate of the true integral and by not stable I mean that small changes in the fit parameters (like theta and phi) could produce wildly different results. This meant that the likelihood function was very noisy and was causing the minimizers to not be able to find the global minimum. The new integration method works *much* better than the trapezoidal rule for the specific functions we are dealing with. The problem is essentially to integrate the product of two functions over some interval, one of which is very "peaky", i.e. we want to find: \int f(x) g(x) dx where f(x) is peaked around some region and g(x) is relatively smooth. For our case, f(x) represents the angular distribution of the Cerenkov light and g(x) represents the factors like solid angle, absorption, etc. The technique I discovered was that you can approximate this integral via a discrete sum: constant \sum_i g(x_i) where the x_i are chosen to have equal spacing along the range of the integral of f(x), i.e. x_i = F^(-1)(i*constant) This new method produces likelihood functions which are *much* more smooth and accurate than previously. In addition, there are a few other fixes in this commit: - switch from specifying a step size for the shower integration to a number of points, i.e. dx_shower -> number of shower points - only integrate to the PSUP I realized that previously we were integrating to the end of the track even if the particle left the PSUP, and that there was no code to deal with the fact that light emitted beyond the PSUP can't make it back to the PMTs. - only integrate to the Cerenkov threshold When integrating over the particle track to calculate the expected number of direct Cerenkov photons, we now only integrate the track up to the point where the particle's velocity is 1/index. This should hopefully make the likelihood smoother because previously the estimate would depend on exactly whether the points we sampled the track were above or below this point. - add a minimum theta0 value based on the angular width of the PMT When calculating the expected number of Cerenkov photons we assumed that the angular distribution was constant over the whole PMT. This is a bad assumption when the particle is very close to the PMT. Really we should average the function over all the angles of the PMT, but that would be too computationally expensive so instead we just calculate a minimum theta0 value which depends on the distance and angle to the PMT. This seems to make the likelihood much smoother for particles near the PSUP. - add a factor of sin(theta) when checking if we can skip calculating the charge in get_expected_charge() - fix a nan in beta_root() when the momentum is negative - update PSUP_RADIUS from 800 cm -> 840 cm
2019-03-31switch back to using subplextlatorre
2019-03-31fix a few typos in interp2d()tlatorre
2019-03-31update test-find-peaks to plot cerenkov ringstlatorre
This commit updates the test-find-peaks script to plot Cerenkov rings for each of the peaks. It also updates the script to use quad to find the position instead of using the MC information. Finally, I added a -n argument to the script to specify how many peaks to draw.