LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::EventPrincipal Class Referencefinal

#include "EventPrincipal.h"

Inheritance diagram for art::EventPrincipal:
art::Principal art::EDProductGetterFinder

Public Types

using Auxiliary = EventAuxiliary
 
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

 EventPrincipal (EventAuxiliary const &aux, ProcessConfiguration const &pc, cet::exempt_ptr< ProductTable const > presentProducts, std::shared_ptr< History > history=std::make_shared< History >(), std::unique_ptr< BranchMapper > &&mapper=std::make_unique< BranchMapper >(), std::unique_ptr< DelayedReader > &&rtrv=std::make_unique< NoDelayedReader >(), bool lastInSubRun=false)
 
SubRunPrincipal const & subRunPrincipal () const
 
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipalExemptPtr () const
 
void setSubRunPrincipal (cet::exempt_ptr< SubRunPrincipal const > srp)
 
EventID const & id () const
 
Timestamp const & time () const
 
bool isReal () const
 
EventAuxiliary::ExperimentType ExperimentType () const
 
EventAuxiliary const & aux () const
 
SubRunNumber_t subRun () const
 
RunNumber_t run () const
 
EventNumber_t event () const
 
EventSelectionIDVector const & eventSelectionIDs () const
 
History const & history () const
 
void put (std::unique_ptr< EDProduct > &&edp, BranchDescription const &pd, std::unique_ptr< ProductProvenance const > &&productProvenance)
 
void fillGroup (BranchDescription const &) override
 
BranchType branchType () const override
 
bool isLastInSubRun () const
 
RangeSet seenRanges () const override
 
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 = Auxiliary::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

void throwIfExistingGroup (BranchDescription const &pd) const
 
ProcessHistoryID const & processHistoryID () const override
 
void setProcessHistoryID (ProcessHistoryID const &phid) override
 

Private Attributes

EventAuxiliary aux_
 
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipal_ {nullptr}
 
std::shared_ptr< Historyhistory_
 
bool lastInSubRun_ {false}
 

Detailed Description

Definition at line 30 of file EventPrincipal.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.

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::EventPrincipal::EventPrincipal ( EventAuxiliary const &  aux,
ProcessConfiguration const &  pc,
cet::exempt_ptr< ProductTable const >  presentProducts,
std::shared_ptr< History history = std::make_shared<History>(),
std::unique_ptr< BranchMapper > &&  mapper = std::make_unique<BranchMapper>(),
std::unique_ptr< DelayedReader > &&  rtrv = std::make_unique<NoDelayedReader>(),
bool  lastInSubRun = false 
)

Definition at line 20 of file EventPrincipal.cc.

References art::Principal::addToProcessHistory(), aux(), aux_, history(), history_, art::InEvent, art::ProductMetaData::instance(), lastInSubRun_, art::Principal::productReader(), and art::DelayedReader::setGroupFinder().

28  : Principal{pc,
30  presentProducts,
31  std::move(mapper),
32  std::move(rtrv)}
33  , aux_{aux}
34  , history_{history}
35  , lastInSubRun_{lastInSubRun}
36  {
38  cet::exempt_ptr<EDProductGetterFinder const>{this});
39  if (ProductMetaData::instance().productProduced(InEvent)) {
41  }
42  }
void setGroupFinder(cet::exempt_ptr< EDProductGetterFinder const > ep)
Definition: DelayedReader.h:38
EventAuxiliary aux_
ProcessHistoryID const & processHistoryID() const
Definition: History.h:42
EventAuxiliary const & aux() const
History const & history() const
Principal(Principal const &)=delete
DelayedReader & productReader()
Definition: Principal.h:198
void addToProcessHistory()
Definition: Principal.cc:80
static ProductMetaData const & instance()
std::shared_ptr< History > history_

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(), EventPrincipal(), art::RunPrincipal::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
EventAuxiliary const& art::EventPrincipal::aux ( ) const
inline

Definition at line 81 of file EventPrincipal.h.

References aux_.

Referenced by EventPrincipal(), ExperimentType(), id(), isReal(), time(), and art::RootOutputFile::writeOne().

82  {
83  return aux_;
84  }
EventAuxiliary aux_
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
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::EventPrincipal::branchType ( ) const
inlineoverridevirtual

Implements art::Principal.

