LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::RootInputFile Class Reference

#include "RootInputFile.h"

Public Types

using RootInputTreePtrArray = std::array< std::unique_ptr< RootInputTree >, NumBranchTypes >
 
using EntryNumber = RootInputTree::EntryNumber
 
using EntryNumbers = RootInputTree::EntryNumbers
 

Public Member Functions

 RootInputFile (RootInputFile const &)=delete
 
RootInputFileoperator= (RootInputFile const &)=delete
 
 RootInputFile (std::string const &fileName, std::string const &catalogName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, std::unique_ptr< TFile > &&filePtr, EventID const &origEventID, unsigned int eventsToSkip, bool compactSubRunRanges, FastCloningInfoProvider const &fcip, unsigned int treeCacheSize, int64_t treeMaxVirtualSize, int64_t saveMemoryObjectThreashold, bool delayedReadEventProducts, bool delayedReadSubRunProducts, bool delayedReadRunProducts, InputSource::ProcessingMode processingMode, int forcedRunOffset, bool noEventSort, GroupSelectorRules const &groupSelectorRules, std::shared_ptr< DuplicateChecker > duplicateChecker, bool dropDescendantsOfDroppedProducts, bool readIncomingParameterSets, cet::exempt_ptr< RootInputFile > primaryFile, std::vector< std::string > const &secondaryFileNames, RootInputFileSequence *rifSequence, MasterProductRegistry &mpr)
 
void reportOpened ()
 
void close (bool reallyClose)
 
std::unique_ptr< ResultsPrincipalreadResults ()
 
std::unique_ptr< RunPrincipalreadRun ()
 
std::unique_ptr< SubRunPrincipalreadSubRun (cet::exempt_ptr< RunPrincipal >)
 
std::unique_ptr< EventPrincipalreadEvent ()
 
bool readRunForSecondaryFile (RunID)
 
bool readSubRunForSecondaryFile (SubRunID)
 
bool readEventForSecondaryFile (EventID eID)
 
std::string const & fileName () const
 
RunAuxiliaryrunAux ()
 
ResultsAuxiliaryresultsAux ()
 
SubRunAuxiliarysubRunAux ()
 
EventAuxiliaryeventAux ()
 
FileFormatVersion fileFormatVersion () const
 
bool fastClonable () const
 
std::unique_ptr< FileBlockcreateFileBlock ()
 
template<BranchType BT>
void setEntry (FileIndex::EntryNumber_t entry)
 
template<BranchType BT, typename ID >
bool setEntry (ID const &id, bool exact=true)
 
void rewind ()
 
void setToLastEntry ()
 
void nextEntry ()
 
void previousEntry ()
 
void advanceEntry (std::size_t n)
 
unsigned int eventsToSkip () const
 
int skipEvents (int offset)
 
int setForcedRunOffset (RunNumber_t const &forcedRunNumber)
 
bool nextEventEntry ()
 
FileIndex::EntryType getEntryType () const
 
FileIndex::EntryType getNextEntryTypeWanted ()
 
std::shared_ptr< FileIndexfileIndexSharedPtr () const
 
EventID eventIDForFileIndexPosition () const
 
auto const & secondaryFileNames () const
 
auto const & secondaryFiles () const
 
void openSecondaryFile (int const idx)
 
std::unique_ptr< RangeSetHandlerrunRangeSetHandler ()
 
std::unique_ptr< RangeSetHandlersubRunRangeSetHandler ()
 

Private Member Functions

RootInputTree const & eventTree () const
 
RootInputTree const & subRunTree () const
 
RootInputTree const & runTree () const
 
RootInputTree const & resultsTree () const
 
RootInputTreeeventTree ()
 
RootInputTreesubRunTree ()
 
RootInputTreerunTree ()
 
RootInputTreeresultsTree ()
 
bool setIfFastClonable (FastCloningInfoProvider const &fcip) const
 
void validateFile ()
 
void fillHistory ()
 
std::array< AvailableProducts_t, NumBranchTypesfillPerBranchTypePresenceFlags (ProductList const &)
 
template<BranchType BT>
void fillAuxiliary (EntryNumber const entry)
 
template<BranchType BT>
std::unique_ptr< RangeSetHandlerfillAuxiliary (EntryNumbers const &entries)
 
void overrideRunNumber (RunID &id)
 
void overrideRunNumber (SubRunID &id)
 
void overrideRunNumber (EventID &id, bool isRealData)
 
void dropOnInput (GroupSelectorRules const &rules, bool dropDescendants, ProductList &branchDescriptions)
 
void readParentageTree (unsigned int treeCacheSize)
 
void readEventHistoryTree (unsigned int treeCacheSize)
 
void initializeDuplicateChecker ()
 
std::pair< EntryNumbers, bool > getEntryNumbers (BranchType)
 
std::unique_ptr< RunPrincipalreadCurrentRun (EntryNumbers const &)
 
std::unique_ptr< SubRunPrincipalreadCurrentSubRun (EntryNumbers const &, cet::exempt_ptr< RunPrincipal >)
 
std::unique_ptr< EventPrincipalreadCurrentEvent (std::pair< EntryNumbers, bool > const &)
 

Private Attributes

std::string const fileName_
 
std::string const catalog_
 
ProcessConfiguration const & processConfiguration_
 
std::string const logicalFileName_
 
std::unique_ptr< TFile > filePtr_
 
cet::sqlite::Connection sqliteDB_ {}
 
EventID origEventID_
 
EventNumber_t eventsToSkip_
 
bool const compactSubRunRanges_
 
RootInputTreePtrArray treePointers_
 
bool delayedReadEventProducts_
 
bool delayedReadSubRunProducts_
 
bool delayedReadRunProducts_
 
InputSource::ProcessingMode processingMode_
 
int forcedRunOffset_
 
bool noEventSort_
 
std::shared_ptr< DuplicateCheckerduplicateChecker_
 
cet::exempt_ptr< RootInputFileprimaryFile_
 
std::vector< std::string > secondaryFileNames_
 
cet::exempt_ptr< RootInputFileSequencerifSequence_
 
FileFormatVersion fileFormatVersion_ {}
 
std::shared_ptr< FileIndexfileIndexSharedPtr_ {new FileIndex}
 
FileIndexfileIndex_ {*fileIndexSharedPtr_}
 
FileIndex::const_iterator fiBegin_ {fileIndex_.begin()}
 
FileIndex::const_iterator fiEnd_ {fileIndex_.end()}
 
FileIndex::const_iterator fiIter_ {fiBegin_}
 
bool fastClonable_ {false}
 
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliaryauxiliaries_ {}
 
ProductRegistry productListHolder_ {}
 
ProductTables presentProducts_ {ProductTables::invalid()}
 
std::unique_ptr< BranchIDLists > branchIDLists_
 
TTree * eventHistoryTree_ {nullptr}
 
std::shared_ptr< Historyhistory_ {std::make_shared<History>()}
 
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_ {}
 
cet::exempt_ptr< EventPrincipalprimaryEP_ {}
 
cet::exempt_ptr< RunPrincipalprimaryRP_ {}
 
cet::exempt_ptr< SubRunPrincipalprimarySRP_ {}
 
std::unique_ptr< RangeSetHandlersubRunRangeSetHandler_ {nullptr}
 
std::unique_ptr< RangeSetHandlerrunRangeSetHandler_ {nullptr}
 

Detailed Description

Definition at line 49 of file RootInputFile.h.

Member Typedef Documentation

Definition at line 53 of file RootInputFile.h.

Constructor & Destructor Documentation

