![]() |
|
|||
File indexing completed on 2024-04-06 12:13:12
0001 #ifndef FWCore_Utilities_ESInputTag_h 0002 #define FWCore_Utilities_ESInputTag_h 0003 // -*- C++ -*- 0004 // 0005 // Package: Utilities 0006 // Class : ESInputTag 0007 // 0008 /**\class ESInputTag ESInputTag.h FWCore/Utilities/interface/ESInputTag.h 0009 0010 Description: Parameter type used to denote how data should be obtained from the EventSetup 0011 0012 Usage: 0013 The ESInputTag can be used in conjunction with an EventSetup Record to retrieve a particular data 0014 item from the Record. The EventSetup uses two pieces of information to find data in a Record 0015 1) the C++ class type of the data 0016 2) an optional string which we will refer to as the 'dataLabel' 0017 The dataLabel is used to differentiate objects of the same type placed in the same Record. 0018 0019 In addition, every piece of data in the EventSetup comes from either an ESSource or an ESProducer. Every 0020 ESSource and ESProducer is assigned a label (referred to here as the moduleLabel) in the configuration of 0021 the job. This label may be explicitly set or it may just be the C++ class type of the ESSource/ESProducer. 0022 For example, say there is an ESProducer of C++ class type FooESProd. If the python configuration has 0023 process.FooESProd = cms.ESProducer("FooESProd", ...) 0024 then the module label is 'FooESProd'. 0025 If the python configuration has 0026 process.add_( cms.ESProducer("FooESProd", ...) 0027 then the module label is also 'FooESProd'. 0028 However, if the python configuration has 0029 process.foos = cms.ESProducer("FooESProd",...) 0030 then the module label is 'foos'. 0031 0032 The ESInputTag allows one to specify both the dataLabel and moduleLabel. The dataLabel is used to find the data 0033 being requested. The moduleLabel is only used to determine if the data that was found comes from the specified 0034 module. If the data does not come from the module then an error has occurred. If the moduleLabel is set to the 0035 empty string then the data is allowed to come from any module. 0036 0037 Example 1: 0038 FooESProd makes Foos with the default dataLabel ("") 0039 The module is declared in the python configuration as 0040 process.FooESProd = cms.ESProducer("FooESProd",...) 0041 The following python configurations for ESInputTag can be used to get its data 0042 cms.ESInputTag("") 0043 cms.ESInputTag(":") 0044 cms.ESInputTag("","") 0045 cms.ESInputTag("FooESProd") 0046 cms.ESInputTag("FooESProd:") 0047 cms.ESInputTag("FooESProd","") 0048 0049 Example 2: 0050 FooESProd makes Foos with the dataLabel "bar" 0051 The module is declared in the python configuration as 0052 process.FooESProd = cms.ESProducer("FooESProd",...) 0053 The following python configurations for ESInputTag can be used to get its data 0054 cms.ESInputTag(":bar") 0055 cms.ESInputTag("","bar") 0056 cms.ESInputTag("FooESProd:bar") 0057 cms.ESInputTag("FooESProd","bar") 0058 0059 Example 3: 0060 FooESProd makes Foos with the default dataLabel ("") 0061 process.FooESProd = cms.ESProducer("FooESProd",...) 0062 Foo2ESProd also makes Foos with the default dataLabel ("") 0063 process.Foo2ESProd = cms.ESProducer("Foo2ESProd",...) 0064 The jobs has an ESPrefer which states Foos should come from FooESProd 0065 process.perferedFoo = cms.ESPrefer("FooESProd") 0066 Then to get the data, one can specify the ESInputTag identical to Example 1. 0067 However, the following ESInputTags will lead to an exception begin thrown 0068 cms.ESInputTag("Foo2ESProd") 0069 cms.ESInputTag("Foo2ESProd:") 0070 cms.ESInputTag("Foo2ESProd","") 0071 The exception happens because FooESProd is the only allowed source of Foos 0072 but the ESInputTag says you really wanted them to come from Foo2ESProd. 0073 */ 0074 // 0075 // Original Author: Chris Jones 0076 // Created: Thu Feb 19 13:01:38 CST 2009 0077 // 0078 0079 // system include files 0080 #include <iosfwd> 0081 #include <string> 0082 0083 // user include files 0084 0085 // forward declarations 0086 namespace edm { 0087 class ESInputTag { 0088 public: 0089 explicit ESInputTag(); 0090 explicit ESInputTag(std::string iModuleLabel, std::string iDataLabel); 0091 explicit ESInputTag(const std::string& iEncodedValue); 0092 0093 // ---------- const member functions --------------------- 0094 0095 /**Returns the label assigned to the module for the data to be retrieved. 0096 If the value matches the defaultModule value (which is the empty string) 0097 Then no match is attempted with the module label. 0098 */ 0099 const std::string& module() const { return module_; } 0100 0101 /**Returns the label used to access the data from the EventSetup. 0102 The empty string is an allowed (and default) value. 0103 */ 0104 const std::string& data() const { return data_; } 0105 0106 bool operator==(const edm::ESInputTag& iRHS) const; 0107 0108 std::string encode() const; 0109 0110 private: 0111 // ---------- member data -------------------------------- 0112 std::string module_; 0113 std::string data_; 0114 }; 0115 0116 std::ostream& operator<<(std::ostream&, ESInputTag const&); 0117 } // namespace edm 0118 0119 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |