This page is intended to be a first attempt at producing a very simple highland2 analysis tutorial, mostly based on Ben Smith’s original highland documentation.
Prerequisites
The tutorial assumes you’ve correctly installed and compiled highland2 following the instruction provided here. Please do this first if you have not already.
Useful Links
The following are links to the highland2 tutorials given by Anselmo in the past:
Setting up your CMT package
Before writing your analysis, you need to create a cmt package to hold it. You should make this in the highland2 directory, so you can commit it if necessary. For this tutorial we will assume the package we are working on is called simpleAnalysis
.
First ensure you are in the directory containing your highland2 installation:
$ cd /home/t2k/user/path/to/highland/installation
Then create your package new cmt package:
$ cmt create highland2/simpleAnalysis v0r0
Move into the associated cmt
directory:
$ cd highland2/simpleAnalysis/v0r0/cmt
And edit the requirements
file to look like the following (plain text):
Ensure your capitalisation is consistent when editing this file to replace simpleAnalysis
with your own. Any instances of simpleAnalysis
should be replaced with your package name. Any instances of SIMPLEANALYSIS
should be replaced with your package name in all capitals.
Finally, configure and setup your analysis package. Still within the cmt
directory run:
$ cmt config; source setup.sh
Setting up the analysis infrastructure
It is recommended that all analyses using the highland2 framework have the same basic structure for their files. Having each analysis use the same structure makes it a lot easier for other people to understand your code. The basic structure we will set up is below. Remember to replace “simpleAnalysis” with something sensible, useful and descriptive.
- app
- RunSimpleAnalysis.cxx: Analysis executable, essentially empty.
- parameters
- simpleAnalysis.parameters.dat: Run time parameters (optional).
- src
- simpleAnalysis.hxx(.cxx): Steering code where we choose our selection and fill the output trees.
- simpleSelection.hxx(.cxx): Cuts and actions to perform your selection.
- simpleUtils.hxx(.cxx): Utility functions for the analysis (optional).
- simpleSystematics.hxx(.cxx): Functions for propagation of analysis specific systematics (optional).
Please, please try and stick to this basic structure.
We’ll now implement the most striped down copies of the necessary files that we can.
Contents
src/simpleAnalysis.hxx
Create the file simpleAnalysis.hxx
within the src
directory and edit to look like the following (plain text):
src/simpleAnalysis.cxx
Create the file simpleAnalysis.cxx
within the src
directory and edit to look like the following (plain text):
src/simpleSelection.hxx
Create the file simpleSelection.hxx
within the src
directory and edit to look like the following (plain text):
src/simpleSelection.cxx
Create the file simpleSelection.cxx
within the src
directory and edit to look like the following (plain text):
src/RunSimpleAnalysis.cxx
Create the file RunSimpleAnalysis.cxx
within the app
directory and edit to look like the following (plain text):
Test compilation
We now have all the infrastructure in place for starting to code the analysis. Before we add our own custom code, we should check that things compile.
Go to the cmt
subdirectory, and add the following line at the end of the requirements
file:
application RunSimpleAnalysis ../app/RunSimpleAnalysis.cxx
This line tells the compiler to convert the app/RunSimpleAnalysis.cxx
file into the RunSimpleAnalysis.exe
executable.
After making the change, run
$ source setup.sh; cmt broadcast cmt make
Your application should now have (hopefully) compiled, and you should be able to run the RunSimpleAnalysis.exe
application. Run the following command and you should be greeted with a usage statement.
$ RunSimpleAnalysis.exe
More to follow soon…