art::RootInputFile::RootInputFile ( RootInputFile const &  )
delete
art::RootInputFile::RootInputFile ( std::string const &  fileName,
std::string const &  catalogName,
ProcessConfiguration const &  processConfiguration,
std::string const &  logicalFileName,
std::unique_ptr< TFile > &&  filePtr,
EventID const &  origEventID,
unsigned int  eventsToSkip,
bool  compactSubRunRanges,
FastCloningInfoProvider const &  fcip,
unsigned int  treeCacheSize,
int64_t  treeMaxVirtualSize,
int64_t  saveMemoryObjectThreashold,
bool  delayedReadEventProducts,
bool  delayedReadSubRunProducts,
bool  delayedReadRunProducts,
InputSource::ProcessingMode  processingMode,
int  forcedRunOffset,
bool  noEventSort,
GroupSelectorRules const &  groupSelectorRules,
std::shared_ptr< DuplicateChecker duplicateChecker,
bool  dropDescendantsOfDroppedProducts,
bool  readIncomingParameterSets,
cet::exempt_ptr< RootInputFile primaryFile,
std::vector< std::string > const &  secondaryFileNames,
RootInputFileSequence rifSequence,
MasterProductRegistry mpr 
)

Member Function Documentation

void art::RootInputFile::advanceEntry ( std::size_t  n)
inline

Definition at line 189 of file RootInputFile.h.

References nextEntry().

190  {
191  while (n-- != 0)
192  nextEntry();
193  }
Char_t n[5]
void art::RootInputFile::close ( bool  reallyClose)

Definition at line 557 of file RootInputFile.cc.

558  {
559  if (!reallyClose) {
560  return;
561  }
562  filePtr_->Close();
563  for (auto const& sf : secondaryFiles_) {
564  if (!sf) {
565  continue;
566  }
567  sf->filePtr_->Close();
568  }
569  }
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_
std::unique_ptr< TFile > filePtr_
std::unique_ptr< FileBlock > art::RootInputFile::createFileBlock ( )

Definition at line 446 of file RootInputFile.cc.

Referenced by fastClonable().

447  {
448  return std::make_unique<RootFileBlock>(
450  fileName_,
451  readResults(),
452  cet::make_exempt_ptr(eventTree().tree()),
453  fastClonable());
454  }
RootInputTree const & eventTree() const
FileFormatVersion fileFormatVersion_
std::string const fileName_
std::unique_ptr< ResultsPrincipal > readResults()
bool fastClonable() const
void art::RootInputFile::dropOnInput ( GroupSelectorRules const &  rules,
bool  dropDescendants,
ProductList branchDescriptions 
)
private

Definition at line 1025 of file RootInputFile.cc.

References art::BranchChildren::appendToDescendants(), art::checkDictionaries(), and E.

Referenced by fillAuxiliary().

1028  {
1029  // This is the selector for drop on input.
1030  GroupSelector const groupSelector{rules, prodList};
1031  // Do drop on input. On the first pass, just fill in a set of
1032  // branches to be dropped. Use the BranchChildren class to
1033  // assemble list of children to drop.
1034  BranchChildren children;
1035  set<ProductID> branchesToDrop;
1036  for (auto const& prod : prodList) {
1037  auto const& pd = prod.second;
1038  if (!groupSelector.selected(pd)) {
1039  if (dropDescendants) {
1040  children.appendToDescendants(pd.productID(), branchesToDrop);
1041  } else {
1042  branchesToDrop.insert(pd.productID());
1043  }
1044  }
1045  }
1046  // On this pass, actually drop the branches.
1047  auto branchesToDropEnd = branchesToDrop.cend();
1048  for (auto I = prodList.begin(), E = prodList.end(); I != E;) {
1049  auto const& pd = I->second;
1050  bool drop = branchesToDrop.find(pd.productID()) != branchesToDropEnd;
1051  if (!drop) {
1052  ++I;
1053  checkDictionaries(pd);
1054  continue;
1055  }
1056  if (groupSelector.selected(pd)) {
1057  mf::LogWarning("RootInputFile")
1058  << "Branch '" << pd.branchName()
1059  << "' is being dropped from the input\n"
1060  << "of file '" << fileName_
1061  << "' because it is dependent on a branch\n"
1062  << "that was explicitly dropped.\n";
1063  }
1064  treePointers_[pd.branchType()]->dropBranch(pd.branchName());
1065  auto icopy = I++;
1066  prodList.erase(icopy);
1067  }
1068  }
Float_t E
Definition: plot.C:23
RootInputTreePtrArray treePointers_
std::string const fileName_
void checkDictionaries(BranchDescription const &productDesc)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
EventAuxiliary& art::RootInputFile::eventAux ( )
inline

Definition at line 124 of file RootInputFile.h.

References auxiliaries_.

125  {
126  return std::get<EventAuxiliary>(auxiliaries_);
127  }
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary > auxiliaries_
EventID art::RootInputFile::eventIDForFileIndexPosition ( ) const

Definition at line 377 of file RootInputFile.cc.

Referenced by fileIndexSharedPtr().

