13 #include "cetlib/container_algorithms.h" 27 class ReverseIteration;
30 ReverseIteration<T> reverse_iteration(T
const&);
33 class ReverseIteration {
34 friend ReverseIteration reverse_iteration<>(T
const&);
36 ReverseIteration(T
const& t) : t_{t} {};
53 reverse_iteration(T
const& t)
55 return ReverseIteration<T>{t};
61 cet::exempt_ptr<ProductTable const> presentProducts,
62 std::unique_ptr<BranchMapper>&& mapper,
63 std::unique_ptr<DelayedReader>&& reader)
64 : processConfiguration_{pc}
67 ,
store_{std::move(reader)}
69 if (!
hist.isValid()) {
87 if (processName == val.processName()) {
89 <<
"The process name " << processName
90 <<
" was previously used on these products.\n" 91 <<
"Please modify the configuration file to use a " 92 <<
"distinct process name.\n";
103 auto const phid = processHistory_.id();
114 if (results.empty()) {
117 *whyFailed <<
"getBySelector: Found zero products matching all criteria\n" 118 <<
"Looking for type: " << wrapped.
product_type <<
"\n";
121 if (results.size() > 1) {
123 <<
"getBySelector: Found " << results.size()
124 <<
" products rather than one which match all criteria\n" 125 <<
"Looking for type: " << wrapped.
product_type <<
"\n";
138 *whyFailed <<
"getGroup: no product with given product id: " << pid <<
"\n";
145 string const& productInstanceName,
146 string const& processName)
const 152 if (results.empty()) {
155 *whyFailed <<
"getByLabel: Found zero products matching all criteria\n" 157 <<
"Looking for module label: " << label <<
"\n" 158 <<
"Looking for productInstanceName: " << productInstanceName
160 << (processName.empty() ?
"" :
"Looking for process: ")
164 if (results.size() > 1) {
166 <<
"getByLabel: Found " << results.size()
167 <<
" products rather than one which match all criteria\n" 169 <<
"Looking for module label: " << label <<
"\n" 170 <<
"Looking for productInstanceName: " << productInstanceName <<
"\n" 171 << (processName.empty() ?
"" :
"Looking for process: ") << processName
208 if (results.empty()) {
210 if (!results.empty()) {
215 results = sp->matchingSequenceFromInputFile(selector);
216 if (!results.empty()) {
223 if (results.empty()) {
236 results = new_sp->matchingSequenceFromInputFile(selector);
237 if (!results.empty()) {
262 g->removeCachedProduct();
266 if (
auto g = sp->getGroup(pid)) {
267 g->removeCachedProduct();
272 <<
"Attempt to remove unknown product corresponding to ProductID: " << pid
274 <<
"Please contact artists@fnal.gov\n";
280 bool const stopIfProcessHasMatch)
const 289 if (it != lookup.end()) {
293 stopIfProcessHasMatch,
306 if (sp->findGroupsFromInputFile(
307 wrapped, selector, results, stopIfProcessHasMatch)) {
323 assert(!secondaryPrincipals_.empty());
324 auto& new_sp = secondaryPrincipals_.back();
325 if (new_sp->findGroupsFromInputFile(
326 wrapped, selector, results, stopIfProcessHasMatch)) {
337 bool const stopIfProcessHasMatch)
const 344 if (it == lookup.end()) {
350 stopIfProcessHasMatch,
358 bool const stopIfProcessHasMatch,
359 TypeID const wanted_wrapper )
const 366 auto it = pl.find(h.processName());
367 if (it != pl.end()) {
370 if (stopIfProcessHasMatch && !res.empty())
380 TypeID const wanted_wrapper)
const 383 for (
auto const pid : vpid) {
388 if (!sel.
match(group->productDescription())) {
391 if (group->productUnavailable()) {
394 if (wanted_wrapper) {
395 group->resolveProduct(wanted_wrapper);
397 group->resolveProduct(group->producedWrapperType());
401 if (group->productUnavailable()) {
405 res.emplace_back(group);
416 return it->second.get();
419 cet::exempt_ptr<Principal const>{
this}, pid);
427 if (g.get() ==
nullptr) {
435 if (g->anyProduct() ==
nullptr) {
438 if (!g->anyProduct()->isPresent()) {
442 if (!g->anyProduct() && !g->productProvenancePtr()) {
446 &g->productDescription(),
447 g->productProvenancePtr(),
451 cet::exempt_ptr<Group const>
458 if (!g.get() || !resolveProd) {
461 bool const gotIt = g->resolveProductIfAvailable(g->producedWrapperType());
475 present = (lookup.find(pid) != lookup.cend());
480 cet::exempt_ptr<Group const>
483 bool produced{
false};
486 if (availableProducts.find(pid) != availableProducts.cend()) {
498 if (sp->presentFromSource(pid)) {
499 return sp->getGroup(pid);
514 assert(!secondaryPrincipals_.empty());
515 auto& new_sp = secondaryPrincipals_.back();
516 if (new_sp->presentFromSource(pid)) {
517 return new_sp->getGroup(pid);
524 cet::exempt_ptr<Group const>
528 return it !=
groups_.cend() ? it->second.get() :
nullptr;
cet::exempt_ptr< ProductTable const > presentProducts_
GroupQueryResultVec findGroupsForProduct(WrappedTypeID const &wrapped, SelectorBase const &, bool stopIfProcessHasMatch) const
std::unique_ptr< BranchMapper > branchMapperPtr_
bool presentFromSource(ProductID) const
std::map< std::string, std::vector< ProductID >> ProcessLookup
size_t findGroupsFromInputFile(WrappedTypeID const &wrapped, SelectorBase const &, GroupQueryResultVec &results, bool stopIfProcessHasMatch) const
std::string friendlyClassName() const
ProcessHistory processHistory_
void removeCachedProduct(ProductID const pid) const
cet::exempt_ptr< Group const > getGroup(ProductID const pid) const
int tryNextSecondaryFile() const
cet::exempt_ptr< ProductTable const > producedProducts_
GroupQueryResult getBySelector(WrappedTypeID const &wrapped, SelectorBase const &) const
std::unique_ptr< DelayedReader > store_
RangeSet const & rangeOfValidity() const
cet::exempt_ptr< Group const > getResolvedGroup(ProductID const pid, bool resolveProd) const
bool processHistoryModified_
TypeID wrapped_product_type
OutputHandle getForOutput(ProductID const, bool resolveProd) const
static collection_type const & get()
size_t findGroups(ProcessLookup const &, SelectorBase const &, GroupQueryResultVec &results, bool stopIfProcessHasMatch, TypeID wanted_wrapper=TypeID{}) const
void addToProcessHistory()
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
GroupQueryResultVec getMatchingSequence(SelectorBase const &) const
std::map< ProductID, std::shared_ptr< DeferredProductGetter const > > deferredGetters_
std::string const & processName() const
std::vector< GroupQueryResult > GroupQueryResultVec
GroupQueryResultVec getMany(WrappedTypeID const &wrapped, SelectorBase const &) const
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
EDProductGetter const * productGetter(ProductID const pid) const
int nextSecondaryFileIdx_
GroupQueryResultVec matchingSequenceFromInputFile(SelectorBase const &) const
ProcessConfiguration const & processConfiguration_
cet::exempt_ptr< Group const > result() const
ProcessHistory const & processHistory() const
static OutputHandle invalid()
bool match(BranchDescription const &p) const
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
size_t findGroupsForProcess(std::vector< ProductID > const &vpid, SelectorBase const &selector, GroupQueryResultVec &results, TypeID wanted_wrapper) const
EDProductGetter const * deferredGetter_(ProductID const pid) const
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
GroupQueryResult getByProductID(ProductID const pid) const
static auto emplace(value_type const &value)
cet::exempt_ptr< Group const > getGroupForPtr(ProductID const pid) const
GroupQueryResult getByLabel(WrappedTypeID const &wrapped, std::string const &label, std::string const &productInstanceName, std::string const &processName) const
virtual void setProcessHistoryID(ProcessHistoryID const &)=0