CMS 3D CMS Logo

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
 
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
 
TypeID const & getTypeIDForPutTokenIndex (EDPutToken::value_type index) const
 
bool isComplete () const
 
void labelsForToken (EDGetToken const &iToken, ProductLabels &oLabels) 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
 
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_ = 0
 
SharedResourcesAcquirerresourcesAcquirer_
 

Detailed Description

Definition at line 134 of file PrincipalGetAdapter.h.

Member Typedef Documentation

Definition at line 185 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  :
24  //putProducts_(),
25  principal_(pcpl),
26  md_(md),
27  consumer_(nullptr),
28  resourcesAcquirer_(nullptr),
30  {
31  }
SharedResourcesAcquirer * resourcesAcquirer_
EDConsumerBase const * consumer_
ModuleDescription const & md_
PrincipalGetAdapter::~PrincipalGetAdapter ( )

Definition at line 33 of file PrincipalGetAdapter.cc.

33  {
34  }
edm::PrincipalGetAdapter::PrincipalGetAdapter ( PrincipalGetAdapter const &  )
delete

Member Function Documentation

BranchType const & PrincipalGetAdapter::branchType ( ) const
private

Definition at line 174 of file PrincipalGetAdapter.cc.

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

Referenced by getByToken_(), and transition().

174  {
175  return principal_.branchType();
176  }
BranchType const & branchType() const
Definition: Principal.h:177
template<typename PROD >
bool PrincipalGetAdapter::checkIfComplete ( ) const
inline

Definition at line 338 of file PrincipalGetAdapter.h.

BranchDescription const & PrincipalGetAdapter::getBranchDescription ( TypeID const &  type,
std::string const &  productInstanceName 
) const

Definition at line 279 of file PrincipalGetAdapter.cc.

References 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.

280  {
281  ProductResolverIndexHelper const& productResolverIndexHelper = principal_.productLookup();
282  ProductResolverIndex index = productResolverIndexHelper.index(PRODUCT_TYPE, type, md_.moduleLabel().c_str(),productInstanceName.c_str(), md_.processName().c_str());
283  if(UNLIKELY(index == ProductResolverIndexInvalid)) {
284  throwUnregisteredPutException(type, productInstanceName);
285  }
286  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
287  assert(phb != nullptr);
288  return phb->branchDescription();
289  }
type
Definition: HCALResponse.h:21
unsigned int ProductResolverIndex
void throwUnregisteredPutException(TypeID const &type, std::string const &productInstanceLabel) const
std::string const & processName() const
std::string const & moduleLabel() const
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:152
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:520
ModuleDescription const & md_
#define UNLIKELY(x)
BranchDescription const & PrincipalGetAdapter::getBranchDescription ( unsigned int  iPutTokenIndex) const

Definition at line 292 of file PrincipalGetAdapter.cc.

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

292  {
293  auto index = prodBase_->putTokenIndexToProductResolverIndex()[iPutTokenIndex];
294  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
295  assert(phb != nullptr);
296  return phb->branchDescription();
297  }
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex() const
Definition: ProducerBase.h:91
ProducerBase const * prodBase_
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:520
BasicHandle PrincipalGetAdapter::getByLabel_ ( TypeID const &  tid,
InputTag const &  tag,
ModuleCallingContext const *  mcc 
) const

Definition at line 179 of file PrincipalGetAdapter.cc.

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

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

181  {
183  }
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:527
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 186 of file PrincipalGetAdapter.cc.

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

190  {
192  }
SharedResourcesAcquirer * resourcesAcquirer_
static PFTauRenderPlugin instance
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:527
BasicHandle PrincipalGetAdapter::getByToken_ ( TypeID const &  id,
KindOfType  kindOfType,
EDGetToken  token,
ModuleCallingContext const *  mcc 
) const

Definition at line 195 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::OccurrenceForOutput::getByToken().

196  {
197  ProductResolverIndexAndSkipBit indexAndBit = consumer_->indexFrom(token,branchType(),id);
198  ProductResolverIndex index = indexAndBit.productResolverIndex();
199  bool skipCurrentProcess = indexAndBit.skipCurrentProcess();
200  if( UNLIKELY(index == ProductResolverIndexInvalid)) {
201  return makeFailToGetException(kindOfType,id,token);
202  } else if( UNLIKELY(index == ProductResolverIndexAmbiguous)) {
203  // This deals with ambiguities where the process is specified
204  throwAmbiguousException(id, token);
205  }
206  bool ambiguous = false;
207  BasicHandle h = principal_.getByToken(kindOfType, id, index, skipCurrentProcess, ambiguous, resourcesAcquirer_, mcc);
208  if (ambiguous) {
209  // This deals with ambiguities where the process is not specified
210  throwAmbiguousException(id, token);
211  } else if(!h.isValid()) {
212  return makeFailToGetException(kindOfType,id,token);
213  }
214  return h;
215  }
SharedResourcesAcquirer * resourcesAcquirer_
unsigned int ProductResolverIndex
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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:564
void throwAmbiguousException(TypeID const &productType, EDGetToken token) const
#define UNLIKELY(x)
template<typename PROD >
void PrincipalGetAdapter::getManyByType ( std::vector< Handle< PROD > > &  results,
ModuleCallingContext const *  mcc 
) const
inline

