This package reads neutrino flux universes produced by Package to Predict the Flux (PPFX), and extracts a neutrino flux prediction with corresponding uncertainties.
All analysis products are output to a .root file specified in a config.toml. The package will also produce figures as pdf, png, and a .tex, for the majority of the products stored in the ROOT file.
Before you begin, make sure you have the following prerequisites installed:
- Python 3.11 or later: Visit the official Python website at https://www.python.org/downloads/ to download and install the latest version of Python.
- ROOT 6.28 or later: Flux-Tool requires ROOT/PyROOT version 6.28 or later. You can obtain ROOT from the official ROOT website at https://root.cern/install/.
Flux-Tool is available for installation from PyPI, the Python Package Index. Follow the steps below to install the project:
-
Open your terminal or command prompt.
-
Create a virtual environment (optional but recommended):
$ python -m venv .venv
-
Activate the virtual environment:
$ source .venv/bin/activate -
Install Flux-Tool using pip:
$ pip install flux-tool
Modify the config.toml file to specify the input files and other analysis parameters.
$ flux_tool -h
usage: flux_uncertainties [-h] [-c CONFIG] [-p PRODUCTS_FILE] [-v] [-z] [--example-config]
This package coerces PPFX output into a neutrino flux prediction with uncertainties, and stores various spectra related to the
flux, e.g., fractional uncertainties, covariance matrices, etc.
options:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
specify the path to a toml configuration file
-p PRODUCTS_FILE, --plots-only PRODUCTS_FILE
Specify path to an existing ROOT file for which to produce plots
-v, --verbose
-z, --enable-compression
Enable compression of the output plots directory
--example-config Print an example configuration fileAlternatively, this package can be imported directly:
import flux_toolSee example_nb.ipynb for a demonstration of how to use the package.
If provided to flux_tool, copies of the systematically altered neutrino flux samples, including the nominal, are stored here.
Fractional shifts from the nominal, calculated for each flux sample in beam_samples.
Contains all covariance and correlation matrices, organized into two subdirectories: one for hadron effects and another for beam effects (if applicable). Each covariance matrix is stored in 2 forms:
TH2D(prefixedhcov_orhcorr_)TMatrixD(prefixedcov_orcorr_) Covariance matrices with the_abssuffix are in absolute units of the flux, whereas those without the suffix are normalized the PPFX universe mean, in the case of hadron systematics, or to the nominal beam run, in the case of the beam line systematics. Each bin is labeled according to the combination of horn polarity, neutrino flavor, and energy bin number, e.g.,fhc-nue-1.
This directory holds a set of TH1D for each neutrino mode. The flux value is
extracted as the PPFX mean, while the uncertainties incorporate statistical,
hadron systematic, and beam line systematic (if applicable) uncertainties.
This directory contains two subdirectories, beam and hadron, containing the fractional contributions to the flux uncertainty for each effect.
This directory houses the outputs of the Principal Component Analysis of the hadron covariance matrix.
eigenvectors/hevec_*Unit eigenvectorsprincipal_components/hpc_*principal components scaled by the square root of the corresponding eigenvalue and transposed into bins of neutrino energyhcov_pcareconstructed hadron covariance matrix used for validation purpose.heigenvalsEach bin of this histogram (TH2D) holds the eigenvalues extracted from the PCAheigenvals_fracsame as the previous, but each eigenvalue is divided by the sum of all eigenvalues such that each eigenvalue is represented as its contribution to the total variance.
Directory containing the PPFX-corrected neutrino spectra. These histograms
are produced by calculating the means and sigmas of the flux distributions across
the 100 universes contained in ppfx_output.
Directory containing TH1D for each horn-neutrino flavor combination, the bins of which contain weights that can be used to apply the PPFX flux correction.
Contains the original output received from PPFX, organized into two subdirectories corresponding to Forward Horn Current (FHC) and Reverse Horn Current (RHC). Each contains a nom subdirectory which holds the nominal (uncorrected) neutrino flux vs. energy spectrum, hnom_nu*, in addition to the PPFX central value, hcv_nu. Spectra broken down by parent hadron can be found under the parent subdirectory. The remaining subdirectories hold the universes for each hadron production
systematic:
Directory containing statistical uncertainties for every horn-neutrino flavor combination. Histograms with the suffix _abs are in absolute units of the flux, and those without the suffix are in the fractional scale. The two matrices, hstatistical_uncertainty_matrix and statistical_uncertainty_matrix, are diagonal TH2D and TMatrixD, respectively, organizing the statistical uncertainties into a useful form to be added with covariance matrices.
TMatrixD correlation matrix incorporating all sources of uncertainty
TMatrixD covariance matrix in units of the flux, incorporating all sources of uncertainty
TH2D correlation matrix incorporating all sources of uncertainty
TH2D covariance matrix in units of the flux, incorporating all sources of uncertainty
TAxis with the binning and labels of all matrix axes
TAxis containing the binning applied to all spectra w.r.t.