LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::RunPrincipal Class Referencefinal

#include "RunPrincipal.h"

Inheritance diagram for art::RunPrincipal:
art::Principal art::EDProductGetterFinder

Public Types

using Auxiliary = RunAuxiliary
 
using GroupCollection = std::map< ProductID, std::unique_ptr< Group >>
 
using const_iterator = GroupCollection::const_iterator
 
using ProcessNameConstIterator = ProcessHistory::const_iterator
 
using GroupQueryResultVec = std::vector< GroupQueryResult >
 
using size_type = GroupCollection::size_type
 
using ProcessName = std::string
 

Public Member Functions

 RunPrincipal (RunAuxiliary const &, ProcessConfiguration const &, cet::exempt_ptr< ProductTable const > presentProducts, std::unique_ptr< BranchMapper > &&=std::make_unique< BranchMapper >(), std::unique_ptr< DelayedReader > &&=std::make_unique< NoDelayedReader >())
 
RunAuxiliary const & aux () const
 
RunID const & id () const
 
RunNumber_t run () const
 
Timestamp const & beginTime () const
 
Timestamp const & endTime () const
 
void setEndTime (Timestamp const &time)
 
BranchType branchType () const override
 
void fillGroup (BranchDescription const &) override
 
void put (std::unique_ptr< EDProduct > &&, BranchDescription const &, std::unique_ptr< ProductProvenance const > &&, RangeSet &&)
 
RangeSet seenRanges () const override
 
void updateSeenRanges (RangeSet const &rs)
 
RangeSetHandler const & rangeSetHandler () const
 
RangeSetHandlerrangeSetHandler ()
 
EDProductGetter const * productGetter (ProductID const pid) const
 
OutputHandle getForOutput (ProductID const, bool resolveProd) const
 
GroupQueryResult getBySelector (WrappedTypeID const &wrapped, SelectorBase const &) const
 
GroupQueryResult getByProductID (ProductID const pid) const
 
GroupQueryResult getByLabel (WrappedTypeID const &wrapped, std::string const &label, std::string const &productInstanceName, std::string const &processName) const
 
GroupQueryResultVec getMany (WrappedTypeID const &wrapped, SelectorBase const &) const
 
GroupQueryResultVec getMatchingSequence (SelectorBase const &) const
 
void removeCachedProduct (ProductID const pid) const
 
void addSecondaryPrincipal (std::unique_ptr< Principal > &&val)
 
void setProducedProducts (ProductTable const &producedProducts)
 
void readImmediate () const
 
void readProvenanceImmediate () const
 
ProcessHistory const & processHistory () const
 
ProcessConfiguration const & processConfiguration () const
 
BranchMapper const & branchMapper () const
 
size_t size () const
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator end () const
 
const_iterator cend () const
 
void addToProcessHistory ()
 
EDProductGetter const * getEDProductGetter (ProductID const pid) const
 

Static Public Attributes

static constexpr BranchType branch_type = RunAuxiliary::branch_type
 

Protected Member Functions

BranchMapperbranchMapper ()
 
void fillGroup (std::unique_ptr< Group > &&group)
 
DelayedReaderproductReader ()
 
int tryNextSecondaryFile () const
 
cet::exempt_ptr< Group const > getGroupForPtr (ProductID const pid) const
 
cet::exempt_ptr< Group const > getGroup (ProductID const pid) const
 
cet::exempt_ptr< Group const > getResolvedGroup (ProductID const pid, bool resolveProd) const
 

Private Member Functions

ProcessHistoryID const & processHistoryID () const override
 
void setProcessHistoryID (ProcessHistoryID const &) override
 

Private Attributes

RunAuxiliary aux_
 
RangeSet seenRangeSet_ {RangeSet::invalid()}
 

Detailed Description

Definition at line 28 of file RunPrincipal.h.

Member Typedef Documentation

Definition at line 30 of file RunPrincipal.h.

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.

using art::Principal::GroupQueryResultVec = std::vector<GroupQueryResult>
inherited

Definition at line 54 of file Principal.h.

