Writing an EventSetup Record Class

Complete: 4


Each Record held by the EventSetup is a separate C++ class. To create a new Record, go to SWGuideSkeletonCodeGenerator and follow the instructions for mkrecord.

Dependent Records

An ESProducer in the EventSetup may need to get data from multiple Records. However, an ESProducer is handed only one Record rather than an EventSetup to its produce method. So how does one handle this case? A Record of one type can be used to get a Record of another type if and only if the first Record was declared to depend on the second Record at compile time.

To declare that one Record depends on another Record

  1. Follow the directions above to create a Record
  2. Edit the Record's .h file
    1. change the include from "EventSetupRecordImplementation.h" to "DependentRecordImplementation.h"
    2. include the header file for the Record(s) to which you will be dependent
    3. change the inheritance from EventSetupRecordImplementation to DependentRecordImplementation
    4. add a second template argument to DependentRecordImplementation of the type boost::mpl::vector<>
    5. add the dependent Record(s) types to the template arguments of the boost::mpl::vector<>

As an example, say Record ARcd depends on two Records BRcd and CRcd. Then the class declaration would look like

  #include "FWCore/Framework/interface/DependentRecordImplementation.h"

  //forward declarations
  class BRcd;
  class CRcd;

  class ARcd : public edm::eventsetup::DependentRecordImplementation<ARcd, boost::mpl::vector<BRcd, CRcd> > {};

Review Status

Reviewer/Editor and Date (copy from screen) Comments
ChrisDJones - 29 Jul 2005 page author
ChrisDJones - 30 Sep 2005 page content last edited
JennyWilliams - 07 Feb 2007 editing to include in SWGuide

Responsible: ChrisDJones
Last reviewed by: Reviewer

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2007-02-07 - JennyWilliams

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