59 <<
"Principal::" << where <<
": no product with given branch id: "<< bid <<
"\n";
66 <<
"Principal::" << where <<
": Product on branch " << branchName <<
" occurs twice in the same event.\n";
70 std::shared_ptr<cms::Exception>
75 *exception <<
"Principal::" << where <<
": Found zero products matching all criteria\nLooking for type: " << productType <<
"\n"
76 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
77 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n";
79 *exception <<
"Principal::" << where <<
": Found zero products matching all criteria\nLooking for a container with elements of type: " << productType <<
"\n"
80 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
81 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n";
90 exception <<
"Principal::" << where <<
": The product matching all criteria\nLooking for type: " << productType <<
"\n"
91 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
92 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n"
93 <<
"Was already deleted. This means there is a configuration error.\n"
94 <<
"The module which is asking for this data must be configured to state that it will read this data.";
102 exception <<
"Principal::" << where <<
": More than 1 product matches all criteria\nLooking for type: " << productType <<
"\n"
103 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
104 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n"
105 <<
"This can only occur with get function calls using a Handle<View> argument.\n"
106 <<
"Try a get not using a View or change the instance name of one of the products";
112 void failedToRegisterConsumesMany(
edm::TypeID const& iType) {
114 exception <<
"::getManyByType called for " << iType
115 <<
" without a corresponding consumesMany being called for this module. \n";
119 void failedToRegisterConsumes(
KindOfType kindOfType,
120 TypeID
const& productType,
125 exception <<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
126 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::View<") << productType
127 << (kindOfType ==
PRODUCT_TYPE ?
"\n module label: " :
">\n module label: ") << moduleLabel
128 <<
"\n product instance name: '" << productInstanceName
129 <<
"'\n process name: '" << processName <<
"'\n";
141 std::shared_ptr<ProductHolderIndexHelper const> productLookup,
146 processHistoryPtr_(),
148 processConfiguration_(&pc),
151 productLookup_(productLookup),
152 lookupProcessOrder_(productLookup->lookupProcessNames().
size(), 0),
156 historyAppender_(historyAppender),
166 bool hasAliases =
false;
167 for(
auto const&
prod : prodsList) {
173 auto cbd = std::make_shared<BranchDescription const>(bd);
191 for(
auto const&
prod : prodsList) {
194 auto cbd = std::make_shared<BranchDescription const>(bd);
203 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
205 std::vector<bool> ambiguous(lookupProcessNames.size(),
false);
207 std::vector<TypeID>
const& sortedTypeIDs =
productLookup_->sortedTypeIDs();
209 std::vector<ProductHolderIndexHelper::IndexAndNames>
const& indexAndNames =
productLookup_->indexAndNames();
210 std::vector<char>
const& processNamesCharArray =
productLookup_->processNames();
212 if (!sortedTypeIDs.empty()) {
214 for(
unsigned int k = 0, kEnd = sortedTypeIDs.size();
k < kEnd; ++
k) {
216 for (
unsigned int i = range.
begin();
i < range.
end(); ++
i) {
220 std::shared_ptr<ProductHolderBase> newHolder = std::make_shared<NoProcessProductHolder>(matchingHolders, ambiguous,
this);
223 ambiguous.assign(lookupProcessNames.size(),
false);
225 productHolderIndex = product.
index();
228 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
process);
229 assert(iter != lookupProcessNames.end());
234 ambiguous.at(iter - lookupProcessNames.begin()) =
true;
236 matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
241 std::shared_ptr<ProductHolderBase> newHolder = std::make_shared<NoProcessProductHolder>(matchingHolders, ambiguous,
this);
255 for(
auto const&
prod : *
this) {
256 if(
prod->singleProduct() &&
257 !
prod->productUnavailable() &&
259 !
prod->branchDescription().dropped()) {
270 for(
auto const&
prod : prodsList) {
273 auto cbd = std::make_shared<BranchDescription const>(bd);
275 if(phb ==
nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
323 for(
auto const&
prod : *
this) {
324 prod->resetProductData();
359 std::shared_ptr<ProcessHistory const> inputProcessHistory;
362 auto noDel =[](
void const*){};
363 inputProcessHistory =
364 std::shared_ptr<ProcessHistory const>(processHistoryRegistry.
getMapped(hist),noDel);
365 if (inputProcessHistory.get() ==
nullptr) {
367 <<
"Principal::fillPrincipal\n"
368 <<
"Input ProcessHistory not found in registry\n"
369 <<
"Contact a Framework developer\n";
373 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory,[](
void const*){});
380 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
385 iter != iEnd; ++iter) {
386 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
387 if (nameIter == lookupProcessNames.end()) {
412 throw cms::Exception(
"HashCollision") <<
"Principal::getExistingProduct\n" <<
413 " Branch " << newProduct.
branchName() <<
" has same branch ID as branch " << existing.
branchName() <<
"\n" <<
414 "Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
442 <<
"addProductOrThrow: Problem found while adding product, "
443 <<
"product already exists for ("
509 bool skipCurrentProcess,
515 assert(0!=productHolder.get());
517 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, sra, mcc);
522 if(productData == 0) {
530 bool skipCurrentProcess,
532 std::shared_ptr<ProductHolderBase>
const& productHolder =
productHolders_.at(index);
533 assert(0!=productHolder.get());
535 productHolder->resolveProduct(resolveStatus, skipCurrentProcess,
nullptr, mcc);
548 failedToRegisterConsumesMany(typeID);
585 std::vector<ProductHolderBase const*> holders;
592 if(!holders.empty()) {
600 holders.push_back(productHolder);
604 if(!holders.empty()) {
619 iter != iEnd; ++iter) {
621 for (
auto productHolder : holders) {
631 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, sra, mcc);
634 results.emplace_back(*productData);
656 if (skipCurrentProcess) {
662 inputTag.
label().c_str(),
680 failedToRegisterConsumes(kindOfType,typeID,inputTag.
label(),inputTag.
instance(),inputTag.
process());
687 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, sra, mcc);
723 failedToRegisterConsumes(kindOfType,typeID,label,instance,process);
729 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, sra, mcc);
755 if (phb->productWasDeleted()) {
758 phb->productInstanceName(),
763 phb->resolveProduct(status,
false,
nullptr, mcc);
765 if(!phb->provenance() || (!phb->product() && !phb->productProvenancePtr())) {
768 return OutputHandle(phb->product(), &phb->branchDescription(), phb->productProvenancePtr());
779 if(phb->onDemand()) {
781 if(not phb->resolveProduct(status,
false,
nullptr, mcc) ) {
785 return *phb->provenance();
794 for(
auto const& productHolder : *
this) {
795 if(productHolder->singleProduct() && productHolder->provenanceAvailable() && !productHolder->branchDescription().isAlias()) {
798 if(productHolder->provenance()->product().present()) {
799 provenances.push_back(productHolder->provenance());
807 for(
auto const&
prod : bids) {
832 std::vector<WrapperBase const*>&,
833 std::vector<unsigned int>&)
const {
839 if(prod ==
nullptr)
return;
842 bool alreadyPresent = !
productPtrs_.insert(prod).second;
879 for(
auto const&
prod :
preg_->productList()) {
887 auto cbd = std::make_shared<BranchDescription const>(bd);
static ProcessHistory const s_emptyProcessHistory
void putOrMerge(std::unique_ptr< WrapperBase > prod, ProductHolderBase const *productHolder) const
ProductRegistry const & productRegistry() const
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
virtual void getThinnedProducts(ProductID const &, std::vector< WrapperBase const * > &, std::vector< unsigned int > &) const override
std::string const & branchName() const
WrapperBase * product() const
BranchType const & branchType() const
HistoryAppender * historyAppender_
ConstProductHolderPtr getProductHolder(BranchID const &oid) const
bool checkTypeDictionary(TypeID const &type)
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
std::shared_ptr< ProductHolderBase > SharedProductPtr
static std::string const source("source")
std::shared_ptr< ProcessHistory const > processHistoryPtr_
void checkType(WrapperBase const &prod) const
ProductHolderBase const * ConstProductHolderPtr
static PFTauRenderPlugin instance
ProductHolderIndex index() const
virtual WrapperBase const * getThinnedProduct(ProductID const &, unsigned int &) const override
ProductHolderIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=0) const
static std::atomic< Principal::CacheIdentifier_t > s_nextIdentifier
std::map< BranchKey, BranchDescription > ProductList
static Principal::CacheIdentifier_t nextIdentifier()
ProcessHistoryID processHistoryID_
std::shared_ptr< ProcessHistory const > appendToProcessHistory(ProcessHistoryID const &inputPHID, ProcessHistory const *inputProcessHistory, ProcessConfiguration const &pc)
void mergeReaders(DelayedReader *other)
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
void getAllProvenance(std::vector< Provenance const * > &provenances) const
static void throwCorruptionException(char const *where, std::string const &branchName)
Provenance getProvenance(BranchID const &bid, ModuleCallingContext const *mcc) const
std::string const & processName() const
unsigned int ProductHolderIndex
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void addInputProduct(std::shared_ptr< BranchDescription const > bd)
static void throwAmbiguousException(const char *where, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
ProductList const & productList() const
std::vector< unsigned int > lookupProcessOrder_
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstProductHolderPtr const phb)
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
BasicHandle getByToken(KindOfType kindOfType, TypeID const &typeID, ProductHolderIndex index, bool skipCurrentProcess, bool &ambiguous, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
void addScheduledProduct(std::shared_ptr< BranchDescription const > bd)
BranchDescription const & branchDescription() const
std::string const & className() const
ProductData const * findProductByTag(TypeID const &typeID, InputTag const &tag, ModuleCallingContext const *mcc) const
std::string const & moduleLabel() const
ConstProductHolderPtr getProductHolderByIndex(ProductHolderIndex const &oid) const
std::shared_ptr< ProductRegistry const > preg_
std::string const & productInstanceName() const
CacheIdentifier_t cacheIdentifier_
BranchType const & branchType() const
ProductHolderCollection productHolders_
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
void addProduct_(std::auto_ptr< ProductHolderBase > phb)
void checkUniquenessAndType(WrapperBase const *prod, ProductHolderBase const *productHolder) const
void addSourceProduct(std::shared_ptr< BranchDescription const > bd)
unsigned int numberOfMatches() const
bool isFullyResolved(unsigned int i) const
ProcessHistoryID orderProcessHistoryID_
unsigned int begin() const
ProductHolderIndex index(unsigned int i) const
std::string const & friendlyClassName() const
BranchID const & branchID() const
Hash< ProcessHistoryType > ProcessHistoryID
void throwMissingDictionariesException()
std::set< void const * > productPtrs_
std::shared_ptr< ProductHolderIndexHelper const > productLookup_
Principal(std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< ProductHolderIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender)
OutputHandle getForOutput(BranchID const &bid, bool getProd, ModuleCallingContext const *mcc) const
DelayedReader * reader() const
void prefetch(ProductHolderIndex index, bool skipCurrentProcess, ModuleCallingContext const *mcc) const
bool registeredToConsumeMany(TypeID const &, BranchType) const
void addUnscheduledProduct(std::shared_ptr< BranchDescription const > bd)
bool putOrMergeProduct() const
std::string wrappedClassName(std::string const &iFullName)
static std::shared_ptr< cms::Exception > makeNotFoundException(char const *where, KindOfType kindOfType, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
void findProducts(std::vector< ProductHolderBase const * > const &holders, TypeID const &typeID, BasicHandleVec &results, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
unsigned long CacheIdentifier_t
virtual WrapperBase const * getIt(ProductID const &) const override
bool registeredToConsume(ProductHolderIndex, bool, BranchType) const
void addProductOrThrow(std::auto_ptr< ProductHolderBase > phb)
bool adjustToNewProductRegistry(ProductRegistry const ®)
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
std::string const & className() const
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
void mergeProduct(std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)
unsigned int startInProcessNames() const
void adjustIndexesAfterProductRegistryAddition()
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
void addAliasedProduct(std::shared_ptr< BranchDescription const > bd)
void fillPrincipal(ProcessHistoryID const &hist, ProcessHistoryRegistry const &phr, DelayedReader *reader)
void recombine(Principal &other, std::vector< BranchID > const &bids)
void putProduct(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)
ProcessConfiguration const * processConfiguration_
tuple size
Write out results.
std::vector< BasicHandle > BasicHandleVec
void getManyByType(TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
ProductHolderBase * getExistingProduct(BranchID const &branchID)
bool checkClassDictionary(TypeID const &type)
static void maybeThrowMissingDictionaryException(TypeID const &productType, bool isElement, std::vector< TypeID > const &missingDictionaries)
ProductHolderIndexHelper const & productLookup() const
void deleteProduct(BranchID const &id)