CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::PrincipalGetAdapter Class Reference

#include <PrincipalGetAdapter.h>

Public Types

typedef std::vector< BasicHandleBasicHandleVec
 

Public Member Functions

template<typename PROD >
bool checkIfComplete () const
 
BranchDescription const & getBranchDescription (TypeID const &type, std::string const &productInstanceName) const
 
BranchDescription const & getBranchDescription (unsigned int iPutTokenIndex) const
 
BasicHandle getByLabel_ (TypeID const &tid, InputTag const &tag, ModuleCallingContext const *mcc) const
 
BasicHandle getByLabel_ (TypeID const &tid, std::string const &label, std::string const &instance, std::string const &process, ModuleCallingContext const *mcc) const
 
BasicHandle getByToken_ (TypeID const &id, KindOfType kindOfType, EDGetToken token, ModuleCallingContext const *mcc) const
 
EDConsumerBase const * getConsumer () const
 
template<typename PROD >
void getManyByType (std::vector< Handle< PROD > > &results, ModuleCallingContext const *mcc) const
 
void getManyByType_ (TypeID const &tid, BasicHandleVec &results, ModuleCallingContext const *mcc) const
 
BasicHandle getMatchingSequenceByLabel_ (TypeID const &typeID, InputTag const &tag, ModuleCallingContext const *mcc) const
 
BasicHandle getMatchingSequenceByLabel_ (TypeID const &typeID, std::string const &label, std::string const &instance, std::string const &process, ModuleCallingContext const *mcc) const
 
ProductID const & getProductID (unsigned int iPutTokenIndex) const
 
EDPutToken::value_type getPutTokenIndex (TypeID const &type, std::string const &productInstanceName) const
 
SharedResourcesAcquirergetSharedResourcesAcquirer () const
 
TypeID const & getTypeIDForPutTokenIndex (EDPutToken::value_type index) const
 
bool isComplete () const
 
void labelsForToken (EDGetToken const &iToken, ProductLabels &oLabels) const
 
ModuleDescription const & moduleDescription () const
 
size_t numberOfProductsConsumed () const
 
PrincipalGetAdapteroperator= (PrincipalGetAdapter const &)=delete
 
Principal const & principal () const
 
 PrincipalGetAdapter (Principal const &pcpl, ModuleDescription const &md, bool isComplete)
 
 PrincipalGetAdapter (PrincipalGetAdapter const &)=delete
 
unsigned int processBlockIndex (std::string const &processName) const
 
ProcessHistory const & processHistory () const
 
EDProductGetter const * prodGetter () const
 
std::string const & productInstanceLabel (EDPutToken) const
 
std::vector
< edm::ProductResolverIndex >
const & 
putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void setConsumer (EDConsumerBase const *iConsumer)
 
void setProducer (ProducerBase const *iProd)
 
void setSharedResourcesAcquirer (SharedResourcesAcquirer *iSra)
 
Transition transition () const
 
 ~PrincipalGetAdapter ()
 

Private Member Functions

BranchType const & branchType () const
 
BasicHandle makeFailToGetException (KindOfType, TypeID const &, EDGetToken) const
 
void throwAmbiguousException (TypeID const &productType, EDGetToken token) const
 
void throwUnregisteredPutException (TypeID const &type, std::string const &productInstanceLabel) const
 

Private Attributes

EDConsumerBase const * consumer_
 
bool isComplete_
 
ModuleDescription const & md_
 
Principal const & principal_
 
ProducerBase const * prodBase_ = nullptr
 
SharedResourcesAcquirerresourcesAcquirer_
 

Detailed Description

Definition at line 132 of file PrincipalGetAdapter.h.

Member Typedef Documentation

Definition at line 173 of file PrincipalGetAdapter.h.

Constructor & Destructor Documentation

PrincipalGetAdapter::PrincipalGetAdapter ( Principal const &  pcpl,
ModuleDescription const &  md,
bool  isComplete 
)

Definition at line 22 of file PrincipalGetAdapter.cc.

23  : //putProducts_(),
24  principal_(pcpl),
25  md_(md),
26  consumer_(nullptr),
27  resourcesAcquirer_(nullptr),
SharedResourcesAcquirer * resourcesAcquirer_
EDConsumerBase const * consumer_
ModuleDescription const & md_
PrincipalGetAdapter::~PrincipalGetAdapter ( )

Definition at line 30 of file PrincipalGetAdapter.cc.

30 {}
edm::PrincipalGetAdapter::PrincipalGetAdapter ( PrincipalGetAdapter const &  )
delete

Member Function Documentation

BranchType const & PrincipalGetAdapter::branchType ( ) const
private

Definition at line 135 of file PrincipalGetAdapter.cc.

References edm::Principal::branchType(), and principal_.

Referenced by getByToken_(), and transition().

135 { return principal_.branchType(); }
BranchType const & branchType() const
Definition: Principal.h:181
template<typename PROD >
bool PrincipalGetAdapter::checkIfComplete ( ) const
inline
BranchDescription const & PrincipalGetAdapter::getBranchDescription ( TypeID const &  type,
std::string const &  productInstanceName 
) const

Definition at line 224 of file PrincipalGetAdapter.cc.

References cms::cuda::assert(), edm::ProductResolverBase::branchDescription(), edm::Principal::getProductResolverByIndex(), edm::ProductResolverIndexHelper::index(), md_, edm::ModuleDescription::moduleLabel(), principal_, edm::ModuleDescription::processName(), edm::PRODUCT_TYPE, edm::Principal::productLookup(), edm::ProductResolverIndexInvalid, throwUnregisteredPutException(), and UNLIKELY.

225  {
226  ProductResolverIndexHelper const& productResolverIndexHelper = principal_.productLookup();
227  ProductResolverIndex index = productResolverIndexHelper.index(
228  PRODUCT_TYPE, type, md_.moduleLabel().c_str(), productInstanceName.c_str(), md_.processName().c_str());
229  if (UNLIKELY(index == ProductResolverIndexInvalid)) {
230  throwUnregisteredPutException(type, productInstanceName);
231  }
232  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
233  assert(phb != nullptr);
234  return phb->branchDescription();
235  }
unsigned int ProductResolverIndex
void throwUnregisteredPutException(TypeID const &type, std::string const &productInstanceLabel) const
std::string const & processName() const
assert(be >=bs)
std::string const & moduleLabel() const
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:148
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
ModuleDescription const & md_
#define UNLIKELY(x)
Definition: Likely.h:21
BranchDescription const & PrincipalGetAdapter::getBranchDescription ( unsigned int  iPutTokenIndex) const

Definition at line 237 of file PrincipalGetAdapter.cc.

References cms::cuda::assert(), edm::ProductResolverBase::branchDescription(), edm::Principal::getProductResolverByIndex(), principal_, prodBase_, and edm::ProducerBase::putTokenIndexToProductResolverIndex().

237  {
238  auto index = prodBase_->putTokenIndexToProductResolverIndex()[iPutTokenIndex];
239  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
240  assert(phb != nullptr);
241  return phb->branchDescription();
242  }
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex() const
Definition: ProducerBase.h:99
ProducerBase const * prodBase_
assert(be >=bs)
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
BasicHandle PrincipalGetAdapter::getByLabel_ ( TypeID const &  tid,
InputTag const &  tag,
ModuleCallingContext const *  mcc 
) const

Definition at line 137 of file PrincipalGetAdapter.cc.

References consumer_, edm::Principal::getByLabel(), principal_, edm::PRODUCT_TYPE, and resourcesAcquirer_.

Referenced by edm::LuminosityBlock::getByLabel(), edm::Run::getByLabel(), edm::Event::getByLabel(), edm::LuminosityBlock::getByLabelImpl(), edm::Run::getByLabelImpl(), and edm::Event::getByLabelImpl().

139  {
141  }
SharedResourcesAcquirer * resourcesAcquirer_
EDConsumerBase const * consumer_
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:571
BasicHandle PrincipalGetAdapter::getByLabel_ ( TypeID const &  tid,
std::string const &  label,
std::string const &  instance,
std::string const &  process,
ModuleCallingContext const *  mcc 
) const

Definition at line 143 of file PrincipalGetAdapter.cc.

References consumer_, edm::Principal::getByLabel(), principal_, edm::PRODUCT_TYPE, and resourcesAcquirer_.

147  {
149  }
SharedResourcesAcquirer * resourcesAcquirer_
static PFTauRenderPlugin instance
EDConsumerBase const * consumer_
char const * label
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:571
tuple process
Definition: LaserDQM_cfg.py:3
BasicHandle PrincipalGetAdapter::getByToken_ ( TypeID const &  id,
KindOfType  kindOfType,
EDGetToken  token,
ModuleCallingContext const *  mcc 
) const

Definition at line 151 of file PrincipalGetAdapter.cc.

References branchType(), consumer_, edm::Principal::getByToken(), h, edm::EDConsumerBase::indexFrom(), edm::BasicHandle::isValid(), makeFailToGetException(), principal_, edm::ProductResolverIndexAndSkipBit::productResolverIndex(), edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, resourcesAcquirer_, edm::ProductResolverIndexAndSkipBit::skipCurrentProcess(), throwAmbiguousException(), and UNLIKELY.

Referenced by edm::LuminosityBlock::get(), edm::Run::get(), edm::Event::get(), edm::ProcessBlock::getByToken(), edm::OccurrenceForOutput::getByToken(), edm::LuminosityBlock::getByToken(), edm::Run::getByToken(), edm::Event::getByToken(), edm::ProcessBlock::getHandle(), edm::OccurrenceForOutput::getHandle(), edm::LuminosityBlock::getHandle(), edm::Run::getHandle(), and edm::Event::getHandle().

