Skip to content

Add geane and pdf evaluator

BoukeJisse Jung requested to merge add_pdf_evaluator into master

Short summary

  1. Move <jppy>/jppy/ and <jppy>/jpp/ to <jppy>/src/ and move <jppy>/src/*.cc to <jppy>/src/jppy/.
  2. Addition of <jppy>/src/jppy/geane.cc for computing muon energy losses.
  3. Addition of <jppy>/src/jppy/pdf_evaluator.py, providing a common interface to evaluate the muon and shower PDFs on an event-by-event basis.
  4. Addition of <jppy>/src/jppy/constants.cc for facilitating python-access to the constants in <Jpp>/software/JPhysics/JConstants.cc
  5. Additional tests in <jppy>/tests/
  6. Update URL in <jppy>/scripts/get_pdfs.py.
  7. Add setup.cfg.

Description

The changes presented in this merge request provide several methods which can be used to evaluate the muon and shower PDFs on an event-by-event basis using a common interface. These methods can be used in combination with other km3py packages, for example with km3pipe to plot the PDF values of the hits in a given event that is stored in an offline file.

The most important changes include the addition of <jppy>/src/jppy/geane.cc and <jppy>/src/jppy/pdf_evaluator.py.

The former file provides methods which can be used to calculate muon energy losses over given distances and for a given initial energies. These methods are necessary for computing the muon PDF values correctly for e.g. offline file events, because the track energies stored in the offline files correspond to those at the neutrino interaction vertex (for neutrino interactions) or at the starting point of the muon (for traversing muons), whilst the energy which needs to be given as argument to the muon PDF evaluator corresponds to the energy at the closest distance of approach to any given PMT.

The second file <jppy>/src/jppy/pdf_evaluator.py provides the aforementioned common interface to evaluate the muon and shower PDFs on an event-by-event basis. It splits the evaluation of the PDFs up into two parts. The first part consists of setting all event-level parameters which are necessary to evaluate the PDFs, i.e. the energy of the shower/muon at the interaction vertex or starting point and the time of the event. These have been implemented as properties of the PDF evaluator objects and can be specified e.g. as follows:

from os import expandvars
import jppy

evaluator = jppy.pdf_evaluator.ShowerPDF(expandvars("$JPP_DATA/J%p.dat"))

evaluator.energy = 10 # GeV
evaluator.t0 = 5 #ns

The second part of the evaluation corresponds to a function call in terms of the rest of the PDF parameters, i.e. the hit observables (hit distance, direction angles and time-residuals). Continuing from the example snippet above:

distance = 10 #m  
cosine_d = 0.1
theta_pmt = 0.2 #rad
phi_pmt = 0.3 #rad
t_obs = 8 #ns

result = evaluator.evaluate(distance, cosine_d, theta_pmt, phi_pmt, t_obs)

This interface mostly comes in handy when computing the pdf values for all hits in an event simultaneously, for example using map():

results = list(
                map(
                    evaluator.evaluate,
                    hit_distances,
                    hit_cosines,
                    theta_pmts,
                    phi_pmts,
                    hit_times
                )
            )

In addition to the above the folder structure and the build system for the <jppy> package has been revamped. The directories <jppy>/jpp/ and <jppy>/jppy/ have been moved into <jppy>/src/. Furthermore, most of the option defaults for setup.py have been transferred to a dedicated ini file at <jppy>/setup.cfg, similar to the other km3py packages.

Other changes in this merge request include the addition of several new tests and an update of the URL from which the Jpp PDFs are fetched in <jppy>/scripts/get_pdfs.py, as

Edited by BoukeJisse Jung

Merge request reports