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 21 of file PrincipalGetAdapter.cc.

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

Definition at line 32 of file PrincipalGetAdapter.cc.

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

Member Function Documentation

BranchType const & PrincipalGetAdapter::branchType ( ) const
private

Definition at line 173 of file PrincipalGetAdapter.cc.

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

Referenced by getByToken_(), and transition().

173  {
174  return principal_.branchType();
175  }
BranchType const & branchType() const
Definition: Principal.h:176
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 278 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.

279  {
280  ProductResolverIndexHelper const& productResolverIndexHelper = principal_.productLookup();
281  ProductResolverIndex index = productResolverIndexHelper.index(PRODUCT_TYPE, type, md_.moduleLabel().c_str(),productInstanceName.c_str(), md_.processName().c_str());
282  if(unlikely(index == ProductResolverIndexInvalid)) {
283  throwUnregisteredPutException(type, productInstanceName);
284  }
285  ProductResolverBase const* phb = principal_.getProductResolverByIndex(index);
286  assert(phb != nullptr);
287  return phb->branchDescription();
288  }
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
#define unlikely(x)
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:151
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:513
ModuleDescription const & md_
BranchDescription const & PrincipalGetAdapter::getBranchDescription ( unsigned int  iPutTokenIndex) const

Definition at line 291 of file PrincipalGetAdapter.cc.

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

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

Definition at line 178 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().

180  {
182  }
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:520
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 185 of file PrincipalGetAdapter.cc.

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

189  {
191  }
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:520
BasicHandle PrincipalGetAdapter::getByToken_ ( TypeID const &  id,
KindOfType  kindOfType,
EDGetToken  token,
ModuleCallingContext const *  mcc 
) const

Definition at line 194 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().

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

Definition at line 241 of file PrincipalGetAdapter.cc.

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

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

Definition at line 217 of file PrincipalGetAdapter.cc.

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

219  {
221  }
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:520
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 224 of file PrincipalGetAdapter.cc.

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

228  {
230  typeID,
231  label,
232  instance,
233  process,
234  consumer_,
236  mcc);
237  return h;
238  }
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:520
ProductID const & PrincipalGetAdapter::getProductID ( unsigned int  iPutTokenIndex) const

Definition at line 299 of file PrincipalGetAdapter.cc.

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

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

Definition at line 328 of file PrincipalGetAdapter.cc.

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

328  {
329  auto tran = transition();
330  size_t index = 0;
331  for(auto const& tl : prodBase_->typeLabelList()) {
332  if((tran == tl.transition_) and (type == tl.typeID_)
333  and (productInstanceName == tl.productInstanceName_)) {
334  return index;
335  }
336  ++index;
337  }
338  throwUnregisteredPutException(type, productInstanceName);
340  }
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 349 of file PrincipalGetAdapter.cc.

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

349  {
350  return prodBase_->typeLabelList()[index].typeID_;
351  }
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 131 of file PrincipalGetAdapter.cc.

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

131  {
132  consumer_->labelsForToken(iToken,oLabels);
133  }
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 136 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_().

138  {
140  consumer_->labelsForToken(token,labels);
141  //no need to copy memory since the exception will no occur after the
142  // const char* have been deleted
143  return BasicHandle(makeHandleExceptionFactory([labels,kindOfType,productType]()->std::shared_ptr<cms::Exception> {
144  std::shared_ptr<cms::Exception> exception(std::make_shared<Exception>(errors::ProductNotFound));
145  if (kindOfType == PRODUCT_TYPE) {
146  *exception << "Principal::getByToken: Found zero products matching all criteria\nLooking for type: " << productType << "\n"
147  << "Looking for module label: " << labels.module << "\n" << "Looking for productInstanceName: " << labels.productInstance << "\n"
148  << (0==labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n";
149  } else {
150  *exception << "Principal::getByToken: Found zero products matching all criteria\nLooking for a container with elements of type: " << productType << "\n"
151  << "Looking for module label: " << labels.module << "\n" << "Looking for productInstanceName: " << labels.productInstance << "\n"
152  << (0==labels.process[0] ? "" : "Looking for process: ") << labels.process << "\n";
153  }
154  return exception;
155  }));
156  }
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 126 of file PrincipalGetAdapter.cc.

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

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

126  {
127  return consumer_->itemsToGetFrom(InEvent).size();
128  }
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 366 of file PrincipalGetAdapter.cc.

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

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

Definition at line 344 of file PrincipalGetAdapter.cc.

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

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

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

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

360  {
362  }
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 159 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_().

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

Referenced by getBranchDescription(), and getPutTokenIndex().

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