378  {
379  if (fiIter_ == fiEnd_) {
380  return EventID{};
381  }
382  return fiIter_->eventID_;
383  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
unsigned int art::RootInputFile::eventsToSkip ( ) const
inline

Definition at line 196 of file RootInputFile.h.

References eventsToSkip_, setForcedRunOffset(), and skipEvents().

197  {
198  return eventsToSkip_;
199  }
EventNumber_t eventsToSkip_
RootInputTree const& art::RootInputFile::eventTree ( ) const
inlineprivate

Definition at line 239 of file RootInputFile.h.

References art::InEvent, and treePointers_.

Referenced by nextEventEntry(), and rewind().

240  {
241  return *treePointers_[InEvent];
242  }
RootInputTreePtrArray treePointers_
RootInputTree& art::RootInputFile::eventTree ( )
inlineprivate

Definition at line 261 of file RootInputFile.h.

References art::InEvent, and treePointers_.

262  {
263  return *treePointers_[InEvent];
264  }
RootInputTreePtrArray treePointers_
bool art::RootInputFile::fastClonable ( ) const
inline

Definition at line 136 of file RootInputFile.h.

References createFileBlock(), and fastClonable_.

137  {
138  return fastClonable_;
139  }
FileFormatVersion art::RootInputFile::fileFormatVersion ( ) const
inline

Definition at line 130 of file RootInputFile.h.

References fileFormatVersion_.

131  {
132  return fileFormatVersion_;
133  }
FileFormatVersion fileFormatVersion_
std::shared_ptr<FileIndex> art::RootInputFile::fileIndexSharedPtr ( ) const
inline

Definition at line 213 of file RootInputFile.h.

References eventIDForFileIndexPosition(), and fileIndexSharedPtr_.

214  {
215  return fileIndexSharedPtr_;
216  }
std::shared_ptr< FileIndex > fileIndexSharedPtr_
std::string const& art::RootInputFile::fileName ( ) const
inline

Definition at line 103 of file RootInputFile.h.

References fileName_.

104  {
105  return fileName_;
106  }
std::string const fileName_
template<BranchType BT>
void art::RootInputFile::fillAuxiliary ( EntryNumber const  entry)
inlineprivate

Definition at line 291 of file RootInputFile.h.

References auxiliaries_, and treePointers_.

292  {
293  using AUX = std::tuple_element_t<BT, decltype(auxiliaries_)>;
294  auto& aux = std::get<BT>(auxiliaries_);
295  aux = treePointers_[BT]->getAux<AUX>(entry);
296  }
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary > auxiliaries_
RootInputTreePtrArray treePointers_
template<BranchType BT>
std::unique_ptr<RangeSetHandler> art::RootInputFile::fillAuxiliary ( EntryNumbers const &  entries)
inlineprivate

Definition at line 300 of file RootInputFile.h.

References auxiliaries_, dropOnInput(), fileFormatVersion_, fileIndex_, fileName_, getEntryNumbers(), initializeDuplicateChecker(), overrideRunNumber(), readCurrentEvent(), readCurrentRun(), readCurrentSubRun(), readEventHistoryTree(), readParentageTree(), sqliteDB_, and treePointers_.

301  {
302  using AUX = std::tuple_element_t<BT, decltype(auxiliaries_)>;
303  auto& aux = std::get<BT>(auxiliaries_);
304  return treePointers_[BT]->fillAux<AUX>(
306  }
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary > auxiliaries_
FileIndex & fileIndex_
RootInputTreePtrArray treePointers_
FileFormatVersion fileFormatVersion_
std::string const fileName_
cet::sqlite::Connection sqliteDB_
void art::RootInputFile::fillHistory ( )
private

Definition at line 572 of file RootInputFile.cc.

References art::errors::DataCorruption, art::rootNames::eventHistoryBranchName(), and art::input::getEntry().

Referenced by resultsTree().

573  {
574  // We could consider doing delayed reading, but because we have to
575  // store this History object in a different tree than the event
576  // data tree, this is too hard to do in this first version.
577  auto pHistory = history_.get();
578  auto eventHistoryBranch =
580  if (!eventHistoryBranch) {
582  << "Failed to find history branch in event history tree.\n";
583  }
584  eventHistoryBranch->SetAddress(&pHistory);
585  input::getEntry(eventHistoryTree_, eventTree().entryNumber());
586  }
std::shared_ptr< History > history_
RootInputTree const & eventTree() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string const & eventHistoryBranchName()
Definition: rootNames.cc:62
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:12
std::array< AvailableProducts_t, NumBranchTypes > art::RootInputFile::fillPerBranchTypePresenceFlags ( ProductList const &  prodList)
private

Definition at line 1012 of file RootInputFile.cc.

Referenced by resultsTree().

1013  {
1014  std::array<AvailableProducts_t, NumBranchTypes> result{{}};
1015  for (auto const& prodpr : prodList) {
1016  auto const& desc = prodpr.second;
1017  if (treePointers_[desc.branchType()]->hasBranch(desc.branchName())) {
1018  result[desc.branchType()].emplace(desc.productID());
1019  }
1020  }
1021  return result;
1022  }
RootInputTreePtrArray treePointers_
std::pair< RootInputFile::EntryNumbers, bool > art::RootInputFile::getEntryNumbers ( BranchType  t)
private

Definition at line 988 of file RootInputFile.cc.

References art::errors::FileReadError, and art::InEvent.

Referenced by fillAuxiliary().

989  {
990  EntryNumbers entries;
991  auto it = fiIter_;
992  if (it == fiEnd_)
993  return std::pair<EntryNumbers, bool>{entries, true};
994 
995  auto const eid = it->eventID_;
996  auto const subrun = eid.subRun();
997  for (; it != fiEnd_ && eid == it->eventID_; ++it) {
998  entries.push_back(it->entry_);
999  }
1000 
1001  if (t == InEvent && entries.size() > 1ul) {
1002  throw Exception{errors::FileReadError} << "File " << fileName_
1003  << " has multiple entries for\n"
1004  << eid << '\n';
1005  }
1006 
1007  bool const lastInSubRun{it == fiEnd_ || it->eventID_.subRun() != subrun};
1008  return std::pair<EntryNumbers, bool>{entries, lastInSubRun};
1009  }
RootInputTree::EntryNumbers EntryNumbers
Definition: RootInputFile.h:55
FileIndex::const_iterator fiIter_
std::string const fileName_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
FileIndex::const_iterator fiEnd_
FileIndex::EntryType art::RootInputFile::getEntryType ( ) const

Definition at line 457 of file RootInputFile.cc.

References art::FileIndex::kEnd.

Referenced by nextEventEntry().

458  {
459  if (fiIter_ == fiEnd_) {
460  return FileIndex::kEnd;
461  }
462  return fiIter_->getEntryType();
463  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
FileIndex::EntryType art::RootInputFile::getNextEntryTypeWanted ( )

Definition at line 466 of file RootInputFile.cc.

References art::FileIndex::kEnd, art::FileIndex::kEvent, art::FileIndex::kRun, art::FileIndex::kSubRun, art::SubRunID::next(), art::DecrepitRelicInputSourceImplementation::processingMode_, art::InputSource::Runs, and art::InputSource::RunsAndSubRuns.

Referenced by nextEventEntry().

467  {
468  auto entryType = getEntryType();
469  if (entryType == FileIndex::kEnd) {
470  return FileIndex::kEnd;
471  }
472  RunID currentRun(fiIter_->eventID_.runID());
473  if (!currentRun.isValid()) {
474  return FileIndex::kEnd;
475  }
476  if (entryType == FileIndex::kRun) {
477  // Skip any runs before the first run specified
478  if (currentRun < origEventID_.runID()) {
480  return getNextEntryTypeWanted();
481  }
482  return FileIndex::kRun;
483  }
486  currentRun.isValid() ? currentRun.next() : currentRun, false);
487  return getNextEntryTypeWanted();
488  }
489  SubRunID const& currentSubRun = fiIter_->eventID_.subRunID();
490  if (entryType == FileIndex::kSubRun) {
491  // Skip any subRuns before the first subRun specified
492  if ((currentRun == origEventID_.runID()) &&
493  (currentSubRun < origEventID_.subRunID())) {
495  return getNextEntryTypeWanted();
496  }
497  return FileIndex::kSubRun;
498  }
500  fiIter_ = fileIndex_.findSubRunOrRunPosition(currentSubRun.next());
501  return getNextEntryTypeWanted();
502  }
503  assert(entryType == FileIndex::kEvent);
504  // Skip any events before the first event specified
505  if (fiIter_->eventID_ < origEventID_) {
507  return getNextEntryTypeWanted();
508  }
509  if (duplicateChecker_.get() && duplicateChecker_->isDuplicateAndCheckActive(
510  fiIter_->eventID_, fileName_)) {
511  nextEntry();
512  return getNextEntryTypeWanted();
513  }
514  if (eventsToSkip_ == 0) {
515  return FileIndex::kEvent;
516  }
517  // We have specified a count of events to skip, keep skipping
518  // events in this subRun block until we reach the end of the
519  // subRun block or the full count of the number of events to skip.
520  while ((eventsToSkip_ != 0) && (fiIter_ != fiEnd_) &&
522  nextEntry();
523  --eventsToSkip_;
524  while ((eventsToSkip_ != 0) && (fiIter_ != fiEnd_) &&
525  (fiIter_->getEntryType() == FileIndex::kEvent) &&
526  duplicateChecker_.get() &&
527  duplicateChecker_->isDuplicateAndCheckActive(fiIter_->eventID_,
528  fileName_)) {
529  nextEntry();
530  }
531  }
532  return getNextEntryTypeWanted();
533  }
RunID const & runID() const
Definition: EventID.h:93
SubRunID const & subRunID() const
Definition: EventID.h:105
FileIndex::EntryType getNextEntryTypeWanted()
EventNumber_t eventsToSkip_
const_iterator findSubRunOrRunPosition(SubRunID const &srID) const
Definition: FileIndex.cc:204
FileIndex & fileIndex_
FileIndex::const_iterator fiIter_
std::shared_ptr< DuplicateChecker > duplicateChecker_
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:123
std::string const fileName_
FileIndex::const_iterator fiEnd_
FileIndex::EntryType getEntryType() const
InputSource::ProcessingMode processingMode_
void art::RootInputFile::initializeDuplicateChecker ( )
private

Definition at line 975 of file RootInputFile.cc.

Referenced by fillAuxiliary().

976  {
977  if (duplicateChecker_.get() == nullptr) {
978  return;
979  }
980  if (eventTree().next()) {
981  fillAuxiliary<InEvent>(eventTree().entryNumber());
982  duplicateChecker_->init(eventAux().isRealData(), fileIndex_);
983  }
985  }
FileIndex & fileIndex_
RootInputTree const & eventTree() const
std::shared_ptr< DuplicateChecker > duplicateChecker_
EntryNumber entryNumber() const
EventAuxiliary & eventAux()
void setEntryNumber(EntryNumber theEntryNumber)
void art::RootInputFile::nextEntry ( )
inline

