Registering a C++ Type to be 'Get'table from the EventSetup
Complete:
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
- create a source file named 'ES_<data type name>.cc' in the src directory of the package containing the data type
- edit the source file
- include the header of the data type
- include the header "FWCore/Utilities/interface/typelookup.h"
- add the line
TYPELOOKUP_DATA_REG(<data type name>);
- edit the CMS.BuildFile.xml of the package
- 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:
- edit the C++ type's header file
- include the header file for the Record
- include FWCore/Framework/interface/data_default_record_trait.h
- at the end of the header file add the line
EVENTSETUP_DATA_DEFAULT_RECORD(<data type name>,<record type name>)
- edit the CMS.BuildFile
- add
<use name=<library holding record type> >
- also add the above to the
<export>
directive block
Review Status
Responsible:
ChrisDJones
Last reviewed by: Reviewer