CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
edm::IndexIntoFile::IndexIntoFileItrSorted Class Reference

#include <IndexIntoFile.h>

Inheritance diagram for edm::IndexIntoFile::IndexIntoFileItrSorted:
edm::IndexIntoFile::IndexIntoFileItrImpl

Public Member Functions

IndexIntoFileItrImplclone () const override
 
EntryNumber_t entry () const override
 
 IndexIntoFileItrSorted (IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
 
LuminosityBlockNumber_t lumi () const override
 
bool lumiEntryValid (int index) const override
 
EntryNumber_t peekAheadAtEventEntry () const override
 
LuminosityBlockNumber_t peekAheadAtLumi () const override
 
int processHistoryIDIndex () const override
 
RunNumber_t run () const override
 
bool skipLumiInRun () override
 
- Public Member Functions inherited from edm::IndexIntoFile::IndexIntoFileItrImpl
void advanceToNextLumiOrRun ()
 
void advanceToNextRun ()
 
void copyPosition (IndexIntoFileItrImpl const &position)
 
EntryNumber_t firstEventEntryThisLumi ()
 
EntryNumber_t firstEventEntryThisRun ()
 
EntryType getEntryType () const
 
void getLumisInRun (std::vector< LuminosityBlockNumber_t > &lumis) const
 
IndexIntoFile const * indexIntoFile () const
 
 IndexIntoFileItrImpl (IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
 
long long indexToEvent () const
 
int indexToEventRange () const
 
int indexToLumi () const
 
int indexToRun () const
 
void initializeLumi ()
 
void initializeRun ()
 
long long nEvents () const
 
void next ()
 
bool operator== (IndexIntoFileItrImpl const &right) const
 
int size () const
 
void skipEventBackward (int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
 
void skipEventForward (int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
 
bool skipToNextEventInLumi ()
 
EntryType type () const
 
virtual ~IndexIntoFileItrImpl ()
 

Private Member Functions

EntryType getRunOrLumiEntryType (int index) const override
 
void initializeLumi_ () override
 
bool isSameLumi (int index1, int index2) const override
 
bool isSameRun (int index1, int index2) const override
 
LuminosityBlockNumber_t lumi (int index) const override
 
bool nextEventRange () override
 
bool previousEventRange () override
 
bool setToLastEventInRange (int index) override
 

Additional Inherited Members

- Protected Member Functions inherited from edm::IndexIntoFile::IndexIntoFileItrImpl
void setIndexToEvent (long long value)
 
void setIndexToEventRange (int value)
 
void setIndexToLumi (int value)
 
void setInvalid ()
 
void setNEvents (long long value)
 

Detailed Description

Definition at line 663 of file IndexIntoFile.h.

Constructor & Destructor Documentation

edm::IndexIntoFile::IndexIntoFileItrSorted::IndexIntoFileItrSorted ( IndexIntoFile const *  indexIntoFile,
EntryType  entryType,
int  indexToRun,
int  indexToLumi,
int  indexToEventRange,
long long  indexToEvent,
long long  nEvents 
)

Definition at line 1670 of file IndexIntoFile.cc.

References edm::IndexIntoFile::fillRunOrLumiIndexes().

Referenced by clone().

1676  :
1678  entryType,
1679  indexToRun,
1680  indexToLumi,
1682  indexToEvent,
1683  nEvents) {
1685  }
IndexIntoFile const * indexIntoFile() const
IndexIntoFileItrImpl(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
void fillRunOrLumiIndexes() const

Member Function Documentation

IndexIntoFile::IndexIntoFileItrImpl * edm::IndexIntoFile::IndexIntoFileItrSorted::clone ( void  ) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1687 of file IndexIntoFile.cc.

References IndexIntoFileItrSorted().

1687  {
1688  return new IndexIntoFileItrSorted(*this);
1689  }
IndexIntoFileItrSorted(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrSorted::entry ( ) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1706 of file IndexIntoFile.cc.

References edm::IndexIntoFile::eventEntries(), edm::IndexIntoFile::fillEventEntries(), mps_fire::i, edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToRun(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, edm::IndexIntoFile::runOrLumiEntries(), edm::IndexIntoFile::runOrLumiIndexes(), and edm::IndexIntoFile::IndexIntoFileItrImpl::type().

1706  {
1707  if(type() == kEnd) return invalidEntry;
1708  if(type() == kRun) {
1709  int i = indexIntoFile()->runOrLumiIndexes()[indexToRun()].indexToGetEntry();
1710  return indexIntoFile()->runOrLumiEntries()[i].entry();
1711  }
1712  if(type() == kLumi) {
1713  int i = indexIntoFile()->runOrLumiIndexes()[indexToLumi()].indexToGetEntry();
1714  return indexIntoFile()->runOrLumiEntries()[i].entry();
1715  }
1716  long long eventNumberIndex =
1717  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1718  indexToEvent();
1720  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1721  }
IndexIntoFile const * indexIntoFile() const
std::vector< EventEntry > & eventEntries() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
void fillEventEntries() const
static constexpr EntryNumber_t invalidEntry
IndexIntoFile::EntryType edm::IndexIntoFile::IndexIntoFileItrSorted::getRunOrLumiEntryType ( int  index) const
overrideprivatevirtual
void edm::IndexIntoFile::IndexIntoFileItrSorted::initializeLumi_ ( )
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1738 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi(), edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents(), edm::IndexIntoFile::runOrLumiIndexes(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange(), and edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents().

1738  {
1739  assert(indexToLumi() != invalidIndex);
1741  setIndexToEvent(0);
1742  setNEvents(
1743  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].endEventNumbers() -
1744  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].beginEventNumbers());
1745  if(nEvents() == 0){
1747  }
1748  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
bool edm::IndexIntoFile::IndexIntoFileItrSorted::isSameLumi ( int  index1,
int  index2 
) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1811 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::runOrLumiIndexes(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

Referenced by setToLastEventInRange().

1811  {
1812  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1813  return false;
1814  }
1815  return indexIntoFile()->runOrLumiIndexes()[index1].lumi() ==
1816  indexIntoFile()->runOrLumiIndexes()[index2].lumi();
1817  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
bool edm::IndexIntoFile::IndexIntoFileItrSorted::isSameRun ( int  index1,
int  index2 
) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1819 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::runOrLumiIndexes(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1819  {
1820  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1821  return false;
1822  }
1823  return indexIntoFile()->runOrLumiIndexes()[index1].run() ==
1824  indexIntoFile()->runOrLumiIndexes()[index2].run() &&
1825  indexIntoFile()->runOrLumiIndexes()[index1].processHistoryIDIndex() ==
1826  indexIntoFile()->runOrLumiIndexes()[index2].processHistoryIDIndex();
1827  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrSorted::lumi ( ) const
overridevirtual
LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrSorted::lumi ( int  index) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1829 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::runOrLumiIndexes(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1829  {
1830  if(index < 0 || index >= size()) {
1831  return invalidLumi;
1832  }
1833  return indexIntoFile()->runOrLumiIndexes()[index].lumi();
1834  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
static constexpr LuminosityBlockNumber_t invalidLumi
bool edm::IndexIntoFile::IndexIntoFileItrSorted::lumiEntryValid ( int  index) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1798 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::runOrLumiEntries(), and edm::IndexIntoFile::runOrLumiIndexes().

1798  {
1799  return indexIntoFile()->runOrLumiEntries()[indexIntoFile()->runOrLumiIndexes()[index].indexToGetEntry()].entry() != invalidEntry;
1800  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
bool edm::IndexIntoFile::IndexIntoFileItrSorted::nextEventRange ( )
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1750 of file IndexIntoFile.cc.

1750  {
1751  return false;
1752  }
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrSorted::peekAheadAtEventEntry ( ) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1728 of file IndexIntoFile.cc.

References edm::IndexIntoFile::eventEntries(), edm::IndexIntoFile::fillEventEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents(), and edm::IndexIntoFile::runOrLumiIndexes().

1728  {
1729  if(indexToLumi() == invalidIndex) return invalidEntry;
1730  if(indexToEvent() >= nEvents()) return invalidEntry;
1731  long long eventNumberIndex =
1732  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1733  indexToEvent();
1735  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1736  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< EventEntry > & eventEntries() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void fillEventEntries() const
static constexpr EntryNumber_t invalidEntry
LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrSorted::peekAheadAtLumi ( ) const
overridevirtual
bool edm::IndexIntoFile::IndexIntoFileItrSorted::previousEventRange ( )
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1754 of file IndexIntoFile.cc.

1754  {
1755  return false;
1756  }
int edm::IndexIntoFile::IndexIntoFileItrSorted::processHistoryIDIndex ( ) const
overridevirtual
RunNumber_t edm::IndexIntoFile::IndexIntoFileItrSorted::run ( ) const
overridevirtual
bool edm::IndexIntoFile::IndexIntoFileItrSorted::setToLastEventInRange ( int  index)
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1758 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), isSameLumi(), edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents(), edm::IndexIntoFile::runOrLumiIndexes(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange(), and edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents().

1758  {
1759  long long nEventsInRange =
1760  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1761  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers();
1762  if(nEventsInRange == 0) {
1763  return false;
1764  }
1765  while(index > 0 &&
1766  !indexIntoFile()->runOrLumiIndexes()[index - 1].isRun() &&
1767  isSameLumi(index, index - 1)) {
1768  --index;
1769  }
1770  assert(nEventsInRange ==
1771  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1772  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers());
1773 
1775  setNEvents(nEventsInRange);
1776  assert(nEvents() > 0);
1777  setIndexToEvent(nEventsInRange - 1);
1778  return true;
1779  }
bool isSameLumi(int index1, int index2) const override
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
bool edm::IndexIntoFile::IndexIntoFileItrSorted::skipLumiInRun ( )
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1781 of file IndexIntoFile.cc.

References mps_fire::i, edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi(), edm::IndexIntoFile::IndexIntoFileItrImpl::initializeLumi(), edm::IndexIntoFile::invalidIndex, lumi(), edm::IndexIntoFile::runOrLumiIndexes(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToLumi(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1781  {
1782  if(indexToLumi() == invalidIndex) return false;
1783  for(int i = 1; indexToLumi() + i < size(); ++i) {
1784  int newLumi = indexToLumi() + i;
1785  if(indexIntoFile()->runOrLumiIndexes()[newLumi].isRun()) {
1786  return false; // hit next run
1787  } else if(indexIntoFile()->runOrLumiIndexes()[newLumi].lumi() ==
1789  continue;
1790  }
1791  setIndexToLumi(newLumi);
1792  initializeLumi();
1793  return true; // hit next lumi
1794  }
1795  return false; // hit the end of the IndexIntoFile
1796  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
LuminosityBlockNumber_t lumi() const override