using art::Principal::ProcessName = std::string
inherited

Definition at line 56 of file Principal.h.

using art::Principal::size_type = GroupCollection::size_type
inherited

Definition at line 55 of file Principal.h.

Constructor & Destructor Documentation

art::RunPrincipal::RunPrincipal ( RunAuxiliary const &  aux,
ProcessConfiguration const &  pc,
cet::exempt_ptr< ProductTable const >  presentProducts,
std::unique_ptr< BranchMapper > &&  mapper = std::make_unique<BranchMapper>(),
std::unique_ptr< DelayedReader > &&  rtrv = std::make_unique<NoDelayedReader>() 
)

Definition at line 11 of file RunPrincipal.cc.

References art::Principal::addToProcessHistory(), aux(), aux_, art::InRun, art::ProductMetaData::instance(), art::RunAuxiliary::processHistoryID_, art::Principal::productReader(), and art::DelayedReader::setGroupFinder().

17  : Principal{pc,
19  presentProducts,
20  std::move(mapper),
21  std::move(rtrv)}
22  , aux_{aux}
23  {
25  cet::exempt_ptr<EDProductGetterFinder const>{this});
26  if (ProductMetaData::instance().productProduced(InRun)) {
28  }
29  }
void setGroupFinder(cet::exempt_ptr< EDProductGetterFinder const > ep)
Definition: DelayedReader.h:38
RunAuxiliary aux_
Definition: RunPrincipal.h:103
Principal(Principal const &)=delete
DelayedReader & productReader()
Definition: Principal.h:198
void addToProcessHistory()
Definition: Principal.cc:80
static ProductMetaData const & instance()
ProcessHistoryID processHistoryID_
Definition: RunAuxiliary.h:101
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:41

Member Function Documentation

void art::Principal::addSecondaryPrincipal ( std::unique_ptr< Principal > &&  val)
inlineinherited

Definition at line 100 of file Principal.h.

References art::Principal::secondaryPrincipals_.

101  {
102  secondaryPrincipals_.emplace_back(std::move(val));
103  }
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
Definition: Principal.h:293
void Principal::addToProcessHistory ( )
inherited

Definition at line 80 of file Principal.cc.

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

Referenced by art::Principal::cend(), art::EventPrincipal::EventPrincipal(), RunPrincipal(), art::SubRunPrincipal::SubRunPrincipal(), art::RootOutput::write(), art::RootOutput::writeRun(), and art::RootOutput::writeSubRun().

81 {
83  return;
84  }
85  string const& processName = processConfiguration_.processName();
86  for (auto const& val : processHistory_) {
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";
93  }
94  }
95  processHistory_.push_back(processConfiguration_);
96  // OPTIMIZATION NOTE: As of 0_9_0_pre3 For very simple Sources
97  // (e.g. EmptyEvent) this routine takes up nearly 50% of the time
98  // per event, and 96% of the time for this routine is spent in
99  // computing the ProcessHistory id which happens because we are
100  // reconstructing the ProcessHistory for each event. It would
101  // probably be better to move the ProcessHistory construction out to
102  // somewhere which persists for longer than one Event.
103  auto const phid = processHistory_.id();
104  ProcessHistoryRegistry::emplace(phid, processHistory_);
105  setProcessHistoryID(phid);
107 }
ProcessHistory processHistory_
Definition: Principal.h:268
bool processHistoryModified_
Definition: Principal.h:277
std::string const & processName() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProcessConfiguration const & processConfiguration_
Definition: Principal.h:270
static auto emplace(value_type const &value)
virtual void setProcessHistoryID(ProcessHistoryID const &)=0
RunAuxiliary const& art::RunPrincipal::aux ( ) const
inline

Definition at line 41 of file RunPrincipal.h.

References aux_.

Referenced by beginTime(), endTime(), id(), processHistoryID(), run(), RunPrincipal(), setProcessHistoryID(), and art::RootOutputFile::writeRun().

42  {
43  return aux_;
44  }
RunAuxiliary aux_
Definition: RunPrincipal.h:103
const_iterator art::Principal::begin ( ) const
inlineinherited

Definition at line 156 of file Principal.h.

References art::Principal::groups_.

157  {
158  return groups_.begin();
159  }
GroupCollection groups_
Definition: Principal.h:280
Timestamp const& art::RunPrincipal::beginTime ( ) const
inline

Definition at line 57 of file RunPrincipal.h.

References aux(), and art::RunAuxiliary::beginTime().

58  {
59  return aux().beginTime();
60  }
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:41
Timestamp const & beginTime() const
Definition: RunAuxiliary.h:57
BranchMapper const& art::Principal::branchMapper ( ) const
inlineinherited
BranchMapper& art::Principal::branchMapper ( )
inlineprotectedinherited

Definition at line 192 of file Principal.h.

References art::Principal::branchMapperPtr_.

193  {
194  return *branchMapperPtr_;
195  }
std::unique_ptr< BranchMapper > branchMapperPtr_
Definition: Principal.h:284
BranchType art::RunPrincipal::branchType ( ) const
inlineoverridevirtual

Implements art::Principal.

Definition at line 74 of file RunPrincipal.h.

References branch_type, fillGroup(), and put().

75  {
76  return branch_type;
77  }
static constexpr BranchType branch_type
Definition: RunPrincipal.h:31
const_iterator art::Principal::cbegin ( ) const
inlineinherited

Definition at line 162 of file Principal.h.

References art::Principal::groups_.

163  {
164  return groups_.cbegin();
165  }
GroupCollection groups_
Definition: Principal.h:280
const_iterator art::Principal::cend ( ) const
inlineinherited
const_iterator art::Principal::end ( void  ) const
inlineinherited

Definition at line 168 of file Principal.h.

References art::Principal::groups_.

169  {
170  return groups_.end();
171  }
GroupCollection groups_
Definition: Principal.h:280
Timestamp const& art::RunPrincipal::endTime ( ) const
inline

Definition at line 62 of file RunPrincipal.h.

References aux(), and art::RunAuxiliary::endTime().

Referenced by art::BeginEndPackage< Level::Run >::End::preScheduleSignal().

63  {
64  return aux().endTime();
65  }
Timestamp const & endTime() const
Definition: RunAuxiliary.h:63
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:41
void art::RunPrincipal::fillGroup ( BranchDescription const &  pd)
overridevirtual

Implements art::Principal.

Definition at line 44 of file RunPrincipal.cc.

References art::Principal::fillGroup(), art::RangeSet::invalid(), art::gfactory::make_group(), and art::BranchDescription::productID().

Referenced by branchType().

45  {
47  gfactory::make_group(pd, pd.productID(), RangeSet::invalid()));
48  }
virtual void fillGroup(BranchDescription const &)=0
static RangeSet invalid()
Definition: RangeSet.cc:46
std::unique_ptr< Group > make_group(BranchDescription const &, ProductID const &, RangeSet &&)
Definition: GroupFactory.h:44
void art::Principal::fillGroup ( std::unique_ptr< Group > &&  group)
inlineprotectedinherited
GroupQueryResult Principal::getByLabel ( WrappedTypeID const &  wrapped,
std::string const &  label,
std::string const &  productInstanceName,
std::string const &  processName 
) const
inherited

Definition at line 143 of file Principal.cc.

References art::Principal::findGroupsForProduct(), art::WrappedTypeID::product_type, and art::errors::ProductNotFound.

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

