7.4.1 PAT Examples: Electron Example

Complete: 5
Detailed Review status



In this example you will find how to make a simple analysis (including some more physics contents) with pat::Electrons within a simple EDAnalyzer. 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.

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

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

This topic: CMSPublic > CMSCommunicationsGroup > CMSCommunicationsProjects > WebHome > SWGuide > WorkBook > WorkBookPAT > WorkBookPATTutorial > WorkBookPATExampleElectron
Topic revision: r8 - 2018-12-03 - CiliciaUzzielPerez
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