49 <<
"Principal::" << where <<
": no product with given branch id: "<< bid <<
"\n";
56 <<
"Principal::" << where <<
": Product on branch " << branchName <<
" occurs twice in the same event.\n";
60 std::shared_ptr<cms::Exception>
65 *exception <<
"Principal::" << where <<
": Found zero products matching all criteria\nLooking for type: " << productType <<
"\n"
66 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
67 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n";
69 *exception <<
"Principal::" << where <<
": Found zero products matching all criteria\nLooking for a container with elements of type: " << productType <<
"\n"
70 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
71 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n";
80 exception <<
"Principal::" << where <<
": The product matching all criteria\nLooking for type: " << productType <<
"\n"
81 <<
"Looking for module label: " << label <<
"\n" <<
"Looking for productInstanceName: " << instance <<
"\n"
82 << (process.empty() ?
"" :
"Looking for process: ") << process <<
"\n"
83 <<
"Was already deleted. This means there is a configuration error.\n"
84 <<
"The module which is asking for this data must be configured to state that it will read this data.";
92 exception <<
"Principal::" << where <<
": More than 1 product matches 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 <<
"This can only occur with get function calls using a Handle<View> argument.\n"
96 <<
"Try a get not using a View or change the instance name of one of the products";
102 void failedToRegisterConsumesMany(
edm::TypeID const& iType) {
103 LogInfo(
"GetManyWithoutRegistration")<<
"::getManyByType called for "<<iType<<
" without a corresponding consumesMany being called for this module. \n";
106 void failedToRegisterConsumes(
KindOfType kindOfType,
107 TypeID
const& productType,
111 LogInfo(
"GetByLabelWithoutRegistration")<<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
112 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::Veiw<")<<productType
113 << (kindOfType ==
PRODUCT_TYPE ?
"\n module label: " :
">\n module label: ")<<moduleLabel
114 <<
"\n product instance name: '"<<productInstanceName
115 <<
"'\n process name: '"<<processName<<
"'\n";
126 boost::shared_ptr<ProductHolderIndexHelper const> productLookup,
131 processHistoryPtr_(),
133 processConfiguration_(&pc),
136 productLookup_(productLookup),
137 lookupProcessOrder_(productLookup->lookupProcessNames().
size(), 0),
141 historyAppender_(historyAppender),
151 bool hasAliases =
false;
152 for(
auto const&
prod : prodsList) {
176 for(
auto const&
prod : prodsList) {
188 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
190 std::vector<bool> ambiguous(lookupProcessNames.size(),
false);
192 std::vector<TypeID>
const& sortedTypeIDs =
productLookup_->sortedTypeIDs();
194 std::vector<ProductHolderIndexHelper::IndexAndNames>
const& indexAndNames =
productLookup_->indexAndNames();
195 std::vector<char>
const& processNamesCharArray =
productLookup_->processNames();
197 if (!sortedTypeIDs.empty()) {
199 for(
unsigned int k = 0, kEnd = sortedTypeIDs.size();
k < kEnd; ++
k) {
201 for (
unsigned int i = range.
begin();
i < range.
end(); ++
i) {
205 boost::shared_ptr<ProductHolderBase> newHolder(
new NoProcessProductHolder(matchingHolders, ambiguous,
this));
208 ambiguous.assign(lookupProcessNames.size(),
false);
210 productHolderIndex = product.
index();
214 assert(
iter != lookupProcessNames.end());
218 assert(
k >= beginElements);
219 ambiguous.at(
iter - lookupProcessNames.begin()) =
true;
221 matchingHolders.at(
iter - lookupProcessNames.begin()) = iMatchingIndex;
226 boost::shared_ptr<ProductHolderBase> newHolder(
new NoProcessProductHolder(matchingHolders, ambiguous,
this));
240 for(
auto const&
prod : *
this) {
241 if(
prod->singleProduct() &&
242 !
prod->productUnavailable() &&
244 !
prod->branchDescription().dropped()) {
255 for(
auto const&
prod : prodsList) {
308 for(
auto const&
prod : *
this) {
309 prod->resetProductData();
317 assert(
nullptr != phb);
344 boost::shared_ptr<ProcessHistory const> inputProcessHistory;
347 auto noDel =[](
void const*){};
348 inputProcessHistory =
349 boost::shared_ptr<ProcessHistory const>(processHistoryRegistry.
getMapped(hist),noDel);
350 if (inputProcessHistory.get() ==
nullptr) {
352 <<
"Principal::fillPrincipal\n"
353 <<
"Input ProcessHistory not found in registry\n"
354 <<
"Contact a Framework developer\n";
358 inputProcessHistory = boost::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory,[](
void const*){});
365 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
371 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
iter->processName());
372 if (nameIter == lookupProcessNames.end()) {
417 <<
"addProductOrThrow: Problem found while adding product, "
418 <<
"product already exists for ("
482 bool skipCurrentProcess,
487 assert(0!=productHolder.get());
489 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
494 if(productData == 0) {
502 bool skipCurrentProcess,
504 boost::shared_ptr<ProductHolderBase>
const& productHolder =
productHolders_.at(index);
505 assert(0!=productHolder.get());
507 productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
516 assert(results.empty());
519 failedToRegisterConsumesMany(typeID);
556 std::vector<ProductHolderBase const*> holders;
563 if(!holders.empty()) {
570 assert(productHolder);
571 holders.push_back(productHolder);
575 if(!holders.empty()) {
591 for (
auto productHolder : holders) {
601 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, mcc);
604 results.emplace_back(*productData);
624 char const* processName = inputTag.
process().c_str();
625 if (skipCurrentProcess) {
631 inputTag.
label().c_str(),
649 failedToRegisterConsumes(kindOfType,typeID,inputTag.
label(),inputTag.
instance(),inputTag.
process());
656 ProductData const* productData = productHolder->resolveProduct(resolveStatus, skipCurrentProcess, mcc);
691 failedToRegisterConsumes(kindOfType,typeID,label,instance,process);
697 ProductData const* productData = productHolder->resolveProduct(resolveStatus,
false, mcc);
722 if (phb->productWasDeleted()) {
725 phb->productInstanceName(),
730 phb->resolveProduct(status,
false,mcc);
732 if(!phb->provenance() || (!phb->product() && !phb->productProvenancePtr())) {
735 return OutputHandle(
WrapperHolder(phb->product().get(), phb->productData().getInterface()), &phb->branchDescription(), phb->productProvenancePtr());
746 if(phb->onDemand()) {
748 if(not phb->resolveProduct(status,
false,mcc) ) {
752 return *phb->provenance();
761 for(
auto const& productHolder : *
this) {
762 if(productHolder->singleProduct() && productHolder->provenanceAvailable() && !productHolder->branchDescription().isAlias()) {
765 if(productHolder->provenance()->product().present()) {
766 provenances.push_back(productHolder->provenance());
774 for(
auto const&
prod : bids) {
834 for(
auto const&
prod :
preg_->productList()) {
static ProcessHistory const s_emptyProcessHistory
ProductRegistry const & productRegistry() const
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
std::string const & branchName() const
BranchType const & branchType() const
HistoryAppender * historyAppender_
ConstProductHolderPtr getProductHolder(BranchID const &oid) const
void resetBranchDescription(boost::shared_ptr< BranchDescription const > bd)
boost::shared_ptr< ProcessHistory const > appendToProcessHistory(ProcessHistoryID const &inputPHID, ProcessHistory const *inputProcessHistory, ProcessConfiguration const &pc)
void addInputProduct(boost::shared_ptr< BranchDescription const > bd)
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
void putOrMerge(WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
static std::string const source("source")
ProductHolderBase const * ConstProductHolderPtr
static PFTauRenderPlugin instance
ProductHolderIndex index() const
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 getAllProvenance(std::vector< Provenance const * > &provenances) const
static void throwCorruptionException(char const *where, std::string const &branchName)
void checkUniquenessAndType(WrapperOwningHolder const &prod, ProductHolderBase const *productHolder) const
Provenance getProvenance(BranchID const &bid, ModuleCallingContext const *mcc) const
boost::shared_ptr< ProductRegistry const > preg_
void getManyByType(TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, ModuleCallingContext const *mcc) const
std::string const & processName() const
Principal(boost::shared_ptr< ProductRegistry const > reg, boost::shared_ptr< ProductHolderIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender)
unsigned int ProductHolderIndex
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
boost::shared_ptr< ProductHolderBase > SharedProductPtr
void checkType(WrapperOwningHolder const &prod) const
boost::shared_ptr< void const > product() const
void addAliasedProduct(boost::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
U second(std::pair< T, U > const &p)
std::vector< unsigned int > lookupProcessOrder_
void addScheduledProduct(boost::shared_ptr< BranchDescription const > bd)
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
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::string const & productInstanceName() const
boost::shared_ptr< ProductHolderIndexHelper const > productLookup_
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)
boost::shared_ptr< ProcessHistory const > processHistoryPtr_
void checkDictionaries(std::string const &name, bool noComponents=false)
unsigned int numberOfMatches() const
bool isFullyResolved(unsigned int i) const
ProcessHistoryID orderProcessHistoryID_
void mergeProduct(WrapperOwningHolder const &edp, ProductProvenance &productProvenance)
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_
OutputHandle getForOutput(BranchID const &bid, bool getProd, ModuleCallingContext const *mcc) const
void addUnscheduledProduct(boost::shared_ptr< BranchDescription const > bd)
DelayedReader * reader() const
static void maybeThrowMissingDictionaryException(TypeID const &productType, bool isElement, std::vector< std::string > const &missingDictionaries)
void prefetch(ProductHolderIndex index, bool skipCurrentProcess, ModuleCallingContext const *mcc) const
bool registeredToConsumeMany(TypeID const &, BranchType) const
void addSourceProduct(boost::shared_ptr< BranchDescription const > bd)
bool putOrMergeProduct() const
std::string wrappedClassName(std::string const &iFullName)
virtual WrapperHolder getIt(ProductID const &) const
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
bool registeredToConsume(ProductHolderIndex, bool, BranchType) const
void addProductOrThrow(std::auto_ptr< ProductHolderBase > phb)
bool adjustToNewProductRegistry(ProductRegistry const ®)
std::string const & className() const
void putProduct(WrapperOwningHolder const &edp, ProductProvenance const &productProvenance)
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)
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, ModuleCallingContext const *mcc) const
void const * wrapper() const
void fillPrincipal(ProcessHistoryID const &hist, ProcessHistoryRegistry const &phr, DelayedReader *reader)
void reset(double vett[256])
void recombine(Principal &other, std::vector< BranchID > const &bids)
ProcessConfiguration const * processConfiguration_
tuple size
Write out results.
std::vector< BasicHandle > BasicHandleVec
ProductHolderBase * getExistingProduct(BranchID const &branchID)
ProductHolderIndexHelper const & productLookup() const
void deleteProduct(BranchID const &id)