Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::RootInputFile Class Reference

#include <RootInputFile.h>

Classes

class  RootInputTree
 

Public Types

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

Public Member Functions

 ~RootInputFile ()
 
 RootInputFile (RootInputFile const &)=delete
 
 RootInputFile (RootInputFile &&)=delete
 
RootInputFileoperator= (RootInputFile const &)=delete
 
RootInputFileoperator= (RootInputFile &&)=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, UpdateOutputCallbacks &outputCallbacks)
 
void reportOpened ()
 
void close (bool reallyClose)
 
std::unique_ptr< ResultsPrincipalreadResults ()
 
std::unique_ptr< RunPrincipalreadRun ()
 
std::unique_ptr< SubRunPrincipalreadSubRun (cet::exempt_ptr< RunPrincipal const >)
 
std::unique_ptr< EventPrincipalreadEvent ()
 
bool readRunForSecondaryFile (RunID)
 
bool readSubRunForSecondaryFile (SubRunID)
 
bool readEventForSecondaryFile (EventID eID)
 
std::string const & fileName () const
 
RootInputTreePtrArraytreePointers ()
 
FileFormatVersion fileFormatVersion () const
 
bool fastClonable () const
 
std::unique_ptr< FileBlockcreateFileBlock ()
 
bool setEntry_Event (EventID const &id, bool exact=true)
 
bool setEntry_SubRun (SubRunID const &id, bool exact=true)
 
bool setEntry_Run (RunID const &id, bool exact=true)
 
void rewind ()
 
void setToLastEntry ()
 
void nextEntry ()
 
void previousEntry ()
 
void advanceEntry (std::size_t n)
 
unsigned eventsToSkip () const
 
int skipEvents (int offset)
 
int setForcedRunOffset (RunNumber_t const &forcedRunNumber)
 
FileIndex::EntryType getEntryType () const
 
FileIndex::EntryType getNextEntryTypeWanted ()
 
std::shared_ptr< FileIndexfileIndexSharedPtr () const
 
EventID eventIDForFileIndexPosition () const
 
std::vector< std::string > const & secondaryFileNames () const
 
std::vector< std::unique_ptr< RootInputFile > > 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 (EntryNumber const entry, History &)
 
void fillAuxiliary_Event (EntryNumber const entry)
 
void fillAuxiliary_SubRun (EntryNumber const entry)
 
void fillAuxiliary_Run (EntryNumber const entry)
 
void fillAuxiliary_Results (EntryNumber const entry)
 
std::unique_ptr< RangeSetHandlerfillAuxiliary_SubRun (EntryNumbers const &entries)
 
std::unique_ptr< RangeSetHandlerfillAuxiliary_Run (EntryNumbers const &entries)
 
void overrideRunNumber (RunAuxiliary &)
 
void overrideRunNumber (SubRunID &id)
 
void overrideRunNumber (EventID &id, bool isRealData)
 
void dropOnInput (GroupSelectorRules const &rules, bool dropDescendants, ProductTables &tables)
 
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 const >)
 
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_
 
std::unique_ptr< cet::sqlite::ConnectionsqliteDB_ {nullptr}
 
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::stringsecondaryFileNames_
 
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}
 
EventAuxiliary eventAux_ {}
 
SubRunAuxiliary subRunAux_ {}
 
RunAuxiliary runAux_ {}
 
ResultsAuxiliary resultsAux_ {}
 
ProductTables presentProducts_ {ProductTables::invalid()}
 
std::unique_ptr< BranchIDListsbranchIDLists_ {}
 
TTree * eventHistoryTree_ {nullptr}
 
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}
 
int64_t saveMemoryObjectThreshold_
 

Detailed Description

Definition at line 55 of file RootInputFile.h.

Member Typedef Documentation

Definition at line 98 of file RootInputFile.h.

Definition at line 99 of file RootInputFile.h.

Definition at line 97 of file RootInputFile.h.

Constructor & Destructor Documentation

art::RootInputFile::~RootInputFile ( )

Definition at line 244 of file RootInputFile.cc.

244 {}
art::RootInputFile::RootInputFile ( RootInputFile const &  )
delete
art::RootInputFile::RootInputFile ( RootInputFile &&  )
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,
UpdateOutputCallbacks outputCallbacks 
)

Member Function Documentation

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

Definition at line 740 of file RootInputFile.cc.

741  {
742  while (n-- != 0) {
743  nextEntry();
744  }
745  }
void art::RootInputFile::close ( bool  reallyClose)

Definition at line 993 of file RootInputFile.cc.

994  {
995  if (!reallyClose) {
996  return;
997  }
998  filePtr_->Close();
999  for (auto const& sf : secondaryFiles_) {
1000  if (!sf) {
1001  continue;
1002  }
1003  sf->filePtr_->Close();
1004  }
1005  }
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_
std::unique_ptr< TFile > filePtr_
unique_ptr< FileBlock > art::RootInputFile::createFileBlock ( )

Definition at line 882 of file RootInputFile.cc.

883  {
884  return std::make_unique<RootFileBlock>(
886  fileName_,
887  readResults(),
889  fastClonable());
890  }
std::unique_ptr< ResultsPrincipal > readResults()
RootInputTree const & eventTree() const
exempt_ptr< E > make_exempt_ptr(E *) noexcept
FileFormatVersion fileFormatVersion_
std::string const fileName_
bool fastClonable() const
void art::RootInputFile::dropOnInput ( GroupSelectorRules const &  rules,
bool  dropDescendants,
ProductTables tables 
)
private

Definition at line 1419 of file RootInputFile.cc.

1422  {
1423  auto dropOnInputForBranchType =
1424  [this, &rules, dropDescendants, &tables](BranchType const bt) {
1425  auto& prodList = tables.get(bt).descriptions;
1426 
1427  // This is the selector for drop on input.
1428  GroupSelector const groupSelector{rules, prodList};
1429  // Do drop on input. On the first pass, just fill in a set of
1430  // branches to be dropped. Use the BranchChildren class to
1431  // assemble list of children to drop.
1432  BranchChildren children;
1433  set<ProductID> branchesToDrop;
1434  for (auto const& prod : prodList) {
1435  auto const& pd = prod.second;
1436  if (!groupSelector.selected(pd)) {
1437  if (dropDescendants) {
1438  children.appendToDescendants(pd.productID(), branchesToDrop);
1439  } else {
1440  branchesToDrop.insert(pd.productID());
1441  }
1442  }
1443  }
1444 
1445  // On this pass, actually drop the branches.
1446  auto branchesToDropEnd = branchesToDrop.cend();
1447  for (auto I = prodList.begin(), E = prodList.end(); I != E;) {
1448  auto const& bd = I->second;
1449  bool drop = branchesToDrop.find(bd.productID()) != branchesToDropEnd;
1450  if (!drop) {
1451  ++I;
1452  checkDictionaries(bd);
1453  continue;
1454  }
1455  if (groupSelector.selected(bd)) {
1456  mf::LogWarning("RootInputFile")
1457  << "Branch '" << bd.branchName()
1458  << "' is being dropped from the input\n"
1459  << "of file '" << fileName_
1460  << "' because it is dependent on a branch\n"
1461  << "that was explicitly dropped.\n";
1462  }
1463  treePointers_[bt]->dropBranch(bd.branchName());
1464  auto icopy = I++;
1465  prodList.erase(icopy);
1466  }
1467  };
1468  for_each_branch_type(dropOnInputForBranchType);
1469  }
RootInputTreePtrArray treePointers_
std::string const fileName_
void checkDictionaries(BranchDescription const &productDesc)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
BranchType
Definition: BranchType.h:18
void for_each_branch_type(F f)
Definition: BranchType.h:36
EventID art::RootInputFile::eventIDForFileIndexPosition ( ) const

Definition at line 813 of file RootInputFile.cc.

814  {
815  if (fiIter_ == fiEnd_) {
816  return EventID{};
817  }
818  return fiIter_->eventID_;
819  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
unsigned int art::RootInputFile::eventsToSkip ( ) const

Definition at line 748 of file RootInputFile.cc.

749  {
750  return eventsToSkip_;
751  }
EventNumber_t eventsToSkip_
RootInputFile::RootInputTree const & art::RootInputFile::eventTree ( ) const
private

Definition at line 525 of file RootInputFile.cc.

526  {
527  return *treePointers_[InEvent];
528  }
RootInputTreePtrArray treePointers_
RootInputFile::RootInputTree & art::RootInputFile::eventTree ( )
private

Definition at line 549 of file RootInputFile.cc.

550  {
551  return *treePointers_[InEvent];
552  }
RootInputTreePtrArray treePointers_
bool art::RootInputFile::fastClonable ( ) const

Definition at line 705 of file RootInputFile.cc.

706  {
707  return fastClonable_;
708  }
FileFormatVersion art::RootInputFile::fileFormatVersion ( ) const

Definition at line 699 of file RootInputFile.cc.

700  {
701  return fileFormatVersion_;
702  }
FileFormatVersion fileFormatVersion_
shared_ptr< FileIndex > art::RootInputFile::fileIndexSharedPtr ( ) const

Definition at line 754 of file RootInputFile.cc.

755  {
756  return fileIndexSharedPtr_;
757  }
std::shared_ptr< FileIndex > fileIndexSharedPtr_
string const & art::RootInputFile::fileName ( ) const

Definition at line 687 of file RootInputFile.cc.

688  {
689  return fileName_;
690  }
std::string const fileName_
void art::RootInputFile::fillAuxiliary_Event ( EntryNumber const  entry)
private

Definition at line 573 of file RootInputFile.cc.

574  {
575  auto auxbr = treePointers_[InEvent]->auxBranch();
576  auto pAux = &eventAux_;
577  auxbr->SetAddress(&pAux);
578  input::getEntry(auxbr, entry);
579  }
RootInputTreePtrArray treePointers_
EventAuxiliary eventAux_
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
void art::RootInputFile::fillAuxiliary_Results ( EntryNumber const  entry)
private

Definition at line 600 of file RootInputFile.cc.

601  {
602  auto auxbr = treePointers_[InResults]->auxBranch();
603  auto pAux = &resultsAux_;
604  auxbr->SetAddress(&pAux);
605  input::getEntry(auxbr, entry);
606  }
ResultsAuxiliary resultsAux_
RootInputTreePtrArray treePointers_
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
void art::RootInputFile::fillAuxiliary_Run ( EntryNumber const  entry)
private

Definition at line 591 of file RootInputFile.cc.

592  {
593  auto auxbr = treePointers_[InRun]->auxBranch();
594  auto pAux = &runAux_;
595  auxbr->SetAddress(&pAux);
596  input::getEntry(auxbr, entry);
597  }
RootInputTreePtrArray treePointers_
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
RunAuxiliary runAux_
unique_ptr< RangeSetHandler > art::RootInputFile::fillAuxiliary_Run ( EntryNumbers const &  entries)
private

Definition at line 648 of file RootInputFile.cc.

649  {
650  RunAuxiliary auxResult{};
651  {
652  auto auxbr = treePointers_[InRun]->auxBranch();
653  auto pAux = &auxResult;
654  auxbr->SetAddress(&pAux);
655  input::getEntry(auxbr, entries[0]);
656  }
657  if (fileFormatVersion_.value_ < 9) {
658  swap(runAux_, auxResult);
659  return make_unique<OpenRangeSetHandler>(runAux_.run());
660  }
661  auto resolve_info = [this](auto const id) {
663  this->fileName_,
665  id,
667  };
668  auto rangeSetInfo = resolve_info(auxResult.rangeSetID());
669  for (auto i = entries.cbegin() + 1, e = entries.cend(); i != e; ++i) {
670  RunAuxiliary tmpAux{};
671  {
672  auto auxbr = treePointers_[InRun]->auxBranch();
673  auto pAux = &tmpAux;
674  auxbr->SetAddress(&pAux);
675  input::getEntry(auxbr, *i);
676  }
677  detail::mergeAuxiliary(auxResult, tmpAux);
678  rangeSetInfo.update(resolve_info(tmpAux.rangeSetID()),
680  }
681  auxResult.setRangeSetID(-1u); // Range set of new auxiliary is invalid
682  swap(runAux_, auxResult);
683  return make_unique<ClosedRangeSetHandler>(resolveRangeSet(rangeSetInfo));
684  }
std::unique_ptr< cet::sqlite::Connection > sqliteDB_
RangeSetInfo resolveRangeSetInfo(sqlite3 *, std::string const &filename, BranchType, unsigned RangeSetID, bool compact)
void mergeAuxiliary(RunAuxiliary &left, RunAuxiliary const &right)
RangeSet resolveRangeSet(RangeSetInfo const &rs)
RootInputTreePtrArray treePointers_
const double e
void swap(Handle< T > &a, Handle< T > &b)
FileFormatVersion fileFormatVersion_
std::string const fileName_
RunNumber_t run() const noexcept
bool const compactSubRunRanges_
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
RunAuxiliary runAux_
static constexpr BranchType branch_type
Definition: RunAuxiliary.h:21
void art::RootInputFile::fillAuxiliary_SubRun ( EntryNumber const  entry)
private

Definition at line 582 of file RootInputFile.cc.

583  {
584  auto auxbr = treePointers_[InSubRun]->auxBranch();
585  auto pAux = &subRunAux_;
586  auxbr->SetAddress(&pAux);
587  input::getEntry(auxbr, entry);
588  }
SubRunAuxiliary subRunAux_
RootInputTreePtrArray treePointers_
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
unique_ptr< RangeSetHandler > art::RootInputFile::fillAuxiliary_SubRun ( EntryNumbers const &  entries)
private

Definition at line 609 of file RootInputFile.cc.

610  {
611  SubRunAuxiliary auxResult{};
612  {
613  auto auxbr = treePointers_[InSubRun]->auxBranch();
614  auto pAux = &auxResult;
615  auxbr->SetAddress(&pAux);
616  input::getEntry(auxbr, entries[0]);
617  }
618  if (fileFormatVersion_.value_ < 9) {
619  swap(subRunAux_, auxResult);
620  return make_unique<OpenRangeSetHandler>(subRunAux_.run());
621  }
622  auto resolve_info = [this](auto const id) {
624  this->fileName_,
626  id,
628  };
629  auto rangeSetInfo = resolve_info(auxResult.rangeSetID());
630  for (auto i = entries.cbegin() + 1, e = entries.cend(); i != e; ++i) {
631  SubRunAuxiliary tmpAux{};
632  {
633  auto auxbr = treePointers_[InSubRun]->auxBranch();
634  auto pAux = &tmpAux;
635  auxbr->SetAddress(&pAux);
636  input::getEntry(auxbr, *i);
637  }
638  detail::mergeAuxiliary(auxResult, tmpAux);
639  rangeSetInfo.update(resolve_info(tmpAux.rangeSetID()),
641  }
642  auxResult.setRangeSetID(-1u); // Range set of new auxiliary is invalid
643  swap(subRunAux_, auxResult);
644  return make_unique<ClosedRangeSetHandler>(resolveRangeSet(rangeSetInfo));
645  }
std::unique_ptr< cet::sqlite::Connection > sqliteDB_
RangeSetInfo resolveRangeSetInfo(sqlite3 *, std::string const &filename, BranchType, unsigned RangeSetID, bool compact)
void mergeAuxiliary(RunAuxiliary &left, RunAuxiliary const &right)
SubRunAuxiliary subRunAux_
RangeSet resolveRangeSet(RangeSetInfo const &rs)
RootInputTreePtrArray treePointers_
const double e
void swap(Handle< T > &a, Handle< T > &b)
FileFormatVersion fileFormatVersion_
static constexpr BranchType branch_type
std::string const fileName_
RunNumber_t run() const noexcept
bool const compactSubRunRanges_
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
void art::RootInputFile::fillHistory ( EntryNumber const  entry,
History history 
)
private

Definition at line 1008 of file RootInputFile.cc.

1009  {
1010  // We could consider doing delayed reading, but because we have to
1011  // store this History object in a different tree than the event
1012  // data tree, this is too hard to do in this first version.
1013  auto pHistory = &history;
1014  auto eventHistoryBranch =
1016  if (!eventHistoryBranch) {
1018  << "Failed to find history branch in event history tree.\n";
1019  }
1020  eventHistoryBranch->SetAddress(&pHistory);
1022  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string const & eventHistoryBranchName()
Definition: rootNames.cc:61
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
pair< RootInputFile::EntryNumbers, bool > art::RootInputFile::getEntryNumbers ( BranchType  bt)
private

Definition at line 1397 of file RootInputFile.cc.

1398  {
1399  EntryNumbers enumbers;
1400  if (fiIter_ == fiEnd_) {
1401  return pair<EntryNumbers, bool>{enumbers, true};
1402  }
1403  auto const eid = fiIter_->eventID_;
1404  auto iter = fiIter_;
1405  for (; (iter != fiEnd_) && (iter->eventID_ == eid); ++iter) {
1406  enumbers.push_back(iter->entry_);
1407  }
1408  if ((bt == InEvent) && (enumbers.size() > 1ul)) {
1409  throw Exception{errors::FileReadError} << "File " << fileName_
1410  << " has multiple entries for\n"
1411  << eid << '\n';
1412  }
1413  bool const lastInSubRun{(iter == fiEnd_) ||
1414  (iter->eventID_.subRun() != eid.subRun())};
1415  return pair<EntryNumbers, bool>{enumbers, lastInSubRun};
1416  }
RootInputTree::EntryNumbers EntryNumbers
Definition: RootInputFile.h:99
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 893 of file RootInputFile.cc.

894  {
895  if (fiIter_ == fiEnd_) {
896  return FileIndex::kEnd;
897  }
898  return fiIter_->getEntryType();
899  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
FileIndex::EntryType art::RootInputFile::getNextEntryTypeWanted ( )

Definition at line 902 of file RootInputFile.cc.

903  {
904  auto entryType = getEntryType();
905  if (entryType == FileIndex::kEnd) {
906  return FileIndex::kEnd;
907  }
908  RunID currentRun(fiIter_->eventID_.runID());
909  if (!currentRun.isValid()) {
910  return FileIndex::kEnd;
911  }
912  if (entryType == FileIndex::kRun) {
913  // Skip any runs before the first run specified
914  if (currentRun < origEventID_.runID()) {
916  return getNextEntryTypeWanted();
917  }
918  return FileIndex::kRun;
919  }
922  currentRun.isValid() ? currentRun.next() : currentRun, false);
923  return getNextEntryTypeWanted();
924  }
925  SubRunID const& currentSubRun = fiIter_->eventID_.subRunID();
926  if (entryType == FileIndex::kSubRun) {
927  // Skip any subRuns before the first subRun specified
928  if ((currentRun == origEventID_.runID()) &&
929  (currentSubRun < origEventID_.subRunID())) {
931  return getNextEntryTypeWanted();
932  }
933  return FileIndex::kSubRun;
934  }
936  fiIter_ = fileIndex_.findSubRunOrRunPosition(currentSubRun.next());
937  return getNextEntryTypeWanted();
938  }
939  assert(entryType == FileIndex::kEvent);
940  // Skip any events before the first event specified
941  if (fiIter_->eventID_ < origEventID_) {
943  return getNextEntryTypeWanted();
944  }
945  if (duplicateChecker_.get() && duplicateChecker_->isDuplicateAndCheckActive(
946  fiIter_->eventID_, fileName_)) {
947  nextEntry();
948  return getNextEntryTypeWanted();
949  }
950  if (eventsToSkip_ == 0) {
951  return FileIndex::kEvent;
952  }
953  // We have specified a count of events to skip, keep skipping
954  // events in this subRun block until we reach the end of the
955  // subRun block or the full count of the number of events to skip.
956  while ((eventsToSkip_ != 0) && (fiIter_ != fiEnd_) &&
958  nextEntry();
959  --eventsToSkip_;
960  while ((eventsToSkip_ != 0) && (fiIter_ != fiEnd_) &&
961  (fiIter_->getEntryType() == FileIndex::kEvent) &&
962  duplicateChecker_.get() &&
963  duplicateChecker_->isDuplicateAndCheckActive(fiIter_->eventID_,
964  fileName_)) {
965  nextEntry();
966  }
967  }
968  return getNextEntryTypeWanted();
969  }
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:318
FileIndex & fileIndex_
FileIndex::const_iterator fiIter_
std::shared_ptr< DuplicateChecker > duplicateChecker_
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:239
std::string const fileName_
FileIndex::const_iterator fiEnd_
FileIndex::EntryType getEntryType() const
InputSource::ProcessingMode processingMode_
void art::RootInputFile::initializeDuplicateChecker ( )
private

Definition at line 1383 of file RootInputFile.cc.

1384  {
1385  if (duplicateChecker_.get() == nullptr) {
1386  return;
1387  }
1388  if (eventTree().entries()) {
1389  // FIXME: We don't initialize the duplicate checker if there are no
1390  // events!
1393  }
1394  }
FileIndex & fileIndex_
RootInputTree const & eventTree() const
void fillAuxiliary_Event(EntryNumber const entry)
std::shared_ptr< DuplicateChecker > duplicateChecker_
EventAuxiliary eventAux_
bool isRealData() const noexcept
void art::RootInputFile::nextEntry ( )

Definition at line 728 of file RootInputFile.cc.

729  {
730  ++fiIter_;
731  }
FileIndex::const_iterator fiIter_
void art::RootInputFile::openSecondaryFile ( int const  idx)

Definition at line 1472 of file RootInputFile.cc.

1473  {
1474  secondaryFiles_[idx] =
1475  rifSequence_->openSecondaryFile(secondaryFileNames_[idx], this);
1476  }
std::vector< std::string > secondaryFileNames_
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_
cet::exempt_ptr< RootInputFileSequence > rifSequence_
RootInputFile& art::RootInputFile::operator= ( RootInputFile const &  )
delete
RootInputFile& art::RootInputFile::operator= ( RootInputFile &&  )
delete
void art::RootInputFile::overrideRunNumber ( RunAuxiliary aux)
private

Definition at line 1336 of file RootInputFile.cc.

1337  {
1338  if (forcedRunOffset_ != 0) {
1339  aux.runID(RunID(aux.run() + forcedRunOffset_));
1340  }
1341  if (aux.runID() < RunID::firstRun()) {
1342  aux.runID(RunID::firstRun());
1343  }
1344  }
static RunID firstRun()
Definition: RunID.h:117
void art::RootInputFile::overrideRunNumber ( SubRunID id)
private

Definition at line 1347 of file RootInputFile.cc.

1348  {
1349  if (forcedRunOffset_ != 0) {
1350  id = SubRunID(id.run() + forcedRunOffset_, id.subRun());
1351  }
1352  }
unsigned int run
void art::RootInputFile::overrideRunNumber ( EventID id,
bool  isRealData 
)
private

Definition at line 1355 of file RootInputFile.cc.

1356  {
1357  if (forcedRunOffset_ == 0) {
1358  return;
1359  }
1360  if (isRealData) {
1362  "RootInputFile::overrideRunNumber()"}
1363  << "The 'setRunNumber' parameter of RootInput cannot "
1364  << "be used with real data.\n";
1365  }
1366  id = EventID(id.run() + forcedRunOffset_, id.subRun(), id.event());
1367  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int run
void art::RootInputFile::previousEntry ( )

Definition at line 734 of file RootInputFile.cc.

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

Definition at line 1077 of file RootInputFile.cc.

1078  {
1079  assert(entryNumbers.first.size() == 1ull);
1080  fillAuxiliary_Event(entryNumbers.first.front());
1081  assert(eventAux_.eventID() == fiIter_->eventID_);
1082  unique_ptr<History> history = make_unique<History>();
1083  fillHistory(entryNumbers.first.front(), *history);
1084  overrideRunNumber(const_cast<EventID&>(eventAux_.eventID()),
1085  eventAux_.isRealData());
1086  auto ep = make_unique<EventPrincipal>(
1087  eventAux_,
1090  move(history),
1091  make_unique<RootDelayedReader>(fileFormatVersion_,
1092  nullptr,
1093  entryNumbers.first,
1094  &eventTree().branches(),
1097  this,
1098  branchIDLists_.get(),
1099  InEvent,
1100  eventAux_.eventID(),
1102  entryNumbers.second);
1104  ep->readImmediate();
1105  }
1106  primaryEP_ = make_exempt_ptr(ep.get());
1107  return ep;
1108  }
EventID const & eventID() const noexcept
auto & get(BranchType const bt)
Definition: ProductTables.h:47
void overrideRunNumber(RunAuxiliary &)
FileIndex::const_iterator fiIter_
RootInputTree const & eventTree() const
void fillAuxiliary_Event(EntryNumber const entry)
exempt_ptr< E > make_exempt_ptr(E *) noexcept
FileFormatVersion fileFormatVersion_
EventAuxiliary eventAux_
cet::exempt_ptr< EventPrincipal > primaryEP_
std::unique_ptr< BranchIDLists > branchIDLists_
bool const compactSubRunRanges_
void fillHistory(EntryNumber const entry, History &)
int64_t saveMemoryObjectThreshold_
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
BranchMap const & branches() const
bool isRealData() const noexcept
ProcessConfiguration const & processConfiguration_
unique_ptr< RunPrincipal > art::RootInputFile::readCurrentRun ( EntryNumbers const &  entryNumbers)
private

Definition at line 1167 of file RootInputFile.cc.

1168  {
1169  runRangeSetHandler_ = fillAuxiliary_Run(entryNumbers);
1170  assert(runAux_.runID() == fiIter_->eventID_.runID());
1175  }
1176  auto rp = make_unique<RunPrincipal>(
1177  runAux_,
1180  make_unique<RootDelayedReader>(fileFormatVersion_,
1181  *sqliteDB_,
1182  entryNumbers,
1183  &runTree().branches(),
1186  this,
1187  nullptr,
1188  InRun,
1189  fiIter_->eventID_,
1191  if (!delayedReadRunProducts_) {
1192  rp->readImmediate();
1193  }
1194  primaryRP_ = make_exempt_ptr(rp.get());
1195  return rp;
1196  }
std::unique_ptr< cet::sqlite::Connection > sqliteDB_
RunID const & runID() const noexcept
auto & get(BranchType const bt)
Definition: ProductTables.h:47
Timestamp const & beginTime() const noexcept
void overrideRunNumber(RunAuxiliary &)
FileIndex::const_iterator fiIter_
exempt_ptr< E > make_exempt_ptr(E *) noexcept
FileFormatVersion fileFormatVersion_
EventAuxiliary eventAux_
std::unique_ptr< RangeSetHandler > runRangeSetHandler_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
bool const compactSubRunRanges_
void fillAuxiliary_Run(EntryNumber const entry)
int64_t saveMemoryObjectThreshold_
Timestamp const & endTime() const noexcept
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
cet::exempt_ptr< RunPrincipal > primaryRP_
BranchMap const & branches() const
RunAuxiliary runAux_
Timestamp const & time() const noexcept
ProcessConfiguration const & processConfiguration_
RootInputTree const & runTree() const
unique_ptr< SubRunPrincipal > art::RootInputFile::readCurrentSubRun ( EntryNumbers const &  ,
cet::exempt_ptr< RunPrincipal const >   
)
private

Definition at line 1259 of file RootInputFile.cc.

1262  {
1264  assert(subRunAux_.subRunID() == fiIter_->eventID_.subRunID());
1266  assert(subRunAux_.runID() == rp->runID());
1270  }
1271  auto srp = make_unique<SubRunPrincipal>(
1272  subRunAux_,
1275  make_unique<RootDelayedReader>(fileFormatVersion_,
1276  *sqliteDB_,
1277  entryNumbers,
1278  &subRunTree().branches(),
1281  this,
1282  nullptr,
1283  InSubRun,
1284  fiIter_->eventID_,
1287  srp->readImmediate();
1288  }
1289  primarySRP_ = make_exempt_ptr(srp.get());
1290  return srp;
1291  }
RunID const & runID() const noexcept
std::unique_ptr< cet::sqlite::Connection > sqliteDB_
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler_
SubRunAuxiliary subRunAux_
auto & get(BranchType const bt)
Definition: ProductTables.h:47
void overrideRunNumber(RunAuxiliary &)
FileIndex::const_iterator fiIter_
SubRunID const & subRunID() const noexcept
void fillAuxiliary_SubRun(EntryNumber const entry)
exempt_ptr< E > make_exempt_ptr(E *) noexcept
FileFormatVersion fileFormatVersion_
EventAuxiliary eventAux_
RootInputTree const & subRunTree() const
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
bool const compactSubRunRanges_
int64_t saveMemoryObjectThreshold_
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
BranchMap const & branches() const
Timestamp const & time() const noexcept
Timestamp const & beginTime() const noexcept
ProcessConfiguration const & processConfiguration_
cet::exempt_ptr< SubRunPrincipal > primarySRP_
unique_ptr< EventPrincipal > art::RootInputFile::readEvent ( )

Definition at line 1060 of file RootInputFile.cc.

1061  {
1062  assert(fiIter_ != fiEnd_);
1063  assert(fiIter_->getEntryType() == FileIndex::kEvent);
1064  assert(fiIter_->eventID_.runID().isValid());
1065  auto const& entryNumbers = getEntryNumbers(InEvent);
1066  auto ep = readCurrentEvent(entryNumbers);
1067  assert(ep);
1068  assert(eventAux_.run() == fiIter_->eventID_.run() + forcedRunOffset_);
1069  assert(eventAux_.subRunID() == fiIter_->eventID_.subRunID());
1070  nextEntry();
1071  return ep;
1072  }
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
SubRunID const & subRunID() const noexcept
FileIndex::const_iterator fiIter_
RunNumber_t run() const noexcept
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 1111 of file RootInputFile.cc.

1112  {
1113  // Used just after opening a new secondary file in response to a
1114  // failed product lookup. Synchronize the file index to the event
1115  // needed and create a secondary EventPrincipal for it.
1116  if (!setEntry_Event(eID, /*exact=*/true)) {
1117  // Error, could not find specified event in file.
1118  return false;
1119  }
1120  auto const& entryNumbers = getEntryNumbers(InEvent);
1121  assert(entryNumbers.first.size() == 1ull);
1122  fillAuxiliary_Event(entryNumbers.first.front());
1123  unique_ptr<History> history = make_unique<History>();
1124  fillHistory(entryNumbers.first.front(), *history);
1125  overrideRunNumber(const_cast<EventID&>(eventAux_.eventID()),
1126  eventAux_.isRealData());
1127  auto ep = make_unique<EventPrincipal>(
1128  eventAux_,
1131  move(history),
1132  make_unique<RootDelayedReader>(fileFormatVersion_,
1133  nullptr,
1134  entryNumbers.first,
1135  &eventTree().branches(),
1138  this,
1139  branchIDLists_.get(),
1140  InEvent,
1141  eventAux_.eventID(),
1143  entryNumbers.second);
1144  primaryFile_->primaryEP_->addSecondaryPrincipal(move(ep));
1145  return true;
1146  }
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
EventID const & eventID() const noexcept
auto & get(BranchType const bt)
Definition: ProductTables.h:47
void overrideRunNumber(RunAuxiliary &)
RootInputTree const & eventTree() const
void fillAuxiliary_Event(EntryNumber const entry)
FileFormatVersion fileFormatVersion_
EventAuxiliary eventAux_
std::unique_ptr< BranchIDLists > branchIDLists_
cet::exempt_ptr< RootInputFile > primaryFile_
bool const compactSubRunRanges_
void fillHistory(EntryNumber const entry, History &)
int64_t saveMemoryObjectThreshold_
bool setEntry_Event(EventID const &id, bool exact=true)
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
BranchMap const & branches() const
bool isRealData() const noexcept
ProcessConfiguration const & processConfiguration_
void art::RootInputFile::readEventHistoryTree ( unsigned int  treeCacheSize)
private

Definition at line 1370 of file RootInputFile.cc.

1371  {
1372  // Read in the event history tree, if we have one...
1373  eventHistoryTree_ = static_cast<TTree*>(
1374  filePtr_->Get(rootNames::eventHistoryTreeName().c_str()));
1375  if (!eventHistoryTree_) {
1377  << "Failed to find the event history tree.\n";
1378  }
1379  eventHistoryTree_->SetCacheSize(static_cast<Long64_t>(treeCacheSize));
1380  }
std::string const & eventHistoryTreeName()
Definition: rootNames.cc:54
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 772 of file RootInputFile.cc.

773  {
774  //
775  // Auxiliary routine for the constructor.
776  //
777  auto parentageTree = static_cast<TTree*>(
778  filePtr_->Get(rootNames::parentageTreeName().c_str()));
779  if (!parentageTree) {
782  }
783  parentageTree->SetCacheSize(static_cast<Long64_t>(treeCacheSize));
784  auto idBuffer = root::getObjectRequireDict<ParentageID>();
785  auto pidBuffer = &idBuffer;
786  parentageTree->SetBranchAddress(rootNames::parentageIDBranchName().c_str(),
787  &pidBuffer);
788 
789  auto parentageBuffer = root::getObjectRequireDict<Parentage>();
790  auto pParentageBuffer = &parentageBuffer;
791  parentageTree->SetBranchAddress(rootNames::parentageBranchName().c_str(),
792  &pParentageBuffer);
793 
794  // Fill the registry
795  for (EntryNumber i = 0, numEntries = parentageTree->GetEntries();
796  i < numEntries;
797  ++i) {
798  input::getEntry(parentageTree, i);
799  if (idBuffer != parentageBuffer.id()) {
801  << "Corruption of Parentage tree detected.\n";
802  }
803  ParentageRegistry::emplace(parentageBuffer.id(), parentageBuffer);
804  }
805 
806  parentageTree->SetBranchAddress(rootNames::parentageIDBranchName().c_str(),
807  nullptr);
808  parentageTree->SetBranchAddress(rootNames::parentageBranchName().c_str(),
809  nullptr);
810  }
std::string const & parentageTreeName()
Definition: rootNames.cc:21
std::string couldNotFindTree(std::string const &treename)
Definition: rootErrMsgs.h:9
std::string const & parentageBranchName()
Definition: rootNames.cc:33
std::string const & parentageIDBranchName()
Definition: rootNames.cc:27
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::unique_ptr< TFile > filePtr_
RootInputTree::EntryNumber EntryNumber
Definition: RootInputFile.h:98
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: getEntry.cc:20
static auto emplace(value_type const &value)
unique_ptr< art::ResultsPrincipal > art::RootInputFile::readResults ( )

Definition at line 1479 of file RootInputFile.cc.

1480  {
1481  unique_ptr<art::ResultsPrincipal> resp;
1482  if (!resultsTree().isValid()) {
1483  resp = make_unique<ResultsPrincipal>(
1484  ResultsAuxiliary{}, processConfiguration_, nullptr);
1485  return resp;
1486  }
1487 
1488  EntryNumbers const& entryNumbers{
1489  0}; // FIXME: Not sure hard-coding 0 is the right thing to do.
1490  assert(entryNumbers.size() == 1ull);
1491  fillAuxiliary_Results(entryNumbers.front());
1492  resp = std::make_unique<ResultsPrincipal>(
1493  resultsAux_,
1496  make_unique<RootDelayedReader>(fileFormatVersion_,
1497  nullptr,
1498  entryNumbers,
1499  &resultsTree().branches(),
1502  this,
1503  nullptr,
1504  InResults,
1505  EventID{},
1507  return resp;
1508  }
RootInputTree::EntryNumbers EntryNumbers
Definition: RootInputFile.h:99
auto & get(BranchType const bt)
Definition: ProductTables.h:47
ResultsAuxiliary resultsAux_
FileFormatVersion fileFormatVersion_
bool const compactSubRunRanges_
int64_t saveMemoryObjectThreshold_
void fillAuxiliary_Results(EntryNumber const entry)
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
BranchMap const & branches() const
ProcessConfiguration const & processConfiguration_
RootInputTree const & resultsTree() const
unique_ptr< RunPrincipal > art::RootInputFile::readRun ( )

Definition at line 1155 of file RootInputFile.cc.

1156  {
1157  assert(fiIter_ != fiEnd_);
1158  assert(fiIter_->getEntryType() == FileIndex::kRun);
1159  assert(fiIter_->eventID_.runID().isValid());
1160  auto const& entryNumbers = getEntryNumbers(InRun).first;
1161  auto rp = readCurrentRun(entryNumbers);
1162  advanceEntry(entryNumbers.size());
1163  return rp;
1164  }
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
std::unique_ptr< RunPrincipal > readCurrentRun(EntryNumbers const &)
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
void advanceEntry(std::size_t n)
bool art::RootInputFile::readRunForSecondaryFile ( RunID  rID)

Definition at line 1199 of file RootInputFile.cc.

1200  {
1201  // Used just after opening a new secondary file in response to a failed
1202  // product lookup. Synchronize the file index to the run needed and
1203  // create a secondary RunPrincipal for it.
1204  if (!setEntry_Run(rID)) {
1205  // Error, could not find specified run in file.
1206  return false;
1207  }
1208  auto const& entryNumbers = getEntryNumbers(InRun).first;
1209  assert(fiIter_ != fiEnd_);
1210  assert(fiIter_->getEntryType() == FileIndex::kRun);
1211  assert(fiIter_->eventID_.runID().isValid());
1212  runRangeSetHandler_ = fillAuxiliary_Run(entryNumbers);
1213  assert(runAux_.runID() == fiIter_->eventID_.runID());
1218  }
1219  auto rp = make_unique<RunPrincipal>(
1220  runAux_,
1223  make_unique<RootDelayedReader>(fileFormatVersion_,
1224  *sqliteDB_,
1225  entryNumbers,
1226  &runTree().branches(),
1229  this,
1230  nullptr,
1231  InRun,
1232  fiIter_->eventID_,
1234  if (!delayedReadRunProducts_) {
1235  rp->readImmediate();
1236  }
1237  primaryFile_->primaryRP_->addSecondaryPrincipal(move(rp));
1238  return true;
1239  }
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
std::unique_ptr< cet::sqlite::Connection > sqliteDB_
RunID const & runID() const noexcept
auto & get(BranchType const bt)
Definition: ProductTables.h:47
Timestamp const & beginTime() const noexcept
void overrideRunNumber(RunAuxiliary &)
FileIndex::const_iterator fiIter_
bool setEntry_Run(RunID const &id, bool exact=true)
FileFormatVersion fileFormatVersion_
EventAuxiliary eventAux_
std::unique_ptr< RangeSetHandler > runRangeSetHandler_
cet::exempt_ptr< RootInputFile > primaryFile_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
bool const compactSubRunRanges_
FileIndex::const_iterator fiEnd_
void fillAuxiliary_Run(EntryNumber const entry)
int64_t saveMemoryObjectThreshold_
Timestamp const & endTime() const noexcept
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
BranchMap const & branches() const
RunAuxiliary runAux_
Timestamp const & time() const noexcept
ProcessConfiguration const & processConfiguration_
RootInputTree const & runTree() const
unique_ptr< SubRunPrincipal > art::RootInputFile::readSubRun ( cet::exempt_ptr< RunPrincipal const >  rp)

Definition at line 1248 of file RootInputFile.cc.

1249  {
1250  assert(fiIter_ != fiEnd_);
1251  assert(fiIter_->getEntryType() == FileIndex::kSubRun);
1252  auto const& entryNumbers = getEntryNumbers(InSubRun).first;
1253  auto srp = readCurrentSubRun(entryNumbers, rp);
1254  advanceEntry(entryNumbers.size());
1255  return srp;
1256  }
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
std::unique_ptr< SubRunPrincipal > readCurrentSubRun(EntryNumbers const &, cet::exempt_ptr< RunPrincipal const >)
void advanceEntry(std::size_t n)
bool art::RootInputFile::readSubRunForSecondaryFile ( SubRunID  srID)

Definition at line 1294 of file RootInputFile.cc.

1295  {
1296  // Used just after opening a new secondary file in response to a failed
1297  // product lookup. Synchronize the file index to the subRun needed and
1298  // create a secondary SubRunPrincipal for it.
1299  if (!setEntry_SubRun(srID)) {
1300  // Error, could not find specified subRun in file.
1301  return false;
1302  }
1303  auto const& entryNumbers = getEntryNumbers(InSubRun).first;
1304  assert(fiIter_ != fiEnd_);
1305  assert(fiIter_->getEntryType() == FileIndex::kSubRun);
1307  assert(subRunAux_.subRunID() == fiIter_->eventID_.subRunID());
1312  }
1313  auto srp = make_unique<SubRunPrincipal>(
1314  subRunAux_,
1317  make_unique<RootDelayedReader>(fileFormatVersion_,
1318  *sqliteDB_,
1319  entryNumbers,
1320  &subRunTree().branches(),
1323  this,
1324  nullptr,
1325  InSubRun,
1326  fiIter_->eventID_,
1329  srp->readImmediate();
1330  }
1331  primaryFile_->primarySRP_->addSecondaryPrincipal(move(srp));
1332  return true;
1333  }
std::pair< EntryNumbers, bool > getEntryNumbers(BranchType)
std::unique_ptr< cet::sqlite::Connection > sqliteDB_
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler_
SubRunAuxiliary subRunAux_
auto & get(BranchType const bt)
Definition: ProductTables.h:47
void overrideRunNumber(RunAuxiliary &)
FileIndex::const_iterator fiIter_
SubRunID const & subRunID() const noexcept
void fillAuxiliary_SubRun(EntryNumber const entry)
FileFormatVersion fileFormatVersion_
EventAuxiliary eventAux_
RootInputTree const & subRunTree() const
cet::exempt_ptr< RootInputFile > primaryFile_
static constexpr Timestamp invalidTimestamp()
Definition: Timestamp.h:83
bool const compactSubRunRanges_
FileIndex::const_iterator fiEnd_
int64_t saveMemoryObjectThreshold_
TBranch * productProvenanceBranch() const
ProductTables presentProducts_
bool setEntry_SubRun(SubRunID const &id, bool exact=true)
BranchMap const & branches() const
Timestamp const & time() const noexcept
Timestamp const & beginTime() const noexcept
ProcessConfiguration const & processConfiguration_
void art::RootInputFile::reportOpened ( )

Definition at line 989 of file RootInputFile.cc.

990  {}
RootInputFile::RootInputTree const & art::RootInputFile::resultsTree ( ) const
private

Definition at line 543 of file RootInputFile.cc.

544  {
545  return *treePointers_[InResults];
546  }
RootInputTreePtrArray treePointers_
RootInputFile::RootInputTree & art::RootInputFile::resultsTree ( )
private

Definition at line 567 of file RootInputFile.cc.

568  {
569  return *treePointers_[InResults];
570  }
RootInputTreePtrArray treePointers_
void art::RootInputFile::rewind ( )

Definition at line 711 of file RootInputFile.cc.

712  {
713  fiIter_ = fiBegin_;
714  // FIXME: Rewinding the trees is suspicious!
715  // FIXME: They should be positioned based on the new iter pos.
716  // eventTree().rewind();
717  // subRunTree().rewind();
718  // runTree().rewind();
719  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiBegin_
unique_ptr< RangeSetHandler > art::RootInputFile::runRangeSetHandler ( )

Definition at line 1149 of file RootInputFile.cc.

1150  {
1151  return move(runRangeSetHandler_);
1152  }
std::unique_ptr< RangeSetHandler > runRangeSetHandler_
RootInputFile::RootInputTree const & art::RootInputFile::runTree ( ) const
private

Definition at line 537 of file RootInputFile.cc.

538  {
539  return *treePointers_[InRun];
540  }
RootInputTreePtrArray treePointers_
RootInputFile::RootInputTree & art::RootInputFile::runTree ( )
private

Definition at line 561 of file RootInputFile.cc.

562  {
563  return *treePointers_[InRun];
564  }
RootInputTreePtrArray treePointers_
vector< string > const & art::RootInputFile::secondaryFileNames ( ) const

Definition at line 760 of file RootInputFile.cc.

761  {
762  return secondaryFileNames_;
763  }
std::vector< std::string > secondaryFileNames_
vector< unique_ptr< RootInputFile > > const & art::RootInputFile::secondaryFiles ( ) const

Definition at line 766 of file RootInputFile.cc.

767  {
768  return secondaryFiles_;
769  }
std::vector< std::unique_ptr< RootInputFile > > secondaryFiles_
bool art::RootInputFile::setEntry_Event ( EventID const &  id,
bool  exact = true 
)

Definition at line 495 of file RootInputFile.cc.

496  {
497  fiIter_ = fileIndex_.findPosition(id, exact);
498  if (fiIter_ == fiEnd_) {
499  return false;
500  }
501  return true;
502  }
FileIndex & fileIndex_
FileIndex::const_iterator fiIter_
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:239
FileIndex::const_iterator fiEnd_
bool art::RootInputFile::setEntry_Run ( RunID const &  id,
bool  exact = true 
)

Definition at line 515 of file RootInputFile.cc.

516  {
517  fiIter_ = fileIndex_.findPosition(id, exact);
518  if (fiIter_ == fiEnd_) {
519  return false;
520  }
521  return true;
522  }
FileIndex & fileIndex_
FileIndex::const_iterator fiIter_
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:239
FileIndex::const_iterator fiEnd_
bool art::RootInputFile::setEntry_SubRun ( SubRunID const &  id,
bool  exact = true 
)

Definition at line 505 of file RootInputFile.cc.

506  {
507  fiIter_ = fileIndex_.findPosition(id, exact);
508  if (fiIter_ == fiEnd_) {
509  return false;
510  }
511  return true;
512  }
FileIndex & fileIndex_
FileIndex::const_iterator fiIter_
const_iterator findPosition(EventID const &eID) const
Definition: FileIndex.cc:239
FileIndex::const_iterator fiEnd_
int art::RootInputFile::setForcedRunOffset ( RunNumber_t const &  forcedRunNumber)

Definition at line 865 of file RootInputFile.cc.

866  {
867  if (fiBegin_ == fiEnd_) {
868  return 0;
869  }
870  forcedRunOffset_ = 0;
871  if (!RunID(forcedRunNumber).isValid()) {
872  return 0;
873  }
874  forcedRunOffset_ = forcedRunNumber - fiBegin_->eventID_.run();
875  if (forcedRunOffset_ != 0) {
876  fastClonable_ = false;
877  }
878  return forcedRunOffset_;
879  }
FileIndex::const_iterator fiBegin_
FileIndex::const_iterator fiEnd_
bool art::RootInputFile::setIfFastClonable ( FastCloningInfoProvider const &  fcip) const
private

Definition at line 822 of file RootInputFile.cc.

823  {
824  if (!fcip.fastCloningPermitted()) {
825  return false;
826  }
827  if (secondaryFileNames_.size() != 0) {
828  return false;
829  }
831  return false;
832  }
833  if (eventsToSkip_ != 0) {
834  return false;
835  }
836  if ((fcip.remainingEvents() >= 0) &&
837  (eventTree().entries() > fcip.remainingEvents())) {
838  return false;
839  }
840  if ((fcip.remainingSubRuns() >= 0) &&
841  (subRunTree().entries() > fcip.remainingSubRuns())) {
842  return false;
843  }
845  return false;
846  }
847  if (forcedRunOffset_ != 0) {
848  return false;
849  }
850  // Find entry for first event in file.
851  auto it = fiBegin_;
852  while ((it != fiEnd_) && (it->getEntryType() != FileIndex::kEvent)) {
853  ++it;
854  }
855  if (it == fiEnd_) {
856  return false;
857  }
858  if (it->eventID_ < origEventID_) {
859  return false;
860  }
861  return true;
862  }
std::vector< std::string > secondaryFileNames_
EventNumber_t eventsToSkip_
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:177
FileIndex & fileIndex_
RootInputTree const & eventTree() const
FileIndex::const_iterator fiBegin_
RootInputTree const & subRunTree() const
FileIndex::const_iterator fiEnd_
InputSource::ProcessingMode processingMode_
void art::RootInputFile::setToLastEntry ( )

Definition at line 722 of file RootInputFile.cc.

723  {
724  fiIter_ = fiEnd_;
725  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiEnd_
int art::RootInputFile::skipEvents ( int  offset)

Definition at line 1025 of file RootInputFile.cc.

1026  {
1027  while ((offset > 0) && (fiIter_ != fiEnd_)) {
1028  if (fiIter_->getEntryType() == FileIndex::kEvent) {
1029  --offset;
1030  }
1031  nextEntry();
1032  }
1033  while ((offset < 0) && (fiIter_ != fiBegin_)) {
1034  previousEntry();
1035  if (fiIter_->getEntryType() == FileIndex::kEvent) {
1036  ++offset;
1037  }
1038  }
1039  while ((fiIter_ != fiEnd_) &&
1040  (fiIter_->getEntryType() != FileIndex::kEvent)) {
1041  nextEntry();
1042  }
1043  return offset;
1044  }
FileIndex::const_iterator fiIter_
FileIndex::const_iterator fiBegin_
FileIndex::const_iterator fiEnd_
unique_ptr< RangeSetHandler > art::RootInputFile::subRunRangeSetHandler ( )

Definition at line 1242 of file RootInputFile.cc.

1243  {
1244  return move(subRunRangeSetHandler_);
1245  }
std::unique_ptr< RangeSetHandler > subRunRangeSetHandler_
RootInputFile::RootInputTree const & art::RootInputFile::subRunTree ( ) const
private

Definition at line 531 of file RootInputFile.cc.

532  {
533  return *treePointers_[InSubRun];
534  }
RootInputTreePtrArray treePointers_
RootInputFile::RootInputTree & art::RootInputFile::subRunTree ( )
private

Definition at line 555 of file RootInputFile.cc.

556  {
557  return *treePointers_[InSubRun];
558  }
RootInputTreePtrArray treePointers_
RootInputFile::RootInputTreePtrArray & art::RootInputFile::treePointers ( )

Definition at line 693 of file RootInputFile.cc.

694  {
695  return treePointers_;
696  }
RootInputTreePtrArray treePointers_
void art::RootInputFile::validateFile ( )
private

Definition at line 972 of file RootInputFile.cc.

973  {
974  if (!fileFormatVersion_.isValid()) {
976  }
977  if (!eventTree().isValid()) {
979  << "'Events' tree is corrupted or not present\n"
980  << "in the input file.\n";
981  }
982  if (fileIndex_.empty()) {
984  << "FileIndex information is missing for the input file.\n";
985  }
986  }
FileIndex & fileIndex_
bool empty() const
Definition: FileIndex.cc:104
RootInputTree const & eventTree() const
FileFormatVersion fileFormatVersion_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Data Documentation

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

Definition at line 242 of file RootInputFile.h.

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

Definition at line 210 of file RootInputFile.h.

bool const art::RootInputFile::compactSubRunRanges_
private

Definition at line 218 of file RootInputFile.h.

bool art::RootInputFile::delayedReadEventProducts_
private

Definition at line 220 of file RootInputFile.h.

bool art::RootInputFile::delayedReadRunProducts_
private

Definition at line 222 of file RootInputFile.h.

bool art::RootInputFile::delayedReadSubRunProducts_
private

Definition at line 221 of file RootInputFile.h.

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

Definition at line 226 of file RootInputFile.h.

EventAuxiliary art::RootInputFile::eventAux_ {}
private

Definition at line 237 of file RootInputFile.h.

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

Definition at line 243 of file RootInputFile.h.

EventNumber_t art::RootInputFile::eventsToSkip_
private

Definition at line 217 of file RootInputFile.h.

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

Definition at line 236 of file RootInputFile.h.

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

Definition at line 233 of file RootInputFile.h.

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

Definition at line 234 of file RootInputFile.h.

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

Definition at line 235 of file RootInputFile.h.

FileFormatVersion art::RootInputFile::fileFormatVersion_ {}
private

Definition at line 230 of file RootInputFile.h.

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

Definition at line 232 of file RootInputFile.h.

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

Definition at line 231 of file RootInputFile.h.

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

Definition at line 209 of file RootInputFile.h.

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

Definition at line 213 of file RootInputFile.h.

int art::RootInputFile::forcedRunOffset_
private

Definition at line 224 of file RootInputFile.h.

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

Definition at line 212 of file RootInputFile.h.

bool art::RootInputFile::noEventSort_
private

Definition at line 225 of file RootInputFile.h.

EventID art::RootInputFile::origEventID_
private

Definition at line 216 of file RootInputFile.h.

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

Definition at line 241 of file RootInputFile.h.

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

Definition at line 250 of file RootInputFile.h.

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

Definition at line 227 of file RootInputFile.h.

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

Definition at line 251 of file RootInputFile.h.

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

Definition at line 252 of file RootInputFile.h.

ProcessConfiguration const& art::RootInputFile::processConfiguration_
private

Definition at line 211 of file RootInputFile.h.

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

Definition at line 223 of file RootInputFile.h.

ResultsAuxiliary art::RootInputFile::resultsAux_ {}
private

Definition at line 240 of file RootInputFile.h.

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

Definition at line 229 of file RootInputFile.h.

RunAuxiliary art::RootInputFile::runAux_ {}
private

Definition at line 239 of file RootInputFile.h.

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

Definition at line 254 of file RootInputFile.h.

int64_t art::RootInputFile::saveMemoryObjectThreshold_
private

Definition at line 255 of file RootInputFile.h.

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

Definition at line 228 of file RootInputFile.h.

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

Definition at line 244 of file RootInputFile.h.

std::unique_ptr<cet::sqlite::Connection> art::RootInputFile::sqliteDB_ {nullptr}
private

Definition at line 215 of file RootInputFile.h.

SubRunAuxiliary art::RootInputFile::subRunAux_ {}
private

Definition at line 238 of file RootInputFile.h.

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

Definition at line 253 of file RootInputFile.h.

RootInputTreePtrArray art::RootInputFile::treePointers_
private

Definition at line 219 of file RootInputFile.h.


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