Definition at line 179 of file RootInputFile.h.

References fiIter_.

Referenced by advanceEntry().

180  {
181  ++fiIter_;
182  }
FileIndex::const_iterator fiIter_
bool art::RootInputFile::nextEventEntry ( )
inline

Definition at line 204 of file RootInputFile.h.

References eventTree(), getEntryType(), getNextEntryTypeWanted(), and art::RootInputTree::next().

205  {
206  return eventTree().next();
207  }
RootInputTree const & eventTree() const
void art::RootInputFile::openSecondaryFile ( int const  idx)

Definition at line 1071 of file RootInputFile.cc.

Referenced by secondaryFiles().

1072  {
1073  secondaryFiles_[idx] =
1074  rifSequence_->openSecondaryFile(secondaryFileNames_[idx], this);
1075  }
std::vector< std::string > secondaryFileNames_
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_
cet::exempt_ptr< RootInputFileSequence > rifSequence_
RootInputFile& art::RootInputFile::operator= ( RootInputFile const &  )
delete
void art::RootInputFile::overrideRunNumber ( RunID id)
private

Definition at line 928 of file RootInputFile.cc.

References art::RunID::firstRun().

Referenced by fillAuxiliary().

929  {
930  if (forcedRunOffset_ != 0) {
931  id = RunID(id.run() + forcedRunOffset_);
932  }
933  if (id < RunID::firstRun()) {
934  id = RunID::firstRun();
935  }
936  }
static RunID firstRun()
Definition: RunID.h:115
void art::RootInputFile::overrideRunNumber ( SubRunID id)
private

Definition at line 939 of file RootInputFile.cc.

940  {
941  if (forcedRunOffset_ != 0) {
942  id = SubRunID(id.run() + forcedRunOffset_, id.subRun());
943  }
944  }
void art::RootInputFile::overrideRunNumber ( EventID id,
bool  isRealData 
)
private

Definition at line 947 of file RootInputFile.cc.

References art::errors::Configuration.

948  {
949  if (forcedRunOffset_ == 0) {
950  return;
951  }
952  if (isRealData) {
954  "RootInputFile::overrideRunNumber()"}
955  << "The 'setRunNumber' parameter of RootInput cannot "
956  << "be used with real data.\n";
957  }
958  id = EventID(id.run() + forcedRunOffset_, id.subRun(), id.event());
959  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Event finding and building.
void art::RootInputFile::previousEntry ( )
inline

Definition at line 184 of file RootInputFile.h.

References fiIter_.

185  {
186  --fiIter_;
187  }
FileIndex::const_iterator fiIter_
unique_ptr< EventPrincipal > art::RootInputFile::readCurrentEvent ( std::pair< EntryNumbers, bool > const &  entryNumbers)
private

Definition at line 647 of file RootInputFile.cc.

References art::InEvent.

Referenced by fillAuxiliary().

649  {
650  assert(entryNumbers.first.size() == 1ull);
651  fillAuxiliary<InEvent>(entryNumbers.first.front());
652  assert(eventAux().id() == fiIter_->eventID_);
653  fillHistory();
654  overrideRunNumber(const_cast<EventID&>(eventAux().id()),
655  eventAux().isRealData());
656  auto ep = std::make_unique<EventPrincipal>(
657  eventAux(),
660  history_,
664  branchIDLists_.get(), // Only for backwards compatibility
665  InEvent,
666  entryNumbers.first,
667  eventAux().id()),
668  entryNumbers.second);
669  eventTree().fillGroups(*ep);
671  ep->readImmediate();
672  }
673  primaryEP_ = make_exempt_ptr(ep.get());
674  return ep;
675  }
std::shared_ptr< History > history_
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
RootInputTree const & eventTree() const
void overrideRunNumber(RunID &id)
FileIndex::const_iterator fiIter_
void fillGroups(Principal &p)
FileFormatVersion fileFormatVersion_
EventAuxiliary & eventAux()
std::unique_ptr< BranchMapper > makeBranchMapper() const
cet::exempt_ptr< EventPrincipal > primaryEP_
std::unique_ptr< BranchIDLists > branchIDLists_
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
ProcessConfiguration const & processConfiguration_
EventID const & id() const
unique_ptr< RunPrincipal > art::RootInputFile::readCurrentRun ( EntryNumbers const &  entryNumbers)
private

Definition at line 736 of file RootInputFile.cc.

References art::InRun, and art::Timestamp::invalidTimestamp().

Referenced by fillAuxiliary().

737  {
738  runRangeSetHandler_ = fillAuxiliary<InRun>(entryNumbers);
739  assert(runAux().id() == fiIter_->eventID_.runID());
740  overrideRunNumber(runAux().id_);
741  if (runAux().beginTime() == Timestamp::invalidTimestamp()) {
742  // RunAuxiliary did not contain a valid timestamp.
743  // Take it from the next event.
744  if (eventTree().next()) {
745  fillAuxiliary<InEvent>(eventTree().entryNumber());
746  // back up, so event will not be skipped.
747  eventTree().previous();
748  }
749  runAux().beginTime_ = eventAux().time();
751  }
752  auto rp = std::make_unique<RunPrincipal>(
753  runAux(),
758  sqliteDB_,
759  nullptr,
760  InRun,
761  entryNumbers,
762  fiIter_->eventID_));
763  runTree().fillGroups(*rp);
765  rp->readImmediate();
766  }
767  primaryRP_ = make_exempt_ptr(rp.get());
768  return rp;
769  }
RunAuxiliary & runAux()
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
Timestamp const & time() const
RootInputTree const & eventTree() const
void overrideRunNumber(RunID &id)
FileIndex::const_iterator fiIter_
EntryNumber entryNumber() const
void fillGroups(Principal &p)
FileFormatVersion fileFormatVersion_
EventAuxiliary & eventAux()
RootInputTree const & runTree() const
std::unique_ptr< RangeSetHandler > runRangeSetHandler_
std::unique_ptr< BranchMapper > makeBranchMapper() const
cet::sqlite::Connection sqliteDB_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
cet::exempt_ptr< RunPrincipal > primaryRP_
Timestamp beginTime_
Definition: RunAuxiliary.h:111
Timestamp endTime_
Definition: RunAuxiliary.h:112
ProcessConfiguration const & processConfiguration_
unique_ptr< SubRunPrincipal > art::RootInputFile::readCurrentSubRun ( EntryNumbers const &  ,
cet::exempt_ptr< RunPrincipal  
)
private

Definition at line 842 of file RootInputFile.cc.

References art::InSubRun, and art::Timestamp::invalidTimestamp().

Referenced by fillAuxiliary().

845  {
846  subRunRangeSetHandler_ = fillAuxiliary<InSubRun>(entryNumbers);
847  assert(subRunAux().id() == fiIter_->eventID_.subRunID());
849  assert(subRunAux().runID() == rp->id());
851  // SubRunAuxiliary did not contain a timestamp.
852  // Take it from the next event.
853  if (eventTree().next()) {
854  fillAuxiliary<InEvent>(eventTree().entryNumber());
855  // back up, so event will not be skipped.
856  eventTree().previous();
857  }
860  }
861 
862  auto srp = std::make_unique<SubRunPrincipal>(
863  subRunAux(),
868  sqliteDB_,
869  nullptr,
870  InSubRun,
871  entryNumbers,
872  fiIter_->eventID_));
873  subRunTree().fillGroups(*srp);
875  srp->readImmediate();
876  }
877  primarySRP_ = make_exempt_ptr(srp.get());
878  return srp;
879  }
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler_
Timestamp const & time() const
SubRunID const & id() const
RootInputTree const & eventTree() const
void overrideRunNumber(RunID &id)
FileIndex::const_iterator fiIter_
EntryNumber entryNumber() const
void fillGroups(Principal &p)
Timestamp const & beginTime() const
FileFormatVersion fileFormatVersion_
EventAuxiliary & eventAux()
std::unique_ptr< BranchMapper > makeBranchMapper() const
cet::sqlite::Connection sqliteDB_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
RootInputTree const & subRunTree() const
SubRunAuxiliary & subRunAux()
ProcessConfiguration const & processConfiguration_
cet::exempt_ptr< SubRunPrincipal > primarySRP_
unique_ptr< EventPrincipal > art::RootInputFile::readEvent ( )

