CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
edm::ESConsumesCollector Class Reference

#include "FWCore/Framework/interface/ESConsumesCollector.h"

Inheritance diagram for edm::ESConsumesCollector:
edm::ESConsumesCollectorT< RECORD >

Public Member Functions

template<typename Product , typename Record >
auto consumesFrom ()
 
template<typename Product , typename Record >
auto consumesFrom (ESInputTag const &tag)
 
 ESConsumesCollector ()=delete
 
 ESConsumesCollector (ESConsumesCollector &&)=default
 
 ESConsumesCollector (ESConsumesCollector const &)=delete
 
ESConsumesCollectoroperator= (ESConsumesCollector &&)=default
 
ESConsumesCollectoroperator= (ESConsumesCollector const &)=delete
 
template<typename Product , typename Record >
ESConsumesCollectorsetConsumes (ESGetToken< Product, Record > &token)
 
template<typename Product , typename Record >
ESConsumesCollectorsetConsumes (ESGetToken< Product, Record > &token, ESInputTag const &tag)
 

Protected Member Functions

 ESConsumesCollector (ESConsumesInfo *const iConsumer, unsigned int iTransitionID)
 
template<typename Product , typename Record , typename Collector , typename PTag >
auto registerMayConsume (std::unique_ptr< Collector > iCollector, PTag const &productTag)
 

Private Attributes

edm::propagate_const< ESConsumesInfo * > m_consumer {nullptr}
 
unsigned int m_transitionID {0}
 

Detailed Description

Description: Helper class to gather consumes information for the EventSetup.

Usage: The constructor of an ESProducer module can get an instance of edm::ESConsumesCollector by calling consumesCollector() method. This instance can then be passed to helper classes in order to register the event-setup data the helper will request from an Event, LuminosityBlock or Run on behalf of the module.

Caveat: The ESConsumesCollector should be used during the time that modules are being constructed. It should not be saved and used later. It will not work if it is used to call the consumes function during beginJob, beginRun, beginLuminosity block, event processing or at any later time. As of now, an ESConsumesCollector is provided for only ESProducer subclasses–i.e. those that call setWhatProduced(this, ...).

Definition at line 58 of file ESConsumesCollector.h.

Constructor & Destructor Documentation

◆ ESConsumesCollector() [1/4]

edm::ESConsumesCollector::ESConsumesCollector ( )
delete

◆ ESConsumesCollector() [2/4]

edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesCollector const &  )
delete

◆ ESConsumesCollector() [3/4]

edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesCollector &&  )
default

◆ ESConsumesCollector() [4/4]

edm::ESConsumesCollector::ESConsumesCollector ( ESConsumesInfo *const  iConsumer,
unsigned int  iTransitionID 
)
inlineexplicitprotected

Definition at line 104 of file ESConsumesCollector.h.

105  : m_consumer{iConsumer}, m_transitionID{iTransitionID} {}

Member Function Documentation

◆ consumesFrom() [1/2]

template<typename Product , typename Record >
auto edm::ESConsumesCollector::consumesFrom ( )
inline

Definition at line 81 of file ESConsumesCollector.h.

81  {
82  using namespace edm::eventsetup;
83  ESTokenIndex index{static_cast<ESTokenIndex::Value_t>(m_consumer->size())};
84  m_consumer->emplace_back(
85  EventSetupRecordKey::makeKey<Record>(), DataKey(DataKey::makeTypeTag<Product>(), ""), "", nullptr);
86  //even though m_consumer may expand, the address for
87  // name().value() remains the same since it is 'moved'.
88  return ESGetToken<Product, Record>{m_transitionID, index, m_consumer->back().productKey_.name().value()};
89  }

References m_consumer, and m_transitionID.

◆ consumesFrom() [2/2]

template<typename Product , typename Record >
auto edm::ESConsumesCollector::consumesFrom ( ESInputTag const &  tag)
inline

Definition at line 68 of file ESConsumesCollector.h.

68  {
69  using namespace edm::eventsetup;
70  ESTokenIndex index{static_cast<ESTokenIndex::Value_t>(m_consumer->size())};
71  m_consumer->emplace_back(EventSetupRecordKey::makeKey<Record>(),
72  DataKey(DataKey::makeTypeTag<Product>(), tag.data().c_str()),
73  tag.module(),
74  nullptr);
75  //even though m_consumer may expand, the address for
76  // name().value() remains the same since it is 'moved'.
77  return ESGetToken<Product, Record>{m_transitionID, index, m_consumer->back().productKey_.name().value()};
78  }

References m_consumer, m_transitionID, and GlobalPosition_Frontier_DevDB_cff::tag.

◆ operator=() [1/2]

ESConsumesCollector& edm::ESConsumesCollector::operator= ( ESConsumesCollector &&  )
default

◆ operator=() [2/2]

ESConsumesCollector& edm::ESConsumesCollector::operator= ( ESConsumesCollector const &  )
delete

◆ registerMayConsume()

template<typename Product , typename Record , typename Collector , typename PTag >
auto edm::ESConsumesCollector::registerMayConsume ( std::unique_ptr< Collector >  iCollector,
PTag const &  productTag 
)
inlineprotected

Definition at line 108 of file ESConsumesCollector.h.

108  {
109  //NOTE: for now, just treat like standard consumes request for the product needed to
110  // do the decision
111  setConsumes(iCollector->token(), productTag.inputTag());
112 
113  using namespace edm::eventsetup;
114  ESTokenIndex index{static_cast<ESTokenIndex::Value_t>(m_consumer->size())};
115  m_consumer->emplace_back(EventSetupRecordKey::makeKey<Record>(),
116  DataKey(DataKey::makeTypeTag<Product>(), "@mayConsume"),
117  "@mayConsume",
118  std::move(iCollector));
119  //even though m_consumer may expand, the address for
120  // name().value() remains the same since it is 'moved'.
121  return ESGetToken<Product, Record>{m_transitionID, index, m_consumer->back().productKey_.name().value()};
122  }

References m_consumer, m_transitionID, eostools::move(), and setConsumes().

◆ setConsumes() [1/2]

template<typename Product , typename Record >
ESConsumesCollector& edm::ESConsumesCollector::setConsumes ( ESGetToken< Product, Record > &  token)
inline

Definition at line 98 of file ESConsumesCollector.h.

98  {
99  token = consumesFrom<Product, Record>();
100  return *this;
101  }

References unpackBuffers-CaloStage2::token.

◆ setConsumes() [2/2]

template<typename Product , typename Record >
ESConsumesCollector& edm::ESConsumesCollector::setConsumes ( ESGetToken< Product, Record > &  token,
ESInputTag const &  tag 
)
inline

Definition at line 92 of file ESConsumesCollector.h.

92  {
93  token = consumesFrom<Product, Record>(tag);
94  return *this;
95  }

References GlobalPosition_Frontier_DevDB_cff::tag, and unpackBuffers-CaloStage2::token.

Referenced by registerMayConsume().

Member Data Documentation

◆ m_consumer

edm::propagate_const<ESConsumesInfo*> edm::ESConsumesCollector::m_consumer {nullptr}
private

Definition at line 126 of file ESConsumesCollector.h.

Referenced by consumesFrom(), and registerMayConsume().

◆ m_transitionID

unsigned int edm::ESConsumesCollector::m_transitionID {0}
private

Definition at line 127 of file ESConsumesCollector.h.

Referenced by consumesFrom(), and registerMayConsume().

edm::ESConsumesCollector::setConsumes
ESConsumesCollector & setConsumes(ESGetToken< Product, Record > &token, ESInputTag const &tag)
Definition: ESConsumesCollector.h:92
edm::eventsetup::DataKey
Definition: DataKey.h:29
edm::ESConsumesCollector::m_transitionID
unsigned int m_transitionID
Definition: ESConsumesCollector.h:127
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::ESConsumesCollector::m_consumer
edm::propagate_const< ESConsumesInfo * > m_consumer
Definition: ESConsumesCollector.h:126
ESTokenIndex
ESGetToken
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::eventsetup
Definition: ES_DDDetector.cc:16
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316