154  {
155  ProductResolverIndexAndSkipBit indexAndBit = consumer_->indexFrom(token, branchType(), id);
156  ProductResolverIndex index = indexAndBit.productResolverIndex();
157  bool skipCurrentProcess = indexAndBit.skipCurrentProcess();
158  if (UNLIKELY(index == ProductResolverIndexInvalid)) {
159  return makeFailToGetException(kindOfType, id, token);
160  } else if (UNLIKELY(index == ProductResolverIndexAmbiguous)) {
161  // This deals with ambiguities where the process is specified
162  throwAmbiguousException(id, token);
163  }
164  bool ambiguous = false;
165  BasicHandle h =
166  principal_.getByToken(kindOfType, id, index, skipCurrentProcess, ambiguous, resourcesAcquirer_, mcc);
167  if (ambiguous) {
168  // This deals with ambiguities where the process is not specified
169  throwAmbiguousException(id, token);
170  } else if (!h.isValid()) {
171  return makeFailToGetException(kindOfType, id, token);
172  }
173  return h;
174  }
SharedResourcesAcquirer * resourcesAcquirer_
unsigned int ProductResolverIndex
EDConsumerBase const * consumer_
BranchType const & branchType() const
ProductResolverIndexAndSkipBit indexFrom(EDGetToken, BranchType, TypeID const &) const
BasicHandle makeFailToGetException(KindOfType, TypeID const &, EDGetToken) const
BasicHandle getByToken(KindOfType kindOfType, TypeID const &typeID, ProductResolverIndex index, bool skipCurrentProcess, bool &ambiguous, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:613
#define UNLIKELY(x)
Definition: Likely.h:21
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void throwAmbiguousException(TypeID const &productType, EDGetToken token) const
EDConsumerBase const* edm::PrincipalGetAdapter::getConsumer ( ) const
inline

Definition at line 144 of file PrincipalGetAdapter.h.

References consumer_.

Referenced by edm::Event::fillLuminosityBlock(), and edm::LuminosityBlock::fillRun().

144 { return consumer_; }
EDConsumerBase const * consumer_
template<typename PROD >
void PrincipalGetAdapter::getManyByType ( std::vector< Handle< PROD > > &  results,
ModuleCallingContext const *  mcc 
) const
inline

Definition at line 319 of file PrincipalGetAdapter.h.

References dataset::end, getManyByType_(), eostools::move(), PROD, edm::es::products(), and bookConverter::results.

Referenced by edm::LuminosityBlock::getManyByType(), edm::Run::getManyByType(), and edm::Event::getManyByType().

320  {
321  BasicHandleVec bhv;
322  this->getManyByType_(TypeID(typeid(PROD)), bhv, mcc);
323 
324  // Go through the returned handles; for each element,
325  // 1. create a Handle<PROD> and
326  //
327  // This function presents an exception safety difficulty. If an
328  // exception is thrown when converting a handle, the "got
329  // products" record will be wrong.
330  //
331  // Since EDProducers are not allowed to use this function,
332  // the problem does not seem too severe.
333  //
334  // Question: do we even need to keep track of the "got products"
335  // for this function, since it is *not* to be used by EDProducers?
336  std::vector<Handle<PROD> > products;
337 
338  typename BasicHandleVec::iterator it = bhv.begin();
339  typename BasicHandleVec::iterator end = bhv.end();
340 
341  while (it != end) {
342  products.push_back(convert_handle<PROD>(std::move(*it)));
343  ++it;
344  }
345  results.swap(products);
346  }
dictionary results
ESProducts< std::remove_reference_t< TArgs >...> products(TArgs &&...args)
Definition: ESProducts.h:128
def move
Definition: eostools.py:511
void getManyByType_(TypeID const &tid, BasicHandleVec &results, ModuleCallingContext const *mcc) const
#define PROD(A, B)
string end
Definition: dataset.py:937
std::vector< BasicHandle > BasicHandleVec
void PrincipalGetAdapter::getManyByType_ ( TypeID const &  tid,
BasicHandleVec results,
ModuleCallingContext const *  mcc 
) const

Definition at line 191 of file PrincipalGetAdapter.cc.

References consumer_, edm::Principal::getManyByType(), principal_, and resourcesAcquirer_.

Referenced by getManyByType().

193  {
195  }
SharedResourcesAcquirer * resourcesAcquirer_
dictionary results
EDConsumerBase const * consumer_
void getManyByType(TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:649
BasicHandle PrincipalGetAdapter::getMatchingSequenceByLabel_ ( TypeID const &  typeID,
InputTag const &  tag,
ModuleCallingContext const *  mcc 
) const

Definition at line 176 of file PrincipalGetAdapter.cc.

References consumer_, edm::ELEMENT_TYPE, edm::Principal::getByLabel(), principal_, and resourcesAcquirer_.

Referenced by edm::Event::getByLabel().

178  {
180  }
SharedResourcesAcquirer * resourcesAcquirer_
EDConsumerBase const * consumer_
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:571
BasicHandle PrincipalGetAdapter::getMatchingSequenceByLabel_ ( TypeID const &  typeID,
std::string const &  label,
std::string const &  instance,
std::string const &  process,
ModuleCallingContext const *  mcc 
) const

Definition at line 182 of file PrincipalGetAdapter.cc.

References consumer_, edm::ELEMENT_TYPE, edm::Principal::getByLabel(), h, principal_, and resourcesAcquirer_.

186  {
188  return h;
189  }
SharedResourcesAcquirer * resourcesAcquirer_
static PFTauRenderPlugin instance
EDConsumerBase const * consumer_
char const * label
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:571
tuple process
Definition: LaserDQM_cfg.py:3
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
ProductID const & PrincipalGetAdapter::getProductID ( unsigned int  iPutTokenIndex) const

Definition at line 244 of file PrincipalGetAdapter.cc.

References cms::cuda::assert(), edm::Principal::getProductResolverByIndex(), principal_, prodBase_, edm::ProducerBase::putTokenIndexToProductResolverIndex(), and edm::ProductResolverBase::stableProvenance().

Referenced by edm::Event::emplaceImpl(), edm::Event::getRefBeforePut(), and edm::Event::putImpl().

244  {
245  auto index = prodBase_->putTokenIndexToProductResolverIndex()[iPutTokenIndex];
246  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
247  assert(phb != nullptr);
248  auto prov = phb->stableProvenance();
249  assert(prov != nullptr);
250  return prov->productID();
251  }
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex() const
Definition: ProducerBase.h:99
ProducerBase const * prodBase_
assert(be >=bs)
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
EDPutToken::value_type PrincipalGetAdapter::getPutTokenIndex ( TypeID const &  type,
std::string const &  productInstanceName 
) const

Definition at line 271 of file PrincipalGetAdapter.cc.

References SiStripPI::max, prodBase_, throwUnregisteredPutException(), transition(), and edm::ProductRegistryHelper::typeLabelList().

Referenced by edm::Event::getRefBeforePut(), edm::Run::put(), edm::LuminosityBlock::put(), and edm::Event::put().

272  {
273  auto tran = transition();
274  size_t index = 0;
275  for (auto const& tl : prodBase_->typeLabelList()) {
276  if ((tran == tl.transition_) and (type == tl.typeID_) and (productInstanceName == tl.productInstanceName_)) {
277  return index;
278  }
279  ++index;
280  }
281  throwUnregisteredPutException(type, productInstanceName);
283  }
Transition transition() const
void throwUnregisteredPutException(TypeID const &type, std::string const &productInstanceLabel) const
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
ProducerBase const * prodBase_
SharedResourcesAcquirer* edm::PrincipalGetAdapter::getSharedResourcesAcquirer ( ) const
inline

Definition at line 147 of file PrincipalGetAdapter.h.

References resourcesAcquirer_.

Referenced by edm::Event::fillLuminosityBlock(), and edm::LuminosityBlock::fillRun().

147 { return resourcesAcquirer_; }
SharedResourcesAcquirer * resourcesAcquirer_
TypeID const & PrincipalGetAdapter::getTypeIDForPutTokenIndex ( EDPutToken::value_type  index) const
bool edm::PrincipalGetAdapter::isComplete ( ) const
inline
void PrincipalGetAdapter::labelsForToken ( EDGetToken const &  iToken,
ProductLabels oLabels 
) const

Definition at line 84 of file PrincipalGetAdapter.cc.

References consumer_, and edm::EDConsumerBase::labelsForToken().

Referenced by edm::LuminosityBlock::labelsForToken(), edm::Run::labelsForToken(), and edm::Event::labelsForToken().

84  {
85  consumer_->labelsForToken(iToken, oLabels);
86  }
EDConsumerBase const * consumer_
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
BasicHandle PrincipalGetAdapter::makeFailToGetException ( KindOfType  kindOfType,
TypeID const &  productType,
EDGetToken  token 
) const
private

Definition at line 92 of file PrincipalGetAdapter.cc.

References consumer_, cppFunctionSkipper::exception, HLT_FULL_cff::labels, edm::EDConsumerBase::labelsForToken(), edm::makeHandleExceptionFactory(), edm::ProductLabels::module, edm::ProductLabels::process, edm::PRODUCT_TYPE, edm::ProductLabels::productInstance, and edm::errors::ProductNotFound.

Referenced by getByToken_().

94  {
96  consumer_->labelsForToken(token, labels);
97  //no need to copy memory since the exception will no occur after the
98  // const char* have been deleted
99  return BasicHandle(
100  makeHandleExceptionFactory([labels, kindOfType, productType]() -> std::shared_ptr<cms::Exception> {
101  std::shared_ptr<cms::Exception> exception(std::make_shared<Exception>(errors::ProductNotFound));
102  if (kindOfType == PRODUCT_TYPE) {
103  *exception << "Principal::getByToken: Found zero products matching all criteria\nLooking for type: "
104  << productType << "\n"
105  << "Looking for module label: " << labels.module << "\n"
106  << "Looking for productInstanceName: " << labels.productInstance << "\n"
107  << (0 == labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n";
108  } else {
109  *exception << "Principal::getByToken: Found zero products matching all criteria\nLooking for a container "
110  "with elements of type: "
111  << productType << "\n"
112  << "Looking for module label: " << labels.module << "\n"
113  << "Looking for productInstanceName: " << labels.productInstance << "\n"
114  << (0 == labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n";
115  }
116  return exception;
117  }));
118  }
EDConsumerBase const * consumer_
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
ProductLabels Labels
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
ModuleDescription const& edm::PrincipalGetAdapter::moduleDescription ( ) const
inline

Definition at line 177 of file PrincipalGetAdapter.h.

References md_.

Referenced by edm::Event::fillLuminosityBlock(), and edm::LuminosityBlock::fillRun().

177 { return md_; }
ModuleDescription const & md_
size_t PrincipalGetAdapter::numberOfProductsConsumed ( ) const

Definition at line 82 of file PrincipalGetAdapter.cc.

References consumer_, edm::InEvent, and edm::EDConsumerBase::itemsToGetFrom().

Referenced by edm::Event::setConsumer().

82 { return consumer_->itemsToGetFrom(InEvent).size(); }
EDConsumerBase const * consumer_
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType iType) const
PrincipalGetAdapter& edm::PrincipalGetAdapter::operator= ( PrincipalGetAdapter const &  )
delete
Principal const& edm::PrincipalGetAdapter::principal ( ) const
inline
unsigned int PrincipalGetAdapter::processBlockIndex ( std::string const &  processName) const

Definition at line 88 of file PrincipalGetAdapter.cc.

References principal_, and edm::Principal::processBlockIndex().

Referenced by edm::Event::processBlockIndex().

88  {
90  }
virtual unsigned int processBlockIndex(std::string const &processName) const
Definition: Principal.cc:567
ProcessHistory const & PrincipalGetAdapter::processHistory ( ) const
EDProductGetter const * PrincipalGetAdapter::prodGetter ( ) const

Definition at line 301 of file PrincipalGetAdapter.cc.

References principal_, and edm::Principal::prodGetter().

Referenced by edm::Event::getRefBeforePut().

301 { return principal_.prodGetter(); }
EDProductGetter const * prodGetter() const
Definition: Principal.h:92
std::string const & PrincipalGetAdapter::productInstanceLabel ( EDPutToken  iToken) const

Definition at line 285 of file PrincipalGetAdapter.cc.

References edm::EDPutToken::index(), prodBase_, and edm::ProductRegistryHelper::typeLabelList().

Referenced by edm::ProcessBlock::put(), edm::Run::put(), edm::LuminosityBlock::put(), and edm::Event::put().

285  {
286  return prodBase_->typeLabelList()[iToken.index()].productInstanceName_;
287  }
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
ProducerBase const * prodBase_
std::vector< edm::ProductResolverIndex > const & PrincipalGetAdapter::putTokenIndexToProductResolverIndex ( ) const
std::vector< bool > const & PrincipalGetAdapter::recordProvenanceList ( ) const

Definition at line 297 of file PrincipalGetAdapter.cc.

References prodBase_, and edm::ProductRegistryHelper::recordProvenanceList().

Referenced by edm::Event::commit_aux(), and edm::Event::setProducer().

297  {
299  }
std::vector< bool > const & recordProvenanceList() const
ProducerBase const * prodBase_
void edm::PrincipalGetAdapter::setConsumer ( EDConsumerBase const *  iConsumer)
inline
void edm::PrincipalGetAdapter::setProducer ( ProducerBase const *  iProd)
inline
void edm::PrincipalGetAdapter::setSharedResourcesAcquirer ( SharedResourcesAcquirer iSra)
inline
void PrincipalGetAdapter::throwAmbiguousException ( TypeID const &  productType,
EDGetToken  token 
) const
private

Definition at line 120 of file PrincipalGetAdapter.cc.

References consumer_, cppFunctionSkipper::exception, HLT_FULL_cff::labels, edm::EDConsumerBase::labelsForToken(), edm::ProductLabels::module, edm::ProductLabels::process, and edm::ProductLabels::productInstance.

Referenced by getByToken_().

120  {
122  consumer_->labelsForToken(token, labels);
123  cms::Exception exception("AmbiguousProduct");
124  exception << "Principal::getByToken: More than 1 product matches all criteria\nLooking for a container with "
125  "elements of type: "
126  << productType << "\n"
127  << "Looking for module label: " << labels.module << "\n"
128  << "Looking for productInstanceName: " << labels.productInstance << "\n"
129  << (0 == labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n"
130  << "This can only occur with get function calls using a Handle<View> argument.\n"
131  << "Try a get not using a View or change the instance name of one of the products";
132  throw exception;
133  }
EDConsumerBase const * consumer_
ProductLabels Labels
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
void PrincipalGetAdapter::throwUnregisteredPutException ( TypeID const &  type,
std::string const &  productInstanceLabel 
) const
private

Definition at line 199 of file PrincipalGetAdapter.cc.

References edm::ProductRegistry::allBranchDescriptions(), Exception, edm::TypeID::friendlyClassName(), edm::errors::InsertFailure, md_, edm::ModuleDescription::moduleLabel(), principal_, edm::ModuleDescription::processName(), edm::Principal::productRegistry(), and str.

Referenced by getBranchDescription(), and getPutTokenIndex().

200  {
201  std::ostringstream str;
202  for (auto branchDescription : principal_.productRegistry().allBranchDescriptions()) {
203  if (branchDescription->moduleLabel() == md_.moduleLabel() and
204  branchDescription->processName() == md_.processName()) {
205  str << *branchDescription << "-----\n";
206  }
207  }
209  << "Illegal attempt to 'put' an unregistered product.\n"
210  << "No product is registered for\n"
211  << " product friendly class name: '" << type.friendlyClassName() << "'\n"
212  << " module label: '" << md_.moduleLabel() << "'\n"
213  << " product instance name: '" << productInstanceName << "'\n"
214  << " process name: '" << md_.processName() << "'\n"
215 
216  << "The following data products are registered for production by " << md_.moduleLabel() << ":\n"
217  << str.str() << '\n'
218  << "To correct the problem:\n"
219  " 1) make sure the proper 'produce' call is being made in the module's constructor,\n"
220  " 2) if 'produce' exists and uses a product instance name make sure that same name is used during the "
221  "'put' call.";
222  }
ProductRegistry const & productRegistry() const
Definition: Principal.h:146
std::string const & processName() const
std::string const & moduleLabel() const
std::vector< BranchDescription const * > allBranchDescriptions() const
ModuleDescription const & md_
#define str(s)
Transition PrincipalGetAdapter::transition ( ) const

Member Data Documentation

EDConsumerBase const* edm::PrincipalGetAdapter::consumer_
private
bool edm::PrincipalGetAdapter::isComplete_
private

Definition at line 249 of file PrincipalGetAdapter.h.

Referenced by isComplete().

ModuleDescription const& edm::PrincipalGetAdapter::md_
private
Principal const& edm::PrincipalGetAdapter::principal_
private
ProducerBase const* edm::PrincipalGetAdapter::prodBase_ = nullptr
private
SharedResourcesAcquirer* edm::PrincipalGetAdapter::resourcesAcquirer_
private