CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
timestudy::ExternalWorkSleepingProducer Class Reference
Inheritance diagram for timestudy::ExternalWorkSleepingProducer:
edm::global::EDProducer< edm::ExternalWork > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void acquire (edm::StreamID, edm::Event const &e, edm::EventSetup const &c, edm::WaitingTaskWithArenaHolder holder) const override
 
 ExternalWorkSleepingProducer (edm::ParameterSet const &p)
 
void produce (edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
 
- Public Member Functions inherited from edm::global::EDProducer< edm::ExternalWork >
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< long > finishTimes_
 
std::vector< long > initTimes_
 
Sleeper sleeper_
 
int value_
 
std::vector< long > workTimes_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 295 of file TimeStudyModules.cc.

Constructor & Destructor Documentation

timestudy::ExternalWorkSleepingProducer::ExternalWorkSleepingProducer ( edm::ParameterSet const &  p)
inlineexplicit

Definition at line 297 of file TimeStudyModules.cc.

References EnergyCorrector::c, MillePedeFileConverter_cfg::e, fillDescriptions(), edm::ParameterSet::getParameter(), and lumiQTWidget::t.

297  :
298  value_(p.getParameter<int>("ivalue")),
300  {
301  {
302  auto const& tv = p.getParameter<std::vector<double>>("serviceInitTimes");
303  initTimes_.reserve(tv.size());
304  for(auto t: tv) {
305  initTimes_.push_back( static_cast<useconds_t>(t*1E6));
306  }
307  }
308  {
309  auto const& tv = p.getParameter<std::vector<double>>("serviceWorkTimes");
310  workTimes_.reserve(tv.size());
311  for(auto t: tv) {
312  workTimes_.push_back( static_cast<useconds_t>(t*1E6));
313  }
314  }
315  {
316  auto const& tv = p.getParameter<std::vector<double>>("serviceFinishTimes");
317  finishTimes_.reserve(tv.size());
318  for(auto t: tv) {
319  finishTimes_.push_back( static_cast<useconds_t>(t*1E6));
320  }
321  }
322  assert(finishTimes_.size() == initTimes_.size());
323  assert(workTimes_.size() == initTimes_.size());
324 
325  produces<int>();
326  }
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.

Member Function Documentation

void timestudy::ExternalWorkSleepingProducer::acquire ( edm::StreamID  id,
edm::Event const &  e,
edm::EventSetup const &  c,
edm::WaitingTaskWithArenaHolder  holder 
) const
override

Definition at line 342 of file TimeStudyModules.cc.

References edm::EventID::event(), edm::EventBase::id(), eostools::move(), and definitions::server.

342  {
343  // EventSetup is not used.
344  sleeper_.getAndSleep(e);
346  auto index = (e.id().event()-1) % initTimes_.size();
347  server->asyncWork(id, std::move(holder), initTimes_[index], workTimes_[index], finishTimes_[index]);
348  }
def move(src, dest)
Definition: eostools.py:510
void timestudy::ExternalWorkSleepingProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 356 of file TimeStudyModules.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and DEFINE_FWK_SERVICE.

356  {
358 
359  desc.add<int>("ivalue")->setComment("Value to put into Event");
360  desc.add<std::vector<double>>("serviceInitTimes");
361  desc.add<std::vector<double>>("serviceWorkTimes");
362  desc.add<std::vector<double>>("serviceFinishTimes");
363  Sleeper::fillDescription(desc);
364 
365  descriptions.addDefault(desc);
366  }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void timestudy::ExternalWorkSleepingProducer::produce ( edm::StreamID  ,
edm::Event e,
edm::EventSetup const &  c 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 351 of file TimeStudyModules.cc.

References edm::Event::put().

351  {
352  e.put(std::make_unique<int>(value_));
353  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137

Member Data Documentation

std::vector<long> timestudy::ExternalWorkSleepingProducer::finishTimes_
private

Definition at line 336 of file TimeStudyModules.cc.

std::vector<long> timestudy::ExternalWorkSleepingProducer::initTimes_
private

Definition at line 334 of file TimeStudyModules.cc.

Sleeper timestudy::ExternalWorkSleepingProducer::sleeper_
private

Definition at line 338 of file TimeStudyModules.cc.

int timestudy::ExternalWorkSleepingProducer::value_
private

Definition at line 337 of file TimeStudyModules.cc.

std::vector<long> timestudy::ExternalWorkSleepingProducer::workTimes_
private

Definition at line 335 of file TimeStudyModules.cc.