Using Electrons in Analysis

Last update: 11 Mar 2024 [History] [Edit]

The following section will walk you through adding electrons to the analysis, applying selection cuts, and writing them to the output ntuple.

Add Electrons to your Job

We include electrons to our analysis by adding the following lines to your config.yaml file:

# Define analysis electron container, specify ID/Isolation working
# points, base pT/eta selection
Electrons:
  - containerName: 'AnaElectrons'
    WorkingPoint:
      - selectionName: 'loose'
        noEffSF: True
        likelihoodWP: 'LooseBLayerLH'
        isolationWP: 'Loose_VarRad'
    PtEtaSelection:
        minPt: 25000.0
        maxEta: 2.47

The Electrons line schedules electron calibration, scale factors and systematic variations. The containerName defines the container in which calibrated electrons that pass the selection are stored. The lines in the scope of WorkingPoint set requirements on the electron identification and isolation. Upon selection, the algorithm adds a decoration to each electron named baselineSelection_loose, where the loose selection name is prepended by baselineSelection_ automatically. It is saved as a char with a value of 0 or 1, indicating whether the electron passes the selection. The use of a char is to save disk space compared to using an int or bool.

The lines in the scope of PtEtaSelection apply some basic kinematic selection criteria for our electrons. We will not use electrons with pT < 25 GeV or |η| > 2.47. This algorithm checks whether each electron passes the pT and η requirements and decorates them with a flag called selectPtEta that we can access later to easily determine whether the electron passes the kinematic requirements.

To summarize what we’ve done here, including this block of text in the configuration file automatically retrieves the electron container from the xAOD and applies selection cuts based on the identification likelihood working point, isolation working point, pT and η. (All this code is contained in the block sequences in Python that are invoked by this text in the config file, which, in turn, contain the algorithms and tools in C++ that perform the actual selections.)

Write the electron information to the ntuple

To write the electrons to the output ntuple, we must specify their output thinning and their output container. Let’s start with their thinning block. Add the following lines of text to the config.yaml file:

# Apply object thinning and specify the name for the thinned container.
Thinning:
  - containerName: 'AnaElectrons'
    outputName: 'OutElectrons'
    selectionName: 'loose'

This block maps the input container being processed ('AnaElectrons') to its output container ('OutElectrons').

Now, we want top specify the branches of the output ntuple that map to the electron container. For this, modify the Output block in the config.yaml file to include:

        'el_': 'OutElectrons'

nested under containers:. Here, we specify that branches with electron information are denoted by the prefix el_ and contain information from the OutElectrons container we defined in the Thinning block.

Congrats, we have electrons!

Examine the output electrons

Now that we have added electrons to our ntuple, take a look at them. Open submitDir/data-ANALYSIS/dataset.root and look for el_* branches in analysis. Draw some of the kinematic branches to see their distributions.

tip Some of the electron branches end with _NOSYS while others do not. This suffix is used for the nominal values of variables that can have systematic variations. When systematics are enabled, you will see versions of these branches with different suffixes.

When you are satisfied with the result, commit and push your code changes.