Definition at line 118 of file EventPrincipal.h.

References branch_type.

119  {
120  return branch_type;
121  }
static constexpr BranchType branch_type
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
EventNumber_t art::EventPrincipal::event ( ) const
inline

Definition at line 96 of file EventPrincipal.h.

References art::EventID::event(), eventSelectionIDs(), and id().

97  {
98  return id().event();
99  }
EventNumber_t event() const
Definition: EventID.h:117
EventID const & id() const
EventSelectionIDVector const & art::EventPrincipal::eventSelectionIDs ( ) const

Definition at line 89 of file EventPrincipal.cc.

References history_.

Referenced by event().

90  {
91  return history_->eventSelectionIDs();
92  }
std::shared_ptr< History > history_
EventAuxiliary::ExperimentType art::EventPrincipal::ExperimentType ( ) const
inline

Definition at line 75 of file EventPrincipal.h.

References aux(), and art::EventAuxiliary::experimentType().

76  {
77  return aux().experimentType();
78  }
EventAuxiliary const & aux() const
ExperimentType experimentType() const
void art::EventPrincipal::fillGroup ( BranchDescription const &  pd)
overridevirtual

Implements art::Principal.

Definition at line 68 of file EventPrincipal.cc.

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

Referenced by history().

69  {
72  gfactory::make_group(pd, pd.productID(), RangeSet::invalid()));
73  }
void throwIfExistingGroup(BranchDescription const &pd) const
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
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

Definition at line 525 of file Principal.cc.

References art::Principal::groups_.

Referenced by art::Principal::fillGroup(), art::Principal::findGroupsForProcess(), art::Principal::getGroupForPtr(), history(), art::Principal::removeCachedProduct(), and throwIfExistingGroup().

526 {
527  auto it = groups_.find(pid);
528  return it != groups_.cend() ? it->second.get() : nullptr;
529 }
GroupCollection groups_
Definition: Principal.h:280
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
History const& art::EventPrincipal::history ( ) const
inline

Definition at line 104 of file EventPrincipal.h.

References fillGroup(), art::Principal::getGroup(), history_, and put().

Referenced by EventPrincipal(), art::Event::history(), art::Event::processHistoryID(), processHistoryID(), and setProcessHistoryID().

105  {
106  return *history_;
107  }
std::shared_ptr< History > history_
EventID const& art::EventPrincipal::id ( ) const
inline
bool art::EventPrincipal::isLastInSubRun ( ) const
inline

Definition at line 124 of file EventPrincipal.h.

References lastInSubRun_.

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

125  {
126  return lastInSubRun_;
127  }
bool art::EventPrincipal::isReal ( ) const
inline

Definition at line 69 of file EventPrincipal.h.

References aux(), and art::EventAuxiliary::isRealData().

70  {
71  return aux().isRealData();
72  }
bool isRealData() const
EventAuxiliary const & aux() const
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::EventPrincipal::processHistoryID ( ) const
inlineoverrideprivatevirtual

Implements art::Principal.

Definition at line 138 of file EventPrincipal.h.

References history(), and art::History::processHistoryID().

139  {
140  return history().processHistoryID();
141  }
ProcessHistoryID const & processHistoryID() const
Definition: History.h:42
History const & history() const
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 EventPrincipal(), art::ResultsPrincipal::ResultsPrincipal(), art::RunPrincipal::RunPrincipal(), and art::SubRunPrincipal::SubRunPrincipal().

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

Definition at line 76 of file EventPrincipal.cc.

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

Referenced by art::Event::commit(), and history().

80  {
81  assert(edp);
82  branchMapper().insert(std::move(productProvenance));
85  pd, pd.productID(), RangeSet::invalid(), std::move(edp)));
86  }
void throwIfExistingGroup(BranchDescription const &pd) const
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
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::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::EventPrincipal::run ( ) const
inline

Definition at line 91 of file EventPrincipal.h.

References id(), and art::EventID::run().

92  {
93  return id().run();
94  }
RunNumber_t run() const
Definition: EventID.h:99
EventID const & id() const
RangeSet art::EventPrincipal::seenRanges ( ) const
inlineoverridevirtual

Implements art::Principal.

Definition at line 129 of file EventPrincipal.h.

References art::RangeSet::invalid(), and throwIfExistingGroup().

