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)
 
 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_
 
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 
)

Definition at line 21 of file PrincipalGetAdapter.cc.

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

Definition at line 31 of file PrincipalGetAdapter.cc.

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

Member Function Documentation

BranchType const & PrincipalGetAdapter::branchType ( ) const
private

Definition at line 172 of file PrincipalGetAdapter.cc.

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

Referenced by getByToken_(), and transition().

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

Definition at line 337 of file PrincipalGetAdapter.h.

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

Definition at line 277 of file PrincipalGetAdapter.cc.

References edm::ProductResolverBase::branchDescription(), edm::Principal::getProductResolverByIndex(), edm::ProductResolverIndexHelper::index(), diffTreeTool::index, md_, edm::ModuleDescription::moduleLabel(), principal_, edm::ModuleDescription::processName(), edm::PRODUCT_TYPE, edm::Principal::productLookup(), edm::ProductResolverIndexInvalid, throwUnregisteredPutException(), and unlikely.

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

Definition at line 290 of file PrincipalGetAdapter.cc.

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

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

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

179  {
181  }
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:505
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 184 of file PrincipalGetAdapter.cc.

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

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

Definition at line 193 of file PrincipalGetAdapter.cc.

References branchType(), consumer_, edm::Principal::getByToken(), h, diffTreeTool::index, 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().

194  {
195  ProductResolverIndexAndSkipBit indexAndBit = consumer_->indexFrom(token,branchType(),id);
196  ProductResolverIndex index = indexAndBit.productResolverIndex();
197  bool skipCurrentProcess = indexAndBit.skipCurrentProcess();
198  if( unlikely(index == ProductResolverIndexInvalid)) {
199  return makeFailToGetException(kindOfType,id,token);
200  } else if( unlikely(index == ProductResolverIndexAmbiguous)) {
201  // This deals with ambiguities where the process is specified
202  throwAmbiguousException(id, token);
203  }
204  bool ambiguous = false;
205  BasicHandle h = principal_.getByToken(kindOfType, id, index, skipCurrentProcess, ambiguous, resourcesAcquirer_, mcc);
206  if (ambiguous) {
207  // This deals with ambiguities where the process is not specified
208  throwAmbiguousException(id, token);
209  } else if(!h.isValid()) {
210  return makeFailToGetException(kindOfType,id,token);
211  }
212  return h;
213  }
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:542
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 344 of file PrincipalGetAdapter.h.

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

345  {
346  BasicHandleVec bhv;
347  this->getManyByType_(TypeID(typeid(PROD)), bhv, mcc);
348 
349  // Go through the returned handles; for each element,
350  // 1. create a Handle<PROD> and
351  //
352  // This function presents an exception safety difficulty. If an
353  // exception is thrown when converting a handle, the "got
354  // products" record will be wrong.
355  //
356  // Since EDProducers are not allowed to use this function,
357  // the problem does not seem too severe.
358  //
359  // Question: do we even need to keep track of the "got products"
360  // for this function, since it is *not* to be used by EDProducers?
361  std::vector<Handle<PROD> > products;
362 
363  typename BasicHandleVec::iterator it = bhv.begin();
364  typename BasicHandleVec::iterator end = bhv.end();
365 
366  while (it != end) {
368  convert_handle(std::move(*it), result); // throws on conversion error
369  products.push_back(result);
370  ++it;
371  }
372  results.swap(products);
373  }
ESProducts< T, S > products(const T &i1, const S &i2)
Definition: ESProducts.h:191
#define end
Definition: vmac.h:37
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 240 of file PrincipalGetAdapter.cc.

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

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

Definition at line 216 of file PrincipalGetAdapter.cc.

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

218  {
220  }
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:505
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 223 of file PrincipalGetAdapter.cc.

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

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

Definition at line 298 of file PrincipalGetAdapter.cc.

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

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

Definition at line 327 of file PrincipalGetAdapter.cc.

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

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

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

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

Definition at line 370 of file PrincipalGetAdapter.cc.

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

Referenced by edm::OccurrenceForOutput::getByToken().

370  {
371  return principal_.isComplete();
372  }
bool isComplete() const
Definition: Principal.h:200
void PrincipalGetAdapter::labelsForToken ( EDGetToken const &  iToken,
ProductLabels oLabels 
) const

Definition at line 130 of file PrincipalGetAdapter.cc.

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

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

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

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

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

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

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

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

Definition at line 343 of file PrincipalGetAdapter.cc.

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

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

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

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

359  {
361  }
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.

References mps_update::results.

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

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 158 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_().

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

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

Definition at line 308 of file PrincipalGetAdapter.cc.

References edm::BeginLuminosityBlock, edm::BeginRun, branchType(), edm::EndLuminosityBlock, edm::EndRun, edm::Event, edm::InEvent, edm::InRun, likely, and principal().

Referenced by getPutTokenIndex().

308  {
309  if(likely(principal().branchType() == InEvent)) {
310  return Transition::Event;
311  }
312  if(principal().branchType() == InRun) {
313  if(principal().atEndTransition()) {
314  return Transition::EndRun;
315  } else {
316  return Transition::BeginRun;
317  }
318  }
319  if(principal().atEndTransition()) {
321  }
323  //Must be lumi
324  }
Principal const & principal() const
#define likely(x)
BranchType const & branchType() const

Member Data Documentation

EDConsumerBase const* edm::PrincipalGetAdapter::consumer_
private
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