7.11 Particle Flow Tutorial
Complete:
Please have a look at the left bar for the other pages of the particle flow documentation.
Detailed Review status
Overview
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.
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:
#process.load("RecoParticleFlow.Configuration.source_singleTau_cfi")
process.load("RecoParticleFlow.Configuration.source_particleGun_cfi")
# 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 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.load("FastSimulation.Configuration.EventContent_cff")
process.aod = cms.OutputModule("PoolOutputModule",
process.AODSIMEventContent,
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.
PAT
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
FWLite
{
gSystem->Load("libFWCoreFWLite.so");
AutoLibraryLoader::enable();
gSystem->Load("libCintex.so");
ROOT::Cintex::Cintex::Enable();
}
- Open the CMSSW root file containing the collection of PFCandidates, and have a look at them:
TFile f("aod.root")
Events.Draw("recoPFCandidates_particleFlow__PROD.obj.particleId_")
Events.Draw("recoPFCandidates_particleFlow__PROD.obj.pt()")
Fireworks
Fireworks can be configured to display particle-flow reconstructed events:
This configuration allows to display:
- PFCandidates
- PFJets and PFMET
- calorimeter jets and MET
- gen jets and MET
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 |