Definition at line 624 of file RootInputFile.cc.

References art::InEvent, and art::FileIndex::kEvent.

625  {
626  assert(fiIter_ != fiEnd_);
627  assert(fiIter_->getEntryType() == FileIndex::kEvent);
628  assert(fiIter_->eventID_.runID().isValid());
629 
630  auto const& entryNumbers = getEntryNumbers(InEvent);
631  if (!eventTree().current(entryNumbers.first)) {
632  // The supplied entry numbers are not valid.
633  return nullptr;
634  }
635 
636  auto ep = readCurrentEvent(entryNumbers);
637  assert(ep);
638  assert(eventAux().run() == fiIter_->eventID_.run() + forcedRunOffset_);
639  assert(eventAux().subRunID() == fiIter_->eventID_.subRunID());
640  nextEntry();
641  return ep;
642  }
RootInputTree const & eventTree() const
FileIndex::const_iterator fiIter_
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
EventAuxiliary & eventAux()
std::unique_ptr< EventPrincipal > readCurrentEvent(std::pair< EntryNumbers, bool > const &)
FileIndex::const_iterator fiEnd_
bool art::RootInputFile::readEventForSecondaryFile ( EventID  eID)

Definition at line 678 of file RootInputFile.cc.

References art::InEvent.

679  {
680  // Used just after opening a new secondary file in response to a failed
681  // product lookup. Synchronize the file index to the event needed and
682  // create a secondary EventPrincipal for it.
683  if (!setEntry<InEvent>(eID, /*exact=*/true)) {
684  // Error, could not find specified event in file.
685  return false;
686  }
687  auto const& entryNumbers = getEntryNumbers(InEvent);
688  assert(entryNumbers.first.size() == 1ull);
689  fillAuxiliary<InEvent>(entryNumbers.first.front());
690  fillHistory();
691  overrideRunNumber(const_cast<EventID&>(eventAux().id()),
692  eventAux().isRealData());
693  auto ep = std::make_unique<EventPrincipal>(
694  eventAux(),
697  history_,
701  branchIDLists_.get(), // Only for backwards compatibility
702  InEvent,
703  entryNumbers.first,
704  eventAux().id()),
705  entryNumbers.second);
706  eventTree().fillGroups(*ep);
707  primaryFile_->primaryEP_->addSecondaryPrincipal(move(ep));
708  return true;
709  }
std::shared_ptr< History > history_
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
RootInputTree const & eventTree() const
void overrideRunNumber(RunID &id)
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
void fillGroups(Principal &p)
FileFormatVersion fileFormatVersion_
EventAuxiliary & eventAux()
std::unique_ptr< BranchMapper > makeBranchMapper() const
std::unique_ptr< BranchIDLists > branchIDLists_
cet::exempt_ptr< RootInputFile > primaryFile_
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
ProcessConfiguration const & processConfiguration_
EventID const & id() const
void art::RootInputFile::readEventHistoryTree ( unsigned int  treeCacheSize)
private

Definition at line 962 of file RootInputFile.cc.

References art::errors::DataCorruption, and art::rootNames::eventHistoryTreeName().

Referenced by fillAuxiliary().

963  {
964  // Read in the event history tree, if we have one...
965  eventHistoryTree_ = static_cast<TTree*>(
966  filePtr_->Get(rootNames::eventHistoryTreeName().c_str()));
967  if (!eventHistoryTree_) {
969  << "Failed to find the event history tree.\n";
970  }
971  eventHistoryTree_->SetCacheSize(static_cast<Long64_t>(treeCacheSize));
972  }
std::string const & eventHistoryTreeName()
Definition: rootNames.cc:55
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::unique_ptr< TFile > filePtr_
void art::RootInputFile::readParentageTree ( unsigned int  treeCacheSize)
private

Definition at line 336 of file RootInputFile.cc.

References art::couldNotFindTree(), art::errors::DataCorruption, art::thread_safe_registry_via_id< K, M >::emplace(), art::errors::FileReadError, art::input::getEntry(), art::rootNames::parentageBranchName(), art::rootNames::parentageIDBranchName(), and art::rootNames::parentageTreeName().

Referenced by fillAuxiliary().

337  {
338  //
339  // Auxiliary routine for the constructor.
340  //
341  auto parentageTree = static_cast<TTree*>(
342  filePtr_->Get(rootNames::parentageTreeName().c_str()));
343  if (!parentageTree) {
346  }
347  parentageTree->SetCacheSize(static_cast<Long64_t>(treeCacheSize));
348  auto idBuffer = root::getObjectRequireDict<ParentageID>();
349  auto pidBuffer = &idBuffer;
350  parentageTree->SetBranchAddress(rootNames::parentageIDBranchName().c_str(),
351  &pidBuffer);
352 
353  auto parentageBuffer = root::getObjectRequireDict<Parentage>();
354  auto pParentageBuffer = &parentageBuffer;
355  parentageTree->SetBranchAddress(rootNames::parentageBranchName().c_str(),
356  &pParentageBuffer);
357 
358  // Fill the registry
359  for (EntryNumber i = 0, numEntries = parentageTree->GetEntries();
360  i < numEntries;
361  ++i) {
362  input::getEntry(parentageTree, i);
363  if (idBuffer != parentageBuffer.id()) {
365  << "Corruption of Parentage tree detected.\n";
366  }
367  ParentageRegistry::emplace(parentageBuffer.id(), parentageBuffer);
368  }
369 
370  parentageTree->SetBranchAddress(rootNames::parentageIDBranchName().c_str(),
371  nullptr);
372  parentageTree->SetBranchAddress(rootNames::parentageBranchName().c_str(),
373  nullptr);
374  }
std::string const & parentageTreeName()
Definition: rootNames.cc:22
std::string couldNotFindTree(std::string const &treename)
Definition: rootErrMsgs.h:9
std::string const & parentageBranchName()
Definition: rootNames.cc:34
std::string const & parentageIDBranchName()
Definition: rootNames.cc:28
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::unique_ptr< TFile > filePtr_
RootInputTree::EntryNumber EntryNumber
Definition: RootInputFile.h:54
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:12
static auto emplace(value_type const &value)
std::unique_ptr< art::ResultsPrincipal > art::RootInputFile::readResults ( )

Definition at line 1078 of file RootInputFile.cc.

References art::InResults.

1079  {
1080  std::unique_ptr<art::ResultsPrincipal> resp;
1081  if (resultsTree()) {
1082  resultsTree().rewind();
1083  EntryNumbers const& entryNumbers{resultsTree().entryNumber()};
1084  assert(entryNumbers.size() == 1ull);
1085  fillAuxiliary<InResults>(entryNumbers.front());
1086  resp = std::make_unique<ResultsPrincipal>(
1087  resultsAux(),
1092  fileFormatVersion_, nullptr, InResults, entryNumbers, EventID{}));
1093  resultsTree().fillGroups(*resp);
1094  } else { // Empty
1095  resp = std::make_unique<ResultsPrincipal>(
1096  ResultsAuxiliary{}, processConfiguration_, nullptr);
1097  }
1098  return resp;
1099  }
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
RootInputTree const & resultsTree() const
RootInputTree::EntryNumbers EntryNumbers
Definition: RootInputFile.h:55
ResultsAuxiliary & resultsAux()
EntryNumber entryNumber() const
void fillGroups(Principal &p)
FileFormatVersion fileFormatVersion_
std::unique_ptr< BranchMapper > makeBranchMapper() const
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
ProcessConfiguration const & processConfiguration_
unique_ptr< RunPrincipal > art::RootInputFile::readRun ( )

Definition at line 718 of file RootInputFile.cc.

References art::InRun, and art::FileIndex::kRun.

719  {
720  assert(fiIter_ != fiEnd_);
721  assert(fiIter_->getEntryType() == FileIndex::kRun);
722  assert(fiIter_->eventID_.runID().isValid());
723 
724  auto const& entryNumbers = getEntryNumbers(InRun).first;
725  if (!runTree().current(entryNumbers)) {
726  // The supplied entry numbers are not valid.
727  return nullptr;
728  }
729 
730  auto rp = readCurrentRun(entryNumbers);
731  advanceEntry(entryNumbers.size());
732  return rp;
733  }
std::unique_ptr< RunPrincipal > readCurrentRun(EntryNumbers const &)
FileIndex::const_iterator fiIter_
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
RootInputTree const & runTree() const
FileIndex::const_iterator fiEnd_
void advanceEntry(std::size_t n)
bool art::RootInputFile::readRunForSecondaryFile ( RunID  rID)

Definition at line 772 of file RootInputFile.cc.

References art::InRun, art::Timestamp::invalidTimestamp(), and art::FileIndex::kRun.

773  {
774  // Used just after opening a new secondary file in response to a failed
775  // product lookup. Synchronize the file index to the run needed and
776  // create a secondary RunPrincipal for it.
777  if (!setEntry<InRun>(rID)) {
778  // Error, could not find specified run in file.
779  return false;
780  }
781  auto const& entryNumbers = getEntryNumbers(InRun).first;
782  assert(fiIter_ != fiEnd_);
783  assert(fiIter_->getEntryType() == FileIndex::kRun);
784  assert(fiIter_->eventID_.runID().isValid());
785  runRangeSetHandler_ = fillAuxiliary<InRun>(entryNumbers);
786  assert(runAux().id() == fiIter_->eventID_.runID());
787  overrideRunNumber(runAux().id_);
788  if (runAux().beginTime() == Timestamp::invalidTimestamp()) {
789  // RunAuxiliary did not contain a valid timestamp.
790  // Take it from the next event.
791  if (eventTree().next()) {
792  fillAuxiliary<InEvent>(eventTree().entryNumber());
793  // back up, so event will not be skipped.
794  eventTree().previous();
795  }
796  runAux().beginTime_ = eventAux().time();
798  }
799  auto rp = std::make_unique<RunPrincipal>(
800  runAux(),
805  sqliteDB_,
806  nullptr,
807  InRun,
808  entryNumbers,
809  fiIter_->eventID_));
810  runTree().fillGroups(*rp);
812  rp->readImmediate();
813  }
814  primaryFile_->primaryRP_->addSecondaryPrincipal(move(rp));
815  return true;
816  }
RunAuxiliary & runAux()
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
Timestamp const & time() const
RootInputTree const & eventTree() const
void overrideRunNumber(RunID &id)
FileIndex::const_iterator fiIter_
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
EntryNumber entryNumber() const
void fillGroups(Principal &p)
FileFormatVersion fileFormatVersion_
EventAuxiliary & eventAux()
RootInputTree const & runTree() const
std::unique_ptr< RangeSetHandler > runRangeSetHandler_
std::unique_ptr< BranchMapper > makeBranchMapper() const
cet::sqlite::Connection sqliteDB_
cet::exempt_ptr< RootInputFile > primaryFile_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
FileIndex::const_iterator fiEnd_
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
Timestamp beginTime_
Definition: RunAuxiliary.h:111
Timestamp endTime_
Definition: RunAuxiliary.h:112
ProcessConfiguration const & processConfiguration_
unique_ptr< SubRunPrincipal > art::RootInputFile::readSubRun ( cet::exempt_ptr< RunPrincipal rp)

Definition at line 825 of file RootInputFile.cc.

References art::InSubRun, and art::FileIndex::kSubRun.

826  {
827  assert(fiIter_ != fiEnd_);
828  assert(fiIter_->getEntryType() == FileIndex::kSubRun);
829 
830  auto const& entryNumbers = getEntryNumbers(InSubRun).first;
831  if (!subRunTree().current(entryNumbers)) {
832  // The supplied entry numbers are not valid.
833  return nullptr;
834  }
835 
836  auto srp = readCurrentSubRun(entryNumbers, rp);
837  advanceEntry(entryNumbers.size());
838  return srp;
839  }
std::unique_ptr< SubRunPrincipal > readCurrentSubRun(EntryNumbers const &, cet::exempt_ptr< RunPrincipal >)
FileIndex::const_iterator fiIter_
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
FileIndex::const_iterator fiEnd_
void advanceEntry(std::size_t n)
RootInputTree const & subRunTree() const
bool art::RootInputFile::readSubRunForSecondaryFile ( SubRunID  srID)

Definition at line 882 of file RootInputFile.cc.

References art::InSubRun, art::Timestamp::invalidTimestamp(), and art::FileIndex::kSubRun.

883  {
884  // Used just after opening a new secondary file in response to a failed
885  // product lookup. Synchronize the file index to the subRun needed and
886  // create a secondary SubRunPrincipal for it.
887  if (!setEntry<InSubRun>(srID)) {
888  // Error, could not find specified subRun in file.
889  return false;
890  }
891  auto const& entryNumbers = getEntryNumbers(InSubRun).first;
892  assert(fiIter_ != fiEnd_);
893  assert(fiIter_->getEntryType() == FileIndex::kSubRun);
894  subRunRangeSetHandler_ = fillAuxiliary<InSubRun>(entryNumbers);
895  assert(subRunAux().id() == fiIter_->eventID_.subRunID());
897  if (subRunAux().beginTime() == Timestamp::invalidTimestamp()) {
898  // SubRunAuxiliary did not contain a timestamp.
899  // Take it from the next event.
900  if (eventTree().next()) {
901  fillAuxiliary<InEvent>(eventTree().entryNumber());
902  // back up, so event will not be skipped.
903  eventTree().previous();
904  }
907  }
908  auto srp = std::make_unique<SubRunPrincipal>(
909  subRunAux(),
914  sqliteDB_,
915  nullptr,
916  InSubRun,
917  entryNumbers,
918  fiIter_->eventID_));
919  subRunTree().fillGroups(*srp);
921  srp->readImmediate();
922  }
923  primaryFile_->primarySRP_->addSecondaryPrincipal(move(srp));
924  return true;
925  }
std::unique_ptr< DelayedReader > makeDelayedReader(FileFormatVersion, cet::exempt_ptr< BranchIDLists const > branchIDLists, BranchType, std::vector< EntryNumber > const &entrySet, EventID)
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler_
Timestamp const & time() const
RootInputTree const & eventTree() const
void overrideRunNumber(RunID &id)
FileIndex::const_iterator fiIter_
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
EntryNumber entryNumber() const
void fillGroups(Principal &p)
FileFormatVersion fileFormatVersion_
EventAuxiliary & eventAux()
std::unique_ptr< BranchMapper > makeBranchMapper() const
cet::sqlite::Connection sqliteDB_
cet::exempt_ptr< RootInputFile > primaryFile_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
FileIndex::const_iterator fiEnd_
auto const & get(BranchType const bt) const
Definition: ProductTables.h:42
ProductTables presentProducts_
RootInputTree const & subRunTree() const
SubRunAuxiliary & subRunAux()
ProcessConfiguration const & processConfiguration_
void art::RootInputFile::reportOpened ( )

Definition at line 553 of file RootInputFile.cc.

554  {}
ResultsAuxiliary& art::RootInputFile::resultsAux ( )
inline

