48 m_tag(iTag), m_label(iLabel) {}
69 namespace eventsetup {
75 bool iTransientAccessOnly,
76 std::shared_ptr<ESHandleExceptionFactory>& whyFailedFactory)
const {
77 DataKey dataKey(*(iData->m_tag),
79 DataKey::kDoNotCopyMemory);
81 const void* pValue = this->getFromProxy(dataKey,iDesc,iTransientAccessOnly);
83 throw cms::Exception(
"NoProxyException")<<
"No data of type \""<<iData->m_tag->name()<<
"\" with label \""<<
84 iName<<
"\" in record \""<<this->
key().name()<<
"\"";
86 iData->m_data = pValue;
92 t.
m_tag = &(iHolder.m_info->m_tag);
95 std::shared_ptr<ESHandleExceptionFactory>
dummy;
96 impl_->getImplementation(value, iName.c_str(),desc,
true, dummy);
98 iHolder.m_desc = desc;
108 class RecordHandler {
112 std::vector<DataInfo>& ioInfo):
115 m_writer(m_key.name(),iFile),
117 m_dataInfos.swap(ioInfo);
122 m_record = iSetup.
find(m_key);
125 if(m_cacheID != m_record->cacheIdentifier()) {
126 m_cacheID = m_record->cacheIdentifier();
128 for(std::vector<DataInfo>::const_iterator it = m_dataInfos.begin(),
129 itEnd = m_dataInfos.end();
133 m_record->get(it->m_label,h);
134 m_writer.update(h.
m_data,(it->m_tag.value()),it->m_label.c_str());
143 std::optional<edm::eventsetup::EventSetupRecordGeneric> m_record;
145 unsigned long long m_cacheID;
146 std::vector<DataInfo> m_dataInfos;
160 void endJob()
override ;
190 for (std::vector<std::string>::const_iterator it = names.begin(), itEnd=names.end(); it != itEnd; ++it) {
191 const std::vector<edm::ParameterSet>& ps = iConfig.
getUntrackedParameter<std::vector<edm::ParameterSet> >(*it);
192 std::vector<std::pair<std::string,std::string> >&
data = m_recordToDataNames[*it];
193 for(std::vector<edm::ParameterSet>::const_iterator itPS = ps.begin(),itPSEnd = ps.end();
198 data.push_back(std::make_pair(type,label) );
223 if(m_handlers.empty()) {
225 for(
std::map<
std::string, std::vector<std::pair<std::string,std::string> > >::iterator it=m_recordToDataNames.begin(),
226 itEnd = m_recordToDataNames.end();
230 if(tt == HCTypeTag()) {
231 throw cms::Exception(
"UnknownESRecordType")<<
"The name '"<<it->first<<
"' is not associated with a known EventSetupRecord.\n" 232 "Please check spelling or load a module known to link with the package which declares that Record.";
236 auto rec = iSetup.
find(tt);
238 throw cms::Exception(
"UnknownESRecordType")<<
"The name '"<<it->first<<
"' is not associated with a type which is not an EventSetupRecord.\n" 239 "Please check your spelling.";
243 std::vector<std::pair<std::string,std::string> >&
data = it->second;
246 std::vector<edm::eventsetup::DataKey>
keys;
247 rec->fillRegisteredDataKeys(keys);
248 for(std::vector<edm::eventsetup::DataKey>::iterator itKey = keys.begin(), itKeyEnd = keys.end();
251 data.push_back(std::make_pair(
std::string(itKey->type().name()),
256 std::vector<DataInfo> dataInfos;
257 for (std::vector<std::pair<std::string,std::string> >::iterator itData = data.begin(), itDataEnd = data.end();
261 if(tt == HCTypeTag()) {
262 throw cms::Exception(
"UnknownESDataType")<<
"The name '"<<itData->first<<
"' is not associated with a known type held in the "<<it->first<<
" Record.\n" 263 "Please check spelling or load a module known to link with the package which declares that type.";
266 throw cms::Exception(
"NoDictionary")<<
"The type '"<<itData->first<<
"' can not be retrieved from the Record "<<it->first<<
" and stored \n" 267 "because no dictionary exists for the type.";
269 dataInfos.push_back(DataInfo(tt,itData->second));
271 m_handlers.push_back( std::make_shared<RecordHandler>(rKey,m_file,dataInfos) );
275 for(std::vector<std::shared_ptr<RecordHandler> >::iterator it = m_handlers.begin(),itEnd = m_handlers.end();
278 (*it)->update(iSetup);
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
void beginRun(edm::Run const &, edm::EventSetup const &) override
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const EventID & eventID() const
void analyze(const edm::Event &, const edm::EventSetup &) override
const edm::eventsetup::heterocontainer::HCTypeTag * m_tag
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
std::vector< std::shared_ptr< RecordHandler > > m_handlers
const edm::eventsetup::ComponentDescription * m_desc
const std::string names[nVars_]
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
~FWLiteESRecordWriterAnalyzer() override
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
#define DEFINE_FWK_MODULE(type)
FWLiteESRecordWriterAnalyzer(const edm::ParameterSet &)
Handle(const DataInfo *iInfo)
std::map< std::string, std::vector< std::pair< std::string, std::string > > > m_recordToDataNames
char data[epos_bytes_allocation]
void update(const edm::EventSetup &)
const Timestamp & time() const
const IOVSyncValue & first() const