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) {
113 LogError(
"GetManyWithoutRegistration")<<
"::getManyByType called for "<<iType<<
" without a corresponding consumesMany being called for this module. \n";
116 void failedToRegisterConsumes(
KindOfType kindOfType,
117 TypeID
const& productType,
121 LogError(
"GetByLabelWithoutRegistration")<<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
122 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::View<")<<productType
123 << (kindOfType ==
PRODUCT_TYPE ?
"\n module label: " :
">\n module label: ")<<moduleLabel
124 <<
"\n product instance name: '"<<productInstanceName
125 <<
"'\n process name: '"<<processName<<
"'\n";
136 std::shared_ptr<ProductHolderIndexHelper const> productLookup,
141 processHistoryPtr_(),
143 processConfiguration_(&pc),
146 productLookup_(productLookup),
147 lookupProcessOrder_(productLookup->lookupProcessNames().
size(), 0),
151 historyAppender_(historyAppender),
161 bool hasAliases =
false;
162 for(
auto const&
prod : prodsList) {
168 auto cbd = std::make_shared<BranchDescription const>(bd);
186 for(
auto const&
prod : prodsList) {
189 auto cbd = std::make_shared<BranchDescription const>(bd);
198 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
200 std::vector<bool> ambiguous(lookupProcessNames.size(),
false);
202 std::vector<TypeID>
const& sortedTypeIDs =
productLookup_->sortedTypeIDs();
204 std::vector<ProductHolderIndexHelper::IndexAndNames>
const& indexAndNames =
productLookup_->indexAndNames();
205 std::vector<char>
const& processNamesCharArray =
productLookup_->processNames();
207 if (!sortedTypeIDs.empty()) {
209 for(
unsigned int k = 0, kEnd = sortedTypeIDs.size();
k < kEnd; ++
k) {
211 for (
unsigned int i = range.
begin();
i < range.
end(); ++
i) {
215 std::shared_ptr<ProductHolderBase> newHolder = std::make_shared<NoProcessProductHolder>(matchingHolders, ambiguous,
this);
218 ambiguous.assign(lookupProcessNames.size(),
false);
220 productHolderIndex = product.
index();
223 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
process);
224 assert(iter != lookupProcessNames.end());
229 ambiguous.at(iter - lookupProcessNames.begin()) =
true;
231 matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
236 std::shared_ptr<ProductHolderBase> newHolder = std::make_shared<NoProcessProductHolder>(matchingHolders, ambiguous,
this);
250 for(
auto const&
prod : *
this) {
251 if(
prod->singleProduct() &&
252 !
prod->productUnavailable() &&
254 !
prod->branchDescription().dropped()) {
265 for(
auto const&
prod : prodsList) {
268 auto cbd = std::make_shared<BranchDescription const>(bd);
270 if(phb ==
nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
318 for(
auto const&
prod : *
this) {
319 prod->resetProductData();
354 std::shared_ptr<ProcessHistory const> inputProcessHistory;
357 auto noDel =[](
void const*){};
358 inputProcessHistory =
359 std::shared_ptr<ProcessHistory const>(processHistoryRegistry.
getMapped(hist),noDel);
360 if (inputProcessHistory.get() ==
nullptr) {
362 <<
"Principal::fillPrincipal\n"
363 <<
"Input ProcessHistory not found in registry\n"
364 <<
"Contact a Framework developer\n";
368 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory,[](
void const*){});
375 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
380 iter != iEnd; ++iter) {
381 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
382 if (nameIter == lookupProcessNames.end()) {
407 throw cms::Exception(
"HashCollision") <<
"Principal::getExistingProduct\n" <<
408 " Branch " << newProduct.
branchName() <<
" has same branch ID as branch " << existing.
branchName() <<
"\n" <<
409 "Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
437 <<
"addProductOrThrow: Problem found while adding product, "
438 <<
"product already exists for ("
502 bool skipCurrentProcess,
507 assert(0!=productHolder.get());
509 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
514 if(productData == 0) {
522 bool skipCurrentProcess,
524 std::shared_ptr<ProductHolderBase>
const& productHolder =
productHolders_.at(index);
525 assert(0!=productHolder.get());
527 productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
539 failedToRegisterConsumesMany(typeID);
576 std::vector<ProductHolderBase const*> holders;
583 if(!holders.empty()) {
591 holders.push_back(productHolder);
595 if(!holders.empty()) {
609 iter != iEnd; ++iter) {
611 for (
auto productHolder : holders) {
621 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, mcc);
624 results.emplace_back(*productData);
645 if (skipCurrentProcess) {
651 inputTag.
label().c_str(),
669 failedToRegisterConsumes(kindOfType,typeID,inputTag.
label(),inputTag.
instance(),inputTag.
process());
676 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
711 failedToRegisterConsumes(kindOfType,typeID,label,instance,process);
717 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, mcc);
742 if (phb->productWasDeleted()) {
745 phb->productInstanceName(),
750 phb->resolveProduct(status,
false,mcc);
752 if(!phb->provenance() || (!phb->product() && !phb->productProvenancePtr())) {
755 return OutputHandle(phb->product(), &phb->branchDescription(), phb->productProvenancePtr());
766 if(phb->onDemand()) {
768 if(not phb->resolveProduct(status,
false,mcc) ) {
772 return *phb->provenance();
781 for(
auto const& productHolder : *
this) {
782 if(productHolder->singleProduct() && productHolder->provenanceAvailable() && !productHolder->branchDescription().isAlias()) {
785 if(productHolder->provenance()->product().present()) {
786 provenances.push_back(productHolder->provenance());
794 for(
auto const&
prod : bids) {
819 std::vector<WrapperBase const*>&,
820 std::vector<unsigned int>&)
const {
826 if(prod ==
nullptr)
return;
829 bool alreadyPresent = !
productPtrs_.insert(prod).second;
866 for(
auto const&
prod :
preg_->productList()) {
874 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
void getManyByType(TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, 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 getByToken(KindOfType kindOfType, TypeID const &typeID, ProductHolderIndex index, bool skipCurrentProcess, bool &ambiguous, 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
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, ModuleCallingContext const *mcc) 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_
void findProducts(std::vector< ProductHolderBase const * > const &holders, TypeID const &typeID, BasicHandleVec &results, ModuleCallingContext const *mcc) const
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)
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 ®)
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)
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, ModuleCallingContext const *mcc) const
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
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)