147 {
148  Selector const sel{ModuleLabelSelector{label} &&
149  ProductInstanceNameSelector{productInstanceName} &&
150  ProcessNameSelector{processName}};
151  auto const& results = findGroupsForProduct(wrapped, sel, true);
152  if (results.empty()) {
153  auto whyFailed =
154  std::make_shared<art::Exception>(art::errors::ProductNotFound);
155  *whyFailed << "getByLabel: Found zero products matching all criteria\n"
156  << "Looking for type: " << wrapped.product_type << "\n"
157  << "Looking for module label: " << label << "\n"
158  << "Looking for productInstanceName: " << productInstanceName
159  << "\n"
160  << (processName.empty() ? "" : "Looking for process: ")
161  << processName;
162  return GroupQueryResult{whyFailed};
163  }
164  if (results.size() > 1) {
166  << "getByLabel: Found " << results.size()
167  << " products rather than one which match all criteria\n"
168  << "Looking for type: " << wrapped.product_type << "\n"
169  << "Looking for module label: " << label << "\n"
170  << "Looking for productInstanceName: " << productInstanceName << "\n"
171  << (processName.empty() ? "" : "Looking for process: ") << processName
172  << "\n";
173  }
174  return results[0];
175 }
GroupQueryResultVec findGroupsForProduct(WrappedTypeID const &wrapped, SelectorBase const &, bool stopIfProcessHasMatch) const
Definition: Principal.cc:278
const std::string label
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
GroupQueryResult Principal::getByProductID ( ProductID const  pid) const
inherited

Definition at line 131 of file Principal.cc.

References art::Principal::getGroupForPtr(), and art::errors::ProductNotFound.

Referenced by art::DataViewImpl::getByProductID_(), art::Principal::getEDProductGetterImpl(), and art::Principal::productGetter().

132 {
133  if (auto const g = getGroupForPtr(pid)) {
134  return GroupQueryResult{g};
135  }
136  auto whyFailed =
137  std::make_shared<art::Exception>(art::errors::ProductNotFound, "InvalidID");
138  *whyFailed << "getGroup: no product with given product id: " << pid << "\n";
139  return GroupQueryResult{whyFailed};
140 }
cet::exempt_ptr< Group const > getGroupForPtr(ProductID const pid) const
Definition: Principal.cc:481
GroupQueryResult Principal::getBySelector ( WrappedTypeID const &  wrapped,
SelectorBase const &  sel 
) const
inherited

Definition at line 110 of file Principal.cc.

References art::Principal::findGroupsForProduct(), art::WrappedTypeID::product_type, and art::errors::ProductNotFound.

Referenced by art::DataViewImpl::get_().

112 {
113  auto const& results = findGroupsForProduct(wrapped, sel, true);
114  if (results.empty()) {
115  auto whyFailed =
116  std::make_shared<art::Exception>(art::errors::ProductNotFound);
117  *whyFailed << "getBySelector: Found zero products matching all criteria\n"
118  << "Looking for type: " << wrapped.product_type << "\n";
119  return GroupQueryResult{whyFailed};
120  }
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";
126  }
127  return results[0];
128 }
GroupQueryResultVec findGroupsForProduct(WrappedTypeID const &wrapped, SelectorBase const &, bool stopIfProcessHasMatch) const
Definition: Principal.cc:278
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
EDProductGetter const* art::EDProductGetterFinder::getEDProductGetter ( ProductID const  pid) const
inlineinherited

Definition at line 25 of file EDProductGetterFinder.h.

References art::EDProductGetterFinder::getEDProductGetterImpl().

26  {
28  }
virtual EDProductGetter const * getEDProductGetterImpl(ProductID) const =0
OutputHandle Principal::getForOutput ( ProductID const  pid,
bool  resolveProd 
) const
inherited

Definition at line 424 of file Principal.cc.

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

Referenced by art::RootOutputFile::fillBranches(), art::detail::KeptProvenance::insertAncestors(), and art::ProvenanceCheckerOutput::write().

