CMS 3D CMS Logo

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

#include <IndexIntoFile.h>

Inheritance diagram for edm::IndexIntoFile::IndexIntoFileItrNoSort:
edm::IndexIntoFile::IndexIntoFileItrImpl

Public Member Functions

IndexIntoFileItrImplclone () const override
 
EntryNumber_t entry () const override
 
 IndexIntoFileItrNoSort (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 627 of file IndexIntoFile.h.

Constructor & Destructor Documentation

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

Definition at line 1470 of file IndexIntoFile.cc.

Referenced by clone().

1476  :
1478  entryType,
1479  indexToRun,
1480  indexToLumi,
1482  indexToEvent,
1483  nEvents)
1484  {
1485  }
IndexIntoFile const * indexIntoFile() const
IndexIntoFileItrImpl(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)

Member Function Documentation

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

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1488 of file IndexIntoFile.cc.

References IndexIntoFileItrNoSort().

1488  {
1489  return new IndexIntoFileItrNoSort(*this);
1490  }
IndexIntoFileItrNoSort(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrNoSort::entry ( ) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1508 of file IndexIntoFile.cc.

References 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(), and edm::IndexIntoFile::IndexIntoFileItrImpl::type().

1508  {
1509  if(type() == kEnd) return invalidEntry;
1510  if(type() == kRun) return indexIntoFile()->runOrLumiEntries()[indexToRun()].entry();
1511  if(type() == kLumi) return indexIntoFile()->runOrLumiEntries()[indexToLumi()].entry();
1512  return
1513  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1514  indexToEvent();
1515  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
IndexIntoFile::EntryType edm::IndexIntoFile::IndexIntoFileItrNoSort::getRunOrLumiEntryType ( int  index) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1636 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, edm::IndexIntoFile::runOrLumiEntries(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1636  {
1637  if(index < 0 || index >= size()) {
1638  return kEnd;
1639  } else if(indexIntoFile()->runOrLumiEntries()[index].isRun()) {
1640  return kRun;
1641  }
1642  return kLumi;
1643  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
void edm::IndexIntoFile::IndexIntoFileItrNoSort::initializeLumi_ ( )
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1530 of file IndexIntoFile.cc.

References edm::IndexIntoFile::beginEvents(), edm::IndexIntoFile::endEvents(), mps_fire::i, edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::runOrLumiEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange(), edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1530  {
1531  assert(indexToLumi() != invalidIndex);
1532 
1534  setIndexToEvent(0);
1535  setNEvents(0);
1536 
1537  for(int i = 0; indexToLumi() + i < size(); ++i) {
1538  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].isRun()) {
1539  break;
1540  } else if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].lumi() ==
1541  indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1542  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].beginEvents() == invalidEntry) {
1543  continue;
1544  }
1546  setIndexToEvent(0);
1549  break;
1550  } else {
1551  break;
1552  }
1553  }
1554  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
EntryNumber_t & endEvents() const
EntryNumber_t & beginEvents() const
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::isSameLumi ( int  index1,
int  index2 
) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1645 of file IndexIntoFile.cc.

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

Referenced by previousEventRange().

1645  {
1646  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1647  return false;
1648  }
1649  return indexIntoFile()->runOrLumiEntries()[index1].lumi() ==
1650  indexIntoFile()->runOrLumiEntries()[index2].lumi();
1651  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::isSameRun ( int  index1,
int  index2 
) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1653 of file IndexIntoFile.cc.

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

1653  {
1654  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1655  return false;
1656  }
1657  return indexIntoFile()->runOrLumiEntries()[index1].run() ==
1658  indexIntoFile()->runOrLumiEntries()[index2].run() &&
1659  indexIntoFile()->runOrLumiEntries()[index1].processHistoryIDIndex() ==
1660  indexIntoFile()->runOrLumiEntries()[index2].processHistoryIDIndex();
1661  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrNoSort::lumi ( ) const
overridevirtual
LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrNoSort::lumi ( int  index) const
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1663 of file IndexIntoFile.cc.

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

