HighLAND
How to analyse events with the micro-tree and the DrawingTools

This page documents how to analyse the information stored in the micro-tree produced by your analysis executable. The example commands assume you have an output file called microtree.root from running your analysis macro.

Main concepts

The micro-tree files can be analysed either in an interactive ROOT session, or using a simple ROOT macro. The complicated plotting logic is taken care of through the DrawingTools, DataSample and Experiment classes, which can be used directly in your ROOT session.

In basic terms, the DataSample class represents a single data or MC sample. It handles reading in the correct information from a micro-tree file, and the DrawingTools class handles plotting that information. The Experiment class allows combining several data and MC samples, taking into account the correct normalization between them. This is specially useful for treating in a coherent way several data taking periods.

Detailed info on how to create and use the DrawingTools, DataSample and Experiment classes can be found in the DrawingTools page.

The TTree's in the output file

The ouput root files contain header and config trees which hold information relevant to the analysis that was performed, including POT information, the name of the cuts and actions that were applied, the meaning of each variable in the micro-tree, and more. These trees are read in automatically when you instantiate the DrawingTools in your macro. There are useful functions in the DrawingTools which allows you to dump on the screen useful information about cuts, variables, etc.

The main trees in the output file are the default and truth trees. The default tree contains all selected events (the ones that passed a given cut, ussualy specified in the parameters file). This is the tree used to optimise the selection cuts, to make selection plots and to compute or plot the purity of the selection. The main reason for having a separate tree, call truth, is to allow the efficiency computation. The default tree does not contain all true signal events, because it will be too big. The preselection for that tree is only based in reconstructed quantities (selection cuts). Instead, to compute true signal efficiencies we need all true signal events to be present in the output tree. The truth tree fullfils this condition. Since, in general, this tree will contain many events, only a reduced set of variables (the ones needed to compute the efficiency) is stored in that tree.

Before you start

Before analysing events, you MUST source setup.sh in your analysis' cmt directory. Doing this does some ROOT magic so that it "knows" about the classes we will be using. This means that you don't have to load any libraries in order to use the DrawingTools, DataSample and Experiment classes - ROOT will automatically know about them.

Drawing a basic distribution

The below macro is all that is needed to make a simple plot, showing the momentum of tracks that passed the first 3 cuts of an analysis. The plot will be drawn as a stacked histogram, broken down by the true particle associated with the selected reconstructed track.

Note the unusual syntax for specifying the number of cuts that must be passed! See the Cut information section for more.

{
DrawingTools draw("microtree.root");
DataSample mc("microtree.root");
draw.Draw(mc, "mom", 50, 0, 5000, "particle", "accum_level>2");
}

You can either type to code between the braces into an interactive ROOT session, or save the code (including the braces!) as a macro file (say, momentum.C), and then run root momentum.C.

Cut information

Cut names are stored in the output .root file, and more specifically into the "config" tree . You can see the list of cuts by typing

draw.DumpCuts()

Utility functions are provided to plot the event reduction, efficiency and purity of the sample as a function of the cut.

{
DrawingTools draw("microtree.root");
DataSample mc("microtree.root");
// event reduction
draw.DrawEventsVSCut(mc);
// true muon selection purity
std::string signal = "particle==13";
draw.DrawPurVSCut(mc, signal);
// true numu CCQE selection efficiency
// using the truth tree
std::string numuCCQE = "nu_truereac == 1";
draw.DrawEffVSCut(mc, signal);
}

Normally, you will want to plot histograms of the events that passed certain cuts. The syntax for this was mentioned above, and is repeated here as the last argument to the DrawingTools::Draw() function:

draw.Draw(mc, "mom", 50, 0, 5000, "particle", "accum_level>2");

accum_level is the variable that store the accumulated number of cuts passed by events in the micro-tree. Events that passed the event quality cut would be selected with accum_level>0". One way to think about the numbering is that you would select the events that failed cut 4 by specifying accum_level==4. So to select events that passed cut 4, you need to do accum_level>4.

highland2 supports analyses with multiple branches (i.e. having multiple distinct selection criteria - say, an analysis that has CC0pi, CC1pi and CCNpi branches), and is stored as an array. If you have multiple branches you need to specify the branch you want to plot. For example:

draw.Draw(mc, "mom", 50, 0, 5000, "particle", "accum_level[][0]>2");

The first number (0) is the branch to look at - if your analysis only has 1 branch, then this will always be zero! The second number (after the > sign) is the number of cuts that must be passed.

If no branches were defined, there will be only one branch. In that case accum_level[][0]>2 and accum_level>2 have the same effect.

highland2 also supports analyses with multiple selections (each of which may have several branches), and is stored as an array. If you have multiple selections you need to specify the selection you want to plot. For example:

draw.Draw(mc, "mom", 50, 0, 5000, "particle", "accum_level[][0][0]>2");

will do the plot for branch 0 (third index) in selection 0 (second index).

POT information

POT information for both data and MC files can be accessed through the DataSample.

{
DrawingTools draw("microtree.root");
DataSample mc("microtree.root");
draw.DumpPOT(mc);
}
// Gives following output for a T2K ND280 file:
Initial POT........... 5e+17
|-- Bad Beam.......... 0
|-- Bad ND280......... 0
|-- Total Good POT.... 5e+17
|-- @ 0KA........... 0
|-- @ 200KA......... 0
|-- @ 250KA......... 0
|-- @ Other power... 0

There is also the option to automatically calculate the POT ratio between two samples. This is used to automatically scale MC files to data POT when plotting them on the same canvas.

{
DrawingTools draw("microtree1.root");
DataSample mc1("microtree1.root");
DataSample mc2("microtree2.root");
double ratio = draw.GetPOTRatio(mc1, mc2);
}

Handling multiple data periods with the Experiment class

The Experiment class allows to make data-MC comparison plots with separated data-MC sample pairs for each data taking period, taking into account the proper POT normalization between data and MC for each run. Detailed information can be found here.

All you need to know about the DrawingTools

The DrawingTools class allows you to do all kind of analysis plots. For a detailed description of all available functions and options click here.