7.4.1 PAT Examples: Electron Example

Complete: 5
Detailed Review status

Contents

Introduction

Note: This twiki is under construction.

PAT (Physics Analysis Toolkit) is a common tool and format that facilitates access to event information. Nowadays, centrally produced MiniAODs are produced using PAT on AOD files. In this example twiki, we'll be focusing on working with miniAOD samples.

You can find the EDAnalyzer and the configuration file in the PatExamples package. It will provide you with the following information:

  • how to access information from the pat::Electron.
  • how to determine an electron reconstruction efficiency from simulation.
  • how to estimate an electronID efficiency applying a simple tag and probe method.

It is required that you have a clear picture of:

  • how to write an EDAnalyzer (in principle).
  • how to read in parameters from the configuration file.
  • how to clone modules with different parameters in python.
  • how to access a pat::Candidate collection from the event content with an EDAnalyzer.

Checkout Code

As a first step, let's check out some packages from GitHub and setup the CMS environment.

cmsrel CMSSW_9_4_0
cd CMSSW_9_4_0/src
cmsenv
git cms-init # setup CMS environment
git cms-addpkg PhysicsTools/PatAlgos

We can take a look at one of the configuration files

vi PhysicsTools/PatAlgos/test/patTuple_standard_cfg.py

Run the EDAnalyzer example

If you've done the setup for the [ggNtuplizer][https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookElectronAnalysis#Create_Ntuples_using_the_ggNtupl], you should already have the necessary files to run an EDAnalyzer example.

cd CMSSW_9_4_4/src
cmsenv

The relevant files for this workbook are in =PhysicsTools/PatExamples and they have the following functionality:

  • plugins/PatElectronAnalyzer.cc: the main module to book and fill histograms.
  • python/PatElectronAnalyzer_cfi.py: initialising configuration file for the plugin.
  • python/tagAndProbeAnalysis_cff.py: simple configuration example for a tag and probe analysis with CMSSW.
  • test/analyzePatElectron_cfg.py: main configuration file for cmsRun
  • test/patElectron_recoEfficiency.C: root macro to display the electron reconstruction efficiency from simulation.
  • test/patElectron_eidEfficiency.C: root macro to display the electronID efficiency from the tag and probe method.

cmsRun PhysicsTools/PatExamples/test/analyzePatElectron_cfg.py

Compile and run the example as given below:

scram b 
cmsRun PhysicsTools/PatExamples/test/analyzePatElectron_cfg.py

You can inspect the outcome using the two root macros which are provided with the example:

root -l 
.x patElectron_recoEfficiency.C
.x patElectron_eidEfficiency.C

Review status

Reviewer/Editor and Date (copy from screen) Comments
UzzielPerez - 2-Dec-2018 Update for Run 2, CMSSW 94x
RogerWolf - 11 june 2009 Moved from SWGuidePATExamples

Responsible: RogerWolf
Last reviewed by: most recent reviewer and date

-- RogerWolf - 11 Jun 2009

Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r11 - 2019-01-11 - CiliciaUzzielPerez
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

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