17 #include "cetlib/HorizontalRule.h" 18 #include "cetlib/exempt_ptr.h" 19 #include "cetlib_except/exception.h" 32 ProductRetriever::~ProductRetriever() =
default;
37 bool const recordParents)
41 ,
md_{mc.moduleDescription()}
48 std::lock_guard lock{
mutex_};
52 std::optional<fhicl::ParameterSet const>
55 std::lock_guard lock{
mutex_};
64 return std::make_optional(std::move(ps));
69 std::vector<ProductID>
72 std::lock_guard lock{
mutex_};
77 std::optional<Provenance const>
86 if (!group->productProvenance()) {
91 return std::make_optional<Provenance const>(group);
94 cet::exempt_ptr<BranchDescription const>
103 if (grp->productDescription().transient()) {
106 auto const& parents = grp->productProvenance()->parentage().parents();
113 cet::exempt_ptr<Group const>
115 std::string
const& moduleLabel,
116 std::string
const& productInstanceName,
141 remove_if(qrs.begin(), qrs.end(), [&typeID](
auto const& gqr) {
142 auto const group = gqr.result();
143 assert(group->productDescription().supportsView());
147 qrs.erase(new_end, qrs.end());
149 if (qrs.size() != 1) {
151 e <<
"getView: Found " 152 << (qrs.empty() ?
"no products" :
"more than one product")
153 <<
" matching all criteria\n" 154 <<
"Looking for sequence of type: " << typeID <<
'\n' 155 <<
"Looking for module label: " << moduleLabel <<
'\n' 156 <<
"Looking for productInstanceName: " << productInstanceName <<
'\n';
157 if (!processTag.
name().empty()) {
158 e <<
"Looking for processName: " << processTag.
name() <<
'\n';
163 return qrs[0].result();
170 std::lock_guard lock{
mutex_};
177 "ProductRetriever::getProductID: error while trying to " 178 "retrieve product description:\n")
179 <<
"No product is registered for\n" 184 <<
" product instance name: '" << instance <<
"'\n" 190 return desc->productID();
193 std::vector<InputTag>
205 std::lock_guard lock{
mutex_};
226 std::lock_guard lock{
mutex_};
230 bool const ok = qr.
succeeded() && !qr.failed();
240 std::lock_guard lock{
mutex_};
242 bool const ok = qr.
succeeded() && !qr.failed();
249 std::vector<GroupQueryResult>
253 std::lock_guard lock{
mutex_};
260 for (
auto const& qr : qrs) {
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
static ConsumesInfo * instance()
std::vector< InputTag > getInputTags(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
std::string friendlyClassName() const
std::string const & moduleLabel() const
std::optional< fhicl::ParameterSet const > getProcessParameterSet(std::string const &process) const
static collection_type const & get() noexcept
ModuleContext const & mc_
const std::string instance
Principal const & principal_
bool const recordParents_
BranchType const branchType_
std::set< ProductID > retrievedProducts_
GroupQueryResult getByLabel_(WrappedTypeID const &wrapped, InputTag const &tag) const
std::string const & processName() const
ModuleDescription const & md_
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
GroupQueryResult getBySelector(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
ProductID getProductID_(TypeID const &typeID, std::string const &instance) const
EDProductGetter const * productGetter(ProductID const pid) const
GroupQueryResult getBySelector_(WrappedTypeID const &wrapped, SelectorBase const &selector) const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
EDProductGetter const * productGetter(ProductID id) const
GroupQueryResult getByProductID_(ProductID productID) const
std::recursive_mutex mutex_
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
std::vector< cet::exempt_ptr< Group > > getMatchingSequence(ModuleContext const &, SelectorBase const &, ProcessTag const &) const
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
ProcessHistory const & processHistory() const
cet::exempt_ptr< Group > result() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::optional< ProcessConfiguration > getConfigurationForProcess(std::string const &name) const
auto const & name() const
std::vector< InputTag > getInputTags_(WrappedTypeID const &wrapped, SelectorBase const &selector) const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID) const
std::vector< GroupQueryResult > getMany(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
std::vector< ProductID > retrievedPIDs() const
bool upcastAllowed(std::type_info const &tiFrom, std::type_info const &tiTo)
cet::exempt_ptr< Group const > getContainerForView_(TypeID const &, std::string const &moduleLabel, std::string const &productInstanceName, ProcessTag const &processTag) const
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
GroupQueryResult getByLabel(ModuleContext const &mc, WrappedTypeID const &wrapped, std::string const &label, std::string const &productInstanceName, ProcessTag const &processTag) const
GroupQueryResult getByProductID(ProductID const pid) const
std::vector< GroupQueryResult > getMany_(WrappedTypeID const &wrapped, SelectorBase const &sel) const
std::type_info const & typeInfo() const
std::optional< Provenance const > getProductProvenance(ProductID) const
std::vector< GroupQueryResult > resolve_products(std::vector< cet::exempt_ptr< art::Group >> const &groups, art::TypeID const &wrapped_type)