From 2529567672fa1658d8e77e0b8cd90cd43c7164ee Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 22 Dec 2005 20:33:04 +0000 Subject: [PATCH] --- yaml --- r: 3252 b: "refs/heads/CMSSW_7_0_X" c: d64a00e9ee0a878ac2cf6e46a3cf11cd1ce7084f h: "refs/heads/CMSSW_7_0_X" v: v3 --- [refs] | 2 +- trunk/FWCore/Framework/src/EventProcessor.cc | 81 ++++++++++++++++++-- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 1cf1ed15416ca..f58548087ae58 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -"refs/heads/CMSSW_7_0_X": 65e2fafeb35d367a0adf69f6808775c9421f2b81 +"refs/heads/CMSSW_7_0_X": d64a00e9ee0a878ac2cf6e46a3cf11cd1ce7084f diff --git a/trunk/FWCore/Framework/src/EventProcessor.cc b/trunk/FWCore/Framework/src/EventProcessor.cc index bb7d9005ee716..f56945abdaaa1 100644 --- a/trunk/FWCore/Framework/src/EventProcessor.cc +++ b/trunk/FWCore/Framework/src/EventProcessor.cc @@ -99,8 +99,76 @@ namespace edm { return shared_ptr(); } + static + std::auto_ptr + makeEventSetupProvider(ParameterSet const& params) + { + using namespace std; + using namespace edm::eventsetup; + vector prefers = params.getParameter >("@all_esprefers"); + if(prefers.empty()){ + return std::auto_ptr(new EventSetupProvider()); + } + + EventSetupProvider::PreferredProviderInfo preferInfo; + EventSetupProvider::RecordToDataMap recordToData; + //recordToData.insert(std::make_pair(std::string("DummyRecord"), + // std::make_pair(std::string("DummyData"),std::string()))); + //preferInfo[ComponentDescription("DummyProxyProvider","",false)]=recordToData; + + for(vector::iterator itName = prefers.begin(); + itName != prefers.end(); + ++itName) + { + recordToData.clear(); + ParameterSet preferPSet = params.getParameter(*itName); + std::vector recordNames = preferPSet.getParameterNames(); + for(std::vector::iterator itRecordName = recordNames.begin(); + itRecordName != recordNames.end(); + ++itRecordName) { + if( (*itRecordName)[0]=='@'){ + //this is a 'hidden parameter' so skip it + continue; + } + //this should be a record name with its info + try { + std::vector dataInfo = preferPSet.getParameter >(*itRecordName); + + if(dataInfo.empty()) { + //FUTURE: empty should just mean all data + throw cms::Exception("Configuration")<<"The record named "<<*itRecordName<<" specifies no data items"; + } + //FUTURE: 'any' should be a special name + for(std::vector::iterator itDatum = dataInfo.begin(); + itDatum != dataInfo.end(); + ++itDatum){ + std::string datumName(*itDatum, 0, itDatum->find_first_of("/")); + std::string labelName; + if(itDatum->size() != datumName.size()) { + labelName = std::string(*itDatum, datumName.size()+1); + } + recordToData.insert(std::make_pair(std::string(*itRecordName), + std::make_pair(datumName, + labelName))); + } + } catch(const cms::Exception& iException) { + cms::Exception theError("ESPreferConfigurationError"); + theError<<"While parsing the es_prefer statement for type="<("@module_type") + <<" label=\""<("@module_label")<<"\" an error occurred."; + theError.append(iException); + throw theError; + } + } + preferInfo[ComponentDescription(preferPSet.getParameter("@module_type"), + preferPSet.getParameter("@module_label"), + false)] + =recordToData; + } + return std::auto_ptr(new EventSetupProvider(&preferInfo)); + } + void - fillEventSetupProvider(eventsetup::EventSetupProvider& cp, + fillEventSetupProvider(edm::eventsetup::EventSetupProvider& cp, ParameterSet const& params, const CommonParams& common) { @@ -185,7 +253,8 @@ namespace edm { ServiceToken serviceToken_; shared_ptr input_; std::auto_ptr runner_; - eventsetup::EventSetupProvider esp_; + std::auto_ptr + esp_; bool emittedBeginJob_; ActionTable act_table_; @@ -247,8 +316,8 @@ namespace edm { runner_->preModuleSignal.connect(actReg_.preModuleSignal_); runner_->postModuleSignal.connect(actReg_.postModuleSignal_); - - fillEventSetupProvider(esp_, *params_, common_); + esp_ = makeEventSetupProvider(*params_); + fillEventSetupProvider(*esp_, *params_, common_); // initialize(iToken,iLegacy); FDEBUG(2) << params_->toString() << std::endl; } @@ -273,7 +342,7 @@ namespace edm { if(pep.get()==0) break; IOVSyncValue ts(pep->id(), pep->time()); - EventSetup const& es = esp_.eventSetupForInstance(ts); + EventSetup const& es = esp_->eventSetupForInstance(ts); try { @@ -324,7 +393,7 @@ namespace edm { // If it really means once per 'application' then this code will have to be changed. // Also have to deal with case where have 'run' then new Module added and do 'run' // again. In that case the newly added Module needs its 'beginJob' to be called. - EventSetup const& es = esp_.eventSetupForInstance(IOVSyncValue::beginOfTime()); + EventSetup const& es = esp_->eventSetupForInstance(IOVSyncValue::beginOfTime()); PathList::iterator itWorkerList = workers_.begin(); PathList::iterator itEnd = workers_.end(); ESRefWrapper wrapper(es);