PAT Exercise 01: How to use the PAT Documentation



  • Learn how to use the CMSSW and EDM documentation resources.
  • Learn how to use the PAT documentation resources.


This tutorial will explain how to efficiently use the PAT Documentation. Entry points for typical questions arising about PAT will be given. Finally you may want to go through a small set of exercises to get used to the PAT Documentation. While basic questions are addressed in the WorkBook Documentation, advanced problems are discussed in the SWGuide Documentation.

ALERT! Note:

This web course is part of the PAT Tutorial, which takes regularly place at cern and in other places. When following the PAT Tutorial the answers of questions marked in RED should be filled into the exercise form that has been introduced at the beginning of the tutorial. Also the solutions to the Exercises should be filled into the form. The exercises are marked in three colours, indicating whether this exercise is basic (obligatory), continuative (recommended) or optional (free). The colour coding is summarized in the table below:

Color Code Explanation
red Basic exercise, which is obligatory for the PAT Tutorial.
yellow Continuative exercise, which is recommended for the PAT Tutorial to deepen what has been learned.
green Optional exercise, which shows interesting applications of what has been learned.

Basic exercises ( red ) are obliged and the solutions to the exercises should be filled into the exercise form during the PAT Tutorial.

WorkBook Documentation

The main entry page to light 'weighted' PAT Documentation is the WorkBookPAT. The following basic questions are addressed here:

You can find the basic information about configuring CMSSW jobs in WorkBookConfigFileIntro and WorkBookConfigEditor.

SWGuide Documentation and more

The main entry page to a full weight PAT Documentation is the SWGuidePAT. Here you can find links to all available PAT Documentation. This section will discuss how you can find information to address the following two main questions:

  • What are the parameters of a specific PAT object?
    The primary source of information is the WorkBookPATDataFormats. Every PAT object is described here in detail. Please read through this page to get familiar with the functionality available in the PAT objects. You may want to know for example how b-tag information is accessible for jets in within PAT. A link to the Reference Manual for the pat::Jet is provided. Note that you may have to choose the appropriate CMSSW version here. In case you want to study the source code you may look into the Data Formats defintion at Github or search the code using the LXR cross reference. You will find the answer that pat::Jet::bDiscriminator and pat::Jet::getPairDiscri are returning all b-discriminators stored in the pat::Jet.
Question Question 1 a):
In addition to the 4-momentum what extra information is available in a PAT muon (you can summarize in categories)?

  • How can I configure a specific PAT algorithm?
    The primary source of information are WorkBookPATWorkflow and WorkBookPATConfiguration. Here the configuration of the object content, selection and disambiguation are described. Please read through these pages to get familiar with the algorithms available in the PAT and how they can be configured. You may want to know for example how to change the jet algorithm and apply a cut on the jet pt within PAT. Changing the jet algorithm is a matter of the object (content) configuration itself. Applying a jet pt cut is a matter of the object selection. The object configuration section for pat::Jet provides a link to the Reference Manual for the pat::Jet producer. The parameter jetSource is responsible for changing the jet algorithm. The section about the configuration of the object selection provides a link to the PatAlgos package at Github, which contains the configuration file jetSelector_cfi.py. The parameter cut is responsible for applying a cut on the jet pt.
    Before configuring PAT you should have a look at the available SWGuidePATTools which provide a set of common methods to configure PAT. There you will find the tool switchJetCollection which allows to change the jet algorithm via the parameter jetCollection.
    A much more intuitive way to configure PAT algorithms is by using the WorkBookConfigEditor. It allows to browse available parameters and the available tools, and automatically to create user configuration files with a customised configuration of PAT.
Question Question 1 b):
What are the three main steps of the PAT workflow and what is the purpose of each step?

Question Question 1 c):
What tools are available to configure the content of a PAT electron?


Before leaving this page try to to do the following exercises:

red Exercise 1 a):
Question Find out how to access the JetID in PAT?

Solution in Reference Manual: _pat::Jet::jetID_-->

red Exercise 1 b):
Question Find out what jet algorithm is used for PAT jets by default?

Solution in PAT Workbook: anti-kT with R=0.5 jets
Same solution using ConfigEditor: ak5CaloJets

red Exercise 1 c):
Question Find out if there is a selection applied to pat::Jets by default?

Solution A in CVS: process.patJets.addBTagInfo=False
Solution B in SWGuidePATTools:
# load the standard PAT config

# load the coreTools of PAT
from PhysicsTools.PatAlgos.tools.jetTools import *
                    doJTA            = True,            
                    doBTagging       = False,            
                    jetCorrLabel     = ('AK5','Calo'),  
                    doType1MET       = True,            
                    genJetCollection = cms.InputTag("ak5GenJets"),
                    doJetID      = True,
                    jetIdLabel   = "ak5"
                    )  --> 

yellow Exercise 1 d):
Question Find our how to add an additional jet collection to the PAT event content?
Question What PAT tool can be used?

Solution in SWGuidePATTools:
# load the standard PAT config

# load the coreTools of PAT
from PhysicsTools.PatAlgos.tools.jetTools import *
postfixAK4PFCHS = 'Copy'
   postfix = postfixAK4PFCHS,
   labelName = labelAK4PFCHS,
   jetSource = cms.InputTag('ak4PFJetsCHS'),
   jetCorrections = ('AK5PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'Type-2') # FIXME: Use proper JECs, as soon as available
process.out.outputCommands.append( 'drop *_selectedPatJets%s%s_caloTowers_*'%( labelAK4PFCHS, postfixAK4PFCHS ) )--> 

ALERT! Note:

In case of problems don't hesitate to contact the SWGuidePAT#Support. Having successfully finished Exercise 1 you might want to proceed to Exercise 2 of the WorkBookPATTutorial to learn more about how to create a pat::Tuple from a RECO input file. For an overview you can go back to the WorkBookPATTutorial entry page.

Review status

Reviewer/Editor and Date (copy from screen)Sorted ascending Comments
RogerWolf - 17 March 2012 Added color codes to exercises

Responsible: AndreasHinzmann

This topic: CMSPublic > CMSCommunicationsGroup > CMSCommunicationsProjects > WebHome > SWGuide > WorkBook > WorkBookPAT > WorkBookPATTutorial > WorkBookPATDocNavigationExercise
Topic revision: r47 - 2014-06-30 - TillArndt
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback