CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ConfigurableAPVCyclePhaseProducer Class Reference

#include <DPGAnalysis/SiStripTools/plugins/ConfigurableAPVCyclePhaseProducer.cc>

Inheritance diagram for ConfigurableAPVCyclePhaseProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ConfigurableAPVCyclePhaseProducer (const edm::ParameterSet &)
 
 ~ConfigurableAPVCyclePhaseProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

APVCyclePhaseCollection _currapvphases
 
const std::vector< std::string > _defpartnames
 
const std::vector< int > _defphases
 
std::map< int, std::vector< std::string > > _runpartnames
 
std::map< int, std::vector< int > > _runphases
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: EDproducer for APVCyclePhaseCollection which uses the configuration file to assign a phase to the run

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file ConfigurableAPVCyclePhaseProducer.cc.

Constructor & Destructor Documentation

◆ ConfigurableAPVCyclePhaseProducer()

ConfigurableAPVCyclePhaseProducer::ConfigurableAPVCyclePhaseProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 77 of file ConfigurableAPVCyclePhaseProducer.cc.

78  : _defpartnames(iConfig.getParameter<std::vector<std::string> >("defaultPartitionNames")),
79  _defphases(iConfig.getParameter<std::vector<int> >("defaultPhases")),
80  _currapvphases() {
81  produces<APVCyclePhaseCollection, edm::InEvent>();
82 
83  //now do what ever other initialization is needed
84 
85  if (_defphases.size() < _defpartnames.size()) {
86  // throw exception
87  throw cms::Exception("InvalidAPVCyclePhases")
88  << " Inconsistent default phases/partitions vector sizes: " << _defphases.size() << " " << _defpartnames.size();
89  }
90 
91  std::vector<edm::ParameterSet> vps(iConfig.getParameter<std::vector<edm::ParameterSet> >("runPhases"));
92 
93  for (std::vector<edm::ParameterSet>::const_iterator ps = vps.begin(); ps != vps.end(); ps++) {
94  _runphases[ps->getParameter<int>("runNumber")] = ps->getUntrackedParameter<std::vector<int> >("phases", _defphases);
95  _runpartnames[ps->getParameter<int>("runNumber")] =
96  ps->getUntrackedParameter<std::vector<std::string> >("partitions", _defpartnames);
97 
98  if (_runphases[ps->getParameter<int>("runNumber")].size() <
99  _runpartnames[ps->getParameter<int>("runNumber")].size()) {
100  // throw exception
101  throw cms::Exception("InvalidAPVCyclePhases")
102  << " Inconsistent run " << ps->getParameter<int>("runNumber")
103  << " phases/partitions vector sizes: " << _runphases[ps->getParameter<int>("runNumber")].size() << " "
104  << _runpartnames[ps->getParameter<int>("runNumber")].size();
105  }
106  }
107 }

References _defpartnames, _defphases, _runpartnames, _runphases, Exception, edm::ParameterSet::getParameter(), and findQualityFiles::size.

◆ ~ConfigurableAPVCyclePhaseProducer()

ConfigurableAPVCyclePhaseProducer::~ConfigurableAPVCyclePhaseProducer ( )
override

Definition at line 109 of file ConfigurableAPVCyclePhaseProducer.cc.

109  {
110  // do anything here that needs to be done at desctruction time
111  // (e.g. close files, deallocate resources etc.)
112 }

Member Function Documentation

◆ beginJob()

void ConfigurableAPVCyclePhaseProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 169 of file ConfigurableAPVCyclePhaseProducer.cc.

169 {}

◆ beginRun()

void ConfigurableAPVCyclePhaseProducer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 119 of file ConfigurableAPVCyclePhaseProducer.cc.

119  {
120  using namespace edm;
121 
122  _currapvphases.get().clear();
123 
124  // fill phase map
125 
126  const std::map<int, std::vector<std::string> >& _crunpartnames = _runpartnames;
127  const std::map<int, std::vector<int> >& _crunphases = _runphases;
128 
129  std::map<int, std::vector<int> >::const_iterator trphases = _crunphases.find(iRun.run());
130  std::map<int, std::vector<std::string> >::const_iterator trpartnames = _crunpartnames.find(iRun.run());
131 
132  std::vector<int> phases = _defphases;
133  std::vector<std::string> partnames = _defpartnames;
134 
135  if (trphases != _crunphases.end()) {
136  phases = trphases->second;
137  }
138  if (trpartnames != _crunpartnames.end()) {
139  partnames = trpartnames->second;
140  }
141 
142  if (phases.size() < partnames.size()) {
143  // throw exception
144  throw cms::Exception("InvalidAPVCyclePhases")
145  << " Inconsistent phases/partitions vector sizes: " << phases.size() << " " << partnames.size();
146  }
147 
148  for (unsigned int ipart = 0; ipart < partnames.size(); ++ipart) {
149  if (phases[ipart] >= 0) {
150  _currapvphases.get()[partnames[ipart]] = phases[ipart];
151  }
152  }
153 
154  for (std::map<std::string, int>::const_iterator it = _currapvphases.get().begin(); it != _currapvphases.get().end();
155  it++) {
156  edm::LogInfo("APVCyclePhaseProducerDebug") << "partition " << it->first << " phase " << it->second;
157  }
158 }

References _currapvphases, _defpartnames, _defphases, _runpartnames, _runphases, Exception, APVCyclePhaseCollection::get(), phases, and edm::RunBase::run().

◆ endJob()

void ConfigurableAPVCyclePhaseProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 172 of file ConfigurableAPVCyclePhaseProducer.cc.

172 {}

◆ produce()

void ConfigurableAPVCyclePhaseProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 160 of file ConfigurableAPVCyclePhaseProducer.cc.

160  {
161  using namespace edm;
162 
163  std::unique_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection(_currapvphases));
164 
165  iEvent.put(std::move(apvphases));
166 }

References _currapvphases, iEvent, and eostools::move().

Member Data Documentation

◆ _currapvphases

APVCyclePhaseCollection ConfigurableAPVCyclePhaseProducer::_currapvphases
private

Definition at line 63 of file ConfigurableAPVCyclePhaseProducer.cc.

Referenced by beginRun(), and produce().

◆ _defpartnames

const std::vector<std::string> ConfigurableAPVCyclePhaseProducer::_defpartnames
private

◆ _defphases

const std::vector<int> ConfigurableAPVCyclePhaseProducer::_defphases
private

◆ _runpartnames

std::map<int, std::vector<std::string> > ConfigurableAPVCyclePhaseProducer::_runpartnames
private

◆ _runphases

std::map<int, std::vector<int> > ConfigurableAPVCyclePhaseProducer::_runphases
private
ConfigurableAPVCyclePhaseProducer::_defpartnames
const std::vector< std::string > _defpartnames
Definition: ConfigurableAPVCyclePhaseProducer.cc:57
phases
std::vector< int > phases
Definition: compareAlignments.cc:30
edm
HLT enums.
Definition: AlignableModifier.h:19
ConfigurableAPVCyclePhaseProducer::_defphases
const std::vector< int > _defphases
Definition: ConfigurableAPVCyclePhaseProducer.cc:58
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
ConfigurableAPVCyclePhaseProducer::_runphases
std::map< int, std::vector< int > > _runphases
Definition: ConfigurableAPVCyclePhaseProducer.cc:61
APVCyclePhaseCollection
Definition: APVCyclePhaseCollection.h:8
APVCyclePhaseCollection::get
const std::map< std::string, int > & get() const
Definition: APVCyclePhaseCollection.h:13
ConfigurableAPVCyclePhaseProducer::_currapvphases
APVCyclePhaseCollection _currapvphases
Definition: ConfigurableAPVCyclePhaseProducer.cc:63
iEvent
int iEvent
Definition: GenABIO.cc:224
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ConfigurableAPVCyclePhaseProducer::_runpartnames
std::map< int, std::vector< std::string > > _runpartnames
Definition: ConfigurableAPVCyclePhaseProducer.cc:60
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443