425 {
426  auto const& g = getResolvedGroup(pid, resolveProd);
427  if (g.get() == nullptr) {
428  return OutputHandle::invalid();
429  }
430 
431  if (resolveProd) {
432  // If a request to resolve the product is made, then it should
433  // exist and be marked as present. Return invalid handles if this
434  // is not the case.
435  if (g->anyProduct() == nullptr) {
436  return OutputHandle::invalid();
437  }
438  if (!g->anyProduct()->isPresent()) {
439  return OutputHandle::invalid();
440  }
441  }
442  if (!g->anyProduct() && !g->productProvenancePtr()) {
443  return OutputHandle{g->rangeOfValidity()};
444  }
445  return OutputHandle{g->anyProduct(),
446  &g->productDescription(),
447  g->productProvenancePtr(),
448  g->rangeOfValidity()};
449 }
RangeSet const & rangeOfValidity() const
Definition: OutputHandle.h:78
cet::exempt_ptr< Group const > getResolvedGroup(ProductID const pid, bool resolveProd) const
Definition: Principal.cc:452
static OutputHandle invalid()
Definition: OutputHandle.h:52
cet::exempt_ptr< Group const > Principal::getGroup ( ProductID const  pid) const
protectedinherited
cet::exempt_ptr< Group const > Principal::getGroupForPtr ( ProductID const  pid) const
protectedinherited

Definition at line 481 of file Principal.cc.

References art::Principal::getGroup(), art::Principal::presentFromSource(), art::Principal::producedProducts_, art::Principal::secondaryPrincipals_, and art::Principal::tryNextSecondaryFile().

Referenced by art::Principal::fillGroup(), art::Principal::getByProductID(), and art::Principal::getResolvedGroup().

482 {
483  bool produced{false};
484  if (producedProducts_) {
485  auto const& availableProducts = producedProducts_->availableProducts;
486  if (availableProducts.find(pid) != availableProducts.cend()) {
487  produced = true;
488  }
489  }
490 
491  // Look through current process and currently opened primary input file.
492  if (produced || presentFromSource(pid)) {
493  return getGroup(pid);
494  }
495 
496  // Look through secondary files
497  for (auto const& sp : secondaryPrincipals_) {
498  if (sp->presentFromSource(pid)) {
499  return sp->getGroup(pid);
500  }
501  }
502 
503  // Try new secondary files
504  while (true) {
505  int const err = tryNextSecondaryFile();
506  if (err == -2) {
507  // No more files.
508  return nullptr;
509  }
510  if (err == -1) {
511  // Run, SubRun, or Event not found.
512  continue;
513  }
514  assert(!secondaryPrincipals_.empty());
515  auto& new_sp = secondaryPrincipals_.back();
516  if (new_sp->presentFromSource(pid)) {
517  return new_sp->getGroup(pid);
518  }
519  }
520 
521  return nullptr;
522 }
bool presentFromSource(ProductID) const
Definition: Principal.cc:470
cet::exempt_ptr< Group const > getGroup(ProductID const pid) const
Definition: Principal.cc:525
int tryNextSecondaryFile() const
Definition: Principal.cc:184
cet::exempt_ptr< ProductTable const > producedProducts_
Definition: Principal.h:272
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
Definition: Principal.h:293
Principal::GroupQueryResultVec Principal::getMany ( WrappedTypeID const &  wrapped,
SelectorBase const &  sel 
) const
inherited

Definition at line 178 of file Principal.cc.

References art::Principal::findGroupsForProduct().

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

179 {
180  return findGroupsForProduct(wrapped, sel, false);
181 }
GroupQueryResultVec findGroupsForProduct(WrappedTypeID const &wrapped, SelectorBase const &, bool stopIfProcessHasMatch) const
Definition: Principal.cc:278
Principal::GroupQueryResultVec Principal::getMatchingSequence ( SelectorBase const &  selector) const
inherited

Definition at line 195 of file Principal.cc.

References art::Principal::findGroups(), art::Principal::matchingSequenceFromInputFile(), art::Principal::producedProducts_, art::Principal::secondaryPrincipals_, and art::Principal::tryNextSecondaryFile().

Referenced by art::DataViewImpl::getMatchingSequenceByLabel_().

