Project

General

Profile

Booster Neutrino Beam Simulation project

The current version is based on the MiniBooNE BooNEG4Beam. The original code can be found under BooNE-BackTrack subproject. The old code has been cleaned up, partly rewritten and rearranged to get it up to date and working against current versions of geant4. Wiki_old covers some of the validation work by Paul Lebrun while transitioning. There are two repositories within the main project page, one used during the upgrade (booster-neutrino-beamline) and one with the final working version where code has been further restructured (booster-neutrino-beamline-g4bnb).

Downloading the G4BNB code

G4BNB software is maintained in a git repository associated with this redmine project. You may clone this repository anonymously and without authentication but in order to push commits back you must be authenticated. See About this redmine for details on authentication.

Authenticated clone (i.e., allows to modify the software and upload your modification on this site, via git push):

$ git clone ssh://p-booster-neutrino-beamline@cdcvs.fnal.gov/cvs/projects/booster-neutrino-beamline-g4bnb

Anonymous clone (no push):

$ git clone http://cdcvs.fnal.gov/projects/booster-neutrino-beamline-g4bnb/

For help with git see Git Help. To check out a fixed release of g4bnb (which is recommended for large production runs) into a directory with the name of the tag, you can do:

$ git clone ssh://p-booster-neutrino-beamline@cdcvs.fnal.gov/cvs/projects/booster-neutrino-beamline-g4bnb/ <tag_name>
$ cd <tag_name>
$ git checkout <tag_name>

You can see a list of available tags by doing:
$ git tag

Building G4BNB at Fermilab

Use setup_g4101.sh in scripts directory to setup products required to run and analyze BNB MC.

source scripts/setup_g4101.sh

cd into build directory and run:

cmake ../
make -j4
make install

Submit grid jobs

To submit grid jobs use submitBeam.py script:

usage: submitBeam.py [-h] -n [1-10000] -b BIN -i INPUT -g GEOMETRY
                     [-c HORNCURRENT] [-j JOBID] [-o OUTPUTPATH] [-p POT]
                     [-r RANDOMSEED] [-d]

Submit beam MC jobs.

optional arguments:
  -h, --help            show this help message and exit
  -n [1-10000]          Number of jobs to submit.
  -b BIN, --bin BIN     Path to beam g4 executable. Bin dir where exe files
                        are installed.
  -i INPUT, --input INPUT
                        Job options input file.
  -g GEOMETRY, --geometry GEOMETRY
                        GDML geometry file
  -c HORNCURRENT, --horn-current HORNCURRENT
                        Horn current in A. If specified overwrites
                        /boone/field/horncurrent and
                        /boone/field/skin/SkinDepthHornCurrent commands.
  -j JOBID, --jobidoffset JOBID
                        Id for running job. If submitting multiple jobs each
                        one is offset by its process number (0..n)
  -o OUTPUTPATH, --output-path OUTPUTPATH
                        Path where to copy final output.
                        (default=/pnfs/uboone/scratch/users/${USER}/beammc)
  -p POT, --pot POT     Protons on target per job. If specified overwrites
                        /run/beamOn command.
  -r RANDOMSEED, --random-seed RANDOMSEED
                        Random seed RS. Each process gets seed=$((PROCESS+RS))
  -d, --debug           Will not delete submission files in the end. Useful
                        for debugging and will only print the submission
                        command on screen.

Example to submit 100 jobs with 50000 POT each using production.in input file as template (note that submitBeam.py overrides POT, horn current and geometry):

bin/v4_10_1_p03/submitBeam.py -n 100 -b bin/v4_10_1_p03/ -i input/production.in -g geometry/BooNE_50m.gdml  -p 50000

Analyzing beam MC

The output of the beam MC are dk2nu beam ntuples. Code to produce standard set of histograms is in scripts/beamHist.cc and gets compiled with beam MC.

Options:
  -h [ --help ]                     Print help message
  -i [ --input ] arg                Path pattern for input files. Put it in 
                                    quotes or escape *.
  -o [ --output ] arg (=hist.root)  Output file name.
  -p [ --pot ] arg                  POT used for normalization (overides 
                                    counting using info in meta tree and speeds
                                    up process). 
                                    Total POT should be given (number of files 
                                    X POT per file).
  -n [ --nredecays ] arg (=1)       Number of redecays.
  -r [ --detector-radius ] arg (=0) Detector radius (in cm).
  -x [ --detector-position ] arg    Detector position (in cm).
  -t [ --thread ] arg (=1)          Number of threads to run. (max set to 8)

Example to produce histograms from previously generated jobs:

bin/v4_10_1_p03/beamHist -i /pnfs/uboone/scratch/users/${USER}/beammc/production_BooNE_50m_I174000A/\*/\*root -r 610 -x 0 189.614 54134 -t4 -o hist_miniboone.root

This might take a while if analyzing many jobs. submitBeam.py actually produces histogram files using beamHist command for sbnd, uboone, miniboone, icarus locations:

x/cm y/cm z/cm r/cm
sbnd 0 0 11000 200
uboone 0 0 47000 200
miniboone 0 189.614 54134 610
icarus 0 0 60000 200

One can merge those histograms to save some time. For this use mergeHist.py script:

usage: mergeHist.py [-h] -i INPUT [-o OUTPUT] [-l LOCATION]

Merge beam MC histograms.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Path to top directory containing histograms to merge.
  -o OUTPUT, --output OUTPUT
                        Output root file.
  -l LOCATION, --location LOCATION
                        Used to pick the correct hist file. (grid jobs create
                        sbnd, uboone, icarus, miniboone by default.)

For example to merge histograms from previously ran jobs:

bin/v4_10_1_p03/mergeHist.py -i /pnfs/uboone/scratch/users/${USER}/beammc/production_BooNE_50m_I174000A/  -l miniboone

This creates hist_miniboone.root. Merge script scales histograms dividing out the number of files so normalization is always the same.

Making plots

Histograms can be plotted in the usual way using root.
compare.py script is provided that can overlay multiple histograms and produce standard set of plots.

usage: compare.py [-h] -d DATA -c COMPARE [COMPARE ...] [-o OUTPUT]
compare.py: error: argument -d/--data is required

Example to compare to the original MiniBooNE flux histogram:

bin/v4_10_1_p03/compare.py -d validation/april07_baseline_rgen610.6_fixrnd_20171212.root -c hist_miniboone.root -o miniboone_plot.pdf

Multiple histogram files can be listed after -c option and those will all be compared to file under -d option.