1663  {
1664  if(index < 0 || index >= size()) {
1665  return invalidLumi;
1666  }
1667  return indexIntoFile()->runOrLumiEntries()[index].lumi();
1668  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr LuminosityBlockNumber_t invalidLumi
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::lumiEntryValid ( int  index) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1632 of file IndexIntoFile.cc.

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

1632  {
1633  return indexIntoFile()->runOrLumiEntries()[index].entry() != invalidEntry;
1634  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::nextEventRange ( )
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1556 of file IndexIntoFile.cc.

References edm::IndexIntoFile::beginEvents(), edm::IndexIntoFile::endEvents(), mps_fire::i, edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::runOrLumiEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange(), edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1556  {
1557  if(indexToEventRange() == invalidIndex) return false;
1558 
1559  // Look for the next event range, same lumi but different entry
1560  for(int i = 1; indexToEventRange() + i < size(); ++i) {
1561  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i ].isRun()) {
1562  return false; // hit next run
1563  } else if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].lumi() ==
1565  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].beginEvents() == invalidEntry) {
1566  continue; // same lumi but has no events, keep looking
1567  }
1569  setIndexToEvent(0);
1572  return true; // found more events in this lumi
1573  }
1574  return false; // hit next lumi
1575  }
1576  return false; // hit the end of the IndexIntoFile
1577  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
EntryNumber_t & endEvents() const
EntryNumber_t & beginEvents() const
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrNoSort::peekAheadAtEventEntry ( ) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1522 of file IndexIntoFile.cc.

References 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::runOrLumiEntries().

1522  {
1523  if(indexToLumi() == invalidIndex) return invalidEntry;
1524  if(indexToEvent() >= nEvents()) return invalidEntry;
1525  return
1526  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1527  indexToEvent();
1528  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrNoSort::peekAheadAtLumi ( ) const
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1517 of file IndexIntoFile.cc.

References edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi(), edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::invalidLumi, and edm::IndexIntoFile::runOrLumiEntries().

1517  {
1518  if(indexToLumi() == invalidIndex) return invalidLumi;
1519  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1520  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr LuminosityBlockNumber_t invalidLumi
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::previousEventRange ( )
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1579 of file IndexIntoFile.cc.

References edm::IndexIntoFile::beginEvents(), edm::IndexIntoFile::endEvents(), mps_fire::i, edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, isSameLumi(), edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents(), edm::IndexIntoFile::runOrLumiEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange(), edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1579  {
1580  if(indexToEventRange() == invalidIndex) return false;
1581  assert(indexToEventRange() < size());
1582 
1583  // Look backward for a previous event range with events, same lumi but different entry
1584  for(int i = 1; indexToEventRange() - i > 0; ++i) {
1585  int newRange = indexToEventRange() - i;
1586  if(indexIntoFile()->runOrLumiEntries()[newRange].isRun()) {
1587  return false; // hit run
1588  } else if(isSameLumi(newRange, indexToEventRange())) {
1589  if(indexIntoFile()->runOrLumiEntries()[newRange].beginEvents() == invalidEntry) {
1590  continue; // same lumi but has no events, keep looking
1591  }
1592  setIndexToEventRange(newRange);
1595  setIndexToEvent(nEvents() - 1);
1596  return true; // found previous event in this lumi
1597  }
1598  return false; // hit previous lumi
1599  }
1600  return false; // hit the beginning of the IndexIntoFile, 0th entry has to be a run
1601  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
bool isSameLumi(int index1, int index2) const override
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
EntryNumber_t & endEvents() const
EntryNumber_t & beginEvents() const
int edm::IndexIntoFile::IndexIntoFileItrNoSort::processHistoryIDIndex ( ) const
overridevirtual
RunNumber_t edm::IndexIntoFile::IndexIntoFileItrNoSort::run ( ) const
overridevirtual
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::setToLastEventInRange ( int  index)
overrideprivatevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1603 of file IndexIntoFile.cc.

References edm::IndexIntoFile::beginEvents(), edm::IndexIntoFile::endEvents(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile(), edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents(), edm::IndexIntoFile::runOrLumiEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange(), and edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents().

1603  {
1605  return false;
1606  }
1610  assert(nEvents() > 0);
1611  setIndexToEvent(nEvents() - 1);
1612  return true;
1613  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
static constexpr EntryNumber_t invalidEntry
EntryNumber_t & endEvents() const
EntryNumber_t & beginEvents() const
bool edm::IndexIntoFile::IndexIntoFileItrNoSort::skipLumiInRun ( )
overridevirtual

Implements edm::IndexIntoFile::IndexIntoFileItrImpl.

Definition at line 1615 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::runOrLumiEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToLumi(), and edm::IndexIntoFile::IndexIntoFileItrImpl::size().

1615  {
1616  if(indexToLumi() == invalidIndex) return false;
1617  for(int i = 1; indexToLumi() + i < size(); ++i) {
1618  int newLumi = indexToLumi() + i;
1619  if(indexIntoFile()->runOrLumiEntries()[newLumi].isRun()) {
1620  return false; // hit next run
1621  } else if(indexIntoFile()->runOrLumiEntries()[newLumi].lumi() ==
1623  continue;
1624  }
1625  setIndexToLumi(newLumi);
1626  initializeLumi();
1627  return true; // hit next lumi
1628  }
1629  return false; // hit the end of the IndexIntoFile
1630  }
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
LuminosityBlockNumber_t lumi() const override