CMS 3D CMS Logo

IndexIntoFile.cc
Go to the documentation of this file.
5 
6 #include <algorithm>
7 #include <iomanip>
8 #include <ostream>
9 
10 namespace edm {
11 
17 
18  IndexIntoFile::Transients::Transients() : previousAddedIndex_(invalidIndex),
19  runToOrder_(),
20  lumiToOrder_(),
21  beginEvents_(invalidEntry),
22  endEvents_(invalidEntry),
23  currentIndex_(invalidIndex),
24  currentRun_(invalidRun),
25  currentLumi_(invalidLumi),
26  numberOfEvents_(0),
27  eventFinder_(),
28  runOrLumiIndexes_(),
29  eventNumbers_(),
30  eventEntries_(),
31  unsortedEventNumbers_() {
32  }
33 
34  void
37  runToOrder_.clear();
38  lumiToOrder_.clear();
44  numberOfEvents_ = 0;
45  eventFinder_ = nullptr; // propagate_const<T> has no reset() function
46  runOrLumiIndexes_.clear();
47  eventNumbers_.clear();
48  eventEntries_.clear();
49  unsortedEventNumbers_.clear();
50  }
51 
55  }
56 
58  }
59 
61  return processHistoryIDs_.at(i);
62  }
63 
64  std::vector<ProcessHistoryID> const& IndexIntoFile::processHistoryIDs() const {
65  return processHistoryIDs_;
66  }
67 
68  void
70  // assign each lumi an order value sequentially when first seen
71  std::pair<IndexRunLumiKey, EntryNumber_t> keyAndOrder(IndexRunLumiKey(index, run, lumi), lumiToOrder().size());
72  lumiToOrder().insert(keyAndOrder); // does nothing if this key already was inserted
73  runOrLumiEntries_.emplace_back(
75  lumiToOrder()[IndexRunLumiKey(index, run, lumi)],
76  entry, index,
77  run, lumi,
78  beginEvents(), endEvents());
81 
82  }
83 
84  void
90  int index = 0;
91  // First see if the ProcessHistoryID is the same as the previous one.
92  // This is just a performance optimization. We expect to usually get
93  // many in a row that are the same.
95  processHistoryID == processHistoryIDs_[previousAddedIndex()]) {
96  index = previousAddedIndex();
97  } else {
98  // If it was not the same as the previous one then search through the
99  // entire vector. If it is not there, it needs to be added at the
100  // end.
101  index = 0;
102  while(index < static_cast<int>(processHistoryIDs_.size()) &&
103  processHistoryIDs_[index] != processHistoryID) {
104  ++index;
105  }
106  if(index == static_cast<int>(processHistoryIDs_.size())) {
107  processHistoryIDs_.push_back(processHistoryID);
108  }
109  }
111 
112  assert((currentRun() == run && currentIndex() == index) || currentRun() == invalidRun);
113  if(lumi == invalidLumi) {
114  if(currentLumi() != invalidLumi) {
116  << "In IndexIntoFile::addEntry. Entries were added in illegal order.\n"
117  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
118  << "The output file will be unusable for most purposes.\n"
119  << "If this occurs after an unrelated exception was thrown in\n"
120  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
121  << "the primary exception. This is an expected side effect.\n"
122  << "Otherwise please report this to the core framework developers\n";
123  }
127  // assign each run an order value when first seen (using entry but any increasing value would work)
128  std::pair<IndexRunKey, EntryNumber_t> keyAndOrder(IndexRunKey(index, run), entry);
129  runToOrder().insert(keyAndOrder); // Does nothing if this key was already inserted
130  runOrLumiEntries_.emplace_back(runToOrder()[IndexRunKey(index, run)], invalidEntry, entry, index, run, lumi, invalidEntry, invalidEntry);
131  } else {
132  if(currentRun() == invalidRun) {
133  currentRun() = run;
134  currentIndex() = index;
135  }
136  if(event == invalidEvent) {
137  if(currentLumi() != lumi and currentLumi() != invalidLumi) {
138  //we have overlapping lumis so must inject a placeholder
139  addLumi(index,run,currentLumi(),invalidEntry);
140  }
142  addLumi(index,run,lumi,entry);
143  } else {
144  if(currentLumi() != lumi and currentLumi() != invalidLumi) {
145  //We have overlapping lumis so need to inject a placeholder
146  addLumi(index,run,currentLumi(),invalidEntry);
147  }
149  if(beginEvents() == invalidEntry) {
150  currentLumi() = lumi;
151  beginEvents() = entry;
152  endEvents() = beginEvents() + 1;
153  }
154  else {
155  assert(currentLumi() == lumi);
156  assert(entry == endEvents());
157  ++endEvents();
158  }
159  }
160  }
161  }
162 
164  if(runOrLumiEntries_.empty() || !runOrLumiIndexes().empty()) {
165  return;
166  }
167  runOrLumiIndexes().reserve(runOrLumiEntries_.size());
168 
169  int index = 0;
170  for(RunOrLumiEntry const& item : runOrLumiEntries_) {
171  runOrLumiIndexes().emplace_back(item.processHistoryIDIndex(),
172  item.run(),
173  item.lumi(),
174  index);
175  ++index;
176  }
178 
179  long long beginEventNumbers = 0;
180 
181  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
182  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
183  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
184  while(true) {
185  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
186  ++beginOfLumi;
187  }
188  if(beginOfLumi == iEnd) break;
189 
190  endOfLumi = beginOfLumi + 1;
191  while(endOfLumi != iEnd &&
192  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
193  beginOfLumi->run() == endOfLumi->run() &&
194  beginOfLumi->lumi() == endOfLumi->lumi()) {
195  ++endOfLumi;
196  }
197  int nEvents = 0;
198  for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
199  iter != endOfLumi;
200  ++iter) {
201  if(runOrLumiEntries_[iter->indexToGetEntry()].beginEvents() != invalidEntry) {
202  nEvents += runOrLumiEntries_[iter->indexToGetEntry()].endEvents() -
203  runOrLumiEntries_[iter->indexToGetEntry()].beginEvents();
204  }
205  }
206  for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
207  iter != endOfLumi;
208  ++iter) {
209  iter->setBeginEventNumbers(beginEventNumbers);
210  iter->setEndEventNumbers(beginEventNumbers + nEvents);
211  }
212  beginEventNumbers += nEvents;
213  beginOfLumi = endOfLumi;
214  }
215  assert(runOrLumiIndexes().size() == runOrLumiEntries_.size());
216  }
217 
218  void
220  fillEventNumbersOrEntries(true, false);
221  }
222 
223  void
225  fillEventNumbersOrEntries(false, true);
226  }
227 
228  void
229  IndexIntoFile::fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const {
230  if(numberOfEvents() == 0) {
231  return;
232  }
233 
234  if(needEventNumbers && !eventNumbers().empty()) {
235  needEventNumbers = false;
236  }
237 
238  if(needEventEntries && !eventEntries().empty()) {
239  needEventEntries = false;
240  }
241 
242  if(needEventNumbers && !eventEntries().empty()) {
243  assert(numberOfEvents() == eventEntries().size());
244  eventNumbers().reserve(eventEntries().size());
246  eventNumbers().push_back(eventEntries()[entry].event());
247  }
248  return;
249  }
250 
251  if(!needEventNumbers && !needEventEntries) {
252  return;
253  }
254 
256 
257  if(needEventNumbers) {
258  eventNumbers().resize(numberOfEvents(), IndexIntoFile::invalidEvent);
259  }
260  if(needEventEntries) {
261  eventEntries().resize(numberOfEvents());
262  }
263 
264  long long offset = 0;
265  long long previousBeginEventNumbers = -1LL;
266 
267  for(SortedRunOrLumiItr runOrLumi = beginRunOrLumi(), runOrLumiEnd = endRunOrLumi();
268  runOrLumi != runOrLumiEnd; ++runOrLumi) {
269 
270  if(runOrLumi.isRun()) continue;
271 
272  long long beginEventNumbers = 0;
273  long long endEventNumbers = 0;
274  EntryNumber_t beginEventEntry = invalidEntry;
275  EntryNumber_t endEventEntry = invalidEntry;
276  runOrLumi.getRange(beginEventNumbers, endEventNumbers, beginEventEntry, endEventEntry);
277 
278  // This is true each time one hits a new lumi section (except if the previous lumi had
279  // no events, in which case the offset is still 0 anyway)
280  if(beginEventNumbers != previousBeginEventNumbers) offset = 0;
281 
282  for(EntryNumber_t entry = beginEventEntry; entry != endEventEntry; ++entry) {
283  if(needEventNumbers) {
284  eventNumbers().at((entry - beginEventEntry) + offset + beginEventNumbers) = unsortedEventNumbers().at(entry);
285  }
286  if(needEventEntries) {
287  eventEntries().at((entry - beginEventEntry) + offset + beginEventNumbers) =
289  }
290  }
291 
292  previousBeginEventNumbers = beginEventNumbers;
293  offset += endEventEntry - beginEventEntry;
294  }
295  if(needEventNumbers) {
296  sortEvents();
297  assert(numberOfEvents() == eventNumbers().size());
298  }
299  if(needEventEntries) {
301  assert(numberOfEvents() == eventEntries().size());
302  }
303  }
304 
305  void
307  if(numberOfEvents() == 0 || !unsortedEventNumbers().empty()) {
308  return;
309  }
311 
312  // The main purpose for the existence of the unsortedEventNumbers
313  // vector is that it can easily be filled by reading through
314  // the EventAuxiliary branch in the same order as the TTree
315  // entries. fillEventNumbersOrEntries can then use this information
316  // instead of using getEventNumberOfEntry directly and reading
317  // the branch in a different order.
320  }
321  }
322 
323  // We are closing the input file, but we need to keep event numbers.
324  // We can delete the other transient collections by using the swap trick.
325 
326  void
328  std::vector<EventEntry>().swap(eventEntries());
329  std::vector<RunOrLumiIndexes>().swap(runOrLumiIndexes());
330  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
332  }
333 
334  void
336  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
337  }
338 
339  void
341 
342  std::vector<ProcessHistoryID> reducedPHIDs;
343 
344  std::map<ProcessHistoryID, int> reducedPHIDToIndex;
345  std::pair<ProcessHistoryID, int> mapEntry(ProcessHistoryID(), 0);
346  std::pair<std::map<ProcessHistoryID, int>::iterator, bool> insertResult;
347 
348  std::vector<int> phidIndexConverter;
349  for(auto const& phid : processHistoryIDs_) {
350 
351  ProcessHistoryID const& reducedPHID = processHistoryRegistry.reducedProcessHistoryID(phid);
352  mapEntry.first = reducedPHID;
353  insertResult = reducedPHIDToIndex.insert(mapEntry);
354 
355  if(insertResult.second) {
356  insertResult.first->second = reducedPHIDs.size();
357  reducedPHIDs.push_back(reducedPHID);
358  }
359  phidIndexConverter.push_back(insertResult.first->second);
360  }
361  processHistoryIDs_.swap(reducedPHIDs);
362 
363  // If the size of the vector of IDs does not change
364  // then their indexes and the ordering of the Runs and
365  // and Lumis does not change, so we are done.
366  if(processHistoryIDs_.size() == reducedPHIDs.size()) {
367  return;
368  }
369 
370  std::map<IndexIntoFile::IndexRunKey, int> runOrderMap;
371  std::pair<std::map<IndexIntoFile::IndexRunKey, int>::iterator, bool> runInsertResult;
372 
373  std::map<IndexIntoFile::IndexRunLumiKey, int> lumiOrderMap;
374  std::pair<std::map<IndexIntoFile::IndexRunLumiKey, int>::iterator, bool> lumiInsertResult;
375 
376  // loop over all the RunOrLumiEntry's
377  for(auto& item : runOrLumiEntries_) {
378 
379  // Convert the process history index so it points into the new vector of reduced IDs
380  item.setProcessHistoryIDIndex(phidIndexConverter.at(item.processHistoryIDIndex()));
381 
382  // Convert the phid-run order
383  IndexIntoFile::IndexRunKey runKey(item.processHistoryIDIndex(), item.run());
384  runInsertResult = runOrderMap.insert(std::pair<IndexIntoFile::IndexRunKey, int>(runKey,0));
385  if(runInsertResult.second) {
386  runInsertResult.first->second = item.orderPHIDRun();
387  } else {
388  item.setOrderPHIDRun(runInsertResult.first->second);
389  }
390 
391  // Convert the phid-run-lumi order for the lumi entries
392  if(item.lumi() != 0) {
393  IndexIntoFile::IndexRunLumiKey lumiKey(item.processHistoryIDIndex(), item.run(), item.lumi());
394  lumiInsertResult = lumiOrderMap.insert(std::pair<IndexIntoFile::IndexRunLumiKey, int>(lumiKey,0));
395  if(lumiInsertResult.second) {
396  lumiInsertResult.first->second = item.orderPHIDRunLumi();
397  } else {
398  item.setOrderPHIDRunLumi(lumiInsertResult.first->second);
399  }
400  }
401  }
402  std::stable_sort(runOrLumiEntries_.begin(), runOrLumiEntries_.end());
403  }
404 
405  void
406  IndexIntoFile::fixIndexes(std::vector<ProcessHistoryID> & processHistoryIDs) {
407 
408  std::map<int, int> oldToNewIndex;
409  for(std::vector<ProcessHistoryID>::const_iterator iter = processHistoryIDs_.begin(),
410  iEnd = processHistoryIDs_.end();
411  iter != iEnd;
412  ++iter) {
413  std::vector<ProcessHistoryID>::const_iterator iterExisting =
414  std::find(processHistoryIDs.begin(), processHistoryIDs.end(), *iter);
415  if(iterExisting == processHistoryIDs.end()) {
416  oldToNewIndex[iter - processHistoryIDs_.begin()] = processHistoryIDs.size();
417  processHistoryIDs.push_back(*iter);
418  } else {
419  oldToNewIndex[iter - processHistoryIDs_.begin()] = iterExisting - processHistoryIDs.begin();
420  }
421  }
423 
424  for(RunOrLumiEntry& item : runOrLumiEntries_) {
425  item.setProcessHistoryIDIndex(oldToNewIndex[item.processHistoryIDIndex()]);
426  }
427  }
428 
430  for(RunOrLumiEntry& item : runOrLumiEntries_) {
431  std::map<IndexRunKey, EntryNumber_t>::const_iterator keyAndOrder =
432  runToOrder().find(IndexRunKey(item.processHistoryIDIndex(), item.run()));
433  if(keyAndOrder == runToOrder().end()) {
435  << "In IndexIntoFile::sortVector_Run_Or_Lumi_Entries. A run entry is missing.\n"
436  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
437  << "The output file will be unusable for most purposes.\n"
438  << "If this occurs after an unrelated exception was thrown in\n"
439  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
440  << "the primary exception. This is an expected side effect.\n"
441  << "Otherwise please report this to the core framework developers\n";
442  }
443  item.setOrderPHIDRun(keyAndOrder->second);
444  }
445  stable_sort_all(runOrLumiEntries_);
446  }
447 
450  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
451  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
452  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
453  while(true) {
454  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
455  ++beginOfLumi;
456  }
457  if(beginOfLumi == iEnd) break;
458 
459  endOfLumi = beginOfLumi + 1;
460  while(endOfLumi != iEnd &&
461  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
462  beginOfLumi->run() == endOfLumi->run() &&
463  beginOfLumi->lumi() == endOfLumi->lumi()) {
464  ++endOfLumi;
465  }
466  assert(beginOfLumi->endEventNumbers() >= 0);
467  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventNumbers().size()));
468  std::sort(eventNumbers().begin() + beginOfLumi->beginEventNumbers(),
469  eventNumbers().begin() + beginOfLumi->endEventNumbers());
470  beginOfLumi = endOfLumi;
471  }
472  }
473 
476  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
477  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
478  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
479  while(true) {
480  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
481  ++beginOfLumi;
482  }
483  if(beginOfLumi == iEnd) break;
484 
485  endOfLumi = beginOfLumi + 1;
486  while(endOfLumi != iEnd &&
487  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
488  beginOfLumi->run() == endOfLumi->run() &&
489  beginOfLumi->lumi() == endOfLumi->lumi()) {
490  ++endOfLumi;
491  }
492  assert(beginOfLumi->endEventNumbers() >= 0);
493  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventEntries().size()));
494  std::sort(eventEntries().begin() + beginOfLumi->beginEventNumbers(),
495  eventEntries().begin() + beginOfLumi->endEventNumbers());
496  beginOfLumi = endOfLumi;
497  }
498  }
499 
501  if(empty()) {
502  return end(sortOrder);
503  }
504  IndexIntoFileItr iter(this,
505  sortOrder,
506  kRun,
507  0,
508  invalidIndex,
509  invalidIndex,
510  0,
511  0);
512  iter.initializeRun();
513  return iter;
514  }
515 
517  return IndexIntoFileItr(this,
518  sortOrder,
519  kEnd,
520  invalidIndex,
521  invalidIndex,
522  invalidIndex,
523  0,
524  0);
525  }
526 
528  EntryNumber_t maxEntry = invalidEntry;
529  for(IndexIntoFileItr it = begin(sortOrder), itEnd = end(sortOrder); it != itEnd; ++it) {
530  if(it.getEntryType() == kEvent) {
531  if(it.entry() < maxEntry) {
532  return false;
533  }
534  maxEntry = it.entry();
535  }
536  }
537  return true;
538  }
539 
540  bool IndexIntoFile::empty() const {
541  return runOrLumiEntries().empty();
542  }
543 
547 
548  bool lumiMissing = (lumi == 0 && event != 0);
549 
550  std::vector<RunOrLumiIndexes>::const_iterator it;
551  std::vector<RunOrLumiIndexes>::const_iterator iEnd = runOrLumiIndexes().end();
552  std::vector<RunOrLumiIndexes>::const_iterator phEnd;
553 
554  // Loop over ranges of entries with the same ProcessHistoryID
555  for(std::vector<RunOrLumiIndexes>::const_iterator phBegin = runOrLumiIndexes().begin();
556  phBegin != iEnd;
557  phBegin = phEnd) {
558 
559  RunOrLumiIndexes el(phBegin->processHistoryIDIndex(), run, lumi, 0);
560  phEnd = std::upper_bound(phBegin, iEnd, el, Compare_Index());
561 
562  std::vector<RunOrLumiIndexes>::const_iterator iRun = std::lower_bound(phBegin, phEnd, el, Compare_Index_Run());
563 
564  if(iRun == phEnd || iRun->run() != run) continue;
565 
566  if(lumi == invalidLumi && event == invalidEvent) {
567  IndexIntoFileItr indexItr(this,
569  kRun,
570  iRun - runOrLumiIndexes().begin(),
571  invalidIndex,
572  invalidIndex,
573  0,
574  0);
575  indexItr.initializeRun();
576  return indexItr;
577  }
578 
579  std::vector<RunOrLumiIndexes>::const_iterator iRunEnd = std::upper_bound(iRun, phEnd, el, Compare_Index_Run());
580  if(!lumiMissing) {
581 
582  std::vector<RunOrLumiIndexes>::const_iterator iLumi = std::lower_bound(iRun, iRunEnd, el);
583  if(iLumi == iRunEnd || iLumi->lumi() != lumi) continue;
584 
585  if(event == invalidEvent) {
586  IndexIntoFileItr indexItr(this,
588  kRun,
589  iRun - runOrLumiIndexes().begin(),
590  iLumi - runOrLumiIndexes().begin(),
591  invalidIndex,
592  0,
593  0);
594  indexItr.initializeLumi();
595  return indexItr;
596  }
597 
598  long long beginEventNumbers = iLumi->beginEventNumbers();
599  long long endEventNumbers = iLumi->endEventNumbers();
600  if(beginEventNumbers >= endEventNumbers) continue;
601 
602 
603  long long indexToEvent = 0;
604  if(!eventEntries().empty()) {
605  std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(eventEntries().begin() + beginEventNumbers,
606  eventEntries().begin() + endEventNumbers,
607  EventEntry(event, invalidEntry));
608  if(eventIter == (eventEntries().begin() + endEventNumbers) ||
609  eventIter->event() != event) continue;
610 
611  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
612  } else {
614  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(eventNumbers().begin() + beginEventNumbers,
615  eventNumbers().begin() + endEventNumbers,
616  event);
617  if(eventIter == (eventNumbers().begin() + endEventNumbers) ||
618  *eventIter != event) continue;
619 
620  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
621  }
622 
623  int newIndexToLumi = iLumi - runOrLumiIndexes().begin();
624  while (runOrLumiEntries_[runOrLumiIndexes()[newIndexToLumi].indexToGetEntry()].entry() == invalidEntry) {
625  ++newIndexToLumi;
626  assert(static_cast<unsigned>(newIndexToLumi) < runOrLumiEntries_.size());
627  assert(runOrLumiIndexes()[newIndexToLumi].lumi() == lumi);
628  }
629 
630  return IndexIntoFileItr(this,
632  kRun,
633  iRun - runOrLumiIndexes().begin(),
634  newIndexToLumi,
635  iLumi - runOrLumiIndexes().begin(),
636  indexToEvent,
637  endEventNumbers - beginEventNumbers);
638  }
639  if(lumiMissing) {
640 
641  std::vector<RunOrLumiIndexes>::const_iterator iLumi = iRun;
642  while(iLumi != iRunEnd && iLumi->lumi() == invalidLumi) {
643  ++iLumi;
644  }
645  if(iLumi == iRunEnd) continue;
646 
647  std::vector<RunOrLumiIndexes>::const_iterator lumiEnd;
648  for( ;
649  iLumi != iRunEnd;
650  iLumi = lumiEnd) {
651 
652  RunOrLumiIndexes elWithLumi(phBegin->processHistoryIDIndex(), run, iLumi->lumi(), 0);
653  lumiEnd = std::upper_bound(iLumi, iRunEnd, elWithLumi);
654 
655  long long beginEventNumbers = iLumi->beginEventNumbers();
656  long long endEventNumbers = iLumi->endEventNumbers();
657  if(beginEventNumbers >= endEventNumbers) continue;
658 
659  long long indexToEvent = 0;
660  if(!eventEntries().empty()) {
661  std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(eventEntries().begin() + beginEventNumbers,
662  eventEntries().begin() + endEventNumbers,
663  EventEntry(event, invalidEntry));
664  if(eventIter == (eventEntries().begin() + endEventNumbers) ||
665  eventIter->event() != event) continue;
666  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
667  } else {
669  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(eventNumbers().begin() + beginEventNumbers,
670  eventNumbers().begin() + endEventNumbers,
671  event);
672  if(eventIter == (eventNumbers().begin() + endEventNumbers) ||
673  *eventIter != event) continue;
674  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
675  }
676 
677  int newIndexToLumi = iLumi - runOrLumiIndexes().begin();
678  while (runOrLumiEntries_[runOrLumiIndexes()[newIndexToLumi].indexToGetEntry()].entry() == invalidEntry) {
679  ++newIndexToLumi;
680  assert(static_cast<unsigned>(newIndexToLumi) < runOrLumiEntries_.size());
681  assert(runOrLumiIndexes()[newIndexToLumi].lumi() == iLumi->lumi());
682  }
683 
684  return IndexIntoFileItr(this,
686  kRun,
687  iRun - runOrLumiIndexes().begin(),
688  newIndexToLumi,
689  iLumi - runOrLumiIndexes().begin(),
690  indexToEvent,
691  endEventNumbers - beginEventNumbers);
692  }
693  }
694  } // Loop over ProcessHistoryIDs
695 
696  return IndexIntoFileItr(this,
698  kEnd,
699  invalidIndex,
700  invalidIndex,
701  invalidIndex,
702  0,
703  0);
704 
705  }
706 
709  if(sortOrder == IndexIntoFile::numericalOrder) {
710  return findPosition(run, lumi, event); // a faster algorithm
711  }
712  IndexIntoFileItr itr = begin(sortOrder);
713  IndexIntoFileItr itrEnd = end(sortOrder);
714 
715  while(itr != itrEnd) {
716  if(itr.run() != run) {
717  itr.advanceToNextRun();
718  } else {
719  if(lumi == invalidLumi && event == invalidEvent) {
720  return itr;
721  } else if(lumi != invalidLumi && itr.peekAheadAtLumi() != lumi) {
722  if(!itr.skipLumiInRun()) {
723  itr.advanceToNextRun();
724  }
725  } else {
726  if(event == invalidEvent) {
727  return itr;
728  } else {
730  if(eventNumber == event) {
731  return itr;
732  } else {
733  if(!itr.skipToNextEventInLumi()) {
734  if(!itr.skipLumiInRun()) {
735  itr.advanceToNextRun();
736  }
737  }
738  }
739  }
740  }
741  }
742  }
743  return itrEnd;
744  }
745 
748  assert(event != invalidEvent);
749  IndexIntoFileItr iter = findPosition(run, lumi, event);
750  iter.advanceToEvent();
751  return iter;
752  }
753 
756  assert(lumi != invalidLumi);
757  IndexIntoFileItr iter = findPosition(run, lumi, 0U);
758  iter.advanceToLumi();
759  return iter;
760  }
761 
764  return findPosition(run, 0U, 0U);
765  }
766 
767  bool
769  return (event != 0) ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
770  }
771 
772  bool
774  return findEventPosition(run, lumi, event).getEntryType() != kEnd;
775  }
776 
777  bool
779  return findLumiPosition(run, lumi).getEntryType() != kEnd;
780  }
781 
782  bool
784  return findRunPosition(run).getEntryType() != kEnd;
785  }
786 
788  return SortedRunOrLumiItr(this, 0);
789  }
790 
792  return SortedRunOrLumiItr(this, runOrLumiEntries().size());
793  }
794 
796  std::set<IndexRunLumiEventKey> & intersection) const {
797 
798  if(empty() || indexIntoFile.empty()) return;
800  indexIntoFile.fillRunOrLumiIndexes();
801  RunOrLumiIndexes const& back1 = runOrLumiIndexes().back();
802  RunOrLumiIndexes const& back2 = indexIntoFile.runOrLumiIndexes().back();
803 
804  // Very quick decision if the run ranges in the two files do not overlap
805  if(back2 < runOrLumiIndexes().front()) return;
806  if(back1 < indexIntoFile.runOrLumiIndexes().front()) return;
807 
810 
811  SortedRunOrLumiItr iter2 = indexIntoFile.beginRunOrLumi();
812  SortedRunOrLumiItr iEnd2 = indexIntoFile.endRunOrLumi();
813 
814  // Quick decision if the lumi ranges in the two files do not overlap
815  while(iter1 != iEnd1 && iter1.isRun()) ++iter1;
816  if(iter1 == iEnd1) return;
817  if(back2 < iter1.runOrLumiIndexes()) return;
818 
819  while(iter2 != iEnd2 && iter2.isRun()) ++iter2;
820  if(iter2 == iEnd2) return;
821  if(back1 < iter2.runOrLumiIndexes()) return;
822 
823  RunOrLumiIndexes const* previousIndexes = nullptr;
824 
825  // Loop through the both IndexIntoFile objects and look for matching lumis
826  while(iter1 != iEnd1 && iter2 != iEnd2) {
827 
828  RunOrLumiIndexes const& indexes1 = iter1.runOrLumiIndexes();
829  RunOrLumiIndexes const& indexes2 = iter2.runOrLumiIndexes();
830  if(indexes1 < indexes2) {
831  ++iter1;
832  } else if(indexes2 < indexes1) {
833  ++iter2;
834  } else { // they are equal
835 
836  // Skip them if it is a run or the same lumi
837  if(indexes1.isRun() ||
838  (previousIndexes && !(*previousIndexes < indexes1))) {
839  ++iter1;
840  ++iter2;
841  } else {
842  previousIndexes = &indexes1;
843 
844  // Found a matching lumi, now look for matching events
845 
846  long long beginEventNumbers1 = indexes1.beginEventNumbers();
847  long long endEventNumbers1 = indexes1.endEventNumbers();
848 
849  long long beginEventNumbers2 = indexes2.beginEventNumbers();
850  long long endEventNumbers2 = indexes2.endEventNumbers();
851 
852  // there must be at least 1 event in each lumi for there to be any matches
853  if((beginEventNumbers1 >= endEventNumbers1) ||
854  (beginEventNumbers2 >= endEventNumbers2)) {
855  ++iter1;
856  ++iter2;
857  continue;
858  }
859 
860  if(!eventEntries().empty() && !indexIntoFile.eventEntries().empty()) {
861  std::vector<EventEntry> matchingEvents;
862  std::insert_iterator<std::vector<EventEntry> > insertIter(matchingEvents, matchingEvents.begin());
863  std::set_intersection(eventEntries().begin() + beginEventNumbers1,
864  eventEntries().begin() + endEventNumbers1,
865  indexIntoFile.eventEntries().begin() + beginEventNumbers2,
866  indexIntoFile.eventEntries().begin() + endEventNumbers2,
867  insertIter);
868  for(EventEntry const& entry : matchingEvents) {
869  intersection.insert(IndexRunLumiEventKey(indexes1.processHistoryIDIndex(),
870  indexes1.run(),
871  indexes1.lumi(),
872  entry.event()));
873  }
874  } else {
876  indexIntoFile.fillEventNumbers();
877  std::vector<EventNumber_t> matchingEvents;
878  std::insert_iterator<std::vector<EventNumber_t> > insertIter(matchingEvents, matchingEvents.begin());
879  std::set_intersection(eventNumbers().begin() + beginEventNumbers1,
880  eventNumbers().begin() + endEventNumbers1,
881  indexIntoFile.eventNumbers().begin() + beginEventNumbers2,
882  indexIntoFile.eventNumbers().begin() + endEventNumbers2,
883  insertIter);
884  for(EventNumber_t const& eventNumber : matchingEvents) {
885  intersection.insert(IndexRunLumiEventKey(indexes1.processHistoryIDIndex(),
886  indexes1.run(),
887  indexes1.lumi(),
888  eventNumber));
889  }
890  }
891  }
892  }
893  }
894  }
895 
897 
898  RunOrLumiIndexes const* previousIndexes = nullptr;
899 
900  for(SortedRunOrLumiItr iter = beginRunOrLumi(),
901  iEnd = endRunOrLumi();
902  iter != iEnd; ++iter) {
903 
904  RunOrLumiIndexes const& indexes = iter.runOrLumiIndexes();
905 
906  // Skip it if it is a run or the same lumi
907  if(indexes.isRun() ||
908  (previousIndexes && !(*previousIndexes < indexes))) {
909  continue;
910  }
911  previousIndexes = &indexes;
912 
913  long long beginEventNumbers = indexes.beginEventNumbers();
914  long long endEventNumbers = indexes.endEventNumbers();
915 
916  // there must be more than 1 event in the lumi for there to be any duplicates
917  if(beginEventNumbers + 1 >= endEventNumbers) continue;
918 
919  if(!eventEntries().empty()) {
920  std::vector<EventEntry>::iterator last = eventEntries().begin() + endEventNumbers;
921  if(std::adjacent_find(eventEntries().begin() + beginEventNumbers, last) != last) {
922  return true;
923  }
924  } else {
926  std::vector<EventNumber_t>::iterator last = eventNumbers().begin() + endEventNumbers;
927  if(std::adjacent_find(eventNumbers().begin() + beginEventNumbers, last) != last) {
928  return true;
929  }
930  }
931  }
932  return false;
933  }
934 
936  orderPHIDRun_(invalidEntry),
937  orderPHIDRunLumi_(invalidEntry),
938  entry_(invalidEntry),
939  processHistoryIDIndex_(invalidIndex),
940  run_(invalidRun),
941  lumi_(invalidLumi),
942  beginEvents_(invalidEntry),
943  endEvents_(invalidEntry) {
944  }
945 
954  orderPHIDRun_(orderPHIDRun),
955  orderPHIDRunLumi_(orderPHIDRunLumi),
956  entry_(entry),
957  processHistoryIDIndex_(processHistoryIDIndex),
958  run_(run),
959  lumi_(lumi),
960  beginEvents_(beginEvents),
961  endEvents_(endEvents) {
962  }
963 
967  int indexToGetEntry) :
968  processHistoryIDIndex_(processHistoryIDIndex),
969  run_(run),
970  lumi_(lumi),
971  indexToGetEntry_(indexToGetEntry),
972  beginEventNumbers_(-1),
973  endEventNumbers_(-1)
974  {
975  }
976 
977  IndexIntoFile::SortedRunOrLumiItr::SortedRunOrLumiItr(IndexIntoFile const* indexIntoFile, unsigned runOrLumi) :
978  indexIntoFile_(indexIntoFile), runOrLumi_(runOrLumi) {
979  assert(runOrLumi_ <= indexIntoFile_->runOrLumiEntries().size());
981  }
982 
984  return indexIntoFile_ == right.indexIntoFile() &&
985  runOrLumi_ == right.runOrLumi();
986  }
987 
989  return indexIntoFile_ != right.indexIntoFile() ||
990  runOrLumi_ != right.runOrLumi();
991  }
992 
994  if(runOrLumi_ != indexIntoFile_->runOrLumiEntries().size()) {
995  ++runOrLumi_;
996  }
997  return *this;
998  }
999 
1001  return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).lumi() == invalidLumi;
1002  }
1003 
1004  void IndexIntoFile::SortedRunOrLumiItr::getRange(long long & beginEventNumbers,
1005  long long & endEventNumbers,
1006  EntryNumber_t & beginEventEntry,
1007  EntryNumber_t & endEventEntry) {
1008  beginEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).beginEventNumbers();
1009  endEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).endEventNumbers();
1010 
1011  int indexToGetEntry = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).indexToGetEntry();
1012  beginEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).beginEvents();
1013  endEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).endEvents();
1014  }
1015 
1019  }
1020 
1022  EntryType entryType,
1023  int indexToRun,
1024  int indexToLumi,
1025  int indexToEventRange,
1026  long long indexToEvent,
1027  long long nEvents) :
1028  indexIntoFile_(indexIntoFile),
1029  size_(static_cast<int>(indexIntoFile_->runOrLumiEntries_.size())),
1030  type_(entryType),
1031  indexToRun_(indexToRun),
1032  indexToLumi_(indexToLumi),
1033  indexToEventRange_(indexToEventRange),
1034  indexToEvent_(indexToEvent),
1035  nEvents_(nEvents) {
1036  }
1037 
1039 
1041 
1042  if(type_ == kEvent) {
1043  if((indexToEvent_ + 1) < nEvents_) {
1044  ++indexToEvent_;
1045  } else {
1046  bool found = nextEventRange();
1047 
1048  if(!found) {
1050 
1051  if(type_ == kLumi) {
1052  ++indexToLumi_;
1053  initializeLumi();
1054  } else if(type_ == kRun) {
1055  indexToRun_ = indexToLumi_ + 1;
1056  initializeRun();
1057  } else {
1058  setInvalid(); // type_ is kEnd
1059  }
1060  }
1061  }
1062  } else if(type_ == kLumi) {
1063 
1064  if(indexToLumi_ + 1 == size_) {
1065  if(indexToEvent_ < nEvents_) {
1066  type_ = kEvent;
1067  } else {
1068  setInvalid();
1069  }
1070  } else {
1071 
1073 
1074  if(nextType == kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
1075  ++indexToLumi_;
1076  } else if(indexToEvent_ < nEvents_) {
1077  type_ = kEvent;
1078  } else if(nextType == kRun) {
1079  type_ = kRun;
1080  indexToRun_ = indexToLumi_ + 1;
1081  initializeRun();
1082  } else {
1083  ++indexToLumi_;
1084  initializeLumi();
1085  }
1086  }
1087  } else if(type_ == kRun) {
1089  bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
1090  if(nextType == kRun && sameRun) {
1091  ++indexToRun_;
1092  } else if(nextType == kRun && !sameRun) {
1093  ++indexToRun_;
1094  initializeRun();
1095  } else if(nextType == kLumi) {
1096  type_ = kLumi;
1097  } else {
1098  setInvalid();
1099  }
1100  }
1101  }
1102 
1104  RunNumber_t & runOfSkippedEvent,
1105  LuminosityBlockNumber_t & lumiOfSkippedEvent,
1106  EntryNumber_t & skippedEventEntry) {
1107  if(indexToEvent_ < nEvents_) {
1108  phIndexOfSkippedEvent = processHistoryIDIndex();
1109  runOfSkippedEvent = run();
1110  lumiOfSkippedEvent = peekAheadAtLumi();
1111  skippedEventEntry = peekAheadAtEventEntry();
1112 
1113  if((indexToEvent_ + 1) < nEvents_) {
1114  ++indexToEvent_;
1115  return;
1116  } else if(nextEventRange()) {
1117  return;
1118  } else if(type_ == kRun || type_ == kLumi) {
1119  if(skipLumiInRun()) {
1120  return;
1121  }
1122  } else if(type_ == kEvent) {
1123  next();
1124  return;
1125  }
1126  advanceToNextRun();
1127  return;
1128  }
1129 
1130  if(type_ == kRun) {
1131  while(skipLumiInRun()) {
1132  if(indexToEvent_ < nEvents_) {
1133  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1134  return;
1135  }
1136  }
1137  }
1138 
1139  while(indexToEvent_ >= nEvents_ && type_ != kEnd) {
1140  while(skipLumiInRun()) {
1141  if(indexToEvent_ < nEvents_) {
1142  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1143  return;
1144  }
1145  }
1146  advanceToNextRun();
1147  }
1148  if(type_ == kEnd) {
1149  phIndexOfSkippedEvent = invalidIndex;
1150  runOfSkippedEvent = invalidRun;
1151  lumiOfSkippedEvent = invalidLumi;
1152  skippedEventEntry = invalidEntry;
1153  return;
1154  }
1155  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1156  return;
1157  }
1158 
1160  RunNumber_t& runOfEvent,
1161  LuminosityBlockNumber_t& lumiOfEvent,
1162  EntryNumber_t& eventEntry) {
1163  // Look for previous events in the current lumi
1164  if(indexToEvent_ > 0) {
1165  --indexToEvent_;
1166  } else if(!previousEventRange()) {
1167 
1168  // Look for previous events in previous lumis
1169  if(!previousLumiWithEvents()) {
1170 
1171  // If we get here there are no previous events in the file
1172 
1173  if(!indexIntoFile_->empty()) {
1174  // Set the iterator to the beginning of the file
1175  type_ = kRun;
1176  indexToRun_ = 0;
1177  initializeRun();
1178  }
1179  phIndexOfEvent = invalidIndex;
1180  runOfEvent = invalidRun;
1181  lumiOfEvent = invalidLumi;
1182  eventEntry = invalidEntry;
1183  return;
1184  }
1185  }
1186  // Found a previous event and we have set the iterator so that this event
1187  // will be the next event process. (There may or may not be a run and/or
1188  // a lumi processed first).
1189  // Return information about this event
1190  phIndexOfEvent = processHistoryIDIndex();
1191  runOfEvent = run();
1192  lumiOfEvent = peekAheadAtLumi();
1193  eventEntry = peekAheadAtEventEntry();
1194  }
1195 
1197  // Find the correct place to start the search
1198  int newLumi = indexToLumi();
1199  if(newLumi == invalidIndex) {
1200  newLumi = indexToRun() == invalidIndex ? size() - 1 : indexToRun();
1201  } else {
1202  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1203  isSameLumi(newLumi, newLumi - 1)) {
1204  --newLumi;
1205  }
1206  --newLumi;
1207  }
1208  if(newLumi <= 0) return false;
1209 
1210  // Look backwards for a lumi with events
1211  for( ; newLumi > 0; --newLumi) {
1212  if(getRunOrLumiEntryType(newLumi) == kRun) {
1213  continue;
1214  }
1215  if(setToLastEventInRange(newLumi)) {
1216  break; // found it
1217  }
1218  }
1219  if(newLumi == 0) return false;
1220 
1221  // Finish initializing the iterator
1222  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1223  isSameLumi(newLumi, newLumi - 1) &&
1224  lumiEntryValid(newLumi - 1)) {
1225  --newLumi;
1226  }
1227  setIndexToLumi(newLumi);
1228 
1229  if(type() != kEnd &&
1230  isSameRun(newLumi, indexToRun())) {
1231  if(type() == kEvent) type_ = kLumi;
1232  return true;
1233  }
1234  int newRun = newLumi;
1235  while(newRun > 0 && getRunOrLumiEntryType(newRun - 1) == kLumi) {
1236  --newRun;
1237  }
1238  --newRun;
1239  assert(getRunOrLumiEntryType(newRun) == kRun);
1240  while(getRunOrLumiEntryType(newRun - 1) == kRun &&
1241  isSameRun(newRun - 1, newLumi)) {
1242  --newRun;
1243  }
1244  indexToRun_ = newRun;
1245  type_ = kRun;
1246  return true;
1247  }
1248 
1250  if(indexToLumi() == invalidIndex) return invalidEntry;
1251 
1252  int saveIndexToLumi = indexToLumi();
1253  int saveIndexToEventRange = indexToEventRange();
1254  long long saveIndexToEvent = indexToEvent();
1255  long long saveNEvents = nEvents();
1256 
1257  initializeRun();
1258 
1260 
1261  do {
1262  if(indexToEvent() < nEvents()) {
1263  returnValue = peekAheadAtEventEntry();
1264  break;
1265  }
1266  } while(skipLumiInRun());
1267 
1268  setIndexToLumi(saveIndexToLumi);
1269  setIndexToEventRange(saveIndexToEventRange);
1270  setIndexToEvent(saveIndexToEvent);
1271  setNEvents(saveNEvents);
1272 
1273  return returnValue;
1274  }
1275 
1277  if(indexToLumi() == invalidIndex) return invalidEntry;
1278 
1279  int saveIndexToLumi = indexToLumi();
1280  int saveIndexToEventRange = indexToEventRange();
1281  long long saveIndexToEvent = indexToEvent();
1282  long long saveNEvents = nEvents();
1283 
1284  for(int i = 1; indexToLumi() - i > 0; ++i) {
1285  if(getRunOrLumiEntryType(indexToLumi_ - i) == kRun) break;
1286  if(!isSameLumi(indexToLumi(), indexToLumi() - i)) break;
1288  }
1289  initializeLumi();
1290 
1292 
1293  if(indexToEvent() < nEvents()) {
1294  returnValue = peekAheadAtEventEntry();
1295  }
1296 
1297  setIndexToLumi(saveIndexToLumi);
1298  setIndexToEventRange(saveIndexToEventRange);
1299  setIndexToEvent(saveIndexToEvent);
1300  setNEvents(saveNEvents);
1301 
1302  return returnValue;
1303  }
1304 
1306  if(type_ == kEnd) return;
1307  for(int i = 1; indexToRun_ + i < size_; ++i) {
1309  if(!isSameRun(indexToRun_, indexToRun_ + i)) {
1310  type_ = kRun;
1311  indexToRun_ += i;
1312  initializeRun();
1313  return;
1314  }
1315  }
1316  }
1317  setInvalid();
1318  }
1319 
1321  if(type_ == kEnd) return;
1322  assert(indexToRun_ != invalidIndex);
1323 
1324  // A preliminary step is to advance to the last run entry for
1325  // this run (actually this step is not needed in the
1326  // context I expect this to be called in, just being careful)
1327  int startSearch = indexToRun_;
1328  for(int i = 1; startSearch + i < size_; ++i) {
1329  if(getRunOrLumiEntryType(startSearch + i) == kRun &&
1330  isSameRun(indexToRun_, startSearch + i)) {
1331  indexToRun_ = startSearch + i;
1332  } else {
1333  break;
1334  }
1335  }
1336 
1337  if(type_ == kRun && indexToLumi_ != invalidIndex) {
1338  type_ = kLumi;
1339  return;
1340  }
1341 
1342  startSearch = indexToLumi_;
1343  if(startSearch == invalidIndex) startSearch = indexToRun_;
1344  for(int i = 1; startSearch + i < size_; ++i) {
1345  if(getRunOrLumiEntryType(startSearch + i) == kRun) {
1346  if(!isSameRun(indexToRun_, startSearch + i)) {
1347  type_ = kRun;
1348  indexToRun_ = startSearch + i;
1349  initializeRun();
1350  return;
1351  }
1352  } else if(indexToLumi_ != invalidIndex) {
1353  if(!isSameLumi(indexToLumi_, startSearch + i)) {
1354  type_ = kLumi;
1355  indexToLumi_ = startSearch + i;
1356  initializeLumi();
1357  return;
1358  }
1359  }
1360  }
1361  setInvalid();
1362  }
1363 
1365  if(indexToEvent_ >= nEvents_) return false;
1366  if((indexToEvent_ + 1) < nEvents_) {
1367  ++indexToEvent_;
1368  return true;
1369  }
1370  return nextEventRange();
1371  }
1372 
1374 
1377  indexToEvent_ = 0;
1378  nEvents_ = 0;
1379 
1380  for(int i = 1; (i + indexToRun_) < size_; ++i) {
1382  bool sameRun = isSameRun(indexToRun_, indexToRun_ + i);
1383 
1384  if(entryType == kRun) {
1385  if(sameRun) {
1386  continue;
1387  } else {
1388  break;
1389  }
1390  } else {
1392  initializeLumi();
1393  return;
1394  }
1395  }
1396  }
1397 
1399  initializeLumi_();
1400  //See if entry number is invalid, this can happen if events from
1401  // different lumis overlap when doing concurrent lumi processing
1402  auto oldLumi = lumi();
1403  while( not lumiEntryValid(indexToLumi_) ) {
1404  ++indexToLumi_;
1405  }
1406  assert(oldLumi == lumi());
1407  }
1408 
1410  return (indexIntoFile_ == right.indexIntoFile_ &&
1411  size_ == right.size_ &&
1412  type_ == right.type_ &&
1413  indexToRun_ == right.indexToRun_ &&
1414  indexToLumi_ == right.indexToLumi_ &&
1416  indexToEvent_ == right.indexToEvent_ &&
1417  nEvents_ == right.nEvents_);
1418  }
1419 
1420  void
1422  type_ = position.type_;
1423  indexToRun_ = position.indexToRun_;
1424  indexToLumi_ = position.indexToLumi_;
1426  indexToEvent_ = position.indexToEvent_;
1427  nEvents_ = position.nEvents_;
1428  }
1429 
1431  type_ = kEnd;
1435  indexToEvent_ = 0;
1436  nEvents_ = 0;
1437  }
1438 
1440  EntryType entryType,
1441  int indexToRun,
1442  int indexToLumi,
1443  int indexToEventRange,
1444  long long indexToEvent,
1445  long long nEvents) :
1446  IndexIntoFileItrImpl(indexIntoFile,
1447  entryType,
1448  indexToRun,
1449  indexToLumi,
1450  indexToEventRange,
1451  indexToEvent,
1452  nEvents)
1453  {
1454  }
1455 
1458  return new IndexIntoFileItrNoSort(*this);
1459  }
1460 
1461  int
1463  if(type() == kEnd) return invalidIndex;
1464  return indexIntoFile()->runOrLumiEntries()[indexToRun()].processHistoryIDIndex();
1465  }
1466 
1468  if(type() == kEnd) return invalidRun;
1469  return indexIntoFile()->runOrLumiEntries()[indexToRun()].run();
1470  }
1471 
1473  if(type() == kEnd || type() == kRun) return invalidLumi;
1474  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1475  }
1476 
1478  if(type() == kEnd) return invalidEntry;
1479  if(type() == kRun) return indexIntoFile()->runOrLumiEntries()[indexToRun()].entry();
1480  if(type() == kLumi) return indexIntoFile()->runOrLumiEntries()[indexToLumi()].entry();
1481  return
1482  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1483  indexToEvent();
1484  }
1485 
1487  if(indexToLumi() == invalidIndex) return invalidLumi;
1488  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1489  }
1490 
1492  if(indexToLumi() == invalidIndex) return invalidEntry;
1493  if(indexToEvent() >= nEvents()) return invalidEntry;
1494  return
1495  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1496  indexToEvent();
1497  }
1498 
1500  assert(indexToLumi() != invalidIndex);
1501 
1503  setIndexToEvent(0);
1504  setNEvents(0);
1505 
1506  for(int i = 0; indexToLumi() + i < size(); ++i) {
1507  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].isRun()) {
1508  break;
1509  } else if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].lumi() ==
1510  indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1511  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].beginEvents() == invalidEntry) {
1512  continue;
1513  }
1515  setIndexToEvent(0);
1518  break;
1519  } else {
1520  break;
1521  }
1522  }
1523  }
1524 
1526  if(indexToEventRange() == invalidIndex) return false;
1527 
1528  // Look for the next event range, same lumi but different entry
1529  for(int i = 1; indexToEventRange() + i < size(); ++i) {
1530  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i ].isRun()) {
1531  return false; // hit next run
1532  } else if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].lumi() ==
1534  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].beginEvents() == invalidEntry) {
1535  continue; // same lumi but has no events, keep looking
1536  }
1538  setIndexToEvent(0);
1541  return true; // found more events in this lumi
1542  }
1543  return false; // hit next lumi
1544  }
1545  return false; // hit the end of the IndexIntoFile
1546  }
1547 
1549  if(indexToEventRange() == invalidIndex) return false;
1550  assert(indexToEventRange() < size());
1551 
1552  // Look backward for a previous event range with events, same lumi but different entry
1553  for(int i = 1; indexToEventRange() - i > 0; ++i) {
1554  int newRange = indexToEventRange() - i;
1555  if(indexIntoFile()->runOrLumiEntries()[newRange].isRun()) {
1556  return false; // hit run
1557  } else if(isSameLumi(newRange, indexToEventRange())) {
1558  if(indexIntoFile()->runOrLumiEntries()[newRange].beginEvents() == invalidEntry) {
1559  continue; // same lumi but has no events, keep looking
1560  }
1561  setIndexToEventRange(newRange);
1564  setIndexToEvent(nEvents() - 1);
1565  return true; // found previous event in this lumi
1566  }
1567  return false; // hit previous lumi
1568  }
1569  return false; // hit the beginning of the IndexIntoFile, 0th entry has to be a run
1570  }
1571 
1574  return false;
1575  }
1576  setIndexToEventRange(index);
1579  assert(nEvents() > 0);
1580  setIndexToEvent(nEvents() - 1);
1581  return true;
1582  }
1583 
1585  if(indexToLumi() == invalidIndex) return false;
1586  for(int i = 1; indexToLumi() + i < size(); ++i) {
1587  int newLumi = indexToLumi() + i;
1588  if(indexIntoFile()->runOrLumiEntries()[newLumi].isRun()) {
1589  return false; // hit next run
1590  } else if(indexIntoFile()->runOrLumiEntries()[newLumi].lumi() ==
1592  continue;
1593  }
1594  setIndexToLumi(newLumi);
1595  initializeLumi();
1596  return true; // hit next lumi
1597  }
1598  return false; // hit the end of the IndexIntoFile
1599  }
1600 
1602  return indexIntoFile()->runOrLumiEntries()[index].entry() != invalidEntry;
1603  }
1604 
1606  if(index < 0 || index >= size()) {
1607  return kEnd;
1608  } else if(indexIntoFile()->runOrLumiEntries()[index].isRun()) {
1609  return kRun;
1610  }
1611  return kLumi;
1612  }
1613 
1614  bool IndexIntoFile::IndexIntoFileItrNoSort::isSameLumi(int index1, int index2) const {
1615  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1616  return false;
1617  }
1618  return indexIntoFile()->runOrLumiEntries()[index1].lumi() ==
1619  indexIntoFile()->runOrLumiEntries()[index2].lumi();
1620  }
1621 
1622  bool IndexIntoFile::IndexIntoFileItrNoSort::isSameRun(int index1, int index2) const {
1623  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1624  return false;
1625  }
1626  return indexIntoFile()->runOrLumiEntries()[index1].run() ==
1627  indexIntoFile()->runOrLumiEntries()[index2].run() &&
1628  indexIntoFile()->runOrLumiEntries()[index1].processHistoryIDIndex() ==
1629  indexIntoFile()->runOrLumiEntries()[index2].processHistoryIDIndex();
1630  }
1631 
1633  EntryType entryType,
1634  int indexToRun,
1635  int indexToLumi,
1636  int indexToEventRange,
1637  long long indexToEvent,
1638  long long nEvents) :
1639  IndexIntoFileItrImpl(indexIntoFile,
1640  entryType,
1641  indexToRun,
1642  indexToLumi,
1643  indexToEventRange,
1644  indexToEvent,
1645  nEvents) {
1646  indexIntoFile->fillRunOrLumiIndexes();
1647  }
1648 
1650  return new IndexIntoFileItrSorted(*this);
1651  }
1652 
1654  if(type() == kEnd) return invalidIndex;
1655  return indexIntoFile()->runOrLumiIndexes()[indexToRun()].processHistoryIDIndex();
1656  }
1657 
1659  if(type() == kEnd) return invalidRun;
1660  return indexIntoFile()->runOrLumiIndexes()[indexToRun()].run();
1661  }
1662 
1664  if(type() == kEnd || type() == kRun) return invalidLumi;
1665  return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1666  }
1667 
1669  if(type() == kEnd) return invalidEntry;
1670  if(type() == kRun) {
1671  int i = indexIntoFile()->runOrLumiIndexes()[indexToRun()].indexToGetEntry();
1672  return indexIntoFile()->runOrLumiEntries()[i].entry();
1673  }
1674  if(type() == kLumi) {
1675  int i = indexIntoFile()->runOrLumiIndexes()[indexToLumi()].indexToGetEntry();
1676  return indexIntoFile()->runOrLumiEntries()[i].entry();
1677  }
1678  long long eventNumberIndex =
1679  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1680  indexToEvent();
1682  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1683  }
1684 
1686  if(indexToLumi() == invalidIndex) return invalidLumi;
1687  return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1688  }
1689 
1691  if(indexToLumi() == invalidIndex) return invalidEntry;
1692  if(indexToEvent() >= nEvents()) return invalidEntry;
1693  long long eventNumberIndex =
1694  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1695  indexToEvent();
1697  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1698  }
1699 
1701  assert(indexToLumi() != invalidIndex);
1703  setIndexToEvent(0);
1704  setNEvents(
1705  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].endEventNumbers() -
1706  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].beginEventNumbers());
1707  if(nEvents() == 0){
1709  }
1710  }
1711 
1713  return false;
1714  }
1715 
1717  return false;
1718  }
1719 
1721  long long nEventsInRange =
1722  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1723  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers();
1724  if(nEventsInRange == 0) {
1725  return false;
1726  }
1727  while(index > 0 &&
1728  !indexIntoFile()->runOrLumiIndexes()[index - 1].isRun() &&
1729  isSameLumi(index, index - 1)) {
1730  --index;
1731  }
1732  assert(nEventsInRange ==
1733  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1734  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers());
1735 
1736  setIndexToEventRange(index);
1737  setNEvents(nEventsInRange);
1738  assert(nEvents() > 0);
1739  setIndexToEvent(nEventsInRange - 1);
1740  return true;
1741  }
1742 
1744  if(indexToLumi() == invalidIndex) return false;
1745  for(int i = 1; indexToLumi() + i < size(); ++i) {
1746  int newLumi = indexToLumi() + i;
1747  if(indexIntoFile()->runOrLumiIndexes()[newLumi].isRun()) {
1748  return false; // hit next run
1749  } else if(indexIntoFile()->runOrLumiIndexes()[newLumi].lumi() ==
1751  continue;
1752  }
1753  setIndexToLumi(newLumi);
1754  initializeLumi();
1755  return true; // hit next lumi
1756  }
1757  return false; // hit the end of the IndexIntoFile
1758  }
1759 
1761  return indexIntoFile()->runOrLumiEntries()[indexIntoFile()->runOrLumiIndexes()[index].indexToGetEntry()].entry() != invalidEntry;
1762  }
1763 
1765  if(index < 0 || index >= size()) {
1766  return kEnd;
1767  } else if(indexIntoFile()->runOrLumiIndexes()[index].isRun()) {
1768  return kRun;
1769  }
1770  return kLumi;
1771  }
1772 
1773  bool IndexIntoFile::IndexIntoFileItrSorted::isSameLumi(int index1, int index2) const {
1774  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1775  return false;
1776  }
1777  return indexIntoFile()->runOrLumiIndexes()[index1].lumi() ==
1778  indexIntoFile()->runOrLumiIndexes()[index2].lumi();
1779  }
1780 
1781  bool IndexIntoFile::IndexIntoFileItrSorted::isSameRun(int index1, int index2) const {
1782  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1783  return false;
1784  }
1785  return indexIntoFile()->runOrLumiIndexes()[index1].run() ==
1786  indexIntoFile()->runOrLumiIndexes()[index2].run() &&
1787  indexIntoFile()->runOrLumiIndexes()[index1].processHistoryIDIndex() ==
1788  indexIntoFile()->runOrLumiIndexes()[index2].processHistoryIDIndex();
1789  }
1790 
1792  SortOrder sortOrder,
1793  EntryType entryType,
1794  int indexToRun,
1795  int indexToLumi,
1796  int indexToEventRange,
1797  long long indexToEvent,
1798  long long nEvents) :
1799  impl_() {
1800  if(sortOrder == numericalOrder) {
1802  entryType,
1803  indexToRun,
1804  indexToLumi,
1805  indexToEventRange,
1806  indexToEvent,
1807  nEvents
1808  ));
1809  swap(temp, impl_);
1810  } else {
1812  entryType,
1813  indexToRun,
1814  indexToLumi,
1815  indexToEventRange,
1816  indexToEvent,
1817  nEvents));
1818  swap(temp, impl_);
1819  }
1820  }
1821 
1823  for(EntryType entryType = getEntryType();
1824  entryType != kEnd && entryType != kEvent;
1825  entryType = getEntryType()) {
1826  impl_->next();
1827  }
1828  }
1829 
1831  for(EntryType entryType = getEntryType();
1832  entryType != kEnd && entryType != kLumi;
1833  entryType = getEntryType()) {
1834  impl_->next();
1835  }
1836  }
1837 
1838  void
1840  impl_->copyPosition(*position.impl_);
1841  }
1842 
1844  if(lh.processHistoryIDIndex() == rh.processHistoryIDIndex()) {
1845  return lh.run() < rh.run();
1846  }
1847  return lh.processHistoryIDIndex() < rh.processHistoryIDIndex();
1848  }
1849 
1851  return lh.processHistoryIDIndex() < rh.processHistoryIDIndex();
1852  }
1853 }
void initializeRun()
Should only be used internally and for tests.
size
Write out results.
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
RunNumber_t & currentRun() const
virtual bool isSameLumi(int index1, int index2) const =0
EntryNumber_t peekAheadAtEventEntry() const
bool isSameLumi(int index1, int index2) const override
EntryNumber_t endEvents() const
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
IndexIntoFileItrImpl * clone() const override
LuminosityBlockNumber_t currentLumi_
bool isSameRun(int index1, int index2) const override
void addLumi(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EntryNumber_t entry)
std::vector< EventEntry > & eventEntries() const
Definition: Hash.h:43
EntryNumber_t beginEvents() const
EntryNumber_t entry() const override
std::vector< EventNumber_t > eventNumbers_
virtual bool setToLastEventInRange(int index)=0
SortedRunOrLumiItr beginRunOrLumi() const
bool empty() const
True if no runs, lumis, or events are in the file.
LuminosityBlockNumber_t & currentLumi() const
bool isSameLumi(int index1, int index2) const override
bool operator==(SortedRunOrLumiItr const &right) const
unsigned long long EventNumber_t
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void sortEvents() const
void fillUnsortedEventNumbers() const
EntryNumber_t peekAheadAtEventEntry() const override
IndexIntoFileItr begin(SortOrder sortOrder) const
void swap(Hash< I > &other)
Definition: Hash.h:210
LuminosityBlockNumber_t lumi() const
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToOrder() const
bool int lh
Definition: SIMDVec.h:21
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
LuminosityBlockNumber_t peekAheadAtLumi() const override
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
EntryNumber_t orderPHIDRun() const
std::vector< EventNumber_t > unsortedEventNumbers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EntryNumber_t entry() const override
virtual LuminosityBlockNumber_t lumi() const =0
uint16_t size_type
unsigned int LuminosityBlockNumber_t
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
std::vector< ProcessHistoryID > const & processHistoryIDs() const
static constexpr EventNumber_t invalidEvent
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
virtual bool lumiEntryValid(int index) const =0
std::map< IndexRunLumiKey, EntryNumber_t > lumiToOrder_
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
virtual bool isSameRun(int index1, int index2) const =0
int & previousAddedIndex() const
void sortVector_Run_Or_Lumi_Entries()
EntryType getRunOrLumiEntryType(int index) const override
size_t numberOfEvents() const
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
IndexIntoFile const * indexIntoFile() const
int & currentIndex() const
long long EntryNumber_t
bool setToLastEventInRange(int index) override
RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry)
LuminosityBlockNumber_t lumi() const override
static constexpr RunNumber_t invalidRun
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
EntryNumber_t orderPHIDRunLumi() const
std::vector< RunOrLumiEntry > runOrLumiEntries_
std::map< IndexRunKey, EntryNumber_t > runToOrder_
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
std::vector< ProcessHistoryID > processHistoryIDs_
LuminosityBlockNumber_t lumi_
bool isSameRun(int index1, int index2) const override
void fillEventEntries() const
IndexIntoFileItrImpl(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
EntryType getRunOrLumiEntryType(int index) const override
void fillRunOrLumiIndexes() const
bool operator==(IndexIntoFileItrImpl const &right) const
bool lumiEntryValid(int index) const override
void set_intersection(IndexIntoFile const &indexIntoFile, std::set< IndexRunLumiEventKey > &intersection) const
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
virtual EntryType getRunOrLumiEntryType(int index) const =0
LuminosityBlockNumber_t lumi() const override
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool operator!=(SortedRunOrLumiItr const &right) const
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
SortedRunOrLumiItr(IndexIntoFile const *indexIntoFile, unsigned runOrLumi)
Hash< ProcessHistoryType > ProcessHistoryID
void sortEventEntries() const
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
bool containsDuplicateEvents() const
Returns true if the IndexIntoFile contains 2 events with the same ProcessHistoryID index...
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void inputFileClosed() const
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
bool setToLastEventInRange(int index) override
void resetEventFinder() const
std::vector< EventNumber_t > & unsortedEventNumbers() const
static constexpr EntryNumber_t invalidEntry
EntryNumber_t peekAheadAtEventEntry() const override
IndexIntoFileItrSorted(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
virtual RunNumber_t run() const =0
static constexpr LuminosityBlockNumber_t invalidLumi
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
void initializeLumi()
Should only be used internally and for tests.
ProcessHistoryID const & processHistoryID(int i) const
std::map< IndexRunKey, EntryNumber_t > & runToOrder() const
void copyPosition(IndexIntoFileItrImpl const &position)
IndexIntoFileItrImpl * clone() const override
std::vector< EventEntry > eventEntries_
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
HLT enums.
bool lumiEntryValid(int index) const override
void fillEventNumbers() const
static int position[264][3]
Definition: ReadPGInfo.cc:509
LuminosityBlockNumber_t peekAheadAtLumi() const override
void setNumberOfEvents(EntryNumber_t nevents) const
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
std::vector< EventNumber_t > & eventNumbers() const
std::vector< RunOrLumiIndexes > runOrLumiIndexes_
IndexIntoFileItr(IndexIntoFile const *indexIntoFile, SortOrder sortOrder, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
unsigned int RunNumber_t
virtual int processHistoryIDIndex() const =0
virtual LuminosityBlockNumber_t peekAheadAtLumi() const =0
SortedRunOrLumiItr endRunOrLumi() const
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
UInt_t nEvents
Definition: hcalCalib.cc:42
bool containsRun(RunNumber_t run) const
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
EntryNumber_t entry() const
void getRange(long long &beginEventNumbers, long long &endEventNumbers, EntryNumber_t &beginEventEntry, EntryNumber_t &endEventEntry)
EntryNumber_t & endEvents() const
LuminosityBlockNumber_t peekAheadAtLumi() const
EntryNumber_t & beginEvents() const
virtual EntryNumber_t peekAheadAtEventEntry() const =0
value_ptr< IndexIntoFileItrImpl > impl_
IndexIntoFileItrNoSort(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
Definition: event.py:1
edm::propagate_const< std::shared_ptr< EventFinder > > eventFinder_
RunOrLumiIndexes const & runOrLumiIndexes() const