Definition at line 345 of file PrincipalGetAdapter.h.

References edm::convert_handle(), end, eostools::move(), PROD, edm::es::products(), mps_fire::result, and mps_update::results.

346  {
347  BasicHandleVec bhv;
348  this->getManyByType_(TypeID(typeid(PROD)), bhv, mcc);
349 
350  // Go through the returned handles; for each element,
351  // 1. create a Handle<PROD> and
352  //
353  // This function presents an exception safety difficulty. If an
354  // exception is thrown when converting a handle, the "got
355  // products" record will be wrong.
356  //
357  // Since EDProducers are not allowed to use this function,
358  // the problem does not seem too severe.
359  //
360  // Question: do we even need to keep track of the "got products"
361  // for this function, since it is *not* to be used by EDProducers?
362  std::vector<Handle<PROD> > products;
363 
364  typename BasicHandleVec::iterator it = bhv.begin();
365  typename BasicHandleVec::iterator end = bhv.end();
366 
367  while (it != end) {
369  convert_handle(std::move(*it), result); // throws on conversion error
370  products.push_back(result);
371  ++it;
372  }
373  results.swap(products);
374  }
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&...args)
Definition: ESProducts.h:129
#define end
Definition: vmac.h:39
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:20
void getManyByType_(TypeID const &tid, BasicHandleVec &results, ModuleCallingContext const *mcc) const
#define PROD(A, B)
def move(src, dest)
Definition: eostools.py:511
std::vector< BasicHandle > BasicHandleVec
void PrincipalGetAdapter::getManyByType_ ( TypeID const &  tid,
BasicHandleVec results,
ModuleCallingContext const *  mcc 
) const

Definition at line 242 of file PrincipalGetAdapter.cc.

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

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

Definition at line 218 of file PrincipalGetAdapter.cc.

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

220  {
222  }
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:527
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 225 of file PrincipalGetAdapter.cc.

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

229  {
231  typeID,
232  label,
233  instance,
234  process,
235  consumer_,
237  mcc);
238  return h;
239  }
SharedResourcesAcquirer * resourcesAcquirer_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static PFTauRenderPlugin instance
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:527
ProductID const & PrincipalGetAdapter::getProductID ( unsigned int  iPutTokenIndex) const

Definition at line 300 of file PrincipalGetAdapter.cc.

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

300  {
301  auto index = prodBase_->putTokenIndexToProductResolverIndex()[iPutTokenIndex];
302  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
303  assert(phb != nullptr);
304  auto prov = phb->stableProvenance();
305  assert(prov != nullptr);
306  return prov->productID();
307  }
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex() const
Definition: ProducerBase.h:91
ProducerBase const * prodBase_
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:520
EDPutToken::value_type PrincipalGetAdapter::getPutTokenIndex ( TypeID const &  type,
std::string const &  productInstanceName 
) const

Definition at line 329 of file PrincipalGetAdapter.cc.

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

329  {
330  auto tran = transition();
331  size_t index = 0;
332  for(auto const& tl : prodBase_->typeLabelList()) {
333  if((tran == tl.transition_) and (type == tl.typeID_)
334  and (productInstanceName == tl.productInstanceName_)) {
335  return index;
336  }
337  ++index;
338  }
339  throwUnregisteredPutException(type, productInstanceName);
341  }
type
Definition: HCALResponse.h:21
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_
TypeID const & PrincipalGetAdapter::getTypeIDForPutTokenIndex ( EDPutToken::value_type  index) const

Definition at line 350 of file PrincipalGetAdapter.cc.

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

350  {
351  return prodBase_->typeLabelList()[index].typeID_;
352  }
TypeLabelList const & typeLabelList() const
used by the fwk to register the list of products of this module
ProducerBase const * prodBase_
bool edm::PrincipalGetAdapter::isComplete ( ) const
inline

Definition at line 160 of file PrincipalGetAdapter.h.

References mps_update::results.

Referenced by edm::OccurrenceForOutput::getByToken(), and transition().

void PrincipalGetAdapter::labelsForToken ( EDGetToken const &  iToken,
ProductLabels oLabels 
) const

Definition at line 132 of file PrincipalGetAdapter.cc.

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

132  {
133  consumer_->labelsForToken(iToken,oLabels);
134  }
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 137 of file PrincipalGetAdapter.cc.

References consumer_, cppFunctionSkipper::exception, tablePrinter::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_().

139  {
141  consumer_->labelsForToken(token,labels);
142  //no need to copy memory since the exception will no occur after the
143  // const char* have been deleted
144  return BasicHandle(makeHandleExceptionFactory([labels,kindOfType,productType]()->std::shared_ptr<cms::Exception> {
145  std::shared_ptr<cms::Exception> exception(std::make_shared<Exception>(errors::ProductNotFound));
146  if (kindOfType == PRODUCT_TYPE) {
147  *exception << "Principal::getByToken: Found zero products matching all criteria\nLooking for type: " << productType << "\n"
148  << "Looking for module label: " << labels.module << "\n" << "Looking for productInstanceName: " << labels.productInstance << "\n"
149  << (0==labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n";
150  } else {
151  *exception << "Principal::getByToken: Found zero products matching all criteria\nLooking for a container with elements of type: " << productType << "\n"
152  << "Looking for module label: " << labels.module << "\n" << "Looking for productInstanceName: " << labels.productInstance << "\n"
153  << (0==labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n";
154  }
155  return exception;
156  }));
157  }
EDConsumerBase const * consumer_
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
ProductLabels Labels
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
size_t PrincipalGetAdapter::numberOfProductsConsumed ( ) const

Definition at line 127 of file PrincipalGetAdapter.cc.

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

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

127  {
128  return consumer_->itemsToGetFrom(InEvent).size();
129  }
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
ProcessHistory const & PrincipalGetAdapter::processHistory ( ) const
EDProductGetter const * PrincipalGetAdapter::prodGetter ( ) const

Definition at line 367 of file PrincipalGetAdapter.cc.

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

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

Definition at line 345 of file PrincipalGetAdapter.cc.

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

345  {
346  return prodBase_->typeLabelList()[iToken.index()].productInstanceName_;
347  }
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 361 of file PrincipalGetAdapter.cc.

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

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

361  {
363  }
std::vector< bool > const & recordProvenanceList() const
ProducerBase const * prodBase_
void edm::PrincipalGetAdapter::setConsumer ( EDConsumerBase const *  iConsumer)
inline

Definition at line 146 of file PrincipalGetAdapter.h.

Referenced by edm::OccurrenceForOutput::setConsumer(), edm::LuminosityBlock::setConsumer(), and edm::Event::setConsumer().

146  {
147  consumer_ = iConsumer;
148  }
EDConsumerBase const * consumer_
void edm::PrincipalGetAdapter::setProducer ( ProducerBase const *  iProd)
inline

Definition at line 154 of file PrincipalGetAdapter.h.

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

154  {
155  prodBase_ = iProd;
156  }
ProducerBase const * prodBase_
void edm::PrincipalGetAdapter::setSharedResourcesAcquirer ( SharedResourcesAcquirer iSra)
inline

Definition at line 150 of file PrincipalGetAdapter.h.

Referenced by edm::LuminosityBlock::setSharedResourcesAcquirer(), and edm::Event::setSharedResourcesAcquirer().

150  {
151  resourcesAcquirer_ = iSra;
152  }
SharedResourcesAcquirer * resourcesAcquirer_
void PrincipalGetAdapter::throwAmbiguousException ( TypeID const &  productType,
EDGetToken  token 
) const
private

Definition at line 160 of file PrincipalGetAdapter.cc.

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

Referenced by getByToken_().

161  {
163  consumer_->labelsForToken(token,labels);
164  cms::Exception exception("AmbiguousProduct");
165  exception << "Principal::getByToken: More than 1 product matches all criteria\nLooking for a container with elements of type: " << productType << "\n"
166  << "Looking for module label: " << labels.module << "\n" << "Looking for productInstanceName: " << labels.productInstance << "\n"
167  << (0==labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n"
168  << "This can only occur with get function calls using a Handle<View> argument.\n"
169  << "Try a get not using a View or change the instance name of one of the products";
170  throw exception;
171  }
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 254 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().

255  {
256  std::ostringstream str;
257  for(auto branchDescription: principal_.productRegistry().allBranchDescriptions()) {
258  if (branchDescription->moduleLabel() == md_.moduleLabel() and branchDescription->processName() == md_.processName()) {
259  str << *branchDescription<< "-----\n";
260  }
261  }
263  << "Illegal attempt to 'put' an unregistered product.\n"
264  << "No product is registered for\n"
265  << " product friendly class name: '" << type.friendlyClassName() << "'\n"
266  << " module label: '" << md_.moduleLabel() << "'\n"
267  << " product instance name: '" << productInstanceName << "'\n"
268  << " process name: '" << md_.processName() << "'\n"
269 
270  << "The following data products are registered for production by "<<md_.moduleLabel()<<":\n"
271  << str.str()
272  << '\n'
273  << "To correct the problem:\n"
274  " 1) make sure the proper 'produce' call is being made in the module's constructor,\n"
275  " 2) if 'produce' exists and uses a product instance name make sure that same name is used during the 'put' call.";
276  }
type
Definition: HCALResponse.h:21
ProductRegistry const & productRegistry() const
Definition: Principal.h:150
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 270 of file PrincipalGetAdapter.h.

ModuleDescription const& edm::PrincipalGetAdapter::md_
private

Definition at line 265 of file PrincipalGetAdapter.h.

Referenced by getBranchDescription(), and throwUnregisteredPutException().

Principal const& edm::PrincipalGetAdapter::principal_
private
ProducerBase const* edm::PrincipalGetAdapter::prodBase_ = 0
private
SharedResourcesAcquirer* edm::PrincipalGetAdapter::resourcesAcquirer_
private