Getting and building the code

  • The code can be checked out using:
    git clone ssh://
  • Setting. This sets by default root v5_30_00, boost v1_55_0 and some environmental variables.
    cd ppfx
  • Compiling. This process creates the PPFX library (lib/, executables programs (stored in the bin directory) and a doxygen page.
  • Note: PPFX core uses the environmental variable PPFX_DIR to locate the top directory of two subdirectories (called "data" and "uncertainties") and load them at run time. If you move these subdirectories, be sure to define PPFX_DIR correctly.

Quick example of running the code.

As an example, you can run "doReweight_dk2nu_original". It runs in 3 types:
Using a precalculated detector positions:

bin/doReweight_dk2nu_original [input_file] [output file] [options file] [idet]

Using a user input position:
bin/doReweight_dk2nu_original [input_file] [output file] [options file] [xpos] [ypos] [zpos]

By default, this calculates the flux at MINERvA. The inputs are:
  • [input file] : Some ntuples can be found at /pnfs/numix/flux/g4numi/v6/me000z200i/minervame (The same ntuples are also at /pnfs/nova/data/flux/g4numi/v6).
  • [output file] : will contains histograms of the central value and multi-universes.
  • [option file] : use "scripts/inputs_default.xml" for thin target based correction or "scripts/inputs_mipp_numi.xml" for primary thick target correction.
  • [idet] : index of the precalculated detector (look at the in the dkmeta tree of the g4numi ntuple)
  • [xpos], [ypos], [zpos] : position (cm) respect to the MC NuMI coordinate system to calculate the flux

About "idet": G4NuMI ntuples store an array of weights to get the flux at different detector positions (most of them at the center of the detector's front face). "idet" is the corresponding index in that array. To see the stored detector positions open a G4NuMI flux file and read the dkmetaTree (dkmetaTree->Show(0)). The convention for this index may change depending of the dk2nu version. For instance, for NOvA flux files:

  • 0: random
  • 1: MINERvA
  • 2: MINOS NearDet
  • 3: NOvA NearDet
  • 4: NDOS
  • 5: MiniBooNE
  • 6: MicroBooNE
  • 7: SciBooNE
  • 8: MINOS FarDet
  • 9: Nova FarDet

You can also calculate the ppfx weight and add it to a friend tree to the input tree. Use the executable "doReweight_dk2nu" (it needs some user modifications).

Looking inside doReweight_dk2nu_original.

Inside the macro "doReweight_dk2nu_original.C" there is a singleton called MakeReweight that handles all classes needed to do the job.

  • Create the instance:
    MakeReweight* makerew = MakeReweight::getInstance();
  • Set the option file (scripts/inputs_X.xml, where X = default or mipp_numi):
  • Feed them with dk2nu/dkmeta entries:
  • Get the vector of universes per reweighter:
    vwgt_mipp_pi = makerew->GetWeights(ReweighterName);
    The ReweitherNames are:
     -  MIPPNumiPionYields
     -  MIPPNumiKaonYields
     -  TotalAbsorption
     -  TargetAttenuation
     -  ThinTargetpCPion
     -  ThinTargetpCKaon
     -  ThinTargetnCPion 
     -  ThinTargetpCNucleon 
     -  ThinTargetMesonIncident
     -  ThinTargetnucleonA 
     -  Other
  • Do not forget release the memory used in the job after PPFX calculates the weights for all flux tuple entries:

About GIT

Notes on moving from CVS to Redmine GIT

GIT basics for PPFX

Some Results and Plots

These are some supporting plots for the results we published in Phys. Rev. D 94, 092005 (2016), i.e., NuMI LE beam prediction at MINERvA. These can be used as validation for anyone using PPFX for the first time.

Average number of hadronic Interactions per neutrino energy at MINERvA

Average number of hadronic Interactions per NuMI target material at MINERvA

Average amount of material traversed by the beam particles at NuMI per neutrino at MINERvA

NuMI flux prediction at MINERvA

Hadron production fractional uncertainties at MINERvA

Energy bin to bin correlation for all neutrino types at MINERvA

Muon neutrino and muon antineutrino integrated flux correlation at MINERvA


  • Neutrino Flux Prediction for the NuMI Beamline (thesis):
    Chapter 4: "Correcting the simulation using hadron production data" describes common definitions, explains in detail the procedure we followed to correct the hadron production, presents a survey of all existing relevant data for NuMI and describes their implementation. Particularly, Section 4.8 is dedicated to introduced PPFX as a computational framework that implements the procedure described in the chapter.
  • Calculating the NuMI Flux (JETP-Dec2015)
    Another useful source of information is the "Joint Experimental -Theoretical Physics Seminar" talk about "Calculating the NuMI Flux". From slide 42 to the end, the MINERvA strategy and results for calculating the flux based on PPFX are presented.

Alternative building using cmake

If you do not want to use "make", you can use cmake to build PPFX ( I checked these instructions with the NOvA framework, more general in the future):

  • Setup NOvA framework
  • Get PPFX from the git Redmine repository (see previous section)
  • In order to use cetbuildtools v7_00_03, we need to add the next product area:
    export PRODUCTS=/cvmfs/$PRODUCTS
  • Unsetup all UPS products:
  • Make a directory for building the code and move there.
  • Source setup:
    source [directory to the source code]/ups/setup_for_development -d
  • Run:

*You can access the legacy code (CVS):
Legacy code