Now let’s add jets to our analysis. We will apply a calibration, the JVT selection, and cuts on pT and η before writing their four momenta to the output ntuple.
Begin by scheduling the jet analysis sequence. Do this by adding
the following lines to makeSequence()
in MyAnalysisAlgorithms.py
near the other object analysis sequences:
# Include and set up the jet analysis sequence:
from JetAnalysisAlgorithms.JetAnalysisSequence import makeJetAnalysisSequence
jetContainer = 'AntiKt4EMPFlowJets'
jetSequence = makeJetAnalysisSequence( dataType, jetContainer,
runGhostMuonAssociation = True, shallowViewOutput = False )
jetSequence.configure( inputName = jetContainer,
outputName = 'AnaJets_%SYS%' )
# Add the jet analysis sequence to the job:
algSeq += jetSequence
This schedules the implementation of jet calibration and systematic
uncertainties. It also implements the JVT selection by applying a
decoration called jvt_selection
.
Now let’s apply some basic selection criteria for our jets. We want to only select jets with pT > 50 GeV and |η| < 4.5.
Define the following variables in MyAnalysisAlgorithms.py
:
jetMinPt = 50e3 # Minimum pt in MeV
jetMaxEta = 4.5
Put the following lines in makeSequence()
after the electron selection
algorithm:
# Include and set up jet selection algorithm:
selAlgJet = createAlgorithm( 'CP::AsgSelectionAlg', 'UserJetSelectionAlg' )
addPrivateTool( selAlgJet, 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
if jetMinPt is not None :
selAlgJet.selectionTool.minPt = jetMinPt
if jetMaxEta is not None :
selAlgJet.selectionTool.maxEta = jetMaxEta
selAlgJet.selectionDecoration = 'selectPtEta,as_char'
selAlgJet.particles = 'AnaJets_%SYS%'
# Add the jet selection algorithm to the job:
algSeq += selAlgJet
The jvt_selection
decoration requires an additional step to use.
To do this, we will add an algorithm that summarizes the jet criteria
as a single decoration that we will call preselection
. To do this,
add the following code to makeSequence()
after the object selection
algorithms but before return algSeq
:
# Schedule preselection summary algorithms
preselAlgJet = createAlgorithm( 'CP::AsgSelectionAlg','JetPreelectionAlg' )
preselAlgJet.preselection = 'selectPtEta,as_char&&jvt_selection'
preselAlgJet.particles = 'AnaJets_%SYS%'
preselAlgJet.selectionDecoration = 'preselection,as_char'
algSeq += preselAlgJet
Follow the steps for adding electrons to the output,
making the necessary modifications for jets. Note that you will
need to add xAODJet
to CMakeLists.txt
and add
#include <xAODJet/JetContainer.h>
to MyxAODAnalysis.cxx
.
Instead of applying cuts on baselineSelection_*
(which does not exist
for jets) and selectPtEta
in the loop over jets, simply apply a selection
on the preselection
decoration.
Rerun to make sure your code is behaving as expected. Once you are happy with the changes, commit and push them.
Try running your algorithm using a different AntiKt4
jet container. Check the input
file for the container options you have. How does your output change with these new jets?