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