Go to the documentation of this file.00001 #include "FWCore/Framework/interface/ScheduleItems.h"
00002
00003 #include "FWCore/Framework/interface/Actions.h"
00004 #include "FWCore/Framework/interface/CommonParams.h"
00005 #include "FWCore/Framework/interface/ConstProductRegistry.h"
00006 #include "FWCore/Framework/interface/Schedule.h"
00007 #include "FWCore/Framework/interface/TriggerNamesService.h"
00008 #include "FWCore/Framework/src/SignallingProductRegistry.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
00011 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
00012 #include "FWCore/Utilities/interface/GetPassID.h"
00013 #include "FWCore/Version/interface/GetReleaseVersion.h"
00014
00015 namespace edm {
00016 ScheduleItems::ScheduleItems() :
00017 actReg_(new ActivityRegistry),
00018 preg_(new SignallingProductRegistry),
00019 act_table_(),
00020 processConfiguration_() {
00021 }
00022
00023 ScheduleItems::ScheduleItems(ProductRegistry const& preg) :
00024 actReg_(new ActivityRegistry),
00025 preg_(new SignallingProductRegistry(preg)),
00026 act_table_(),
00027 processConfiguration_() {
00028 for(ProductRegistry::ProductList::iterator it = preg_->productListUpdator().begin(), itEnd = preg_->productListUpdator().end(); it != itEnd; ++it) {
00029 it->second.onDemand() = false;
00030 it->second.produced() = false;
00031 }
00032 }
00033
00034 ServiceToken
00035 ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
00036 ParameterSet& parameterSet,
00037 ServiceToken const& iToken,
00038 serviceregistry::ServiceLegacy iLegacy,
00039 bool associate) {
00040
00041
00042 ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
00043
00044
00045 for(std::vector<ParameterSet>::const_iterator it = pServiceSets.begin(), itEnd = pServiceSets.end();
00046 it != itEnd;
00047 ++it) {
00048 if(it->exists("@save_config")) {
00049 parameterSet.addParameter(it->getParameter<std::string>("@service_type"), *it);
00050 }
00051 }
00052
00053
00054 token.copySlotsTo(*actReg_);
00055 return token;
00056 }
00057
00058 ServiceToken
00059 ScheduleItems::addCPRandTNS(ParameterSet const& parameterSet, ServiceToken const& token) {
00060
00061
00062 typedef serviceregistry::ServiceWrapper<ConstProductRegistry> w_CPR;
00063 boost::shared_ptr<w_CPR>
00064 reg(new w_CPR(std::auto_ptr<ConstProductRegistry>(new ConstProductRegistry(*preg_))));
00065 ServiceToken tempToken(ServiceRegistry::createContaining(reg,
00066 token,
00067 serviceregistry::kOverlapIsError));
00068
00069
00070
00071
00072 typedef service::TriggerNamesService TNS;
00073 typedef serviceregistry::ServiceWrapper<TNS> w_TNS;
00074
00075 boost::shared_ptr<w_TNS> tnsptr
00076 (new w_TNS(std::auto_ptr<TNS>(new TNS(parameterSet))));
00077
00078 return ServiceRegistry::createContaining(tnsptr,
00079 tempToken,
00080 serviceregistry::kOverlapIsError);
00081 }
00082
00083 boost::shared_ptr<CommonParams>
00084 ScheduleItems::initMisc(ParameterSet& parameterSet) {
00085 act_table_.reset(new ActionTable(parameterSet));
00086 std::string processName = parameterSet.getParameter<std::string>("@process_name");
00087 processConfiguration_.reset(new ProcessConfiguration(processName, getReleaseVersion(), getPassID()));
00088 boost::shared_ptr<CommonParams>
00089 common(new CommonParams(processName,
00090 getReleaseVersion(),
00091 getPassID(),
00092 parameterSet.getUntrackedParameterSet(
00093 "maxEvents", ParameterSet()).getUntrackedParameter<int>("input", -1),
00094 parameterSet.getUntrackedParameterSet(
00095 "maxLuminosityBlocks", ParameterSet()).getUntrackedParameter<int>("input", -1)));
00096 return common;
00097 }
00098
00099 std::auto_ptr<Schedule>
00100 ScheduleItems::initSchedule(ParameterSet& parameterSet,
00101 ParameterSet const* subProcessPSet) {
00102 std::auto_ptr<Schedule> schedule(
00103 new Schedule(parameterSet,
00104 ServiceRegistry::instance().get<service::TriggerNamesService>(),
00105 *preg_,
00106 *act_table_,
00107 actReg_,
00108 processConfiguration_,
00109 subProcessPSet));
00110 return schedule;
00111 }
00112
00113 void
00114 ScheduleItems::clear() {
00115 actReg_.reset();
00116 preg_.reset();
00117 processConfiguration_.reset();
00118 }
00119 }
00120