Definition at line 114 of file RootInputFile.h.

References auxiliaries_.

115  {
116  return std::get<ResultsAuxiliary>(auxiliaries_);
117  }
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary > auxiliaries_
RootInputTree const& art::RootInputFile::resultsTree ( ) const
inlineprivate

Definition at line 254 of file RootInputFile.h.

References art::InResults, and treePointers_.

255  {
256  return *treePointers_[InResults];
257  }
RootInputTreePtrArray treePointers_
RootInputTree& art::RootInputFile::resultsTree ( )
inlineprivate

Definition at line 276 of file RootInputFile.h.

References fillHistory(), fillPerBranchTypePresenceFlags(), art::InResults, setIfFastClonable(), treePointers_, and validateFile().

277  {
278  return *treePointers_[InResults];
279  }
RootInputTreePtrArray treePointers_
void art::RootInputFile::rewind ( )
inline

Definition at line 163 of file RootInputFile.h.

References eventTree(), fiBegin_, fiIter_, art::RootInputTree::rewind(), runTree(), and subRunTree().

164  {
165  fiIter_ = fiBegin_;
166  // FIXME: Rewinding the trees is suspicious!
167  // FIXME: They should be positioned based on the new iter pos.
168  eventTree().rewind();
169  subRunTree().rewind();
170  runTree().rewind();
171  }
RootInputTree const & eventTree() const
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiBegin_
RootInputTree const & runTree() const
RootInputTree const & subRunTree() const
RunAuxiliary& art::RootInputFile::runAux ( )
inline

Definition at line 109 of file RootInputFile.h.

References auxiliaries_.

110  {
111  return std::get<RunAuxiliary>(auxiliaries_);
112  }
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary > auxiliaries_
unique_ptr< RangeSetHandler > art::RootInputFile::runRangeSetHandler ( )

Definition at line 712 of file RootInputFile.cc.

Referenced by secondaryFiles().

713  {
714  return std::move(runRangeSetHandler_);
715  }
std::unique_ptr< RangeSetHandler > runRangeSetHandler_
RootInputTree const& art::RootInputFile::runTree ( ) const
inlineprivate

Definition at line 249 of file RootInputFile.h.

References art::InRun, and treePointers_.

Referenced by rewind().

250  {
251  return *treePointers_[InRun];
252  }
RootInputTreePtrArray treePointers_
RootInputTree& art::RootInputFile::runTree ( )
inlineprivate

Definition at line 271 of file RootInputFile.h.

References art::InRun, and treePointers_.

272  {
273  return *treePointers_[InRun];
274  }
RootInputTreePtrArray treePointers_
auto const& art::RootInputFile::secondaryFileNames ( ) const
inline

Definition at line 221 of file RootInputFile.h.

References secondaryFileNames_.

222  {
223  return secondaryFileNames_;
224  }
std::vector< std::string > secondaryFileNames_
auto const& art::RootInputFile::secondaryFiles ( ) const
inline

Definition at line 226 of file RootInputFile.h.

References openSecondaryFile(), runRangeSetHandler(), secondaryFiles_, and subRunRangeSetHandler().

227  {
228  return secondaryFiles_;
229  }
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_
template<BranchType BT>
void art::RootInputFile::setEntry ( FileIndex::EntryNumber_t  entry)
inline

Definition at line 145 of file RootInputFile.h.

References treePointers_.

146  {
147  treePointers_[BT]->setEntryNumber(entry);
148  }
RootInputTreePtrArray treePointers_
template<BranchType BT, typename ID >
bool art::RootInputFile::setEntry ( ID const &  id,
bool  exact = true 
)
inline

Definition at line 152 of file RootInputFile.h.

References fiEnd_, fiIter_, fileIndex_, and art::FileIndex::findPosition().

153  {
154  fiIter_ = fileIndex_.findPosition(id, exact);
155  if (fiIter_ == fiEnd_) {
156  return false;
157  }
158  setEntry<BT>(fiIter_->entry_);
159  return true;
160  }
FileIndex & fileIndex_
FileIndex::const_iterator fiIter_
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:123
FileIndex::const_iterator fiEnd_
int art::RootInputFile::setForcedRunOffset ( RunNumber_t const &  forcedRunNumber)

Definition at line 429 of file RootInputFile.cc.

Referenced by eventsToSkip().

430  {
431  if (fiBegin_ == fiEnd_) {
432  return 0;
433  }
434  forcedRunOffset_ = 0;
435  if (!RunID(forcedRunNumber).isValid()) {
436  return 0;
437  }
438  forcedRunOffset_ = forcedRunNumber - fiBegin_->eventID_.run();
439  if (forcedRunOffset_ != 0) {
440  fastClonable_ = false;
441  }
442  return forcedRunOffset_;
443  }
FileIndex::const_iterator fiBegin_
FileIndex::const_iterator fiEnd_
bool art::RootInputFile::setIfFastClonable ( FastCloningInfoProvider const &  fcip) const
private

Definition at line 386 of file RootInputFile.cc.

References art::FastCloningInfoProvider::fastCloningPermitted(), art::FileIndex::kEvent, art::DecrepitRelicInputSourceImplementation::processingMode_, art::FastCloningInfoProvider::remainingEvents(), art::FastCloningInfoProvider::remainingSubRuns(), and art::InputSource::RunsSubRunsAndEvents.

Referenced by resultsTree().

387  {
388  if (!fcip.fastCloningPermitted()) {
389  return false;
390  }
391  if (secondaryFileNames_.size() != 0) {
392  return false;
393  }
395  return false;
396  }
397  if (eventsToSkip_ != 0) {
398  return false;
399  }
400  if ((fcip.remainingEvents() >= 0) &&
401  (eventTree().entries() > fcip.remainingEvents())) {
402  return false;
403  }
404  if ((fcip.remainingSubRuns() >= 0) &&
405  (subRunTree().entries() > fcip.remainingSubRuns())) {
406  return false;
407  }
409  return false;
410  }
411  if (forcedRunOffset_ != 0) {
412  return false;
413  }
414  // Find entry for first event in file.
415  auto it = fiBegin_;
416  while ((it != fiEnd_) && (it->getEntryType() != FileIndex::kEvent)) {
417  ++it;
418  }
419  if (it == fiEnd_) {
420  return false;
421  }
422  if (it->eventID_ < origEventID_) {
423  return false;
424  }
425  return true;
426  }
std::vector< std::string > secondaryFileNames_
EventNumber_t eventsToSkip_
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:60
FileIndex & fileIndex_
EntryNumber entries() const
RootInputTree const & eventTree() const
FileIndex::const_iterator fiBegin_
FileIndex::const_iterator fiEnd_
InputSource::ProcessingMode processingMode_
RootInputTree const & subRunTree() const
void art::RootInputFile::setToLastEntry ( )
inline

Definition at line 174 of file RootInputFile.h.

References fiEnd_, and fiIter_.