196 {
197  GroupQueryResultVec results;
198 
199  // Find groups from current process
200  if (producedProducts_) {
201  if (findGroups(producedProducts_->viewLookup, selector, results, true) !=
202  0) {
203  return results;
204  }
205  }
206 
207  // Look through currently opened input files
208  if (results.empty()) {
209  results = matchingSequenceFromInputFile(selector);
210  if (!results.empty()) {
211  return results;
212  }
213 
214  for (auto const& sp : secondaryPrincipals_) {
215  results = sp->matchingSequenceFromInputFile(selector);
216  if (!results.empty()) {
217  return results;
218  }
219  }
220  }
221 
222  // Open more secondary files if necessary
223  if (results.empty()) {
224  while (true) {
225  int const err = tryNextSecondaryFile();
226  if (err == -2) {
227  // No more files.
228  break;
229  }
230  if (err == -1) {
231  // Run, SubRun, or Event not found.
232  continue;
233  }
234  assert(!secondaryPrincipals_.empty());
235  auto& new_sp = secondaryPrincipals_.back();
236  results = new_sp->matchingSequenceFromInputFile(selector);
237  if (!results.empty()) {
238  return results;
239  }
240  }
241  }
242 
243  return results;
244 }
int tryNextSecondaryFile() const
Definition: Principal.cc:184
cet::exempt_ptr< ProductTable const > producedProducts_
Definition: Principal.h:272
size_t findGroups(ProcessLookup const &, SelectorBase const &, GroupQueryResultVec &results, bool stopIfProcessHasMatch, TypeID wanted_wrapper=TypeID{}) const
Definition: Principal.cc:355
std::vector< GroupQueryResult > GroupQueryResultVec
Definition: Principal.h:54
GroupQueryResultVec matchingSequenceFromInputFile(SelectorBase const &) const
Definition: Principal.cc:247
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
Definition: Principal.h:293
cet::exempt_ptr< Group const > Principal::getResolvedGroup ( ProductID const  pid,
bool  resolveProd 
) const
protectedinherited

Definition at line 452 of file Principal.cc.

References art::Principal::getGroupForPtr().

Referenced by art::Principal::fillGroup(), and art::Principal::getForOutput().

453 {
454  // FIXME: This reproduces the behavior of the original getGroup with
455  // resolveProv == false but I am not sure this is correct in the
456  // case of an unavailable product.
457  auto const g = getGroupForPtr(pid);
458  if (!g.get() || !resolveProd) {
459  return g;
460  }
461  bool const gotIt = g->resolveProductIfAvailable(g->producedWrapperType());
462  if (!gotIt) {
463  // Behavior is the same as if the group wasn't there.
464  return nullptr;
465  }
466  return g;
467 }
cet::exempt_ptr< Group const > getGroupForPtr(ProductID const pid) const
Definition: Principal.cc:481
RunID const& art::RunPrincipal::id ( ) const
inline
ProcessConfiguration const& art::Principal::processConfiguration ( ) const
inlineinherited

Definition at line 138 of file Principal.h.

References art::Principal::processConfiguration_.

Referenced by art::get_ProductDescription().

139  {
140  return processConfiguration_;
141  }
ProcessConfiguration const & processConfiguration_
Definition: Principal.h:270
ProcessHistory const& art::Principal::processHistory ( ) const
inlineinherited

Definition at line 132 of file Principal.h.

References art::Principal::processHistory_.

Referenced by art::Principal::findGroups(), and art::DataViewImpl::processHistory().

133  {
134  return processHistory_;
135  }
ProcessHistory processHistory_
Definition: Principal.h:268
ProcessHistoryID const & art::RunPrincipal::processHistoryID ( ) const
overrideprivatevirtual

Implements art::Principal.

Definition at line 32 of file RunPrincipal.cc.

References aux(), and art::RunAuxiliary::processHistoryID_.

Referenced by updateSeenRanges().

33  {
34  return aux().processHistoryID_;
35  }
ProcessHistoryID processHistoryID_
Definition: RunAuxiliary.h:101
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:41
EDProductGetter const * Principal::productGetter ( ProductID const  pid) const
inherited

Definition at line 532 of file Principal.cc.

References art::Principal::deferredGetter_(), art::Principal::getByProductID(), and art::GroupQueryResult::result().

Referenced by art::SourceHelper::makePtr(), art::Results::productGetter(), art::Run::productGetter(), art::SubRun::productGetter(), and art::Event::productGetter().

