Complete: 4

Data Formats in GeneratorInterface

Event content definition

RECO Data Formats

InputTag/Module (Instance name) Containers Description

GeneratorInterface collections (in RECOSIM and AODSIM)
generator GenEventInfoProduct General characteristics of a generated event.
generator GenRunInfoProduct Run-specific parameters that define event generation, such as cross-sections, etc.
GeneratorInterface collections (in RECOSIM only)
generator edm::HepMCProduct A tree of final-state particles that form a generated event.
generator GenEventInfoProduct General characteristics of a generated event.
generator GenRunInfoProduct Run-specific parameters that define event generation, such as cross-sections, etc.

Additional information

Out of the event size consideration, in the AOD event content the edm::HepMCProduct format of the is generated event is replaced by the "lighter" record called reco::GenParticleCollection. Formally, it is outside the GeneratorInterface domain, and belongs to the PhysicsTools of CMSSW. For more details, please visit WorkBookGenParticleCandidate and related materials.

How to use the table

In the header of your analyzer you should have the header(s) of the data format(s) you will access. Generator data formats belong to the in the SimDataFormats/GeneratorProducts; the headers are located in the /interface subdirectory. Thus, your EDAnalyzer should contain all or one of the following:

#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"

Note that edm::HepMCProduct is a wrapper on top of HepMC::GenEvent class of the standard LCG package HepMC.
For details about features and access methods of the HepMC::GenEvent class please refer to the HepMC documentation for details.

Here we would like to show how to access the generated event particle tree and to use 2 of the GenEvent::HepMC access methods.
In the analyze(const Event& e, const EventSetup& ) method of your EDAnalyzer you can do something like the following:

edm::Handle<edm:: HepMCProduct > genEvtHandle;
e.getByLabel( "generator", genEvtHandle) ;
const HepMC::GenEvent* Evt = genEvtHandle->GetEvent() ;
//
// this is an example loop over the hierarchy of vertices
//
for ( HepMC::GenEvent::vertex_const_iterator
          itVtx=Evt->vertices_begin(); itVtx!=Evt->vertices_end(); ++itVtx )
{
      //
      // this is an example loop over particles coming out of each vertex in the loop
      //
      for ( HepMC::GenVertex::particles_out_const_iterator
              itPartOut=(*itVtx)->particles_out_const_begin();
              itPartOut!=(*itVtx)->particles_out_const_end(); ++itPartOut )
      {
         // and more of your code...
      }
}

If you wish to analyze general characteristics of an event rather than specific generated particles, in the analyze(const Event& e, const EventSetup& ) of your EDAnalyzer do the following:

edm::Handle<GenEventInfoProduct> genEvtInfo;
e.getByLabel( "generator", genEvtInfo );
double qScale = genEvtInfo->qScale();  // in case of Pythia6, this will be pypars/pari(23)
const std::vector<double>& binningValues = genEvtInfo->binningValues(); // in case of Pythia6, this will be pypars/pari(17)
// more of your code...
std::vector<double>& evtWeights = genEvtInfo->weights();
double theWeight = genEvtInfo->weight();
// and some more of your code again...

Please note that the weights() return the container of the associated event weights, where there may be 1 or more elements. For example, in the case of running Pythia6 generators there'll be 2 elements; please see SWGuidePythia6Interface#Example_8_CSA_mode_with_Event_Re for more details.
The weight() method returns the value which is a result of multiplication of all elements in the weights container.

If you wish to access run-specific information about event generation, you can do so via GenRunInfoProduct. Please be advised that this product

  • belongs to edm::Run rather than =edm::Event=
  • is not finalized until the end of run
Thus you may want to implement endRun(const  Run& r, const EventSetup& ) method in your EDAnalyzer and analyze GenRunInfoProduct there:
edm::Handle<GenRunInfoProduct> genRunInfo;
r.getByLabel( "generator", genRunInfo );

You may also view brief example usage in the HZZ4muAnalyzer.cc (other details of this example analyzer are covered here).

Review status

Reviewer/Editor and Date (copy from screen) Comments
JuliaYarba - 13 Aug 2009 filled up page with basic information
KatiLassilaPerini - 22 Jul 2008 created template page

Responsible:
Last reviewed by:

Edit | Attach | Watch | Print version | History: r16 | r14 < r13 < r12 < r11 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r12 - 2009-10-08 - ChristopheSaout
 
    • 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-2022 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