175  {
176  fiIter_ = fiEnd_;
177  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
int art::RootInputFile::skipEvents ( int  offset)

Definition at line 589 of file RootInputFile.cc.

References art::FileIndex::kEvent.

Referenced by eventsToSkip().

590  {
591  while ((offset > 0) && (fiIter_ != fiEnd_)) {
592  if (fiIter_->getEntryType() == FileIndex::kEvent) {
593  --offset;
594  }
595  nextEntry();
596  }
597  while ((offset < 0) && (fiIter_ != fiBegin_)) {
598  previousEntry();
599  if (fiIter_->getEntryType() == FileIndex::kEvent) {
600  ++offset;
601  }
602  }
603  while ((fiIter_ != fiEnd_) &&
604  (fiIter_->getEntryType() != FileIndex::kEvent)) {
605  nextEntry();
606  }
607  return offset;
608  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiBegin_
FileIndex::const_iterator fiEnd_
SubRunAuxiliary& art::RootInputFile::subRunAux ( )
inline

Definition at line 119 of file RootInputFile.h.

References auxiliaries_.

120  {
121  return std::get<SubRunAuxiliary>(auxiliaries_);
122  }
std::tuple< EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary > auxiliaries_
unique_ptr< RangeSetHandler > art::RootInputFile::subRunRangeSetHandler ( )

Definition at line 819 of file RootInputFile.cc.

Referenced by secondaryFiles().

820  {
821  return std::move(subRunRangeSetHandler_);
822  }
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler_
RootInputTree const& art::RootInputFile::subRunTree ( ) const
inlineprivate

Definition at line 244 of file RootInputFile.h.

References art::InSubRun, and treePointers_.

Referenced by rewind().

245  {
246  return *treePointers_[InSubRun];
247  }
RootInputTreePtrArray treePointers_
RootInputTree& art::RootInputFile::subRunTree ( )
inlineprivate

Definition at line 266 of file RootInputFile.h.

References art::InSubRun, and treePointers_.

267  {
268  return *treePointers_[InSubRun];
269  }
RootInputTreePtrArray treePointers_
void art::RootInputFile::validateFile ( )
private

Definition at line 536 of file RootInputFile.cc.

References art::errors::DataCorruption, and art::errors::FileReadError.

Referenced by resultsTree().

537  {
538  if (!fileFormatVersion_.isValid()) {
540  }
541  if (!eventTree().isValid()) {
543  << "'Events' tree is corrupted or not present\n"
544  << "in the input file.\n";
545  }
546  if (fileIndex_.empty()) {
548  << "FileIndex information is missing for the input file.\n";
549  }
550  }
FileIndex & fileIndex_
RootInputTree const & eventTree() const
bool empty() const
Definition: FileIndex.h:131
FileFormatVersion fileFormatVersion_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool isValid() const

Member Data Documentation

std::tuple<EventAuxiliary, SubRunAuxiliary, RunAuxiliary, ResultsAuxiliary> art::RootInputFile::auxiliaries_ {}
private

Definition at line 359 of file RootInputFile.h.

Referenced by eventAux(), fillAuxiliary(), resultsAux(), runAux(), and subRunAux().

std::unique_ptr<BranchIDLists> art::RootInputFile::branchIDLists_
private
Initial value:
{
nullptr}

Definition at line 365 of file RootInputFile.h.

std::string const art::RootInputFile::catalog_
private

Definition at line 331 of file RootInputFile.h.

bool const art::RootInputFile::compactSubRunRanges_
private

Definition at line 338 of file RootInputFile.h.

bool art::RootInputFile::delayedReadEventProducts_
private

Definition at line 340 of file RootInputFile.h.

bool art::RootInputFile::delayedReadRunProducts_
private

Definition at line 342 of file RootInputFile.h.

bool art::RootInputFile::delayedReadSubRunProducts_
private

Definition at line 341 of file RootInputFile.h.

std::shared_ptr<DuplicateChecker> art::RootInputFile::duplicateChecker_
private

Definition at line 346 of file RootInputFile.h.

TTree* art::RootInputFile::eventHistoryTree_ {nullptr}
private

Definition at line 368 of file RootInputFile.h.

EventNumber_t art::RootInputFile::eventsToSkip_
private

Definition at line 337 of file RootInputFile.h.

Referenced by eventsToSkip().

bool art::RootInputFile::fastClonable_ {false}
private

Definition at line 357 of file RootInputFile.h.

Referenced by fastClonable().

FileIndex::const_iterator art::RootInputFile::fiBegin_ {fileIndex_.begin()}
private

Definition at line 354 of file RootInputFile.h.

Referenced by rewind().

FileIndex::const_iterator art::RootInputFile::fiEnd_ {fileIndex_.end()}
private

Definition at line 355 of file RootInputFile.h.

Referenced by setEntry(), and setToLastEntry().

FileIndex::const_iterator art::RootInputFile::fiIter_ {fiBegin_}
private

Definition at line 356 of file RootInputFile.h.

Referenced by nextEntry(), previousEntry(), rewind(), setEntry(), and setToLastEntry().

FileFormatVersion art::RootInputFile::fileFormatVersion_ {}
private

Definition at line 351 of file RootInputFile.h.

Referenced by fileFormatVersion(), and fillAuxiliary().

FileIndex& art::RootInputFile::fileIndex_ {*fileIndexSharedPtr_}
private

Definition at line 353 of file RootInputFile.h.

Referenced by fillAuxiliary(), and setEntry().

std::shared_ptr<FileIndex> art::RootInputFile::fileIndexSharedPtr_ {new FileIndex}
private

Definition at line 352 of file RootInputFile.h.

Referenced by fileIndexSharedPtr().

std::string const art::RootInputFile::fileName_
private

Definition at line 330 of file RootInputFile.h.

Referenced by fileName(), and fillAuxiliary().

std::unique_ptr<TFile> art::RootInputFile::filePtr_
private

Definition at line 334 of file RootInputFile.h.

int art::RootInputFile::forcedRunOffset_
private

Definition at line 344 of file RootInputFile.h.

std::shared_ptr<History> art::RootInputFile::history_ {std::make_shared<History>()}
private

Definition at line 369 of file RootInputFile.h.

std::string const art::RootInputFile::logicalFileName_
private

Definition at line 333 of file RootInputFile.h.

bool art::RootInputFile::noEventSort_
private

Definition at line 345 of file RootInputFile.h.

EventID art::RootInputFile::origEventID_
private

Definition at line 336 of file RootInputFile.h.

ProductTables art::RootInputFile::presentProducts_ {ProductTables::invalid()}
private

Definition at line 364 of file RootInputFile.h.

cet::exempt_ptr<EventPrincipal> art::RootInputFile::primaryEP_ {}
private

Definition at line 375 of file RootInputFile.h.

cet::exempt_ptr<RootInputFile> art::RootInputFile::primaryFile_
private

Definition at line 347 of file RootInputFile.h.

cet::exempt_ptr<RunPrincipal> art::RootInputFile::primaryRP_ {}
private

Definition at line 376 of file RootInputFile.h.

cet::exempt_ptr<SubRunPrincipal> art::RootInputFile::primarySRP_ {}
private

Definition at line 377 of file RootInputFile.h.

ProcessConfiguration const& art::RootInputFile::processConfiguration_
private

Definition at line 332 of file RootInputFile.h.

InputSource::ProcessingMode art::RootInputFile::processingMode_
private

Definition at line 343 of file RootInputFile.h.

ProductRegistry art::RootInputFile::productListHolder_ {}
private

Definition at line 363 of file RootInputFile.h.

cet::exempt_ptr<RootInputFileSequence> art::RootInputFile::rifSequence_
private

Definition at line 349 of file RootInputFile.h.

std::unique_ptr<RangeSetHandler> art::RootInputFile::runRangeSetHandler_ {nullptr}
private

Definition at line 379 of file RootInputFile.h.

std::vector<std::string> art::RootInputFile::secondaryFileNames_
private

Definition at line 348 of file RootInputFile.h.

Referenced by secondaryFileNames().

std::vector<std::unique_ptr<RootInputFile> > art::RootInputFile::secondaryFiles_ {}
private

Definition at line 370 of file RootInputFile.h.

Referenced by secondaryFiles().

cet::sqlite::Connection art::RootInputFile::sqliteDB_ {}
private

Definition at line 335 of file RootInputFile.h.

Referenced by fillAuxiliary().

std::unique_ptr<RangeSetHandler> art::RootInputFile::subRunRangeSetHandler_ {nullptr}
private

Definition at line 378 of file RootInputFile.h.

RootInputTreePtrArray art::RootInputFile::treePointers_
private

Definition at line 339 of file RootInputFile.h.

Referenced by eventTree(), fillAuxiliary(), resultsTree(), runTree(), setEntry(), and subRunTree().


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