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 529 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 1020 of file IndexIntoFile.cc.

1026  :
1028  size_(static_cast<int>(indexIntoFile_->runOrLumiEntries_.size())),
1029  type_(entryType),
1034  nEvents_(nEvents) {
1035  }
IndexIntoFile const * indexIntoFile() const
std::vector< RunOrLumiEntry > runOrLumiEntries_
edm::IndexIntoFile::IndexIntoFileItrImpl::~IndexIntoFileItrImpl ( )
virtual

Definition at line 1037 of file IndexIntoFile.cc.

1037 {}

Member Function Documentation

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

Definition at line 1319 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_.

1319  {
1320  if(type_ == kEnd) return;
1321  assert(indexToRun_ != invalidIndex);
1322 
1323  // A preliminary step is to advance to the last run entry for
1324  // this run (actually this step is not needed in the
1325  // context I expect this to be called in, just being careful)
1326  int startSearch = indexToRun_;
1327  for(int i = 1; startSearch + i < size_; ++i) {
1328  if(getRunOrLumiEntryType(startSearch + i) == kRun &&
1329  isSameRun(indexToRun_, startSearch + i)) {
1330  indexToRun_ = startSearch + i;
1331  } else {
1332  break;
1333  }
1334  }
1335 
1336  if(type_ == kRun && indexToLumi_ != invalidIndex) {
1337  type_ = kLumi;
1338  return;
1339  }
1340 
1341  startSearch = indexToLumi_;
1342  if(startSearch == invalidIndex) startSearch = indexToRun_;
1343  for(int i = 1; startSearch + i < size_; ++i) {
1344  if(getRunOrLumiEntryType(startSearch + i) == kRun) {
1345  if(!isSameRun(indexToRun_, startSearch + i)) {
1346  type_ = kRun;
1347  indexToRun_ = startSearch + i;
1348  initializeRun();
1349  return;
1350  }
1351  } else if(indexToLumi_ != invalidIndex) {
1352  if(!isSameLumi(indexToLumi_, startSearch + i)) {
1353  type_ = kLumi;
1354  indexToLumi_ = startSearch + i;
1355  initializeLumi();
1356  return;
1357  }
1358  }
1359  }
1360  setInvalid();
1361  }
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 ( )
virtual IndexIntoFileItrImpl* edm::IndexIntoFile::IndexIntoFileItrImpl::clone ( ) const
pure virtual
void edm::IndexIntoFile::IndexIntoFileItrImpl::copyPosition ( IndexIntoFileItrImpl const &  position)

Definition at line 1420 of file IndexIntoFile.cc.

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

1420  {
1421  type_ = position.type_;
1422  indexToRun_ = position.indexToRun_;
1423  indexToLumi_ = position.indexToLumi_;
1424  indexToEventRange_ = position.indexToEventRange_;
1425  indexToEvent_ = position.indexToEvent_;
1426  nEvents_ = position.nEvents_;
1427  }
static int position[264][3]
Definition: ReadPGInfo.cc:509
virtual EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::entry ( ) const
pure virtual
IndexIntoFile::EntryNumber_t edm::IndexIntoFile::IndexIntoFileItrImpl::firstEventEntryThisLumi ( )

Definition at line 1275 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().

1275  {
1276  if(indexToLumi() == invalidIndex) return invalidEntry;
1277 
1278  int saveIndexToLumi = indexToLumi();
1279  int saveIndexToEventRange = indexToEventRange();
1280  long long saveIndexToEvent = indexToEvent();
1281  long long saveNEvents = nEvents();
1282 
1283  while (indexToLumi() - 1 > 0) {
1284  if(getRunOrLumiEntryType(indexToLumi() - 1) == kRun) break;
1285  if(!isSameLumi(indexToLumi(), indexToLumi() - 1)) break;
1286  --indexToLumi_;
1287  }
1288  initializeLumi();
1289 
1291 
1292  if(indexToEvent() < nEvents()) {
1293  returnValue = peekAheadAtEventEntry();
1294  }
1295 
1296  setIndexToLumi(saveIndexToLumi);
1297  setIndexToEventRange(saveIndexToEventRange);
1298  setIndexToEvent(saveIndexToEvent);
1299  setNEvents(saveNEvents);
1300 
1301  return returnValue;
1302  }
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 1248 of file IndexIntoFile.cc.

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

1248  {
1249  if(indexToLumi() == invalidIndex) return invalidEntry;
1250 
1251  int saveIndexToLumi = indexToLumi();
1252  int saveIndexToEventRange = indexToEventRange();
1253  long long saveIndexToEvent = indexToEvent();
1254  long long saveNEvents = nEvents();
1255 
1256  initializeRun();
1257 
1259 
1260  do {
1261  if(indexToEvent() < nEvents()) {
1262  returnValue = peekAheadAtEventEntry();
1263  break;
1264  }
1265  } while(skipLumiInRun());
1266 
1267  setIndexToLumi(saveIndexToLumi);
1268  setIndexToEventRange(saveIndexToEventRange);
1269  setIndexToEvent(saveIndexToEvent);
1270  setNEvents(saveNEvents);
1271 
1272  return returnValue;
1273  }
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 1430 of file IndexIntoFile.cc.

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

