75 : _defpartnames(iConfig.getParameter<
std::
vector<
std::
string>>(
"defaultPartitionNames")),
76 _defphases(iConfig.getParameter<
std::
vector<
int>>(
"defaultPhases")) {
77 produces<APVCyclePhaseCollection, edm::InEvent>();
84 <<
" Inconsistent default phases/partitions vector sizes: " <<
_defphases.size() <<
" " <<
_defpartnames.size();
87 std::vector<edm::ParameterSet> vps(iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"runPhases"));
89 for (std::vector<edm::ParameterSet>::const_iterator ps = vps.begin(); ps != vps.end(); ps++) {
90 _runphases[ps->getParameter<
int>(
"runNumber")] = ps->getUntrackedParameter<std::vector<int>>(
"phases",
_defphases);
92 ps->getUntrackedParameter<std::vector<std::string>>(
"partitions",
_defpartnames);
94 if (
_runphases[ps->getParameter<
int>(
"runNumber")].size() <
98 <<
" Inconsistent run " << ps->getParameter<
int>(
"runNumber")
99 <<
" phases/partitions vector sizes: " <<
_runphases[ps->getParameter<
int>(
"runNumber")].size() <<
" " 119 auto currapvphases = std::make_shared<APVCyclePhaseCollection>();
123 const std::map<int, std::vector<std::string>>& _crunpartnames =
_runpartnames;
124 const std::map<int, std::vector<int>>& _crunphases =
_runphases;
126 std::map<int, std::vector<int>>::const_iterator trphases = _crunphases.find(iRun.
run());
127 std::map<int, std::vector<std::string>>::const_iterator trpartnames = _crunpartnames.find(iRun.
run());
132 if (trphases != _crunphases.end()) {
133 phases = trphases->second;
135 if (trpartnames != _crunpartnames.end()) {
136 partnames = trpartnames->second;
139 if (
phases.size() < partnames.size()) {
142 <<
" Inconsistent phases/partitions vector sizes: " <<
phases.size() <<
" " << partnames.size();
145 for (
unsigned int ipart = 0; ipart < partnames.size(); ++ipart) {
147 currapvphases->get()[partnames[ipart]] =
phases[ipart];
151 for (std::map<std::string, int>::const_iterator it = currapvphases->get().begin(); it != currapvphases->get().end();
153 edm::LogInfo(
"APVCyclePhaseProducerDebug") <<
"partition " << it->first <<
" phase " << it->second;
155 return currapvphases;
163 std::unique_ptr<APVCyclePhaseCollection> apvphases =
164 std::make_unique<APVCyclePhaseCollection>(*runCache(
iEvent.getRun().index()));
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
T getParameter(std::string const &) const
~ConfigurableAPVCyclePhaseProducer() override
std::map< int, std::vector< int > > _runphases
std::map< int, std::vector< std::string > > _runpartnames
const std::vector< int > _defphases
ConfigurableAPVCyclePhaseProducer(const edm::ParameterSet &)
const std::vector< std::string > _defpartnames
#define DEFINE_FWK_MODULE(type)
Log< level::Info, false > LogInfo
std::vector< int > phases
std::shared_ptr< APVCyclePhaseCollection > globalBeginRun(const edm::Run &, const edm::EventSetup &) const override
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override