Using Muons in Analysis

Last update: 16 Aug 2024 [History] [Edit]

The following section will walk you through scheduling the muon analysis sequence, applying selection cuts, and writing them to the output ntuple. It follows the electron procedure closely, so many of the steps will not be spelled out explicitly.

Add Muons to your Job

Begin by scheduling the muon analysis sequence. Do this by adding the following lines to the config.yaml file:

# Define analysis muon container, specify Quality/Isolation working
# points, base pT/eta selection
Muons:
  - containerName: 'AnaMuons'
    WorkingPoint:
      - selectionName: 'medium'
        noEffSF: True
        quality: 'Medium'
        isolation: 'Loose_VarRad'
    PtEtaSelection:
        minPt: 27000.0

This schedules the implementation of muon identification and isolation requirements, momentum corrections, and the calculation of muon scale factors and systematic variations.

tip The muon sequence uses a selectionName of medium, which means the resulting decoration is baselineSelection_medium.

Write muon information to the ntuple

As we did with electrons, we want to ensure that the muon information is written to our final output. To do so, we will add to the existing Thinning and Output blocks in config.yaml file. Let’s start with the thinning block. Add the following lines to the Thinning block, indented the same amount as the electrons information:

  - containerName: 'AnaMuons'
    outputName: 'OutMuons'
    selectionName: 'medium'

Finally, add:

        'mu_': 'OutMuons'

nested withing containers: in the Output block. Be sure to indent this line as much as is the corresponding line for the electron containers.

Rerun your code, then re-examine your data ntuple. You should now be able to see new branches corresponding to muon information. Commit and push your changes when everything is running correctly.


⭐️ Bonus Exercise

Try different muon working points and see how much of an effect it has on your output.