56 typedef std::map<eventsetup::EventSetupRecordKey, std::vector<eventsetup::DataKey> >
RecordToDataKeys;
69 verbose_(iConfig.getUntrackedParameter<
bool>(
"verbose")) {}
82 descriptions.
setComment(
"Retrieves specified data from the EventSetup sytem whenever that data changes.");
86 ->setComment(
"Print a message to the logger each time a data item is gotten.");
90 "The name of an EventSetup record holding the data you want obtained.");
91 toGet.
add<std::vector<std::string> >(
"data")->setComment(
92 "The identifier for the data you wish to retrieve. " 93 "The identifier is in two parts separated by a backslash '/'. " 94 "The first part is the C++ class name of the data and the " 95 "second part is the label used when getting the data (blank is acceptable). " 96 "If there is no label, the backslash may be omitted.");
98 std::vector<edm::ParameterSet> emptyVect;
99 desc.
addVPSet(
"toGet", toGet, emptyVect)
101 "The contained PSets must have the following structure.\n" 102 "A 'string' named 'record' that holds the name of an EventSetup record holding the data you want to " 104 "a 'vstring' named 'data' that holds identifiers for the data you wish to retrieve. " 105 "The identifier is in two parts separated by a backslash '/'. " 106 "The first part is the C++ class name of the data and the " 107 "second part is the label used when getting the data (blank is acceptable). " 108 "If there is no label, the backslash may be omitted.\n" 109 "If the VPSet is empty it means all data in the EventSetup should be retrieved.");
110 descriptions.
add(
"getEventSetupData", desc);
128 for (Parameters::const_iterator itToGet = toGet.begin(), itToGetEnd = toGet.end(); itToGet != itToGetEnd;
135 edm::LogWarning(
"DataGetter") <<
"Record \"" << recordName <<
"\" does not exist " << std::endl;
139 typedef std::vector<std::string>
Strings;
140 Strings dataNames = itToGet->getParameter<Strings>(
"data");
141 std::vector<eventsetup::DataKey> dataKeys;
142 for (Strings::iterator itDatum = dataNames.begin(), itDatumEnd = dataNames.end(); itDatum != itDatumEnd;
144 std::string datumName(*itDatum, 0, itDatum->find_first_of(
"/"));
146 if (itDatum->size() != datumName.size()) {
147 labelName =
std::string(*itDatum, datumName.size() + 1);
152 edm::LogWarning(
"DataGetter") <<
"data item of type \"" << datumName <<
"\" does not exist" << std::endl;
157 dataKeys.push_back(datumKey);
164 std::vector<eventsetup::EventSetupRecordKey> recordKeys;
166 std::vector<eventsetup::DataKey> dataKeys;
168 for (std::vector<eventsetup::EventSetupRecordKey>::iterator itRKey = recordKeys.begin(),
169 itRKeyEnd = recordKeys.end();
175 record->fillRegisteredDataKeys(dataKeys);
187 itRecord != itRecordEnd;
189 auto pRecord = iSetup.
find(itRecord->first);
192 <<
"The EventSetup Record '" << itRecord->first.name() <<
"' is not available for this IOV.";
196 typedef std::vector<DataKey>
Keys;
197 Keys
const&
keys = itRecord->second;
198 for (Keys::const_iterator itKey = keys.begin(), itKeyEnd = keys.end(); itKey != itKeyEnd; ++itKey) {
199 if (!pRecord->doGet(*itKey)) {
201 <<
"No data of type \"" << itKey->type().name() <<
"\" with name \"" << itKey->name().value()
202 <<
"\" in record " << itRecord->first.type().name() <<
" found " << std::endl;
206 <<
"got data of type \"" << itKey->type().name() <<
"\" with name \"" << itKey->name().value()
207 <<
"\" in record " << itRecord->first.type().name() << std::endl;
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
void setComment(std::string const &value)
VParameterSet const & getParameterSetVector(std::string const &name) const
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void doGet(EventSetup const &)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
EventSelector::Strings Strings
void beginRun(Run const &, EventSetup const &) override
EventSetupRecordDataGetter(ParameterSet const &)
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
RecordToDataKeys recordToDataKeys_
void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
vector< ParameterSet > Parameters
std::map< eventsetup::EventSetupRecordKey, unsigned long long > recordToCacheIdentifier_
static void fillDescriptions(ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void analyze(Event const &, EventSetup const &) override
void setComment(std::string const &value)
std::map< eventsetup::EventSetupRecordKey, std::vector< eventsetup::DataKey > > RecordToDataKeys
std::vector< size_type > Keys
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void fillAvailableRecordKeys(std::vector< eventsetup::EventSetupRecordKey > &oToFill) const
clears the oToFill vector and then fills it with the keys for all available records ...
heterocontainer::HCTypeTag TypeTag
~EventSetupRecordDataGetter() override