aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Expand)Author
2020-11-30update code to work with python3tlatorre
2020-11-16update fit to fit events from the salt phasetlatorre
2020-11-16add jdy, ut1, ut2, dte, and hmsc to hdf5 output filetlatorre
2020-11-01update qhl ratiotlatorre
2020-06-22update neck cuttlatorre
2020-05-11delete an empty line in e_water_liquid.txttlatorre
2020-04-14extend electron range tables up to 1 TeVtlatorre
2020-04-13fit for up to 5 peakstlatorre
2020-04-13update fit to fit each event twice with different quad quantilestlatorre
2020-04-13update find_peaks algorithmtlatorre
2020-04-13add probability of a miscalibrated channel to the likelihoodtlatorre
2020-02-10fix formula for calculating b for position distribution of light from electro...tlatorre
2020-02-10fix small memory leak in get_expected_photons()tlatorre
2020-01-06add ctrl-z handler to allow you to skip eventstlatorre
2019-12-12update get_expected_photons()tlatorre
2019-12-12fix typo in bisect_energy() where I forgot to use the actual distance to the ...tlatorre
2019-12-04update submit-grid-jobs and cat-grid-jobstlatorre
2019-12-02add another minimization step with SBPLXtlatorre
2019-11-24update get_expected_charge to not skip calculating the charge if the angle is...tlatorre
2019-11-20update PMT types for PMTs which disagree between snoman.ratdb and the PMT banktlatorre
2019-11-18update get_expected_charge() to always use the index of refraction for d2otlatorre
2019-11-18add a new test for the quad fittertlatorre
2019-11-18clear any flags except for PMT_FLAG_DQXX in get_event()tlatorre
2019-11-18switch to using pt1 instead of the ptmtlatorre
2019-11-18switch to using twice the PSUP reflection time for the time PDFtlatorre
2019-11-18initialize mu_indirect to 0tlatorre
2019-11-18fix bug due to roundoff error in get_{delta_ray,shower}_weights()tlatorre
2019-11-18add nhit_cal to the HDF5 filetlatorre
2019-11-18size_t -> int in is_slot_early()tlatorre
2019-11-18fix bug in quad causing it to always return 0 when f was less than 1tlatorre
2019-11-06add a couple of improvements to the quad fitter and fix a bug in get_hough_tr...tlatorre
2019-11-05update guess_energy()tlatorre
2019-09-30update flasher cut to only check for normal PMTstlatorre
2019-09-30update flasher cuttlatorre
2019-09-30write out run header info to the hdf5 filetlatorre
2019-09-27update the flasher cuttlatorre
2019-09-26update QVNHIT cuttlatorre
2019-09-24update zebra code to store location of MAST banktlatorre
2019-09-24update breakdown cut to include a cut on the number of calibrated PMT hitstlatorre
2019-09-24update shower position distribution parameters for muonstlatorre
2019-09-23add sub_run variable to the events array in the HDF5 filetlatorre
2019-09-23update the ITC cut to use pt1 timetlatorre
2019-09-21update definition of nhittlatorre
2019-09-10add best_uncal_q to the pmt_hit struct and use it in the muon cuttlatorre
2019-09-09fix typo in is_slot_earlytlatorre
2019-09-09update muon cuttlatorre
2019-09-09update fit to allow t0 to be negativetlatorre
2019-09-09fix a gcc warningtlatorre
2019-09-09update is_slot_early() to hopefully catch more flasherstlatorre
2019-09-09add a first draft of a data cleaning cut to detect breakdown eventstlatorre
t ================ $ curl -O -L https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz $ tar -xzvf v2.5.0.tar.gz $ cd nlopt-2.5.0 $ mkdir build $ cd build $ cmake -DCMAKE_INSTALL_PREFIX=$HOME/local .. $ make $ make install To use gsl and nlopt installed locally, you will have to edit the Makefile and add the following to the CFLAGS and LDLIBS variables: CFLAGS=-I$(HOME)/local/include LDLIBS=-L$(HOME)/local/lib -L$(HOME)/local/lib64 and also edit the -lnopt_cxx line to just be -lnlopt. You will also need to edit ~/.bash_profile and add the following line: export LD_LIBRARY_PATH=$HOME/local/lib:$HOME/local/lib64 Installing NLopt for the grid ============================= When running the fitter on the grid, it's necessary to compile NLopt as a static library. $ curl -O -L https://github.com/stevengj/nlopt/archive/v2.6.1.tar.gz $ tar -xzvf v2.6.1.tar.gz $ cd nlopt-2.6.1 $ mkdir build $ cd build $ cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_INSTALL_PREFIX=$HOME/local -DBUILD_SHARED_LIBS=OFF .. $ make $ make install and then you have to edit the Makefile to add: CFLAGS=-fdiagnostics-color -O2 -Wall -g -DSWAP_BYTES -I/home/tlatorre/local/include LDLIBS=-fdiagnostics-color -lm -L/home/tlatorre/local/lib64 -l:libnlopt.a -L/home/tlatorre/local/lib -l:libgsl.a -l:libgslcblas.a -lstdc++ Fitting Events ============== You can fit events from SNOMAN data structure files by running the following command: $ ./src/fit [input file] -o [output file] and then plot the fit results by using the plot script: $ ./utils/plot.py [output file] The plot script relies on the MC information in the SNOMAN file, so make sure that SNOMAN is set up to output MC info when you simulate events (see the next section). Simulating Events with SNOMAN ============================= Since the fitter reads in SNOMAN data structures it is necessary to use a command file which correctly specifies the output file format. To benchmark the fit results it is also necessary to save the initial MC vertex information. I have created a template command file in macros/mc_run_10000.cmd which simulates run 10000 from the D2O phase. You can create a proper command file to run SNOMAN with by running the snogen program which uses a simple templating system to fill in some variables in this template. For example to simulate 100 1 GeV muons uniformly distributed throughout the AV and with isotropic directions you can run: $ ./macros/snogen -p mu_minus -e 1000.0 -n 100 | /path/to/snoman.exe See the comment at the top of ./macros/snogen for more information. Debugging ========= To debug memory issues you can compile everything with an address sanitizer. Edit the Makefile and add the following flags: CFLAGS=-fsanitize=address LDLIBS=-fsanitize=address Then, recompile: $ make clean $ make and run the fitter. It should crash if there is a buffer overflow or use after free bug. You can also run the fitter with valgrind to search for memory leaks: $ valgrind --leak-check=full ./src/fit [input file] Profiling ========= To profile the code, you can use the linux perf command along with Brendan Gregg's flamegraph software to produce a flame graph. First run the fitter: $ ./src/fit [input file] Then, identify the PID of the fit program and run: $ sudo perf record -F 99 -p [PID] --call-graph dwarf -- sleep 10 Then, you can see the results by running: $ perf report or to create a flame graph (see https://github.com/brendangregg/FlameGraph): $ sudo chown [username]:[username] perf.data $ perf script > out.perf $ stack-collapse.pl out.perf > out.folded $ flamegraph.pl out.folded > kernel.svg