533 {
534  EDProductGetter const* result{getByProductID(pid).result().get()};
535  return result ? result : deferredGetter_(pid);
536 }
cet::exempt_ptr< Group const > result() const
EDProductGetter const * deferredGetter_(ProductID const pid) const
Definition: Principal.cc:412
GroupQueryResult getByProductID(ProductID const pid) const
Definition: Principal.cc:131
DelayedReader& art::Principal::productReader ( )
inlineprotectedinherited

Definition at line 198 of file Principal.h.

References art::Principal::store_.

Referenced by art::EventPrincipal::EventPrincipal(), art::ResultsPrincipal::ResultsPrincipal(), RunPrincipal(), and art::SubRunPrincipal::SubRunPrincipal().

199  {
200  return *store_;
201  }
std::unique_ptr< DelayedReader > store_
Definition: Principal.h:288
void art::RunPrincipal::put ( std::unique_ptr< EDProduct > &&  edp,
BranchDescription const &  pd,
std::unique_ptr< ProductProvenance const > &&  productProvenance,
RangeSet &&  rs 
)

Definition at line 51 of file RunPrincipal.cc.

References art::Principal::branchMapper(), art::Principal::fillGroup(), art::BranchMapper::insert(), art::gfactory::make_group(), and art::BranchDescription::productID().

Referenced by branchType(), and art::Run::commit().

56  {
57  assert(edp);
58  branchMapper().insert(std::move(productProvenance));
60  gfactory::make_group(pd, pd.productID(), std::move(rs), std::move(edp)));
61  }
BranchMapper const & branchMapper() const
Definition: Principal.h:144
result_t insert(std::unique_ptr< ProductProvenance const > &&)
Definition: BranchMapper.cc:24
virtual void fillGroup(BranchDescription const &)=0
std::unique_ptr< Group > make_group(BranchDescription const &, ProductID const &, RangeSet &&)
Definition: GroupFactory.h:44
RangeSetHandler const& art::RunPrincipal::rangeSetHandler ( ) const

Referenced by updateSeenRanges().

RangeSetHandler& art::RunPrincipal::rangeSetHandler ( )
void art::Principal::readImmediate ( ) const
inlineinherited

Definition at line 112 of file Principal.h.

References art::Principal::groups_, and art::Principal::readProvenanceImmediate().

113  {
115  for (auto const& val : groups_) {
116  if (!val.second->productUnavailable()) {
117  val.second->resolveProduct(val.second->producedWrapperType());
118  }
119  }
120  }
GroupCollection groups_
Definition: Principal.h:280
void readProvenanceImmediate() const
Definition: Principal.h:123
void art::Principal::readProvenanceImmediate ( ) const
inlineinherited

Definition at line 123 of file Principal.h.

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

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

124  {
125  for (auto const& val : groups_) {
126  (void)val.second->productProvenancePtr();
127  }
128  branchMapperPtr_->setDelayedRead(false);
129  }
std::unique_ptr< BranchMapper > branchMapperPtr_
Definition: Principal.h:284
GroupCollection groups_
Definition: Principal.h:280
void Principal::removeCachedProduct ( ProductID const  pid) const
inherited

Definition at line 259 of file Principal.cc.

References art::Principal::getGroup(), art::errors::ProductNotFound, and art::Principal::secondaryPrincipals_.

Referenced by art::DataViewImpl::removeCachedProduct_().

260 {
261  if (auto g = getGroup(pid)) {
262  g->removeCachedProduct();
263  return;
264  }
265  for (auto const& sp : secondaryPrincipals_) {
266  if (auto g = sp->getGroup(pid)) {
267  g->removeCachedProduct();
268  return;
269  }
270  }
271  throw Exception(errors::ProductNotFound, "removeCachedProduct")
272  << "Attempt to remove unknown product corresponding to ProductID: " << pid
273  << '\n'
274  << "Please contact artists@fnal.gov\n";
275 }
cet::exempt_ptr< Group const > getGroup(ProductID const pid) const
Definition: Principal.cc:525
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::vector< std::unique_ptr< Principal > > secondaryPrincipals_
Definition: Principal.h:293
RunNumber_t art::RunPrincipal::run ( ) const
inline

