61 <<
"Principal::" << where <<
": no product with given branch id: "<< bid <<
"\n";
68 <<
"Principal::" << where <<
": Product on branch " << branchName <<
" occurs twice in the same event.\n";
72 std::shared_ptr<cms::Exception>
77 *exception <<
"Principal::" << where <<
": Found zero products matching all criteria\nLooking for type: " << productType <<
"\n"
78 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
79 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n";
81 *exception <<
"Principal::" << where <<
": Found zero products matching all criteria\nLooking for a container with elements of type: " << productType <<
"\n"
82 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
83 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n";
92 exception <<
"Principal::" << where <<
": The product matching all criteria\nLooking for type: " << productType <<
"\n"
93 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
94 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n"
95 <<
"Was already deleted. This means there is a configuration error.\n"
96 <<
"The module which is asking for this data must be configured to state that it will read this data.";
104 exception <<
"Principal::" << where <<
": More than 1 product matches all criteria\nLooking for type: " << productType <<
"\n"
105 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
106 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n"
107 <<
"This can only occur with get function calls using a Handle<View> argument.\n"
108 <<
"Try a get not using a View or change the instance name of one of the products";
114 void failedToRegisterConsumesMany(
edm::TypeID const& iType) {
116 exception <<
"::getManyByType called for " << iType
117 <<
" without a corresponding consumesMany being called for this module. \n";
121 void failedToRegisterConsumes(
KindOfType kindOfType,
122 TypeID
const& productType,
127 exception <<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
128 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::View<") << productType
129 << (kindOfType ==
PRODUCT_TYPE ?
"\n module label: " :
">\n module label: ") << moduleLabel
130 <<
"\n product instance name: '" << productInstanceName
131 <<
"'\n process name: '" << processName <<
"'\n";
143 std::shared_ptr<ProductHolderIndexHelper const> productLookup,
148 processHistoryPtr_(),
150 processConfiguration_(&pc),
153 productLookup_(productLookup),
154 lookupProcessOrder_(productLookup->lookupProcessNames().
size(), 0),
158 historyAppender_(historyAppender),
168 bool hasAliases =
false;
169 for(
auto const&
prod : prodsList) {
175 auto cbd = std::make_shared<BranchDescription const>(bd);
193 for(
auto const&
prod : prodsList) {
196 auto cbd = std::make_shared<BranchDescription const>(bd);
205 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
207 std::vector<bool> ambiguous(lookupProcessNames.size(),
false);
209 std::vector<TypeID>
const& sortedTypeIDs =
productLookup_->sortedTypeIDs();
211 std::vector<ProductHolderIndexHelper::IndexAndNames>
const& indexAndNames =
productLookup_->indexAndNames();
212 std::vector<char>
const& processNamesCharArray =
productLookup_->processNames();
214 if (!sortedTypeIDs.empty()) {
216 for(
unsigned int k = 0, kEnd = sortedTypeIDs.size();
k < kEnd; ++
k) {
218 for (
unsigned int i = range.
begin();
i < range.
end(); ++
i) {
222 std::shared_ptr<ProductHolderBase> newHolder = std::make_shared<NoProcessProductHolder>(matchingHolders, ambiguous);
225 ambiguous.assign(lookupProcessNames.size(),
false);
227 productHolderIndex = product.
index();
230 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
process);
231 assert(iter != lookupProcessNames.end());
236 ambiguous.at(iter - lookupProcessNames.begin()) =
true;
238 matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
243 std::shared_ptr<ProductHolderBase> newHolder = std::make_shared<NoProcessProductHolder>(matchingHolders, ambiguous);
257 for(
auto const&
prod : *
this) {
258 if(
prod->singleProduct() &&
259 !
prod->productUnavailable() &&
261 !
prod->branchDescription().dropped()) {
272 for(
auto const&
prod : prodsList) {
275 auto cbd = std::make_shared<BranchDescription const>(bd);
277 if(phb ==
nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
325 for(
auto&
prod : *
this) {
326 prod->resetProductData();
339 phb->unsafe_deleteProduct();
361 std::shared_ptr<ProcessHistory const> inputProcessHistory;
364 auto noDel =[](
void const*){};
365 inputProcessHistory =
366 std::shared_ptr<ProcessHistory const>(processHistoryRegistry.
getMapped(hist),noDel);
367 if (inputProcessHistory.get() ==
nullptr) {
369 <<
"Principal::fillPrincipal\n"
370 <<
"Input ProcessHistory not found in registry\n"
371 <<
"Contact a Framework developer\n";
375 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory,[](
void const*){});
382 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
387 iter != iEnd; ++iter) {
388 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
389 if (nameIter == lookupProcessNames.end()) {
418 throw cms::Exception(
"HashCollision") <<
"Principal::getExistingProduct\n" <<
419 " Branch " << newProduct.
branchName() <<
" has same branch ID as branch " << existing.
branchName() <<
"\n" <<
420 "Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
448 <<
"addProductOrThrow: Problem found while adding product, "
449 <<
"product already exists for ("
515 bool skipCurrentProcess,
521 assert(0!=productHolder.get());
523 ProductData const* productData = productHolder->resolveProduct(resolveStatus, *
this, skipCurrentProcess, sra, mcc);
528 if(productData == 0) {
536 bool skipCurrentProcess,
539 assert(0!=productHolder.get());
541 productHolder->resolveProduct(resolveStatus, *
this,skipCurrentProcess,
nullptr, mcc);
554 failedToRegisterConsumesMany(typeID);
591 std::vector<ProductHolderBase const*> holders;
598 if(!holders.empty()) {
606 holders.push_back(productHolder);
610 if(!holders.empty()) {
625 iter != iEnd; ++iter) {
627 for (
auto productHolder : holders) {
637 ProductData const* productData = productHolder->resolveProduct(resolveStatus, *
this,
false, sra, mcc);
640 results.emplace_back(*productData);
662 if (skipCurrentProcess) {
668 inputTag.
label().c_str(),
686 failedToRegisterConsumes(kindOfType,typeID,inputTag.
label(),inputTag.
instance(),inputTag.
process());
693 ProductData const* productData = productHolder->resolveProduct(resolveStatus, *
this, skipCurrentProcess, sra, mcc);
729 failedToRegisterConsumes(kindOfType,typeID,label,instance,process);
735 ProductData const* productData = productHolder->resolveProduct(resolveStatus, *
this,
false, sra, mcc);
761 if (phb->productWasDeleted()) {
764 phb->productInstanceName(),
769 phb->resolveProduct(status,*
this,
false,
nullptr, mcc);
771 if(!phb->provenance() || (!phb->product() && !phb->productProvenancePtr())) {
774 return OutputHandle(phb->product(), &phb->branchDescription(), phb->productProvenancePtr());
785 if(phb->onDemand()) {
787 if(not phb->resolveProduct(status,*
this,
false,
nullptr, mcc) ) {
791 return *phb->provenance();
800 for(
auto const& productHolder : *
this) {
801 if(productHolder->singleProduct() && productHolder->provenanceAvailable() && !productHolder->branchDescription().isAlias()) {
804 if(productHolder->provenance()->product().present()) {
805 provenances.push_back(productHolder->provenance());
813 for(
auto&
prod : bids) {
837 std::vector<WrapperBase const*>&,
838 std::vector<unsigned int>&)
const {
844 if(prod ==
nullptr)
return;
847 bool alreadyPresent = !
productPtrs_.insert(prod).second;
870 if(edp.get() ==
nullptr) {
872 <<
"put: Cannot put because unique_ptr to product is null."
886 for(
auto const&
prod :
preg_->productList()) {
894 auto cbd = std::make_shared<BranchDescription const>(bd);
905 for(
auto &
prod : *
this) {
924 if(edp.get() !=
nullptr) {
static ProcessHistory const s_emptyProcessHistory
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
bool checkTypeDictionary(TypeID const &type, TypeSet &missingTypes)
BranchType const & branchType() const
ConstProductHolderPtr getProductHolder(BranchID const &oid) const
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
void resolveProductImmediately(ProductHolderBase &phb)
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_
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)
T const * getProduct(RefCore const &ref)
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)
edm::propagate_const< HistoryAppender * > historyAppender_
void readAllFromSourceAndMergeImmediately()
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
bool singleProduct() 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
std::set< TypeID > TypeSet
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 putOrMerge(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
void checkUniquenessAndType(WrapperBase const *prod, ProductHolderBase const *productHolder) const
void addSourceProduct(std::shared_ptr< BranchDescription const > bd)
bool checkClassDictionary(TypeID const &type, TypeSet &missingTypes)
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
void throwMissingDictionariesException(TypeSet const &)
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Hash< ProcessHistoryType > ProcessHistoryID
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)
void putProduct(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
void mergeProduct(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
void addProduct_(std::unique_ptr< ProductHolderBase > phb)
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
void addProductOrThrow(std::unique_ptr< ProductHolderBase > phb)
unsigned long CacheIdentifier_t
virtual WrapperBase const * getIt(ProductID const &) const override
bool registeredToConsume(ProductHolderIndex, bool, BranchType) const
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
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)
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)
void deleteProduct(BranchID const &id) const
static void maybeThrowMissingDictionaryException(TypeID const &productType, bool isElement, std::vector< TypeID > const &missingDictionaries)
ProductHolderIndexHelper const & productLookup() const
bool productUnavailable() const