Activity 1: Exploring Beam Simulations


Today's exercises will help you get familiar with the output of several Geant4-based beam simulations. These files contain rich information about neutrinos and other particles produced in the beamline. You'll look at the contents of a file, learn to plot the neutrino flux with and without weighting, learn a trick for visualizing the beam geometry that created the file, and use what you've learned to understand some 'mystery beam' files. Good luck!

By now, you should have received a Google Doc invite from Laura. Information and image files requested in bold below should be saved to that Google Doc. Talk to Laura if you have questions.


  1. Prepare a work area
    • Create a working directory somewhere in your linux filesystem where you can store simulated data and analysis scripts. For example, create a new directory in the home directory of the USPAS machine you are using, and then create a subdirectory there called "Activity_1". Once you are done, 'cd' to that directory.
  2. Inspect a flux file interactively
    • Download this file (by right-clicking and choosing 'Save Link As') to your working directory. It is 189 Mb and may take a few minutes to download on the slow hotel network. Open it using root. You may see some benign warnings as the file is opened:
      -bash-4.1$ root -l numi_flux.root 
      root [0] 
      Attaching file /pnfs/dune/persistent/users/ljf26/fluxfiles/g4numi/g4numiv6_minervame_me000z200i_94_0006.root as _file0...
      Warning in : no dictionary for class bsim::Dk2Nu is available
      Warning in : no dictionary for class bsim::Decay is available
      Warning in : no dictionary for class bsim::TgtExit is available
      Warning in : no dictionary for class bsim::NuRay is available
      Warning in : no dictionary for class bsim::Ancestor is available
      Warning in : no dictionary for class bsim::Traj is available
      Warning in : no dictionary for class bsim::DkMeta is available
      Warning in : no dictionary for class bsim::Location is available
      (TFile *) 0x3ebaae0
      root [1] 
    • Open a TBrowser:
      root [1] TBrowser T
    • Click through the various branches of the tree:
      • Double click the path of the file you opened underneath "ROOT Files" in the left panel
      • You will see three Tree names appears -- two copies of "dk2nuTree" and one copy of dkmetaTree.
      • Double click on each of the trees and look at the branch names to familiarize yourself with the structure/content of the tree. You only need to look at one of the 'dk2nuTree' tuples. I don't know why there are two copies of the same tree.
      • Some documentation of the dk2nu branches is available here .
  3. Run a ROOT macro that plots neutrino energy spectra
    • The neutrino flux ntuples contain a wealth of infromation about what neutrinos are simulated in a neutrino beam and how they are produced. Most neutrino physicists are interested only in number of neutrinos that pass through their detector and their energy speectrum. Here is a python script that plots the energy of all neutrinos produced in the beam and the neutrino energy spectrum at the MINERvA detector. Download that script to your working area and run it by typing:
    • Read through to understand what it does (you can do this using whateve text editor you like. If you aren't sure what you like, you can start with emacs 'emacs &'). Then view the files that it makes:
      display numi_flux_random.png  &
      display numi_flux_MINERvA.png &
    • Question 1: Compare to fluxes shown in the lectures, determine configuration of the NuMI beam numi_flux.root corresponds to.
    • Use the dk2nu documentation to determine all of the detector location weights that are available in the ntuple. Plot the flux at all of the locations.
    • Question 2: How do the fluxes at the various locations in numi_flux.root differ and why?

  4. Explore LBNF flux and importance weights
    • Use and this lbnf flux file to plot the LBNF flux at the DUNE far detector.
    • Question 3: How does the LBNF neutrino spectrum different from that of the NuMI spectrum you plotted earlier?
    • Question 4: How do the importance weights sculpt the DUNE neutrino flux?
  5. Use neutrino parent production vertex to inspect the geometry
    • Use to plot the production point of neutrino ancestors as a way to visualze the beam. Identify the features that you see.
    • Modify to image each of the three horns separately
    • Question 5: Provide image files showing each of the three LBNF horns.
  6. Diagnose some mystery beams
    • Download this tarball of flux files. This file is 3.9 GB, so now would be a good time to go get a cup of coffee. You can get and unpack it from the command line by doing:
      wget href=
      mv uspas_mysterybeams.tar?dl=0 uspas_mysterybeams.tar
      tar -xvzf uspas_mysterybeams.tar
      This will create a folder filled with flux files. The ones named "USPAS_Day1_DUNECDRReference" correspond to an older LBNF design that was based on the NuMI horns. All of the other files correspond to a (secret!) variation on that design. Use the skills you learned above to inspect flux files and visualize the geometries through parent production location to identify what has been changed in each simulation. Please skip the "Mystery7" beam -- there is not enough information in the file for you to identify the change that was made. Here are the things that might have changed: Target position, Decay pipe size, horn 1 position, horn 2 position, primary beam energy or profile
    • Question 6: Provide a plot of the ratio of each mystery beam's flux to the DUNECDRReference flux. Explain what changes you found in the simulation and why would correspond to the change in energy spectrum This one is hard. Just do your best!