PdtEntry: a Configurable Way to Specify Particle Data Table Entries

Complete: 5


Simplify configuration via a Parameter Set of particle identifiers allowing to specify a particle either with its PDG id (e.g.: 13) or with its name (e.g.: "mu-").

Setting up a PdtEntry

A PdtEntry can be specified in the configuration file both as an integer or as a string parameter. Examples of configuration, both valid, for the same module, are:

  module m = MyModule {
    int32 particle = 13


  module m = MyModule {
    string particle = "mu-"

Note that the follwing .cfi is mandatory to use PdtEntry:

  include "SimGeneral/HepPDTESSource/data/pythiapdt.cfi" 

Within the module MyModule, an object of the class PdtEntry can be initialized with the usual interface from the ParameterSet, and should be initialized from the EventSetup in the beginJob method, as follows:

#include "SimGeneral/HepPDTRecord/interface/PdtEntry.h"

  class MyModule : public edm::EDAnalyzer {
    MyModule(const edm::ParameterSet & cfg) :
      particle_(cfg.getParameter<PdtEntry>("particle")) { }
    PdtEntry particle_;
    void beginJob(const edm::EventSetup & es) {
    void analyze( ... )  { ... }

Don't forget to call particle_.setup(es) at beginJob, otherwise an exception will be thrown.

Using a PdtEntry

PdtEntry provides three basic methods to access the PDG identifier, the particle name as a string, and a reference to the entry in the particle data table in HepPDT format:

#include "HepPDT/ParticleData.hh"

   PdtEntry p = ...;
   int pdgId = p.pdgId();
   std::string name = p.name();
   const HepPDT::ParticleData & data = p.data();

If the above methods are called before setting up the PdtEntry from the EventSetup, an exception is thrown.

Vectors of PdtEntry and Untracked Parameters

It is also supported to access a vector of PdtEntry objects from a vector of integers or a vector of strings:

  module m = MyModule {
    vint32 particles = { 13, -13 }


  module m = MyModule {
    vstring particles = { "mu-", "mu+" }

This can be retrieved in the module constructor as:

    MyModule(const edm::ParameterSet & cfg) :
      particles_(cfg.getParameter<std::vector<PdtEntry> >("particles")) { }

Accessing untracked PdtEntry parameters is also supported.

Review Status

Editor/Reviewer and date Comments
LucaLista - 26 Mar 2007 page author

Responsible: LucaLista
Last reviewed by: Reviewer

Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r11 - 2009-05-06 - BenediktHegner

    • 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-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback