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/Framework/interface/eventsetupdata_registration_macro.h"
    3. add the line EVENTSETUP_DATA_REG(<data type name>);
  3. edit the BuildFile of the package
    1. add <use name=FWCore/Framework>
    2. also add the above to the <export> directive block

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


This topic: CMSPublic > CMSCommunicationsGroup > CMSCommunicationsProjects > WebHome > SWGuide > SWGuideFrameWork > SWGuideEventSetupHowTos > SWGuideHowToRegisterESData
Topic revision: r4 - 2007-02-07 - JennyWilliams
 
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.
Ideas, requests, problems regarding TWiki? Send feedback