Generator Pruner Module

Complete: 2

Latest updates

The GenParticlePruner has some problems if there are "n-cycles" of mother/daughter relationships. This has been fixed in the following tag:

PhysicsTools/HepMCCandAlgos                      V11-03-16


Generator information in AOD contains the full particle list in a generated CMS event, and can occupy few tens of kByte per event. This size is large for many analysis applications that require only a subset of this information.

The module GenParticlePruner is a tool to select in a configurable way only the subset of the generator information of interest.

Module definition

The module GenParticlePruner is defined in the package PhysicsTools/HepMCCandAlgos. The source code of CVS HEAD can be seen here

Module configuration

The configuration of GenParticlePruner uses a list of keep and drop statements followed by a selection string, specified with the common cut parser. By default all particles are dropped (equivalent to drop *). The statements:

  • drop * (default)
  • keep *
can only occur as first selection option in the list.

In order to specify to keep or drop all daughters of the particles matching the selection, one can use the statements:

  • drop++ <selection>
  • keep++ <selection>

Similarily, in order to specify to keep or drop all ancestors of the particles matching the selection, one can use the statements:

  • ++drop <selection>
  • ++keep <selection>

To limit the selection to a single "generation" of daughters or ancestors, a single + can be used. Single + or double ++ before and after the keep / drop statements can combined in any possible way.

An example of complete configuration can be the following, selecting all Z and subsequent decays, but excluding the status 2 Z daughter:

process.prunedGenParticles = cms.EDProducer(
    src = cms.InputTag("genParticles"),
    select = cms.vstring(
    "drop  *  ", # this is the default
    "keep++ pdgId = {Z0}",
    "drop pdgId = {Z0} & status = 2"

Note that whenever a pdgId is used for selection, the particle name enclosed in curly braces {...} is replaced by the PDG code from the standard PDT table. So, {Z0} is replaced by 23.

Note, that the following .cfi is mandatory:


Another example could be to only select particles above a given pt, and within a specified η range:

process.prunedGenParticles = cms.EDProducer(
    src = cms.InputTag("genParticles"),
    select = cms.vstring(
    "keep  pt > 1.5 & abs(eta) < 5"

Mother-daughter links

In a decay like: A → B → C, if B is dropped, the indirect mother/daughter relation between A and C can be established. This feature is implemented since the version tagged:

  • CMS.PhysicsTools/HepMCCandAlgos V09-23-01

Possible improvements

  • If needed, it could be possible to specify how many generation down the decay chain to select. At the moment the two supported options are one generation or all generations.

Status and release

This utility is releases starting from the tag V09-22-00 of CMS.PhysicsTools/HepMCCandAlgos, and has been queued for 2.1.x.

-- LucaLista - 01 Jul 2008

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2011-11-02 - SalvatoreRRappoccio
    • 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