CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::IndexIntoFile::IndexIntoFileItrImpl Class Referenceabstract

#include <IndexIntoFile.h>

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

Public Member Functions

void advanceToNextLumiOrRun ()
 
void advanceToNextRun ()
 
virtual IndexIntoFileItrImplclone () const =0
 
void copyPosition (IndexIntoFileItrImpl const &position)
 
virtual EntryNumber_t entry () const =0
 
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 ()
 
virtual LuminosityBlockNumber_t lumi () const =0
 
virtual bool lumiEntryValid (int index) const =0
 
long long nEvents () const
 
void next ()
 
bool operator== (IndexIntoFileItrImpl const &right) const
 
virtual EntryNumber_t peekAheadAtEventEntry () const =0
 
virtual LuminosityBlockNumber_t peekAheadAtLumi () const =0
 
virtual int processHistoryIDIndex () const =0
 
virtual RunNumber_t run () const =0
 
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)
 
virtual bool skipLumiInRun ()=0
 
bool skipToNextEventInLumi ()
 
EntryType type () const
 
virtual ~IndexIntoFileItrImpl ()
 

Protected Member Functions

void setIndexToEvent (long long value)
 
void setIndexToEventRange (int value)
 
void setIndexToLumi (int value)
 
void setInvalid ()
 
void setNEvents (long long value)
 

Private Member Functions

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

Private Attributes

IndexIntoFile const * indexIntoFile_
 
long long indexToEvent_
 
int indexToEventRange_
 
int indexToLumi_
 
int indexToRun_
 
long long nEvents_
 
int size_
 
EntryType type_
 

Detailed Description

Definition at line 516 of file IndexIntoFile.h.

Constructor & Destructor Documentation

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

Definition at line 932 of file IndexIntoFile.cc.

940  size_(static_cast<int>(indexIntoFile_->runOrLumiEntries_.size())),
941  type_(entryType),
946  nEvents_(nEvents) {}
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > runOrLumiEntries_
edm::IndexIntoFile::IndexIntoFileItrImpl::~IndexIntoFileItrImpl ( )
virtual

Definition at line 948 of file IndexIntoFile.cc.

948 {}

Member Function Documentation

void edm::IndexIntoFile::IndexIntoFileItrImpl::advanceToNextLumiOrRun ( )

Definition at line 1229 of file IndexIntoFile.cc.

