9 #include "cetlib_except/demangle.h" 10 #include "range/v3/view.hpp" 18 using namespace detail;
22 delete productProvenance_.load();
23 delete product_.load();
24 delete rangeSet_.load();
25 delete partnerProduct_.load();
26 delete baseProduct_.load();
27 delete partnerBaseProduct_.load();
32 unique_ptr<RangeSet>&& rs,
34 unique_ptr<EDProduct>&& edp )
35 : branchDescription_{bd}
45 std::lock_guard sentry{
mutex_};
56 std::lock_guard sentry{
mutex_};
61 if (result ==
nullptr) {
67 if (result !=
nullptr) {
71 if (result ==
nullptr) {
80 std::lock_guard sentry{
mutex_};
85 << cet::demangle_symbol(
typeid(*this).name())
86 <<
" was asked for a held product (uniqueProduct()) " 87 <<
"without specifying which one was wanted.\n";
93 std::lock_guard sentry{
mutex_};
101 auto assns_type_ids =
product_.load()->getTypeIDs();
103 assert(assns_type_ids.size() == 2ull);
104 if (wanted_wrapper_type ==
111 assert(assns_type_ids.size() == 4ull);
118 if (wanted_wrapper_type ==
140 std::lock_guard sentry{
mutex_};
144 cet::exempt_ptr<ProductProvenance const>
147 std::lock_guard sentry{
mutex_};
157 std::lock_guard sentry{
mutex_};
165 unique_ptr<EDProduct>&& edp,
166 unique_ptr<RangeSet>&& rs)
168 std::lock_guard sentry{
mutex_};
180 std::lock_guard sentry{
mutex_};
183 <<
"Attempt to remove a produced product!\n" 184 <<
"This routine should only be used to remove large data products " 185 <<
"read from disk (like raw digits).\n";
214 std::lock_guard sentry{
mutex_};
215 bool availableAfterCombine{
false};
218 availableAfterCombine =
228 if (availableAfterCombine) {
242 <<
"We have a produced product, the product has been put(), but " 243 "there is no provenance!\n";
255 if (!availableAfterCombine) {
287 TypeID wanted_wrapper_type )
const 289 std::lock_guard sentry{
mutex_};
315 if (!wanted_wrapper_type) {
331 auto assns_type_ids =
product_.load()->getTypeIDs();
332 assert(!assns_type_ids.empty());
334 if (wanted_wrapper_type == assns_type_ids.at(normal_metatype)) {
341 if (wanted_wrapper_type == assns_type_ids.at(partner_metatype)) {
379 std::lock_guard sentry{
mutex_};
386 std::optional<GroupQueryResult>
388 std::vector<cet::exempt_ptr<art::Group>>
const& product_groups,
391 auto by_process_name = [](
auto const ga,
auto const gb) {
392 return ga->productDescription().processName() ==
393 gb->productDescription().processName();
400 for (
auto const groups_per_process :
401 ::ranges::views::chunk_by(product_groups, by_process_name)) {
404 std::vector<cet::exempt_ptr<art::Group>> matched_groups;
405 for (
auto const group : groups_per_process) {
407 matched_groups.emplace_back(group.get());
411 if (
auto const num_matches = matched_groups.size(); num_matches == 1) {
413 }
else if (num_matches > 1) {
415 e <<
"Found " << num_matches
416 <<
" products rather than one that match all criteria\n" 418 for (
auto group : matched_groups) {
419 e <<
" " << group->productDescription().inputTag() <<
'\n';
427 std::vector<GroupQueryResult>
431 std::vector<GroupQueryResult> results;
432 for (
auto group : groups) {
433 if (group->tryToResolveProduct(wrapped_type)) {
434 results.emplace_back(group.get());
bool produced() const noexcept
bool tryToResolveProduct(TypeID const &)
ProductID productID() const
bool productAvailable() const
constexpr ProductStatus dummyToPreventDoubleCount() noexcept
std::optional< GroupQueryResult > resolve_unique_product(std::vector< cet::exempt_ptr< art::Group >> const &product_groups, art::WrappedTypeID const &wrapped)
bool present() const noexcept
std::atomic< ProductProvenance const * > productProvenance_
std::atomic< RangeSet * > rangeSet_
std::atomic< EDProduct * > baseProduct_
void setProductAndProvenance(std::unique_ptr< ProductProvenance const > &&, std::unique_ptr< EDProduct > &&, std::unique_ptr< RangeSet > &&)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
TypeID wrapped_product_type
BranchType branchType() const noexcept
cet::exempt_ptr< ProductProvenance const > productProvenance() const
constexpr ProductStatus uninitialized() noexcept
BranchDescription const & productDescription() const noexcept
bool dropped() const noexcept
std::atomic< EDProduct * > product_
EDProduct const * getIt_() const override
std::recursive_mutex mutex_
EDProduct const * anyProduct() const
cet::exempt_ptr< DelayedReader const > const delayedReader_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
constexpr ProductStatus neverCreated() noexcept
std::atomic< EDProduct * > partnerProduct_
BranchDescription const & branchDescription_
static RangeSet invalid()
bool resolveProductIfAvailable(TypeID wanted_wrapper=TypeID{}) const
void removeCachedProduct()
std::atomic< EDProduct * > partnerBaseProduct_
EDProduct const * uniqueProduct() const
void setProductProvenance(std::unique_ptr< ProductProvenance const > &&)
constexpr ProductStatus present() noexcept
ProductID productID() const noexcept
RangeSet const & rangeOfValidity() const
std::type_info const & typeInfo() const
std::vector< GroupQueryResult > resolve_products(std::vector< cet::exempt_ptr< art::Group >> const &groups, art::TypeID const &wrapped_type)