CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edmtest::AcquireIntProducer Class Reference
Inheritance diagram for edmtest::AcquireIntProducer:
edm::global::EDProducer< edm::ExternalWork, edm::StreamCache< test_acquire::Cache > > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void acquire (edm::StreamID, edm::Event const &, edm::EventSetup const &, edm::WaitingTaskWithArenaHolder) const override
 
 AcquireIntProducer (edm::ParameterSet const &pset)
 
std::unique_ptr< test_acquire::CachebeginStream (edm::StreamID) const override
 
void endJob () override
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const override
 
 ~AcquireIntProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer< edm::ExternalWork, edm::StreamCache< test_acquire::Cache > >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 preallocate (edm::PreallocationConfiguration const &) override
 

Private Attributes

const unsigned int m_numberOfStreamsToAccumulate
 
const unsigned int m_secondsToWaitForWork
 
std::unique_ptr< test_acquire::WaitingServerm_server
 
edm::EDGetTokenT< IntProduct > m_tokenForProduce
 
std::vector< edm::EDGetTokenT< IntProduct > > m_tokens
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file AcquireIntProducer.cc.

Constructor & Destructor Documentation

◆ AcquireIntProducer()

edmtest::AcquireIntProducer::AcquireIntProducer ( edm::ParameterSet const &  pset)
explicit

Definition at line 50 of file AcquireIntProducer.cc.

References m_tokenForProduce, m_tokens, muonDTDigis_cfi::pset, and makeGlobalPositionRcd_cfg::tag.

51  : m_numberOfStreamsToAccumulate(pset.getUntrackedParameter<unsigned int>("streamsToAccumulate", 8)),
52  m_secondsToWaitForWork(pset.getUntrackedParameter<unsigned int>("secondsToWaitForWork", 1)) {
53  for (auto const& tag : pset.getParameter<std::vector<edm::InputTag>>("tags")) {
54  m_tokens.emplace_back(consumes<IntProduct>(tag));
55  }
56  m_tokenForProduce = consumes<IntProduct>(pset.getParameter<edm::InputTag>("produceTag"));
57  produces<IntProduct>();
58  }
edm::EDGetTokenT< IntProduct > m_tokenForProduce
std::vector< edm::EDGetTokenT< IntProduct > > m_tokens
const unsigned int m_secondsToWaitForWork
const unsigned int m_numberOfStreamsToAccumulate

◆ ~AcquireIntProducer()

edmtest::AcquireIntProducer::~AcquireIntProducer ( )
override

Definition at line 60 of file AcquireIntProducer.cc.

References m_server.

60  {
61  if (m_server) {
62  m_server->stop();
63  }
64  }
std::unique_ptr< test_acquire::WaitingServer > m_server

Member Function Documentation

◆ acquire()

void edmtest::AcquireIntProducer::acquire ( edm::StreamID  streamID,
edm::Event const &  event,
edm::EventSetup const &  ,
edm::WaitingTaskWithArenaHolder  holder 
) const
override

Definition at line 76 of file AcquireIntProducer.cc.

References m_server, m_tokens, edmtest::test_acquire::Cache::processed(), edmtest::test_acquire::Cache::retrieved(), unpackBuffers-CaloStage2::token, and edm::StreamID::value().

79  {
80  usleep(1000000);
81 
82  test_acquire::Cache* streamCacheData = streamCache(streamID);
83  streamCacheData->retrieved().clear();
84  streamCacheData->processed().clear();
85 
86  for (auto const& token : m_tokens) {
87  streamCacheData->retrieved().push_back(event.get(token).value);
88  }
89  m_server->requestValuesAsync(
90  streamID.value(), &streamCacheData->retrieved(), &streamCacheData->processed(), holder);
91  }
std::vector< edm::EDGetTokenT< IntProduct > > m_tokens
std::unique_ptr< test_acquire::WaitingServer > m_server
unsigned int value() const
Definition: StreamID.h:43
Definition: event.py:1

◆ beginStream()

std::unique_ptr< test_acquire::Cache > edmtest::AcquireIntProducer::beginStream ( edm::StreamID  ) const
override

Definition at line 72 of file AcquireIntProducer.cc.

72  {
73  return std::make_unique<test_acquire::Cache>();
74  }

◆ endJob()

void edmtest::AcquireIntProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 106 of file AcquireIntProducer.cc.

References m_server.

106  {
107  if (m_server) {
108  m_server->stop();
109  }
110  m_server.reset();
111  }
std::unique_ptr< test_acquire::WaitingServer > m_server

◆ preallocate()

void edmtest::AcquireIntProducer::preallocate ( edm::PreallocationConfiguration const &  iPrealloc)
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 66 of file AcquireIntProducer.cc.

References m_numberOfStreamsToAccumulate, m_secondsToWaitForWork, m_server, and edm::PreallocationConfiguration::numberOfStreams().

66  {
67  m_server = std::make_unique<test_acquire::WaitingServer>(
68  iPrealloc.numberOfStreams(), m_numberOfStreamsToAccumulate, m_secondsToWaitForWork);
69  m_server->start();
70  }
std::unique_ptr< test_acquire::WaitingServer > m_server
const unsigned int m_secondsToWaitForWork
const unsigned int m_numberOfStreamsToAccumulate

◆ produce()

void edmtest::AcquireIntProducer::produce ( edm::StreamID  streamID,
edm::Event event,
edm::EventSetup const &   
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 93 of file AcquireIntProducer.cc.

References m_tokenForProduce, findQualityFiles::v, and funct::void.

93  {
94  usleep(1000000);
95 
96  int sum = 0;
97  for (auto v : streamCache(streamID)->processed()) {
98  sum += v;
99  }
100  event.put(std::make_unique<IntProduct>(sum));
101 
102  // This part is here only for the Parentage test.
104  }
edm::EDGetTokenT< IntProduct > m_tokenForProduce
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
Definition: event.py:1

Member Data Documentation

◆ m_numberOfStreamsToAccumulate

const unsigned int edmtest::AcquireIntProducer::m_numberOfStreamsToAccumulate
private

Definition at line 46 of file AcquireIntProducer.cc.

Referenced by preallocate().

◆ m_secondsToWaitForWork

const unsigned int edmtest::AcquireIntProducer::m_secondsToWaitForWork
private

Definition at line 47 of file AcquireIntProducer.cc.

Referenced by preallocate().

◆ m_server

std::unique_ptr<test_acquire::WaitingServer> edmtest::AcquireIntProducer::m_server
private

Definition at line 45 of file AcquireIntProducer.cc.

Referenced by acquire(), endJob(), preallocate(), and ~AcquireIntProducer().

◆ m_tokenForProduce

edm::EDGetTokenT<IntProduct> edmtest::AcquireIntProducer::m_tokenForProduce
private

Definition at line 44 of file AcquireIntProducer.cc.

Referenced by AcquireIntProducer(), and produce().

◆ m_tokens

std::vector<edm::EDGetTokenT<IntProduct> > edmtest::AcquireIntProducer::m_tokens
private

Definition at line 43 of file AcquireIntProducer.cc.

Referenced by acquire(), and AcquireIntProducer().