1430  {
1431 
1432  lumis.clear();
1433 
1434  if (type_ == kEnd) return;
1435 
1436  LuminosityBlockNumber_t previousLumi = invalidLumi;
1437 
1438  for (int i = 1; (i + indexToRun_) < size_; ++i) {
1439  int index = i + indexToRun_;
1440  EntryType entryType = getRunOrLumiEntryType(index);
1441 
1442  if(entryType == kRun) {
1443  if(isSameRun(indexToRun_, index)) {
1444  continue;
1445  } else {
1446  break;
1447  }
1448  } else {
1449  LuminosityBlockNumber_t luminosityBlock = lumi(index);
1450  if (luminosityBlock != invalidLumi &&
1451  luminosityBlock != previousLumi) {
1452  lumis.push_back(luminosityBlock);
1453  previousLumi = luminosityBlock;
1454  }
1455  }
1456  }
1457  std::sort(lumis.begin(), lumis.end());
1458  lumis.erase(std::unique(lumis.begin(), lumis.end()), lumis.end());
1459  }
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:25
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 577 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().

577 { 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 1397 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().

1397  {
1398  initializeLumi_();
1399  //See if entry number is invalid, this can happen if events from
1400  // different lumis overlap when doing concurrent lumi processing
1401  auto oldLumi = lumi();
1402  while( not lumiEntryValid(indexToLumi_) ) {
1403  ++indexToLumi_;
1404  }
1405  assert(oldLumi == lumi());
1406  }
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 1372 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().

1372  {
1373 
1376  indexToEvent_ = 0;
1377  nEvents_ = 0;
1378 
1379  for(int i = 1; (i + indexToRun_) < size_; ++i) {
1381  bool sameRun = isSameRun(indexToRun_, indexToRun_ + i);
1382 
1383  if(entryType == kRun) {
1384  if(sameRun) {
1385  continue;
1386  } else {
1387  break;
1388  }
1389  } else {
1391  initializeLumi();
1392  return;
1393  }
1394  }
1395  }
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 1039 of file IndexIntoFile.cc.

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

1039  {
1040 
1041  if(type_ == kEvent) {
1042  if((indexToEvent_ + 1) < nEvents_) {
1043  ++indexToEvent_;
1044  } else {
1045  bool found = nextEventRange();
1046 
1047  if(!found) {
1049 
1050  if(type_ == kLumi) {
1051  ++indexToLumi_;
1052  initializeLumi();
1053  } else if(type_ == kRun) {
1054  indexToRun_ = indexToLumi_ + 1;
1055  initializeRun();
1056  } else {
1057  setInvalid(); // type_ is kEnd
1058  }
1059  }
1060  }
1061  } else if(type_ == kLumi) {
1062 
1063  if(indexToLumi_ + 1 == size_) {
1064  if(indexToEvent_ < nEvents_) {
1065  type_ = kEvent;
1066  } else {
1067  setInvalid();
1068  }
1069  } else {
1070 
1072 
1073  if(nextType == kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
1074  ++indexToLumi_;
1075  } else if(indexToEvent_ < nEvents_) {
1076  type_ = kEvent;
1077  } else if(nextType == kRun) {
1078  type_ = kRun;
1079  indexToRun_ = indexToLumi_ + 1;
1080  initializeRun();
1081  } else {
1082  ++indexToLumi_;
1083  initializeLumi();
1084  }
1085  }
1086  } else if(type_ == kRun) {
1088  bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
1089  if(nextType == kRun && sameRun) {
1090  ++indexToRun_;
1091  } else if(nextType == kRun && !sameRun) {
1092  ++indexToRun_;
1093  initializeRun();
1094  } else if(nextType == kLumi) {
1095  type_ = kLumi;
1096  } else {
1097  setInvalid();
1098  }
1099  }
1100  }
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 1408 of file IndexIntoFile.cc.

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

1408  {
1409  return (indexIntoFile_ == right.indexIntoFile_ &&
1410  size_ == right.size_ &&
1411  type_ == right.type_ &&
1412  indexToRun_ == right.indexToRun_ &&
1413  indexToLumi_ == right.indexToLumi_ &&
1414  indexToEventRange_ == right.indexToEventRange_ &&
1415  indexToEvent_ == right.indexToEvent_ &&
1416  nEvents_ == right.nEvents_);
1417  }
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 1195 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().

1195  {
1196  // Find the correct place to start the search
1197  int newLumi = indexToLumi();
1198  if(newLumi == invalidIndex) {
1199  newLumi = indexToRun() == invalidIndex ? size() - 1 : indexToRun();
1200  } else {
1201  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1202  isSameLumi(newLumi, newLumi - 1)) {
1203  --newLumi;
1204  }
1205  --newLumi;
1206  }
1207  if(newLumi <= 0) return false;
1208 
1209  // Look backwards for a lumi with events
1210  for( ; newLumi > 0; --newLumi) {
1211  if(getRunOrLumiEntryType(newLumi) == kRun) {
1212  continue;
1213  }
1214  if(setToLastEventInRange(newLumi)) {
1215  break; // found it
1216  }
1217  }
1218  if(newLumi == 0) return false;
1219 
1220  // Finish initializing the iterator
1221  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1222  isSameLumi(newLumi, newLumi - 1) &&
1223  lumiEntryValid(newLumi - 1)) {
1224  --newLumi;
1225  }
1226  setIndexToLumi(newLumi);
1227 
1228  if(type() != kEnd &&
1229  isSameRun(newLumi, indexToRun())) {
1230  if(type() == kEvent) type_ = kLumi;
1231  return true;
1232  }
1233  int newRun = newLumi;
1234  while(newRun > 0 && getRunOrLumiEntryType(newRun - 1) == kLumi) {
1235  --newRun;
1236  }
1237  --newRun;
1238  assert(getRunOrLumiEntryType(newRun) == kRun);
1239  while(getRunOrLumiEntryType(newRun - 1) == kRun &&
1240  isSameRun(newRun - 1, newLumi)) {
1241  --newRun;
1242  }
1243  indexToRun_ = newRun;
1244  type_ = kRun;
1245  return true;
1246  }
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 1158 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_.