Definition at line 51 of file RunPrincipal.h.

References aux(), and art::RunAuxiliary::run().

52  {
53  return aux().run();
54  }
RunNumber_t run() const
Definition: RunAuxiliary.h:74
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:41
RangeSet art::RunPrincipal::seenRanges ( ) const
inlineoverridevirtual

Implements art::Principal.

Definition at line 87 of file RunPrincipal.h.

References seenRangeSet_.

Referenced by art::EDProducer::doEndRun(), and art::EDFilter::doEndRun().

88  {
89  return seenRangeSet_;
90  }
RangeSet seenRangeSet_
Definition: RunPrincipal.h:104
void art::RunPrincipal::setEndTime ( Timestamp const &  time)
inline

Definition at line 68 of file RunPrincipal.h.

References aux_, and art::RunAuxiliary::setEndTime().

69  {
70  aux_.setEndTime(time);
71  }
RunAuxiliary aux_
Definition: RunPrincipal.h:103
void setEndTime(Timestamp const &time)
Definition: RunAuxiliary.h:80
void art::RunPrincipal::setProcessHistoryID ( ProcessHistoryID const &  phid)
overrideprivatevirtual

Implements art::Principal.

Definition at line 38 of file RunPrincipal.cc.

References aux(), and art::RunAuxiliary::setProcessHistoryID().

Referenced by updateSeenRanges().

39  {
40  return aux().setProcessHistoryID(phid);
41  }
void setProcessHistoryID(ProcessHistoryID const &phid) const
Definition: RunAuxiliary.h:45
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:41
void art::Principal::setProducedProducts ( ProductTable const &  producedProducts)
inlineinherited

Definition at line 106 of file Principal.h.

References art::Principal::producedProducts_.

107  {
108  producedProducts_ = cet::make_exempt_ptr(&producedProducts);
109  }
cet::exempt_ptr< ProductTable const > producedProducts_
Definition: Principal.h:272
size_t art::Principal::size ( void  ) const
inlineinherited

Definition at line 150 of file Principal.h.

References art::Principal::groups_.

Referenced by art::DataViewImpl::size().

151  {
152  return groups_.size();
153  }
GroupCollection groups_
Definition: Principal.h:280
int Principal::tryNextSecondaryFile ( ) const
protectedinherited

Definition at line 184 of file Principal.cc.

References art::Principal::nextSecondaryFileIdx_, and art::Principal::store_.

Referenced by art::Principal::fillGroup(), art::Principal::findGroupsForProduct(), art::Principal::getGroupForPtr(), and art::Principal::getMatchingSequence().

185 {
186  int const err = store_->openNextSecondaryFile(nextSecondaryFileIdx_);
187  if (err != -2) {
188  // there are more files to try
190  }
191  return err;
192 }
std::unique_ptr< DelayedReader > store_
Definition: Principal.h:288
int nextSecondaryFileIdx_
Definition: Principal.h:297
void art::RunPrincipal::updateSeenRanges ( RangeSet const &  rs)
inline

Definition at line 92 of file RunPrincipal.h.

References processHistoryID(), rangeSetHandler(), seenRangeSet_, and setProcessHistoryID().

Referenced by art::EndPathExecutor::setAuxiliaryRangeSetID().

93  {
94  seenRangeSet_ = rs;
95  }
RangeSet seenRangeSet_
Definition: RunPrincipal.h:104

Member Data Documentation

RunAuxiliary art::RunPrincipal::aux_
private

Definition at line 103 of file RunPrincipal.h.

Referenced by aux(), RunPrincipal(), and setEndTime().

constexpr BranchType art::RunPrincipal::branch_type = RunAuxiliary::branch_type
static

Definition at line 31 of file RunPrincipal.h.

Referenced by branchType().

RangeSet art::RunPrincipal::seenRangeSet_ {RangeSet::invalid()}
private

Definition at line 104 of file RunPrincipal.h.

Referenced by seenRanges(), and updateSeenRanges().


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