Registering a C++ Type to be 'Get'table from the EventSetup

Complete: 4

Registering a C++ Type

In order to make a C++ type accessible from an EventSetup Record, that type must be registered with the EventSetup system. This is done by

  1. create a source file named 'ES_<data type name>.cc' in the src directory of the package containing the data type
  2. edit the source file
    1. include the header of the data type
    2. include the header "FWCore/Utilities/interface/typelookup.h"
    3. add the line TYPELOOKUP_DATA_REG(<data type name>);
  3. edit the CMS.BuildFile.xml of the package
    1. add <use name="FWCore/Utilities"/>

In addition, it is possible to make a C++ type accessible directly from the EventSetup (using the getData method) without having the user first get the Record containing the type. The only time to allow this is when the C++ type will only every be contained in one type of Record (or there is a 'default' Record that would be used for almost all data accesses). To make such an access possible, do the following:

  1. edit the C++ type's header file
    1. include the header file for the Record
    2. include FWCore/Framework/interface/data_default_record_trait.h
    3. at the end of the header file add the line EVENTSETUP_DATA_DEFAULT_RECORD(<data type name>,<record type name>)
  2. edit the CMS.BuildFile
    1. add <use name=<library holding record type> >
    2. also add the above to the <export> directive block

Review Status

Reviewer/Editor and Date (copy from screen) Comments
ChrisDJones - 01 Aug 2005 page author
ChrisDJones - 27 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: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r7 - 2010-07-19 - ChrisDJones



 
    • 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