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 LogInfo(
"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 LogInfo(
"GetByLabelWithoutRegistration")<<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
122 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::Veiw<")<<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();
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();
381 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
iter->processName());
382 if (nameIter == lookupProcessNames.end()) {
427 <<
"addProductOrThrow: Problem found while adding product, "
428 <<
"product already exists for ("
492 bool skipCurrentProcess,
497 assert(0!=productHolder.get());
499 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
504 if(productData == 0) {
512 bool skipCurrentProcess,
514 std::shared_ptr<ProductHolderBase>
const& productHolder =
productHolders_.at(index);
515 assert(0!=productHolder.get());
517 productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
529 failedToRegisterConsumesMany(typeID);
566 std::vector<ProductHolderBase const*> holders;
573 if(!holders.empty()) {
581 holders.push_back(productHolder);
585 if(!holders.empty()) {
601 for (
auto productHolder : holders) {
611 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, mcc);
614 results.emplace_back(*productData);
635 if (skipCurrentProcess) {
641 inputTag.
label().c_str(),
659 failedToRegisterConsumes(kindOfType,typeID,inputTag.
label(),inputTag.
instance(),inputTag.
process());
666 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
701 failedToRegisterConsumes(kindOfType,typeID,label,instance,process);
707 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, mcc);
732 if (phb->productWasDeleted()) {
735 phb->productInstanceName(),
740 phb->resolveProduct(status,
false,mcc);
742 if(!phb->provenance() || (!phb->product() && !phb->productProvenancePtr())) {
745 return OutputHandle(phb->product(), &phb->branchDescription(), phb->productProvenancePtr());
756 if(phb->onDemand()) {
758 if(not phb->resolveProduct(status,
false,mcc) ) {
762 return *phb->provenance();
771 for(
auto const& productHolder : *
this) {
772 if(productHolder->singleProduct() && productHolder->provenanceAvailable() && !productHolder->branchDescription().isAlias()) {
775 if(productHolder->provenance()->product().present()) {
776 provenances.push_back(productHolder->provenance());
784 for(
auto const&
prod : bids) {
809 std::vector<WrapperBase const*>&,
810 std::vector<unsigned int>&)
const {
816 if(prod ==
nullptr)
return;
819 bool alreadyPresent = !
productPtrs_.insert(prod).second;
856 for(
auto const&
prod :
preg_->productList()) {
864 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)