Instructions for Running NuDST Related Code

Getting Setup to Start
Making NuDSTs:

    Making a single Full NuDST
    Making multiple NuDSTs using SAM
    Concatenating Full NuDSTs
    Making micro NuDSTs
    Making anti-neutrino NuDSTs
Making/Plotting Histograms:
    Making Standard Histogram Sets
    Plotting Standard Histograms
    Customising the analysis
Running the UK Matrix Method
Contact Details

This page describes how to run the various parts of the code, ranging from creation of the NuDSTs through to creating standards sets of pre-defined histograms.

Read this page to learn more about NuDSTs ntuples themselves:

Getting Setup to Start
Right from the top...

The MINOS software is mostly described here (although there is probably too much non-relevant information for you if you are reading this page):

Within that page there is a link to get MINOS software setup at FNAL, see here:
There is mention of a "test release":
which you will have to set up to use the NuMuBar and NtupleUtils packages.

To get the latest and greatest code then you should checkout the packages from minoscvs to your test release. Having the code in the test release will also allow you to apply your own customisations. To add the packages and compile the code do:
> cd yourtestrelease
> srt_setup -a
> addpkg -h NuMuBar
> addpkg -h NtupleUtils
> gmake clean
> gmake all

There is a general overview of the NuMuBar and NtupleUtils "NuDST"
ntuples/code here:
(links within state where to find NuMuBar group approved NuDST files).

Making a single Full NuDST
Firstly, determine the file that you want to process, then in generic form do:
loon -bq path/to/NuMuBar/macros/makeDst.C sntpfile.root

An example when running on is:
loon -bq /afs/fnal/files/home/room3/hartnell/mytest/NuMuBar/macros/makeDst.C dcache:dcap://

If you have a bunch of files on your local machine then wildcards work, e.g.
loon -bq path/to/NuMuBar/macros/makeDst.C f210*.root
The resulting output will be a single NuDST ntuple in a single file (providing that the output does not exceed the 2GB default file size limit).

Making multiple Full NuDSTs using SAM
The basic command is:
loon -bq 'path/to/NuMuBar/macros/makeDstSam.C("projectName",maxFiles)'

The main benefit of using SAM is that you don't have to know where the data is and you don't have to do nearly as much bookeeping.
In order to use SAM you basically have to run jobs at Fermilab.

A SAM "dataset" is essentially just a definition (e.g. sntp-near files between 2005 and 2006). A SAM dataset can be used to create a "snapshot", which is the list of files that satified the criteria given by the definition at the time that the snapshot was created (e.g. if additional files were processed and declared to SAM after the first snapshot was taken then you will have to create a second snapshot to pick them up).

Once you have a snapshot then you can create a "project". Each loon job is given the name of the project and the maximum number of files to process. The loon job asks the project to supply it with files up to the maximum specified. In order to process all the files in a project the number of loon jobs is simply: number of files in the project divided by maximum files per job.

In the NuMuBar/tools directory there is a script which can be used to create the datasets, snapshots and projects. Furthermore, can actually be used to submit the jobs to the batch farm.

Concatenating Full NuDSTs
To avoid having hundreds of files to shift around they can be concatenated:
loon -bq
This job is smart enough to take care of the POT counting as well as other metadata. It loops over the entire tree and is I/O bound during that step.

Making micro NuDSTs
Micro DSTs have just the pre-selection cuts appied to them. These are better for working with to optimise your own cuts. You can make them from the Full or Concatenated DSTs.

For the NuMuBar Charge Separation Systematics study we used this macro:
loon -bq 'path/to/NuMuBar/macros/microDstCSS.C("NuDSTFull*.root")'

To make a NuDST with all the CC-analysis pre-selection cuts applied (basically everything except NC-PID) do:
loon -bq 'path/to/NuMuBar/macros/microDstCC.C("NuDSTFull*.root")'

Making anti-neutrino NuDSTs
To be written...

Making Standard Histogram Sets
There are two jobs to create standard sets of histograms.
One with CC-analysis cuts:
loon -bq 'path/to/NuMuBar/macros/dstAnaCC.C("NuDSTFull*.root")'
and one with NuMuBar-analysis cuts:
loon -bq 'path/to/NuMuBar/macros/dstAnaNMB.C("NuDSTFull*.root")'

Plotting Standard Histograms
There is a suite of macros available for making standard plots using the standard histograms. The plotting macros access the standard histograms via NuMuBar/macros/FileListSpecial.C. Within this macro there are two functions of interest:
pecial::AddDataFile() and FileListSpecial::AddMCFile().
You should edit these functions so that they point at your standard histogram file.

Here is the sequence of steps to take:
1.) Add the name of your standard histogram file, say  "NMBSumAna21037002.root", to
Note that it doesn't actually have to be a data file. You can always put the MC file in AddDataFile().
2.) Run the various macros:
        loon NuMuBar/macros/mEnergy.C
        loon NuMuBar/macros/mXYZ.C
        loon NuMuBar/macros/mCuts.C
3.) Take the name of your second standard histogram file, say NMBSumAna00011231.root, and add it to:
Note that it doesn't have to always be a MC file. It can be a data file (although it depends on the macro).
4.) Run the various macros in data+MC mode with a "1":
        loon 'NuMuBar/macros/mEnergy.C(1)'
        loon 'NuMuBar/macros/mXYZ.C(1)'
        loon 'NuMuBar/macros/mCuts.C(1)'
You can save the canvases you want in the usual way from the File menu at the top right. There are many macros available in the NuMuBar/macros directory. Just try running them to see what they do.

Customising the analysis

Make sure you have NuMuBar in your test release (as detailed above). Then have a look at NuMuBar/NuDSTAna::StdNMBAna(). You can put your own cuts in the loops in that function.

Running the UK Matrix Method
Please see the separate webpage dedicated to Running the UK Matrix Method that describes all the steps involved and also how to create the standard files for the systematic studies.    

Contact Details
Please email Jeff Hartnell (j.j.hartnell AT with questions or comments.