4.4 Generator event format in AOD

Complete: 5
Detailed Review status

Goals of this page:

This page documents event generator format stored in AOD.



Generator event in AOD takes about half the size of native HepMC events . This is done using a particle representation that inherits from reco::Candidate.

GenParticle: Generator Particle Candidate

Generator particles are represented by the classes GenParticle which inherit from reco::Candidate It contains a four-momentum, charge, vertex and:

  • a PDG identifier (pdg_id() in HepMC::GenParticle)
  • a status code (status() in HepMC::GenParticle). Standard status codes are described in HepMC manual, and have the following convention in Pythia6 (see below):
    0 null entry
    1 particle not decayed or fragmented, represents the final state as given by the generator
    2 decayed or fragmented entry (i.e. decayed particle or parton produced in shower.)
    3 identifies the "hard part" of the interaction, i.e. the partons that are used in the matrix element calculation, including immediate decays of resonances. (documentation entry, defined separately from the event history. "This includes the two incoming colliding particles and partons produced in hard interaction." [ * ])
    4-10 undefined, reserved for future standards
    11-200 at the disposal of each model builder equivalent to a null line
    201-... at the disposal of the user, in particular for event tracking in the detector

IMPORTANT: Other generators have other conventions. (e.g. Those for Pythia8 are described in the documentation for the statusHepMC function in http://home.thep.lu.se/~torbjorn/pythia81html/EventRecord.html . They mainly differ from the Pythia6 ones in that status = 3 is no longer used.). The only thing you can really rely on is that 'stable' particles (=those handed over to Geant or fastsim in the simulation which are those with decay length > 2cm) have status=1.

For some other generators' conventions, see for instance:

Generator Particles Collections

The default generator particle collection is reco::GenParticleCollection, which is a typedef for std::vector<reco::GenParticle>.

Generator particle contain mother and daughter links to particles in the same collection, as sketched below.


An example to access this collection is the following analyzer code fragment:

#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
using namespace reco;

void MyModule::analyze(const edm::Event & iEvent, ...) {
   Handle<GenParticleCollection> genParticles;
   iEvent.getByLabel("genParticles", genParticles);
   for(size_t i = 0; i < genParticles->size(); ++ i) {
     const GenParticle & p = (*genParticles)[i];
     int id = p.pdgId();
     int st = p.status();  
     const Candidate * mom = p.mother();
     double pt = p.pt(), eta = p.eta(), phi = p.phi(), mass = p.mass();
     double vx = p.vx(), vy = p.vy(), vz = p.vz();
     int charge = p.charge();
     int n = p.numberOfDaughters();
     for(size_t j = 0; j < n; ++ j) {
       const Candidate * d = p.daughter( j );
       int dauId = d->pdgId();
       // . . . 
     // . . . 

GenParticle Conversion from HepMCProduct

GenParticles are saved by default in FEVT, RECO and AOD.

If you run the generator yourself, you may need to convert the output of the generator in the HepMC format to the AOD format using the module GenParticleProducer.

You need to add the following configuration files to your script:

include "SimGeneral/HepPDTESSource/data/pythiapdt.cfi"
include "CMS.PhysicsTools/HepMCCandAlgos/data/genParticles.cfi"

and remember to add at the beginning of your path the module:

  • genParticles

Decay Tree Drawing Utilities

The modules ParticleTreeDrawer and ParticleDecayDrawer print the generated decay tree to provide a visual inspection. The modules can be configured with different options to print different levels of details. More information in the page below:

Particle List Utility

The module ParticleListDrawer dumps the full generated event in a way similar to the command PYLIST in pythia. More information in the page below:

Related Documents

Review status

Reviewer/Editor and Date (copy from screen) Comments
Main.Aresh - 21 Feb 2008 changed the title chapter (the number was 4.4 instead of being 4.5)
LucaLista - 27 Mar 2007 author
JennyWilliams - 11 Dec 2006 Moved to workbook, added contents, added review info

Responsible: LucaLista
Last reviewed by: PetarMaksimovic - 28 Feb 2008

Edit | Attach | Watch | Print version | History: r51 < r50 < r49 < r48 < r47 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r51 - 2015-04-09 - IanTomalin



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