References getRunOrLumiEntryType(), mps_fire::i, indexToLumi_, indexToRun_, initializeLumi(), initializeRun(), edm::IndexIntoFile::invalidIndex, isSameLumi(), isSameRun(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, setInvalid(), size_, and type_.

1229  {
1230  if (type_ == kEnd)
1231  return;
1232  assert(indexToRun_ != invalidIndex);
1233 
1234  // A preliminary step is to advance to the last run entry for
1235  // this run (actually this step is not needed in the
1236  // context I expect this to be called in, just being careful)
1237  int startSearch = indexToRun_;
1238  for (int i = 1; startSearch + i < size_; ++i) {
1239  if (getRunOrLumiEntryType(startSearch + i) == kRun && isSameRun(indexToRun_, startSearch + i)) {
1240  indexToRun_ = startSearch + i;
1241  } else {
1242  break;
1243  }
1244  }
1245 
1246  if (type_ == kRun && indexToLumi_ != invalidIndex) {
1247  type_ = kLumi;
1248  return;
1249  }
1250 
1251  startSearch = indexToLumi_;
1252  if (startSearch == invalidIndex)
1253  startSearch = indexToRun_;
1254  for (int i = 1; startSearch + i < size_; ++i) {
1255  if (getRunOrLumiEntryType(startSearch + i) == kRun) {
1256  if (!isSameRun(indexToRun_, startSearch + i)) {
1257  type_ = kRun;
1258  indexToRun_ = startSearch + i;
1259  initializeRun();
1260  return;
1261  }
1262  } else if (indexToLumi_ != invalidIndex) {
1263  if (!isSameLumi(indexToLumi_, startSearch + i)) {
1264  type_ = kLumi;
1265  indexToLumi_ = startSearch + i;
1266  initializeLumi();
1267  return;
1268  }
1269  }
1270  }
1271  setInvalid();
1272  }
virtual bool isSameLumi(int index1, int index2) const =0
static constexpr int invalidIndex
virtual bool isSameRun(int index1, int index2) const =0
virtual EntryType getRunOrLumiEntryType(int index) const =0
void edm::IndexIntoFile::IndexIntoFileItrImpl::advanceToNextRun ( )

Definition at line 1213 of file IndexIntoFile.cc.

References getRunOrLumiEntryType(), mps_fire::i, indexToRun_, initializeRun(), isSameRun(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kRun, setInvalid(), size_, and type_.

Referenced by skipEventForward().

1213  {
1214  if (type_ == kEnd)
1215  return;
1216  for (int i = 1; indexToRun_ + i < size_; ++i) {
1218  if (!isSameRun(indexToRun_, indexToRun_ + i)) {
1219  type_ = kRun;
1220  indexToRun_ += i;
1221  initializeRun();
1222  return;
1223  }
1224  }
1225  }
1226  setInvalid();
1227  }
virtual bool isSameRun(int index1, int index2) const =0
virtual EntryType getRunOrLumiEntryType(int index) const =0
virtual IndexIntoFileItrImpl* edm::IndexIntoFile::IndexIntoFileItrImpl::clone ( ) const
pure virtual
void edm::IndexIntoFile::IndexIntoFileItrImpl::copyPosition ( IndexIntoFileItrImpl const &  position)

Definition at line 1326 of file IndexIntoFile.cc.

References indexToEvent_, indexToEventRange_, indexToLumi_, indexToRun_, nEvents_, and type_.

1326  {
1327  type_ = position.type_;
1328  indexToRun_ = position.indexToRun_;
1329  indexToLumi_ = position.indexToLumi_;
1330  indexToEventRange_ = position.indexToEventRange_;
1331  indexToEvent_ = position.indexToEvent_;
1332  nEvents_ = position.nEvents_;
1333  }
static int position[264][3]
Definition: ReadPGInfo.cc:289
virtual EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::entry ( ) const
pure virtual
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::firstEventEntryThisLumi ( )

Definition at line 1181 of file IndexIntoFile.cc.

References getRunOrLumiEntryType(), indexToEvent(), indexToEventRange(), indexToLumi(), indexToLumi_, initializeLumi(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, isSameLumi(), edm::IndexIntoFile::kRun, nEvents(), peekAheadAtEventEntry(), setIndexToEvent(), setIndexToEventRange(), setIndexToLumi(), and setNEvents().

1181  {
1182  if (indexToLumi() == invalidIndex)
1183  return invalidEntry;
1184 
1185  int saveIndexToLumi = indexToLumi();
1186  int saveIndexToEventRange = indexToEventRange();
1187  long long saveIndexToEvent = indexToEvent();
1188  long long saveNEvents = nEvents();
1189 
1190  while (indexToLumi() - 1 > 0) {
1191  if (getRunOrLumiEntryType(indexToLumi() - 1) == kRun)
1192  break;
1193  if (!isSameLumi(indexToLumi(), indexToLumi() - 1))
1194  break;
1195  --indexToLumi_;
1196  }
1197  initializeLumi();
1198 
1200 
1201  if (indexToEvent() < nEvents()) {
1202  returnValue = peekAheadAtEventEntry();
1203  }
1204 
1205  setIndexToLumi(saveIndexToLumi);
1206  setIndexToEventRange(saveIndexToEventRange);
1207  setIndexToEvent(saveIndexToEvent);
1208  setNEvents(saveNEvents);
1209 
1210  return returnValue;
1211  }
virtual bool isSameLumi(int index1, int index2) const =0
static constexpr int invalidIndex
long long EntryNumber_t
virtual EntryType getRunOrLumiEntryType(int index) const =0
static constexpr EntryNumber_t invalidEntry
virtual EntryNumber_t peekAheadAtEventEntry() const =0
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::firstEventEntryThisRun ( )

Definition at line 1153 of file IndexIntoFile.cc.

References indexToEvent(), indexToEventRange(), indexToLumi(), initializeRun(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, nEvents(), peekAheadAtEventEntry(), setIndexToEvent(), setIndexToEventRange(), setIndexToLumi(), setNEvents(), and skipLumiInRun().

1153  {
1154  if (indexToLumi() == invalidIndex)
1155  return invalidEntry;
1156 
1157  int saveIndexToLumi = indexToLumi();
1158  int saveIndexToEventRange = indexToEventRange();
1159  long long saveIndexToEvent = indexToEvent();
1160  long long saveNEvents = nEvents();
1161 
1162  initializeRun();
1163 
1165 
1166  do {
1167  if (indexToEvent() < nEvents()) {
1168  returnValue = peekAheadAtEventEntry();
1169  break;
1170  }
1171  } while (skipLumiInRun());
1172 
1173  setIndexToLumi(saveIndexToLumi);
1174  setIndexToEventRange(saveIndexToEventRange);
1175  setIndexToEvent(saveIndexToEvent);
1176  setNEvents(saveNEvents);
1177 
1178  return returnValue;
1179  }
static constexpr int invalidIndex
long long EntryNumber_t
static constexpr EntryNumber_t invalidEntry
virtual EntryNumber_t peekAheadAtEventEntry() const =0
EntryType edm::IndexIntoFile::IndexIntoFileItrImpl::getEntryType ( ) const
inline
void edm::IndexIntoFile::IndexIntoFileItrImpl::getLumisInRun ( std::vector< LuminosityBlockNumber_t > &  lumis) const

Definition at line 1335 of file IndexIntoFile.cc.

References getRunOrLumiEntryType(), mps_fire::i, indexToRun_, edm::IndexIntoFile::invalidLumi, isSameRun(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kRun, lumi(), size_, type_, and tier0::unique().

1335  {
1336  lumis.clear();
1337 
1338  if (type_ == kEnd)
1339  return;
1340 
1341  LuminosityBlockNumber_t previousLumi = invalidLumi;
1342 
1343  for (int i = 1; (i + indexToRun_) < size_; ++i) {
1344  int index = i + indexToRun_;
1345  EntryType entryType = getRunOrLumiEntryType(index);
1346 
1347  if (entryType == kRun) {
1348  if (isSameRun(indexToRun_, index)) {
1349  continue;
1350  } else {
1351  break;
1352  }
1353  } else {
1354  LuminosityBlockNumber_t luminosityBlock = lumi(index);
1355  if (luminosityBlock != invalidLumi && luminosityBlock != previousLumi) {
1356  lumis.push_back(luminosityBlock);
1357  previousLumi = luminosityBlock;
1358  }
1359  }
1360  }
1361  std::sort(lumis.begin(), lumis.end());
1362  lumis.erase(std::unique(lumis.begin(), lumis.end()), lumis.end());
1363  }
virtual LuminosityBlockNumber_t lumi() const =0
unsigned int LuminosityBlockNumber_t
virtual bool isSameRun(int index1, int index2) const =0
def unique(seq, keepstr=True)
Definition: tier0.py:24
virtual EntryType getRunOrLumiEntryType(int index) const =0
static constexpr LuminosityBlockNumber_t invalidLumi
virtual EntryType edm::IndexIntoFile::IndexIntoFileItrImpl::getRunOrLumiEntryType ( int  index) const
privatepure virtual
IndexIntoFile const* edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile ( ) const
inline

Definition at line 563 of file IndexIntoFile.h.

Referenced by edm::IndexIntoFile::IndexIntoFileItrNoSort::entry(), edm::IndexIntoFile::IndexIntoFileItrSorted::entry(), edm::IndexIntoFile::IndexIntoFileItrNoSort::getRunOrLumiEntryType(), edm::IndexIntoFile::IndexIntoFileItrSorted::getRunOrLumiEntryType(), edm::IndexIntoFile::IndexIntoFileItrNoSort::initializeLumi_(), edm::IndexIntoFile::IndexIntoFileItrSorted::initializeLumi_(), edm::IndexIntoFile::IndexIntoFileItrNoSort::isSameLumi(), edm::IndexIntoFile::IndexIntoFileItrSorted::isSameLumi(), edm::IndexIntoFile::IndexIntoFileItrNoSort::isSameRun(), edm::IndexIntoFile::IndexIntoFileItrSorted::isSameRun(), edm::IndexIntoFile::IndexIntoFileItrNoSort::lumi(), edm::IndexIntoFile::IndexIntoFileItrSorted::lumi(), edm::IndexIntoFile::IndexIntoFileItrNoSort::lumiEntryValid(), edm::IndexIntoFile::IndexIntoFileItrSorted::lumiEntryValid(), edm::IndexIntoFile::IndexIntoFileItrNoSort::nextEventRange(), edm::IndexIntoFile::IndexIntoFileItrNoSort::peekAheadAtEventEntry(), edm::IndexIntoFile::IndexIntoFileItrSorted::peekAheadAtEventEntry(), edm::IndexIntoFile::IndexIntoFileItrNoSort::peekAheadAtLumi(), edm::IndexIntoFile::IndexIntoFileItrSorted::peekAheadAtLumi(), edm::IndexIntoFile::IndexIntoFileItrNoSort::previousEventRange(), edm::IndexIntoFile::IndexIntoFileItrNoSort::processHistoryIDIndex(), edm::IndexIntoFile::IndexIntoFileItrSorted::processHistoryIDIndex(), edm::IndexIntoFile::IndexIntoFileItrNoSort::run(), edm::IndexIntoFile::IndexIntoFileItrSorted::run(), edm::IndexIntoFile::IndexIntoFileItrNoSort::setToLastEventInRange(), edm::IndexIntoFile::IndexIntoFileItrSorted::setToLastEventInRange(), edm::IndexIntoFile::IndexIntoFileItrNoSort::skipLumiInRun(), and edm::IndexIntoFile::IndexIntoFileItrSorted::skipLumiInRun().

563 { return indexIntoFile_; }
long long edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEvent ( ) const
inline
int edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange ( ) const
inline
int edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi ( ) const
inline
int edm::IndexIntoFile::IndexIntoFileItrImpl::indexToRun ( ) const
inline
void edm::IndexIntoFile::IndexIntoFileItrImpl::initializeLumi ( )

Definition at line 1308 of file IndexIntoFile.cc.

References indexToLumi_, initializeLumi_(), lumi(), and lumiEntryValid().

Referenced by advanceToNextLumiOrRun(), firstEventEntryThisLumi(), initializeRun(), next(), edm::IndexIntoFile::IndexIntoFileItrNoSort::skipLumiInRun(), and edm::IndexIntoFile::IndexIntoFileItrSorted::skipLumiInRun().

1308  {
1309  initializeLumi_();
1310  //See if entry number is invalid, this can happen if events from
1311  // different lumis overlap when doing concurrent lumi processing
1312  auto oldLumi = lumi();
1313  while (not lumiEntryValid(indexToLumi_)) {
1314  ++indexToLumi_;
1315  }
1316  assert(oldLumi == lumi());
1317  }
virtual LuminosityBlockNumber_t lumi() const =0
virtual bool lumiEntryValid(int index) const =0
virtual void edm::IndexIntoFile::IndexIntoFileItrImpl::initializeLumi_ ( )
privatepure virtual
void edm::IndexIntoFile::IndexIntoFileItrImpl::initializeRun ( )

Definition at line 1284 of file IndexIntoFile.cc.

References getRunOrLumiEntryType(), mps_fire::i, indexToEvent_, indexToEventRange_, indexToLumi_, indexToRun_, initializeLumi(), edm::IndexIntoFile::invalidIndex, isSameRun(), edm::IndexIntoFile::kRun, nEvents_, and size_.

Referenced by advanceToNextLumiOrRun(), advanceToNextRun(), firstEventEntryThisRun(), next(), and skipEventBackward().

1284  {
1287  indexToEvent_ = 0;
1288  nEvents_ = 0;
1289 
1290  for (int i = 1; (i + indexToRun_) < size_; ++i) {
1292  bool sameRun = isSameRun(indexToRun_, indexToRun_ + i);
1293 
1294  if (entryType == kRun) {
1295  if (sameRun) {
1296  continue;
1297  } else {
1298  break;
1299  }
1300  } else {
1302  initializeLumi();
1303  return;
1304  }
1305  }
1306  }
static constexpr int invalidIndex
virtual bool isSameRun(int index1, int index2) const =0
virtual EntryType getRunOrLumiEntryType(int index) const =0
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::isSameLumi ( int  index1,
int  index2 
) const
privatepure virtual
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::isSameRun ( int  index1,
int  index2 
) const
privatepure virtual
virtual LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::lumi ( ) const
pure virtual
virtual LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::lumi ( int  index) const
privatepure virtual
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::lumiEntryValid ( int  index) const
pure virtual
long long edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents ( ) const
inline
void edm::IndexIntoFile::IndexIntoFileItrImpl::next ( void  )

Definition at line 950 of file IndexIntoFile.cc.

References newFWLiteAna::found, getRunOrLumiEntryType(), indexToEvent_, indexToLumi_, indexToRun_, initializeLumi(), initializeRun(), isSameLumi(), isSameRun(), edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, nEvents_, nextEventRange(), setInvalid(), size_, and type_.

Referenced by skipEventForward().

950  {
951  if (type_ == kEvent) {
952  if ((indexToEvent_ + 1) < nEvents_) {
953  ++indexToEvent_;
954  } else {
955  bool found = nextEventRange();
956 
957  if (!found) {
959 
960  if (type_ == kLumi) {
961  ++indexToLumi_;
962  initializeLumi();
963  } else if (type_ == kRun) {
965  initializeRun();
966  } else {
967  setInvalid(); // type_ is kEnd
968  }
969  }
970  }
971  } else if (type_ == kLumi) {
972  if (indexToLumi_ + 1 == size_) {
973  if (indexToEvent_ < nEvents_) {
974  type_ = kEvent;
975  } else {
976  setInvalid();
977  }
978  } else {
980 
981  if (nextType == kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
982  ++indexToLumi_;
983  } else if (indexToEvent_ < nEvents_) {
984  type_ = kEvent;
985  } else if (nextType == kRun) {
986  type_ = kRun;
988  initializeRun();
989  } else {
990  ++indexToLumi_;
991  initializeLumi();
992  }
993  }
994  } else if (type_ == kRun) {
996  bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
997  if (nextType == kRun && sameRun) {
998  ++indexToRun_;
999  } else if (nextType == kRun && !sameRun) {
1000  ++indexToRun_;
1001  initializeRun();
1002  } else if (nextType == kLumi) {
1003  type_ = kLumi;
1004  } else {
1005  setInvalid();
1006  }
1007  }
1008  }
virtual bool isSameLumi(int index1, int index2) const =0
virtual bool isSameRun(int index1, int index2) const =0
virtual EntryType getRunOrLumiEntryType(int index) const =0
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::nextEventRange ( )
privatepure virtual
bool edm::IndexIntoFile::IndexIntoFileItrImpl::operator== ( IndexIntoFileItrImpl const &  right) const

Definition at line 1319 of file IndexIntoFile.cc.

References indexIntoFile_, indexToEvent_, indexToEventRange_, indexToLumi_, indexToRun_, nEvents_, size_, and type_.

1319  {
1320  return (indexIntoFile_ == right.indexIntoFile_ && size_ == right.size_ && type_ == right.type_ &&
1321  indexToRun_ == right.indexToRun_ && indexToLumi_ == right.indexToLumi_ &&
1322  indexToEventRange_ == right.indexToEventRange_ && indexToEvent_ == right.indexToEvent_ &&
1323  nEvents_ == right.nEvents_);
1324  }
virtual EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::peekAheadAtEventEntry ( ) const
pure virtual
virtual LuminosityBlockNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::peekAheadAtLumi ( ) const
pure virtual
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::previousEventRange ( )
privatepure virtual
bool edm::IndexIntoFile::IndexIntoFileItrImpl::previousLumiWithEvents ( )
private

Definition at line 1101 of file IndexIntoFile.cc.

References getRunOrLumiEntryType(), indexToLumi(), indexToRun(), indexToRun_, edm::IndexIntoFile::invalidIndex, isSameLumi(), isSameRun(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, lumiEntryValid(), setIndexToLumi(), setToLastEventInRange(), size(), type(), and type_.

Referenced by skipEventBackward().

1101  {
1102  // Find the correct place to start the search
1103  int newLumi = indexToLumi();
1104  if (newLumi == invalidIndex) {
1105  newLumi = indexToRun() == invalidIndex ? size() - 1 : indexToRun();
1106  } else {
1107  while (getRunOrLumiEntryType(newLumi - 1) == kLumi && isSameLumi(newLumi, newLumi - 1)) {
1108  --newLumi;
1109  }
1110  --newLumi;
1111  }
1112  if (newLumi <= 0)
1113  return false;
1114 
1115  // Look backwards for a lumi with events
1116  for (; newLumi > 0; --newLumi) {
1117  if (getRunOrLumiEntryType(newLumi) == kRun) {
1118  continue;
1119  }
1120  if (setToLastEventInRange(newLumi)) {
1121  break; // found it
1122  }
1123  }
1124  if (newLumi == 0)
1125  return false;
1126 
1127  // Finish initializing the iterator
1128  while (getRunOrLumiEntryType(newLumi - 1) == kLumi && isSameLumi(newLumi, newLumi - 1) &&
1129  lumiEntryValid(newLumi - 1)) {
1130  --newLumi;
1131  }
1132  setIndexToLumi(newLumi);
1133 
1134  if (type() != kEnd && isSameRun(newLumi, indexToRun())) {
1135  if (type() == kEvent)
1136  type_ = kLumi;
1137  return true;
1138  }
1139  int newRun = newLumi;
1140  while (newRun > 0 && getRunOrLumiEntryType(newRun - 1) == kLumi) {
1141  --newRun;
1142  }
1143  --newRun;
1144  assert(getRunOrLumiEntryType(newRun) == kRun);
1145  while (getRunOrLumiEntryType(newRun - 1) == kRun && isSameRun(newRun - 1, newLumi)) {
1146  --newRun;
1147  }
1148  indexToRun_ = newRun;
1149  type_ = kRun;
1150  return true;
1151  }
virtual bool isSameLumi(int index1, int index2) const =0
static constexpr int invalidIndex
virtual bool setToLastEventInRange(int index)=0
virtual bool lumiEntryValid(int index) const =0
virtual bool isSameRun(int index1, int index2) const =0
virtual EntryType getRunOrLumiEntryType(int index) const =0
virtual int edm::IndexIntoFile::IndexIntoFileItrImpl::processHistoryIDIndex ( ) const
pure virtual
virtual RunNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::run ( ) const
pure virtual
void edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEvent ( long long  value)
inlineprotected
void edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToEventRange ( int  value)
inlineprotected
void edm::IndexIntoFile::IndexIntoFileItrImpl::setIndexToLumi ( int  value)
inlineprotected
void edm::IndexIntoFile::IndexIntoFileItrImpl::setInvalid ( void  )
protected
void edm::IndexIntoFile::IndexIntoFileItrImpl::setNEvents ( long long  value)
inlineprotected
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::setToLastEventInRange ( int  index)
privatepure virtual
int edm::IndexIntoFile::IndexIntoFileItrImpl::size ( void  ) const
inline
void edm::IndexIntoFile::IndexIntoFileItrImpl::skipEventBackward ( int &  phIndexOfEvent,
RunNumber_t runOfEvent,
LuminosityBlockNumber_t lumiOfEvent,
EntryNumber_t eventEntry 
)

Definition at line 1066 of file IndexIntoFile.cc.

References edm::IndexIntoFile::empty(), indexIntoFile_, indexToEvent_, indexToRun_, initializeRun(), edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::invalidRun, edm::IndexIntoFile::kRun, peekAheadAtEventEntry(), peekAheadAtLumi(), previousEventRange(), previousLumiWithEvents(), processHistoryIDIndex(), run(), and type_.

1069  {
1070  // Look for previous events in the current lumi
1071  if (indexToEvent_ > 0) {
1072  --indexToEvent_;
1073  } else if (!previousEventRange()) {
1074  // Look for previous events in previous lumis
1075  if (!previousLumiWithEvents()) {
1076  // If we get here there are no previous events in the file
1077 
1078  if (!indexIntoFile_->empty()) {
1079  // Set the iterator to the beginning of the file
1080  type_ = kRun;
1081  indexToRun_ = 0;
1082  initializeRun();
1083  }
1084  phIndexOfEvent = invalidIndex;
1085  runOfEvent = invalidRun;
1086  lumiOfEvent = invalidLumi;
1087  eventEntry = invalidEntry;
1088  return;
1089  }
1090  }
1091  // Found a previous event and we have set the iterator so that this event
1092  // will be the next event process. (There may or may not be a run and/or
1093  // a lumi processed first).
1094  // Return information about this event
1095  phIndexOfEvent = processHistoryIDIndex();
1096  runOfEvent = run();
1097  lumiOfEvent = peekAheadAtLumi();
1098  eventEntry = peekAheadAtEventEntry();
1099  }
static constexpr int invalidIndex
bool empty() const
True if no runs, lumis, or events are in the file.
static constexpr RunNumber_t invalidRun
static constexpr EntryNumber_t invalidEntry
virtual RunNumber_t run() const =0
static constexpr LuminosityBlockNumber_t invalidLumi
virtual int processHistoryIDIndex() const =0
virtual LuminosityBlockNumber_t peekAheadAtLumi() const =0
virtual EntryNumber_t peekAheadAtEventEntry() const =0
void edm::IndexIntoFile::IndexIntoFileItrImpl::skipEventForward ( int &  phIndexOfSkippedEvent,
RunNumber_t runOfSkippedEvent,
LuminosityBlockNumber_t lumiOfSkippedEvent,
EntryNumber_t skippedEventEntry 
)

Definition at line 1010 of file IndexIntoFile.cc.

References advanceToNextRun(), indexToEvent_, edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::invalidRun, edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, nEvents_, next(), nextEventRange(), peekAheadAtEventEntry(), peekAheadAtLumi(), processHistoryIDIndex(), run(), skipLumiInRun(), and type_.

1013  {
1014  if (indexToEvent_ < nEvents_) {
1015  phIndexOfSkippedEvent = processHistoryIDIndex();
1016  runOfSkippedEvent = run();
1017  lumiOfSkippedEvent = peekAheadAtLumi();
1018  skippedEventEntry = peekAheadAtEventEntry();
1019 
1020  if ((indexToEvent_ + 1) < nEvents_) {
1021  ++indexToEvent_;
1022  return;
1023  } else if (nextEventRange()) {
1024  return;
1025  } else if (type_ == kRun || type_ == kLumi) {
1026  if (skipLumiInRun()) {
1027  return;
1028  }
1029  } else if (type_ == kEvent) {
1030  next();
1031  return;
1032  }
1033  advanceToNextRun();
1034  return;
1035  }
1036 
1037  if (type_ == kRun) {
1038  while (skipLumiInRun()) {
1039  if (indexToEvent_ < nEvents_) {
1040  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1041  return;
1042  }
1043  }
1044  }
1045 
1046  while (indexToEvent_ >= nEvents_ && type_ != kEnd) {
1047  while (skipLumiInRun()) {
1048  if (indexToEvent_ < nEvents_) {
1049  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1050  return;
1051  }
1052  }
1053  advanceToNextRun();
1054  }
1055  if (type_ == kEnd) {
1056  phIndexOfSkippedEvent = invalidIndex;
1057  runOfSkippedEvent = invalidRun;
1058  lumiOfSkippedEvent = invalidLumi;
1059  skippedEventEntry = invalidEntry;
1060  return;
1061  }
1062  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1063  return;
1064  }
static constexpr int invalidIndex
static constexpr RunNumber_t invalidRun
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
static constexpr EntryNumber_t invalidEntry
virtual RunNumber_t run() const =0
static constexpr LuminosityBlockNumber_t invalidLumi
virtual int processHistoryIDIndex() const =0
virtual LuminosityBlockNumber_t peekAheadAtLumi() const =0
virtual EntryNumber_t peekAheadAtEventEntry() const =0
virtual bool edm::IndexIntoFile::IndexIntoFileItrImpl::skipLumiInRun ( )
pure virtual
bool edm::IndexIntoFile::IndexIntoFileItrImpl::skipToNextEventInLumi ( )

Definition at line 1274 of file IndexIntoFile.cc.

References indexToEvent_, nEvents_, and nextEventRange().

1274  {
1275  if (indexToEvent_ >= nEvents_)
1276  return false;
1277  if ((indexToEvent_ + 1) < nEvents_) {
1278  ++indexToEvent_;
1279  return true;
1280  }
1281  return nextEventRange();
1282  }
EntryType edm::IndexIntoFile::IndexIntoFileItrImpl::type ( ) const
inline

Member Data Documentation

IndexIntoFile const* edm::IndexIntoFile::IndexIntoFileItrImpl::indexIntoFile_
private

Definition at line 597 of file IndexIntoFile.h.

Referenced by operator==(), and skipEventBackward().

long long edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEvent_
private
int edm::IndexIntoFile::IndexIntoFileItrImpl::indexToEventRange_
private

Definition at line 603 of file IndexIntoFile.h.

Referenced by copyPosition(), initializeRun(), operator==(), and setInvalid().

int edm::IndexIntoFile::IndexIntoFileItrImpl::indexToLumi_
private
int edm::IndexIntoFile::IndexIntoFileItrImpl::indexToRun_
private
long long edm::IndexIntoFile::IndexIntoFileItrImpl::nEvents_
private
int edm::IndexIntoFile::IndexIntoFileItrImpl::size_
private
EntryType edm::IndexIntoFile::IndexIntoFileItrImpl::type_
private