LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::ResultsPrincipal Class Referencefinal

#include "ResultsPrincipal.h"

Inheritance diagram for art::ResultsPrincipal:
art::Principal art::PrincipalBase

Public Types

using Auxiliary = ResultsAuxiliary
 
enum  allowed_processes { allowed_processes::current_process, allowed_processes::input_source, allowed_processes::all }
 
using GroupCollection = std::map< ProductID, std::unique_ptr< Group >>
 
using const_iterator = GroupCollection::const_iterator
 

Public Member Functions

 ~ResultsPrincipal ()
 
 ResultsPrincipal (ResultsAuxiliary const &, ProcessConfiguration const &, cet::exempt_ptr< ProductTable const > presentProducts, std::unique_ptr< DelayedReader > &&reader=std::make_unique< NoDelayedReader >())
 
Results makeResults (ModuleContext const &mc)
 
Results makeResults (ModuleContext const &mc) const
 
ResultsAuxiliary const & resultsAux () const
 
void createGroupsForProducedProducts (ProductTables const &producedProducts)
 
GroupQueryResult getByProductID (ProductID const pid) const
 
GroupQueryResult getBySelector (ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
 
GroupQueryResult getByLabel (ModuleContext const &mc, WrappedTypeID const &wrapped, std::string const &label, std::string const &productInstanceName, ProcessTag const &processTag) const
 
std::vector< GroupQueryResultgetMany (ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
 
std::vector< InputTaggetInputTags (ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
 
std::vector< cet::exempt_ptr< Group > > getMatchingSequence (ModuleContext const &, SelectorBase const &, ProcessTag const &) const
 
EDProductGetter const * productGetter (ProductID id) const
 
Provenance provenance (ProductID id) const
 
ProcessHistory const & processHistory () const
 
OutputHandle getForOutput (ProductID const &, bool resolveProd) const
 
cet::exempt_ptr< BranchDescription const > getProductDescription (ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
 
void enableLookupOfProducedProducts ()
 
void markProcessHistoryAsModified ()
 
void readImmediate () const
 
ProcessConfiguration const & processConfiguration () const
 
ProcessHistoryID const & processHistoryID () const
 
cet::exempt_ptr< ProductProvenance const > branchToProductProvenance (ProductID const &) const
 
size_t size () const
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator end () const
 
const_iterator cend () const
 
void addToProcessHistory ()
 
BranchType branchType () const
 
RangeSet seenRanges () const
 
void put (BranchDescription const &, std::unique_ptr< ProductProvenance const > &&, std::unique_ptr< EDProduct > &&, std::unique_ptr< RangeSet > &&)
 
EDProductGetter const * getEDProductGetter (ProductID const &pid) const
 

Static Public Attributes

static constexpr BranchType branch_type = ResultsAuxiliary::branch_type
 

Protected Member Functions

std::optional< ProductInsertermakeInserter (ModuleContext const &mc)
 
void fillGroup (BranchDescription const &)
 
void setProcessHistoryIDcombined (ProcessHistoryID const &)
 
void updateSeenRanges (RangeSet const &rs)
 

Private Attributes

ResultsAuxiliary aux_
 

Detailed Description

Definition at line 25 of file ResultsPrincipal.h.

Member Typedef Documentation

using art::Principal::const_iterator = GroupCollection::const_iterator
inherited

Definition at line 52 of file Principal.h.

using art::Principal::GroupCollection = std::map<ProductID, std::unique_ptr<Group>>
inherited

Definition at line 51 of file Principal.h.

Member Enumeration Documentation

enum art::Principal::allowed_processes
stronginherited
Enumerator
current_process 
input_source 
all 

Definition at line 53 of file Principal.h.

53 { current_process, input_source, all };

Constructor & Destructor Documentation

art::ResultsPrincipal::~ResultsPrincipal ( )
default
art::ResultsPrincipal::ResultsPrincipal ( ResultsAuxiliary const &  aux,
ProcessConfiguration const &  pc,
cet::exempt_ptr< ProductTable const >  presentProducts,
std::unique_ptr< DelayedReader > &&  reader = std::make_unique<NoDelayedReader>() 
)

Definition at line 9 of file ResultsPrincipal.cc.

References aux_, art::InResults, and art::ResultsAuxiliary::processHistoryID().

16  pc,
17  presentProducts,
18  aux.processHistoryID(),
19  std::move(reader)}
20  , aux_{aux}
21  {}
Principal(BranchType, ProcessConfiguration const &, cet::exempt_ptr< ProductTable const > presentProducts, ProcessHistoryID const &id, std::unique_ptr< DelayedReader > &&reader=std::make_unique< NoDelayedReader >())
Definition: Principal.cc:119
ResultsAuxiliary aux_

Member Function Documentation

void art::Principal::addToProcessHistory ( )
inherited

Definition at line 423 of file Principal.cc.

References art::errors::Configuration, art::thread_safe_registry_via_id< K, M >::emplace(), art::ProcessHistory::get_mutex(), art::Principal::processConfiguration_, art::Principal::processHistory_, art::Principal::processHistoryModified_, and art::ProcessConfiguration::processName().

Referenced by art::Principal::createGroupsForProducedProducts(), and art::Principal::processHistoryID().

424  {
425  bool expected = false;
426  if (processHistoryModified_.compare_exchange_strong(expected, true)) {
427  // MT note: We have now locked out any other task trying to
428  // modify the process history. Now we have to block
429  // tasks that already have a pointer to the process
430  // history from accessing its internals while we update
431  // it. We do not protect the iteration interface, the
432  // begin(), end(), and size() are all separate calls
433  // and we cannot lock in each one because there is no
434  // way to automatically unlock.
435  std::lock_guard sentry{processHistory_.get_mutex()};
436  string const& processName = processConfiguration_.processName();
437  for (auto const& val : processHistory_) {
438  if (processName == val.processName()) {
440  << "The process name " << processName
441  << " was previously used on these products.\n"
442  << "Please modify the configuration file to use a "
443  << "distinct process name.\n";
444  }
445  }
446  processHistory_.push_back(processConfiguration_);
447  // Optimization note: As of 0_9_0_pre3 For very simple Sources
448  // (e.g. EmptyEvent) this routine takes up nearly 50% of the
449  // time per event, and 96% of the time for this routine is spent
450  // in computing the ProcessHistory id which happens because we
451  // are reconstructing the ProcessHistory for each event. It
452  // would probably be better to move the ProcessHistory
453  // construction out to somewhere which persists for longer than
454  // one Event.
455  auto const phid = processHistory_.id();
456  ProcessHistoryRegistry::emplace(phid, processHistory_);
457  }
458  }
std::atomic< bool > processHistoryModified_
Definition: Principal.h:232
ProcessHistory processHistory_
Definition: Principal.h:231
std::recursive_mutex & get_mutex() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProcessConfiguration const & processConfiguration_
Definition: Principal.h:233
std::string const & processName() const noexcept
static auto emplace(value_type const &value)
Principal::const_iterator art::Principal::begin ( ) const
inherited

Definition at line 270 of file Principal.cc.

References art::Principal::groupMutex_, and art::Principal::groups_.

Referenced by art::Principal::processHistoryID().

271  {
272  std::lock_guard sentry{groupMutex_};
273  return groups_.begin();
274  }
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
cet::exempt_ptr< ProductProvenance const > art::Principal::branchToProductProvenance ( ProductID const &  pid) const
inherited

Definition at line 298 of file Principal.cc.

References art::Principal::getGroupLocal().

Referenced by art::markAncestors(), and art::Principal::processHistoryID().

299  {
300  // Note: The input source lock will be held when this routine is called.
301  //
302  // MT-TODO: For right now ignore the delay reading option for
303  // product provenance. If we do the delay reading then we
304  // must use a lock to interlock all fetches of provenance
305  // because the delay read fills the pp_by_pid_ one entry
306  // at a time, and we do not want other threads to find
307  // the info only partly there.
308  cet::exempt_ptr<ProductProvenance const> ret;
309  auto g = getGroupLocal(pid);
310  if (g.get() != nullptr) {
311  ret = g->productProvenance();
312  }
313  return ret;
314  }
cet::exempt_ptr< Group > getGroupLocal(ProductID const) const
Definition: Principal.cc:852
BranchType art::Principal::branchType ( ) const
inherited

Definition at line 807 of file Principal.cc.

References art::Principal::branchType_.

Referenced by art::SourceHelper::makePtr(), and art::Principal::processHistoryID().

808  {
809  return branchType_;
810  }
BranchType branchType_
Definition: Principal.h:230
Principal::const_iterator art::Principal::cbegin ( ) const
inherited

Definition at line 277 of file Principal.cc.

References art::Principal::groupMutex_, and art::Principal::groups_.

Referenced by art::Principal::processHistoryID().

278  {
279  std::lock_guard sentry{groupMutex_};
280  return groups_.cbegin();
281  }
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
Principal::const_iterator art::Principal::cend ( ) const
inherited

Definition at line 291 of file Principal.cc.

References art::Principal::groupMutex_, and art::Principal::groups_.

Referenced by art::Principal::processHistoryID().

292  {
293  std::lock_guard sentry{groupMutex_};
294  return groups_.cend();
295  }
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
void art::ResultsPrincipal::createGroupsForProducedProducts ( ProductTables const &  producedProducts)

Definition at line 42 of file ResultsPrincipal.cc.

References aux_, art::Principal::createGroupsForProducedProducts(), art::Principal::processHistoryID(), and art::ResultsAuxiliary::setProcessHistoryID().

44  {
47  }
void createGroupsForProducedProducts(ProductTables const &producedProducts)
Definition: Principal.cc:201
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:148
void setProcessHistoryID(ProcessHistoryID const &phid)
ResultsAuxiliary aux_
void art::Principal::enableLookupOfProducedProducts ( )
inherited

Definition at line 220 of file Principal.cc.

References art::Principal::enableLookupOfProducedProducts_.

221  {
223  }
std::atomic< bool > enableLookupOfProducedProducts_
Definition: Principal.h:238
Principal::const_iterator art::Principal::end ( void  ) const
inherited

Definition at line 284 of file Principal.cc.

References art::Principal::groupMutex_, and art::Principal::groups_.

Referenced by art::Principal::processHistoryID().

285  {
286  std::lock_guard sentry{groupMutex_};
287  return groups_.end();
288  }
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
void art::Principal::fillGroup ( BranchDescription const &  pd)
protectedinherited

Definition at line 137 of file Principal.cc.

References util::cend(), art::combinable(), art::errors::Configuration, art::Principal::delayedReader_, art::Principal::groupMutex_, art::Principal::groups_, art::BranchDescription::processName(), art::BranchDescription::productID(), and art::errors::ProductRegistrationFailure.

Referenced by art::Principal::createGroupsForProducedProducts(), and art::Principal::processHistoryID().

138  {
139  std::lock_guard sentry{groupMutex_};
140  auto it = groups_.find(pd.productID());
141  if (it != std::cend(groups_)) {
142  // The 'combinable' call does not require that the processing
143  // history be the same, which is not what we are checking for here.
144  auto const& found_pd = it->second->productDescription();
145  if (combinable(found_pd, pd)) {
147  << "The process name " << pd.processName()
148  << " was previously used on these products.\n"
149  << "Please modify the configuration file to use a "
150  << "distinct process name.\n";
151  }
153  << "The product ID " << pd.productID() << " of the new product:\n"
154  << pd
155  << " collides with the product ID of the already-existing product:\n"
156  << found_pd
157  << "Please modify the instance name of the new product so as to avoid "
158  "the product ID collision.\n"
159  << "In addition, please notify artists@fnal.gov of this error.\n";
160  }
161 
162  groups_[pd.productID()] = create_group(delayedReader_.get(), pd);
163  }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:93
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
bool combinable(BranchDescription const &a, BranchDescription const &b)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::unique_ptr< DelayedReader > delayedReader_
Definition: Principal.h:250
GroupQueryResult art::Principal::getByLabel ( ModuleContext const &  mc,
WrappedTypeID const &  wrapped,
std::string const &  label,
std::string const &  productInstanceName,
ProcessTag const &  processTag 
) const
inherited

Definition at line 506 of file Principal.cc.

References art::Principal::getBySelector(), and art::ProcessTag::name().

Referenced by art::ProductRetriever::getByLabel_().

511  {
512  auto const& processName = processTag.name();
513  Selector const sel{ModuleLabelSelector{label} &&
514  ProductInstanceNameSelector{productInstanceName} &&
515  ProcessNameSelector{processName}};
516  return getBySelector(mc, wrapped, sel, processTag);
517  }
GroupQueryResult getBySelector(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:488
GroupQueryResult art::Principal::getByProductID ( ProductID const  pid) const
inherited

Definition at line 839 of file Principal.cc.

References art::Principal::branchType_, art::Principal::getGroupTryAllFiles(), and art::errors::ProductNotFound.

Referenced by art::ProductRetriever::getByProductID_(), and art::ProductRetriever::getProductProvenance().

840  {
841  if (auto g = getGroupTryAllFiles(pid)) {
842  return GroupQueryResult{g};
843  }
844  auto whyFailed =
845  make_shared<Exception>(errors::ProductNotFound, "InvalidID");
846  *whyFailed << "Principal::getByProductID: no product with branch type: "
847  << branchType_ << " product id: " << pid << '\n';
848  return GroupQueryResult{whyFailed};
849  }
BranchType branchType_
Definition: Principal.h:230
cet::exempt_ptr< Group > getGroupTryAllFiles(ProductID const) const
Definition: Principal.cc:860
GroupQueryResult art::Principal::getBySelector ( ModuleContext const &  mc,
WrappedTypeID const &  wrapped,
SelectorBase const &  sel,
ProcessTag const &  processTag 
) const
inherited

Definition at line 488 of file Principal.cc.

References art::Principal::findGroupsForProduct(), art::detail::indent(), art::SelectorBase::print(), art::WrappedTypeID::product_type, art::errors::ProductNotFound, and art::resolve_unique_product().

Referenced by art::Principal::getByLabel(), and art::ProductRetriever::getBySelector_().

492  {
493  auto const groups = findGroupsForProduct(mc, wrapped, sel, processTag);
494  auto const result = resolve_unique_product(groups, wrapped);
495  if (!result.has_value()) {
496  auto whyFailed = std::make_shared<Exception>(errors::ProductNotFound);
497  *whyFailed << "Found zero products matching all selection criteria\n"
498  << indent << "C++ type: " << wrapped.product_type << '\n'
499  << sel.print(indent) << '\n';
500  return GroupQueryResult{whyFailed};
501  }
502  return *result;
503  }
std::optional< GroupQueryResult > resolve_unique_product(std::vector< cet::exempt_ptr< art::Group >> const &product_groups, art::WrappedTypeID const &wrapped)
Definition: Group.cc:387
std::string indent(std::size_t const i)
std::vector< cet::exempt_ptr< Group > > findGroupsForProduct(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:625
EDProductGetter const * art::PrincipalBase::getEDProductGetter ( ProductID const &  pid) const
inherited

Definition at line 12 of file PrincipalBase.cc.

References art::PrincipalBase::getEDProductGetter_().

13  {
14  return getEDProductGetter_(pid);
15  }
virtual EDProductGetter const * getEDProductGetter_(ProductID const &) const =0
OutputHandle art::Principal::getForOutput ( ProductID const &  pid,
bool  resolveProd 
) const
inherited

Definition at line 750 of file Principal.cc.

References art::Principal::getGroupTryAllFiles(), art::OutputHandle::invalid(), art::OutputHandle::productProvenance(), and art::OutputHandle::rangeOfValidity().

751  {
752  // MT-FIXME: Uses of group!
753  auto g = getGroupTryAllFiles(pid);
754  if (g.get() == nullptr) {
755  return OutputHandle::invalid();
756  }
757  if (resolveProd) {
758  if (!g->resolveProductIfAvailable()) {
759  // Behavior is the same as if the group wasn't there.
760  return OutputHandle::invalid();
761  }
762  if (g->anyProduct() == nullptr) {
763  return OutputHandle::invalid();
764  }
765  if (!g->anyProduct()->isPresent()) {
766  return OutputHandle::invalid();
767  }
768  }
769  if (!g->anyProduct() && !g->productProvenance()) {
770  return OutputHandle{g->rangeOfValidity()};
771  }
772  return OutputHandle{g->anyProduct(),
773  &g->productDescription(),
774  g->productProvenance(),
775  g->rangeOfValidity()};
776  }
cet::exempt_ptr< Group > getGroupTryAllFiles(ProductID const) const
Definition: Principal.cc:860
static OutputHandle invalid()
Definition: OutputHandle.h:44
std::vector< InputTag > art::Principal::getInputTags ( ModuleContext const &  mc,
WrappedTypeID const &  wrapped,
SelectorBase const &  sel,
ProcessTag const &  processTag 
) const
inherited

Definition at line 520 of file Principal.cc.

References art::Principal::findGroupsForProduct().

Referenced by art::ProductRetriever::getInputTags_().

524  {
525  std::vector<InputTag> tags;
526  auto const groups = findGroupsForProduct(mc, wrapped, sel, processTag);
527  cet::transform_all(groups, back_inserter(tags), [](auto const g) {
528  return g->productDescription().inputTag();
529  });
530  return tags;
531  }
std::vector< cet::exempt_ptr< Group > > findGroupsForProduct(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:625
std::vector< GroupQueryResult > art::Principal::getMany ( ModuleContext const &  mc,
WrappedTypeID const &  wrapped,
SelectorBase const &  sel,
ProcessTag const &  processTag 
) const
inherited

Definition at line 534 of file Principal.cc.

References art::Principal::findGroupsForProduct(), art::resolve_products(), and art::WrappedTypeID::wrapped_product_type.

Referenced by art::ProductRetriever::getMany_().

538  {
539  auto const groups = findGroupsForProduct(mc, wrapped, sel, processTag);
540  return resolve_products(groups, wrapped.wrapped_product_type);
541  }
std::vector< cet::exempt_ptr< Group > > findGroupsForProduct(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:625
std::vector< GroupQueryResult > resolve_products(std::vector< cet::exempt_ptr< art::Group >> const &groups, art::TypeID const &wrapped_type)
Definition: Group.cc:428
std::vector< cet::exempt_ptr< Group > > art::Principal::getMatchingSequence ( ModuleContext const &  mc,
SelectorBase const &  selector,
ProcessTag const &  processTag 
) const
inherited

Definition at line 550 of file Principal.cc.

References art::ProcessTag::current_process_search_allowed(), art::Principal::enableLookupOfProducedProducts_, art::Principal::findGroups(), art::ProcessTag::input_source_search_allowed(), art::Principal::matchingSequenceFromInputFile(), art::Principal::producedProducts_, art::Principal::secondaryPrincipals_, and art::Principal::tryNextSecondaryFile().

Referenced by art::ProductRetriever::getContainerForView_().

553  {
554  std::vector<cet::exempt_ptr<Group>> groups;
555  // Find groups from current process
556  if (processTag.current_process_search_allowed() &&
558  if (findGroups(
559  producedProducts_.load()->viewLookup, mc, selector, groups) != 0) {
560  return groups;
561  }
562  }
563 
564  if (!processTag.input_source_search_allowed()) {
565  return groups;
566  }
567 
568  // Look through currently opened input files
569  if (groups.empty()) {
570  groups = matchingSequenceFromInputFile(mc, selector);
571  if (!groups.empty()) {
572  return groups;
573  }
574  for (auto const& sp : secondaryPrincipals_) {
575  groups = sp->matchingSequenceFromInputFile(mc, selector);
576  if (!groups.empty()) {
577  return groups;
578  }
579  }
580  }
581  // Open more secondary files if necessary
582  if (groups.empty()) {
583  while (auto sp = tryNextSecondaryFile()) {
584  auto& new_sp = secondaryPrincipals_.emplace_back(std::move(sp));
585  groups = new_sp->matchingSequenceFromInputFile(mc, selector);
586  if (!groups.empty()) {
587  return groups;
588  }
589  }
590  }
591  return groups;
592  }
size_t findGroups(ProcessLookup const &, ModuleContext const &, SelectorBase const &, std::vector< cet::exempt_ptr< Group >> &groups) const
Definition: Principal.cc:461
std::atomic< bool > enableLookupOfProducedProducts_
Definition: Principal.h:238
auto tryNextSecondaryFile() const
Definition: Principal.cc:544
std::vector< cet::exempt_ptr< Group > > matchingSequenceFromInputFile(ModuleContext const &, SelectorBase const &) const
Definition: Principal.cc:595
std::atomic< ProductTable const * > producedProducts_
Definition: Principal.h:237
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
Definition: Principal.h:260
cet::exempt_ptr< BranchDescription const > art::Principal::getProductDescription ( ProductID const  pid,
bool const  alwaysEnableLookupOfProducedProducts = false 
) const
inherited

Definition at line 779 of file Principal.cc.

References art::Principal::enableLookupOfProducedProducts_, art::Principal::presentProducts_, art::Principal::producedProducts_, and art::Principal::secondaryPrincipals_.

Referenced by art::ProductRetriever::getProductDescription(), art::ProductInserter::getProductDescription_(), and art::ProductRetriever::getProductID_().

782  {
783  // Find groups from current process
784  if (alwaysEnableLookupOfProducedProducts ||
786  if (producedProducts_.load() != nullptr) {
787  if (auto result = producedProducts_.load()->description(pid)) {
788  return result;
789  }
790  }
791  }
792  if (presentProducts_.load()) {
793  // Look through currently opened input files
794  if (auto result = presentProducts_.load()->description(pid)) {
795  return result;
796  }
797  }
798  for (auto const& sp : secondaryPrincipals_) {
799  if (auto result = sp->getProductDescription(pid)) {
800  return result;
801  }
802  }
803  return nullptr;
804  }
std::atomic< bool > enableLookupOfProducedProducts_
Definition: Principal.h:238
std::atomic< ProductTable const * > producedProducts_
Definition: Principal.h:237
std::atomic< ProductTable const * > presentProducts_
Definition: Principal.h:236
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
Definition: Principal.h:260
std::optional< ProductInserter > art::Principal::makeInserter ( ModuleContext const &  mc)
protectedinherited

Definition at line 813 of file Principal.cc.

References art::Principal::branchType_.

Referenced by art::EventPrincipal::makeEvent(), makeResults(), art::RunPrincipal::makeRun(), art::SubRunPrincipal::makeSubRun(), and art::Principal::processHistoryID().

814  {
815  return std::make_optional<ProductInserter>(branchType_, *this, mc);
816  }
BranchType branchType_
Definition: Principal.h:230
Results art::ResultsPrincipal::makeResults ( ModuleContext const &  mc)

Definition at line 24 of file ResultsPrincipal.cc.

References art::Principal::makeInserter().

Referenced by art::ResultsProducer::doReadResults(), and art::ResultsProducer::doWriteResults().

25  {
26  return Results{*this, mc, makeInserter(mc)};
27  }
std::optional< ProductInserter > makeInserter(ModuleContext const &mc)
Definition: Principal.cc:813
Results art::ResultsPrincipal::makeResults ( ModuleContext const &  mc) const

Definition at line 30 of file ResultsPrincipal.cc.

31  {
32  return Results{*this, mc};
33  }
void art::Principal::markProcessHistoryAsModified ( )
inherited

Definition at line 170 of file Principal.cc.

References art::Principal::processHistoryModified_.

171  {
173  }
std::atomic< bool > processHistoryModified_
Definition: Principal.h:232
ProcessConfiguration const & art::Principal::processConfiguration ( ) const
inherited

Definition at line 257 of file Principal.cc.

References art::Principal::processConfiguration_.

258  {
259  return processConfiguration_;
260  }
ProcessConfiguration const & processConfiguration_
Definition: Principal.h:233
ProcessHistory const & art::Principal::processHistory ( ) const
inherited

Definition at line 247 of file Principal.cc.

References art::Principal::processHistory_.

Referenced by art::ProductRetriever::getProcessParameterSet(), art::Event::processHistory(), art::Run::processHistory(), and art::SubRun::processHistory().

248  {
249  // MT note: We make no attempt to protect callers who use this
250  // call to get access to the iteration interface of the
251  // process history. See the threading notes there and
252  // here for the reasons why.
253  return processHistory_;
254  }
ProcessHistory processHistory_
Definition: Principal.h:231
ProcessHistoryID const& art::Principal::processHistoryID ( ) const
inlineinherited

Definition at line 148 of file Principal.h.

References art::Principal::addToProcessHistory(), art::Principal::begin(), art::Principal::branchToProductProvenance(), art::Principal::branchType(), art::Principal::cbegin(), art::Principal::cend(), art::Principal::ctor_create_groups(), art::Principal::ctor_fetch_process_history(), art::Principal::ctor_read_provenance(), art::Principal::end(), art::Principal::fillGroup(), art::Principal::findGroups(), art::Principal::findGroupsForProcess(), art::Principal::findGroupsForProduct(), art::Principal::findGroupsFromInputFile(), art::Principal::getEDProductGetter_(), art::Principal::getGroupLocal(), art::Principal::getGroupTryAllFiles(), art::ProcessHistory::id(), art::Principal::makeInserter(), art::Principal::matchingSequenceFromInputFile(), art::Principal::presentFromSource(), art::Principal::processHistory_, art::Principal::producedInProcess(), art::Principal::put(), art::Principal::seenRanges(), art::Principal::setProcessHistoryIDcombined(), art::Principal::size(), art::Principal::tryNextSecondaryFile(), art::Principal::updateSeenRanges(), and lar::dump::vector().

Referenced by art::RunPrincipal::createGroupsForProducedProducts(), createGroupsForProducedProducts(), art::SubRunPrincipal::createGroupsForProducedProducts(), art::Event::processHistoryID(), and art::EventPrincipal::refreshProcessHistoryID().

149  {
150  return processHistory_.id();
151  }
ProcessHistory processHistory_
Definition: Principal.h:231
ProcessHistoryID const & id() const
EDProductGetter const * art::Principal::productGetter ( ProductID  id) const
inherited

Definition at line 177 of file Principal.cc.

References art::Principal::getGroupTryAllFiles().

Referenced by art::Principal::getEDProductGetter_(), art::SourceHelper::makePtr(), art::ProductRetriever::productGetter(), and art::ProductInserter::productGetter_().

178  {
179  auto g = getGroupTryAllFiles(pid);
180  if (g.get() != nullptr) {
181  // Note: All produced products should be found.
182  return g.get();
183  }
184  return nullptr;
185  }
cet::exempt_ptr< Group > getGroupTryAllFiles(ProductID const) const
Definition: Principal.cc:860
Provenance art::Principal::provenance ( ProductID  id) const
inherited

Definition at line 189 of file Principal.cc.

References art::Principal::getGroupLocal().

Referenced by art::ProductInserter::provenance_().

190  {
191  return Provenance{getGroupLocal(pid)};
192  }
cet::exempt_ptr< Group > getGroupLocal(ProductID const) const
Definition: Principal.cc:852
void art::Principal::put ( BranchDescription const &  bd,
std::unique_ptr< ProductProvenance const > &&  pp,
std::unique_ptr< EDProduct > &&  edp,
std::unique_ptr< RangeSet > &&  rs 
)
inherited

Definition at line 713 of file Principal.cc.

References art::BranchDescription::branchName(), art::Principal::branchType_, art::Principal::getGroupLocal(), art::RangeSet::invalid(), art::BranchDescription::productID(), art::errors::ProductRegistrationFailure, and art::detail::range_sets_supported().

Referenced by art::ProductInserter::commitProducts(), and art::Principal::processHistoryID().

717  {
718  assert(edp);
720  // Note: We intentionally allow group and provenance replacement
721  // for run and subrun products.
722  auto group = getGroupLocal(bd.productID());
723  assert(group);
724  group->setProductAndProvenance(
725  std::move(pp), std::move(edp), std::move(rs));
726  } else {
727  auto group = getGroupLocal(bd.productID());
728  assert(group);
729  if (group->anyProduct() != nullptr) {
730  throw Exception(errors::ProductRegistrationFailure, "Principal::put:")
731  << "Problem found during put of " << branchType_
732  << " product: product already put for " << bd.branchName() << '\n';
733  }
734  group->setProductAndProvenance(
735  std::move(pp),
736  std::move(edp),
737  make_unique<RangeSet>(RangeSet::invalid()));
738  }
739  }
BranchType branchType_
Definition: Principal.h:230
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
static RangeSet invalid()
Definition: RangeSet.cc:45
cet::exempt_ptr< Group > getGroupLocal(ProductID const) const
Definition: Principal.cc:852
constexpr bool range_sets_supported(BranchType const bt)
void art::Principal::readImmediate ( ) const
inherited

Definition at line 226 of file Principal.cc.

References art::Principal::groupMutex_, art::Principal::groups_, and util::values().

227  {
228  // Read all data products and provenance immediately, if
229  // available. Used only by RootInputFile to implement the
230  // delayedRead*Products config options.
231  //
232  // Note: The input source lock will be held when this routine is called.
233  //
234  // MT-TODO: For right now ignore the delay reading option for
235  // product provenance. If we do the delay reading then we
236  // must use a lock to interlock all fetches of provenance
237  // because the delay read fills the pp_by_pid_ one entry
238  // at a time, and we do not want other threads to find
239  // the info only partly there.
240  std::lock_guard sentry{groupMutex_};
241  for (auto const& group : groups_ | ::ranges::views::values) {
242  group->resolveProductIfAvailable();
243  }
244  }
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
ResultsAuxiliary const & art::ResultsPrincipal::resultsAux ( ) const

Definition at line 36 of file ResultsPrincipal.cc.

References aux_.

37  {
38  return aux_;
39  }
ResultsAuxiliary aux_
RangeSet art::Principal::seenRanges ( ) const
inherited
void art::Principal::setProcessHistoryIDcombined ( ProcessHistoryID const &  )
protectedinherited
size_t art::Principal::size ( void  ) const
inherited

Definition at line 263 of file Principal.cc.

References art::Principal::groupMutex_, and art::Principal::groups_.

Referenced by art::Principal::processHistoryID().

264  {
265  std::lock_guard sentry{groupMutex_};
266  return groups_.size();
267  }
GroupCollection groups_
Definition: Principal.h:246
std::recursive_mutex groupMutex_
Definition: Principal.h:241
void art::Principal::updateSeenRanges ( RangeSet const &  rs)
protectedinherited

Definition at line 707 of file Principal.cc.

References art::Principal::rangeSet_.

Referenced by art::Principal::processHistoryID().

708  {
709  rangeSet_ = rs;
710  }
RangeSet rangeSet_
Definition: Principal.h:266

Member Data Documentation

ResultsAuxiliary art::ResultsPrincipal::aux_
private
constexpr BranchType art::ResultsPrincipal::branch_type = ResultsAuxiliary::branch_type
static

Definition at line 28 of file ResultsPrincipal.h.


The documentation for this class was generated from the following files: