7.11 Particle Flow Tutorial

Complete: 5

TIP Please have a look at the left bar for the other pages of the particle flow documentation.

Detailed Review status


This page will teach you how to:

  • Access the particle flow products in the event
  • Run the particle flow together with the fast sim

For the impatient user

Particle flow in the fast simulation

Follow sections:

Particle flow in the full simulation

Follow sections:

Set up particle flow in CMSSW

The default version of the particle flow is used in this workbook. Get it in the following way, after having set up your local area in the usual way:

addpkg RecoParticleFlow/Configuration
addpkg RecoParticleFlow/PFRootEvent
scram b -j 4

How to run particle flow

With the FULL sim

Reprocessing particle flow, would involve a reprocessing of the tracking, which is a time-consuming operation. Please use the products available in your data sample, or use the fast sim if you need a more recent version of the particle flow.

Warning, important Do not use Summer08 event samples or older!

With the FAST sim

The fast simulation is the ideal tool to test particle flow. Since it is much faster than the full simulation, it is possible to simulate and reconstruct events on the fly. In case the reconstruction needs to be redone, it is not a big deal to simulate again the same sample of events. Moreover, this saves a lot of disk space (or staging time...) because there is no need to store large FEVT files.

Running particle flow together with the fast simulation is straightforward. Follow the instructions below to:

  • (fast) simulate a few thousands of single taus,
  • perform the full reconstruction, including particle flow.
  • run additional producers, necessary for the CMS.PFRootEvent display.

cd RecoParticleFlow/Configuration/test
cmsRun fastSimWithParticleFlow_cfg.py

Output files:

  • display.root : Contains all particle flow objects. This file can be used as an input to PFRootEvent, for display or further processing using the ROOT interface.
  • aod.root : Contains AOD events

Generating and simulating your own events

Just do:

cp fastSimWithParticleFlow_cfg.py myFastSim_cfg.py
Then, edit the file, and replace the current source by the file RecoParticleFlow/Configuration/python/source_particleGun_cfi.py, and modify the pdgId of the particles shot by the gun:
# to get photons:
process.generator.PGunParameters.ParticleID = cms.vint32(22)
Standard generator configuration files can be found in Configuration/Generator/python

How to Rerun the particle flow

  • If the files was saved in the format DISPLAY just use Root Interface.

  • If the FULLSIM or DATA files was saved in RECO format you need to transform it to the DISPLAY format using RecoToDisplay_cfg.py.
    • The process in RecoToDisplay_cfg.py is called REPROD:
      process = cms.Process("REPROD")
      Thus, if you want to have a look on them via Root Interface you need to replace in particleFlow.opt option file all occurrences of PROD by REPROD.
    • Don't forget to change in RecoToDisplay_cfg.py the global tag
      process.GlobalTag.globaltag = 'MC_31X_V3::All'
      according to the CMSSW version used to reconstruct the DATA or MC. All information is available in PFlowDevelopers or more generally SWGuideFrontierConditions.
    • If you want to use the standard benchmark tools to compare 2 versions of reconstruction, PROD and REPROD, you can add Aod files to the output of RecoToDisplay_cfg.py:
              process.aod = cms.OutputModule("PoolOutputModule",
              fileName = cms.untracked.string('aod.root')
              process.outpath = cms.EndPath(process.aod )
      The Benchmark tools are also available directly in Root Interface from DISPLAY files.

  • If the FASTSIM data was saved in RECO format the RecoToDisplay_cfg.py tool doesn't work. The reason is that it uses a full reprocess of the tracking and clustering and the associated information is not available for the FASTSIM. The simplest solution is to regenerate again the FASTSIM files.

Access to the particle flow output

There are 4 alternatives to access the reconstructed particles (PFCandidate)

  • PAT (Physics Analysis Toolkit): run PF2PAT+PAT to get pattuples.
    • This is the recommended way to use particle flow in the analysis
  • access the PFCandidates directly from an EDAnalyzer (or another CMSSW module) in the full framework
    • You should not need to do this, but it can be educational.
  • access the PFCandidates from ROOT+FWLite
    • Use the CMSSW output TTree to plot the PFCandidate variables
  • access the PFCandidates from ROOT+FWLite using PFRootEvent
    • Display and study particle flow.


Full framework

Basic PFCandidate analysis

cd RecoParticleFlow/Configuration/test
cmsRun analyzePFCandidates_cfg.py

The analyzer code is in PFCandidateAnalyzer.h and PFCandidateAnalyzer.cc.

Creating a collection of reco::Muons from the muon PFCandidates



  • Open the CMSSW root file containing the collection of PFCandidates, and have a look at them:

TFile f("aod.root")


Fireworks can be configured to display particle-flow reconstructed events:

  • WorkBookFireworks: Install fireworks
  • run:
    ./cmsShow -c /afs/cern.ch/user/c/cbern/public/pflow2_mc.fwc mc.root

This configuration allows to display:

  • PFCandidates
  • PFJets and PFMET
  • calorimeter jets and MET
  • gen jets and MET

FireWorks for PF studies

The ROOT interface

Review status

Responsible: Colin Bernet

Reviewer/Editor and Date (copy from screen) Comments
Last reviewed by: Colin - 27 Jul 2009 Doc simplified
Last reviewed by: Colin - 7 Mar 2008 Splitted and reorganized the documentation
Last reviewed by: Colin - 9 Nov 2007 Added a legend for PFRootEvent display
Last reviewed by: Colin - 3 Nov 2007 Modified after particle flow workshop
Colin - 20 Apr 2007 New tutorial for particle flow version 2
Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng display_ECAL.png r1 manage 15.1 K 2007-04-20 - 19:34 UnknownUser event display, ECAL
PNGpng display_HCAL.png r1 manage 13.2 K 2007-04-20 - 19:35 UnknownUser event display HCAL.
PNGpng display_XY.png r1 manage 30.3 K 2007-04-20 - 19:35 UnknownUser event display, XY.
PNGpng tauBenchmark.png r1 manage 12.5 K 2007-04-20 - 19:08 UnknownUser Tau Benchmark, Colin 1_3_1/V02-00-03
Edit | Attach | Watch | Print version | History: r36 < r35 < r34 < r33 < r32 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r36 - 2011-09-25 - ColinBernet

No permission to view CMS.PFlowLeftBar



    • 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-2023 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