54 virtual void endJob()
override ;
80 _defpartnames(iConfig.getParameter<std::vector<std::
string> >(
"defaultPartitionNames")),
81 _defphases(iConfig.getParameter<std::vector<int> >(
"defaultPhases")),
85 produces<APVCyclePhaseCollection,edm::InEvent>();
91 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent default phases/partitions vector sizes: "
96 std::vector<edm::ParameterSet> vps(iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"runPhases"));
98 for(std::vector<edm::ParameterSet>::const_iterator ps = vps.begin();ps!=vps.end();ps++) {
99 _runphases[ps->getParameter<
int>(
"runNumber")] = ps->getUntrackedParameter<std::vector<int> >(
"phases",
_defphases);
100 _runpartnames[ps->getParameter<
int>(
"runNumber")] = ps->getUntrackedParameter<std::vector<std::string> >(
"partitions",
_defpartnames);
104 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent run " << ps->getParameter<
int>(
"runNumber")
105 <<
" phases/partitions vector sizes: "
106 <<
_runphases[ps->getParameter<
int>(
"runNumber")].size() <<
" "
139 const std::map<int,std::vector<std::string> >& _crunpartnames =
_runpartnames;
140 const std::map<int,std::vector<int> >& _crunphases =
_runphases;
142 std::map<int,std::vector<int> >::const_iterator trphases = _crunphases.find(iRun.
run());
143 std::map<int,std::vector<std::string> >::const_iterator trpartnames = _crunpartnames.find(iRun.
run());
148 if(trphases != _crunphases.end()) {
149 phases = trphases->second;
151 if(trpartnames != _crunpartnames.end()) {
152 partnames = trpartnames->second;
155 if(phases.size() < partnames.size() ) {
157 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent phases/partitions vector sizes: "
158 << phases.size() <<
" "
162 for(
unsigned int ipart=0;ipart<partnames.size();++ipart) {
163 if(phases[ipart]>=0) {
171 edm::LogInfo(
"APVCyclePhaseProducerDebug") <<
"partition " << it->first <<
" phase " << it->second;
185 iEvent.
put(apvphases);
virtual void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
std::map< int, std::vector< std::string > > _runpartnames
#define DEFINE_FWK_MODULE(type)
const std::vector< int > _defphases
const std::map< std::string, int > & get() const
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
ConfigurableAPVCyclePhaseProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const std::vector< std::string > _defpartnames
APVCyclePhaseCollection _currapvphases
virtual void beginJob() override
virtual void endJob() override
~ConfigurableAPVCyclePhaseProducer()
std::map< int, std::vector< int > > _runphases
tuple size
Write out results.