130  {
131  return RangeSet::invalid();
132  }
static RangeSet invalid()
Definition: RangeSet.cc:46
void art::EventPrincipal::setProcessHistoryID ( ProcessHistoryID const &  phid)
inlineoverrideprivatevirtual

Implements art::Principal.

Definition at line 144 of file EventPrincipal.h.

References history(), and art::History::setProcessHistoryID().

145  {
146  return history().setProcessHistoryID(phid);
147  }
History const & history() const
void setProcessHistoryID(ProcessHistoryID const &phid) const
Definition: History.h:48
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
void art::EventPrincipal::setSubRunPrincipal ( cet::exempt_ptr< SubRunPrincipal const >  srp)
inline

Definition at line 53 of file EventPrincipal.h.

References subRunPrincipal_.

54  {
55  subRunPrincipal_ = srp;
56  }
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipal_
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
SubRunNumber_t art::EventPrincipal::subRun ( ) const
inline

Definition at line 86 of file EventPrincipal.h.

References id(), and art::EventID::subRun().

87  {
88  return id().subRun();
89  }
EventID const & id() const
SubRunNumber_t subRun() const
Definition: EventID.h:111
SubRunPrincipal const & art::EventPrincipal::subRunPrincipal ( ) const

Definition at line 45 of file EventPrincipal.cc.

References art::errors::NullPointerError, and subRunPrincipal_.

46  {
47  if (!subRunPrincipal_) {
49  << "Tried to obtain a NULL subRunPrincipal.\n";
50  }
51  return *subRunPrincipal_;
52  }
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipal_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
cet::exempt_ptr<SubRunPrincipal const> art::EventPrincipal::subRunPrincipalExemptPtr ( ) const
inline

Definition at line 48 of file EventPrincipal.h.

References subRunPrincipal_.

Referenced by art::Source< T >::throwIfInsane_().

49  {
50  return subRunPrincipal_;
51  }
cet::exempt_ptr< SubRunPrincipal const > subRunPrincipal_
void art::EventPrincipal::throwIfExistingGroup ( BranchDescription const &  pd) const
private

Definition at line 55 of file EventPrincipal.cc.

References art::BranchDescription::branchType(), art::BranchDescription::friendlyClassName(), art::Principal::getGroup(), art::BranchDescription::moduleLabel(), art::BranchDescription::processName(), art::BranchDescription::productID(), art::BranchDescription::productInstanceName(), and art::errors::ProductRegistrationFailure.

Referenced by fillGroup(), put(), and seenRanges().

56  {
57  if (getGroup(pd.productID()) != nullptr) {
59  "EventPrincipal::throwIfExistingGroup")
60  << "Problem found while adding product provenance: "
61  << "product already exists for (" << pd.friendlyClassName() << ","
62  << pd.moduleLabel() << "," << pd.productInstanceName() << ","
63  << pd.processName() << "," << pd.branchType() << ")\n";
64  }
65  }
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
Timestamp const& art::EventPrincipal::time ( ) const
inline

Definition at line 64 of file EventPrincipal.h.

References aux(), and art::EventAuxiliary::time().

65  {
66  return aux().time();
67  }
Timestamp const & time() const
EventAuxiliary const & aux() const
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

Member Data Documentation

EventAuxiliary art::EventPrincipal::aux_
private

Definition at line 150 of file EventPrincipal.h.

Referenced by aux(), and EventPrincipal().

constexpr BranchType art::EventPrincipal::branch_type = Auxiliary::branch_type
static

Definition at line 33 of file EventPrincipal.h.

Referenced by branchType().

std::shared_ptr<History> art::EventPrincipal::history_
private

Definition at line 153 of file EventPrincipal.h.

Referenced by EventPrincipal(), eventSelectionIDs(), and history().

bool art::EventPrincipal::lastInSubRun_ {false}
private

Definition at line 154 of file EventPrincipal.h.

Referenced by EventPrincipal(), and isLastInSubRun().

cet::exempt_ptr<SubRunPrincipal const> art::EventPrincipal::subRunPrincipal_ {nullptr}
private

Definition at line 152 of file EventPrincipal.h.

Referenced by setSubRunPrincipal(), subRunPrincipal(), and subRunPrincipalExemptPtr().


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