1161  {
1162  // Look for previous events in the current lumi
1163  if(indexToEvent_ > 0) {
1164  --indexToEvent_;
1165  } else if(!previousEventRange()) {
1166 
1167  // Look for previous events in previous lumis
1168  if(!previousLumiWithEvents()) {
1169 
1170  // If we get here there are no previous events in the file
1171 
1172  if(!indexIntoFile_->empty()) {
1173  // Set the iterator to the beginning of the file
1174  type_ = kRun;
1175  indexToRun_ = 0;
1176  initializeRun();
1177  }
1178  phIndexOfEvent = invalidIndex;
1179  runOfEvent = invalidRun;
1180  lumiOfEvent = invalidLumi;
1181  eventEntry = invalidEntry;
1182  return;
1183  }
1184  }
1185  // Found a previous event and we have set the iterator so that this event
1186  // will be the next event process. (There may or may not be a run and/or
1187  // a lumi processed first).
1188  // Return information about this event
1189  phIndexOfEvent = processHistoryIDIndex();
1190  runOfEvent = run();
1191  lumiOfEvent = peekAheadAtLumi();
1192  eventEntry = peekAheadAtEventEntry();
1193  }
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 1102 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_.

1105  {
1106  if(indexToEvent_ < nEvents_) {
1107  phIndexOfSkippedEvent = processHistoryIDIndex();
1108  runOfSkippedEvent = run();
1109  lumiOfSkippedEvent = peekAheadAtLumi();
1110  skippedEventEntry = peekAheadAtEventEntry();
1111 
1112  if((indexToEvent_ + 1) < nEvents_) {
1113  ++indexToEvent_;
1114  return;
1115  } else if(nextEventRange()) {
1116  return;
1117  } else if(type_ == kRun || type_ == kLumi) {
1118  if(skipLumiInRun()) {
1119  return;
1120  }
1121  } else if(type_ == kEvent) {
1122  next();
1123  return;
1124  }
1125  advanceToNextRun();
1126  return;
1127  }
1128 
1129  if(type_ == kRun) {
1130  while(skipLumiInRun()) {
1131  if(indexToEvent_ < nEvents_) {
1132  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1133  return;
1134  }
1135  }
1136  }
1137 
1138  while(indexToEvent_ >= nEvents_ && type_ != kEnd) {
1139  while(skipLumiInRun()) {
1140  if(indexToEvent_ < nEvents_) {
1141  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1142  return;
1143  }
1144  }
1145  advanceToNextRun();
1146  }
1147  if(type_ == kEnd) {
1148  phIndexOfSkippedEvent = invalidIndex;
1149  runOfSkippedEvent = invalidRun;
1150  lumiOfSkippedEvent = invalidLumi;
1151  skippedEventEntry = invalidEntry;
1152  return;
1153  }
1154  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1155  return;
1156  }
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 1363 of file IndexIntoFile.cc.

References indexToEvent_, nEvents_, and nextEventRange().

1363  {
1364  if(indexToEvent_ >= nEvents_) return false;
1365  if((indexToEvent_ + 1) < nEvents_) {
1366  ++indexToEvent_;
1367  return true;
1368  }
1369  return nextEventRange();
1370  }
EntryType edm::IndexIntoFile::IndexIntoFileItrImpl::type ( ) const
inline

Member Data Documentation

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

Definition at line 613 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 619 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