CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IndexIntoFile.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_IndexIntoFile_h
2 #define DataFormats_Provenance_IndexIntoFile_h
3 
204 
205 #include <memory>
206 
207 #include <cassert>
208 #include <iosfwd>
209 #include <map>
210 #include <set>
211 #include <vector>
212 
213 class TestIndexIntoFile;
214 class TestIndexIntoFile1;
215 class TestIndexIntoFile2;
216 class TestIndexIntoFile3;
217 class TestIndexIntoFile4;
218 class TestIndexIntoFile5;
219 
220 namespace edm {
221 
222  class ProcessHistoryRegistry;
223  class RootFile;
224 
226  public:
227  class IndexIntoFileItr;
228  class SortedRunOrLumiItr;
229  class IndexRunLumiEventKey;
230 
231  using EntryNumber_t = long long;
232  static constexpr int invalidIndex = -1;
233  static constexpr RunNumber_t invalidRun = 0U;
234  static constexpr LuminosityBlockNumber_t invalidLumi = 0U;
235  static constexpr EventNumber_t invalidEvent = 0U;
236  static constexpr EntryNumber_t invalidEntry = -1LL;
237  static constexpr EntryNumber_t continuedLumi = -2LL;
238 
240 
241  IndexIntoFile();
242  ~IndexIntoFile();
243 
244  ProcessHistoryID const& processHistoryID(int i) const;
245  std::vector<ProcessHistoryID> const& processHistoryIDs() const;
246 
268 
271  IndexIntoFileItr begin(SortOrder sortOrder) const;
272 
274  IndexIntoFileItr end(SortOrder sortOrder) const;
275 
277  bool iterationWillBeInEntryOrder(SortOrder sortOrder) const;
278 
280  bool empty() const;
281 
303  IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi = 0U, EventNumber_t event = 0U) const;
304 
305  IndexIntoFileItr findPosition(SortOrder sortOrder,
308  EventNumber_t event = 0U) const;
309 
313 
317 
319  IndexIntoFileItr findRunPosition(RunNumber_t run) const;
320 
324  bool containsRun(RunNumber_t run) const;
325 
326  SortedRunOrLumiItr beginRunOrLumi() const;
327  SortedRunOrLumiItr endRunOrLumi() const;
328 
331  void set_intersection(IndexIntoFile const& indexIntoFile, std::set<IndexRunLumiEventKey>& intersection) const;
332 
334  bool containsDuplicateEvents() const;
335 
336  //*****************************************************************************
337  //*****************************************************************************
338 
340  public:
341  RunOrLumiEntry();
342 
351 
354  EntryNumber_t entry() const { return entry_; }
356  RunNumber_t run() const { return run_; }
357  LuminosityBlockNumber_t lumi() const { return lumi_; }
359  EntryNumber_t endEvents() const { return endEvents_; }
360 
361  bool isRun() const { return lumi() == invalidLumi; }
362 
366 
367  bool operator<(RunOrLumiEntry const& right) const {
368  if (orderPHIDRun_ == right.orderPHIDRun()) {
369  if (orderPHIDRunLumi_ == right.orderPHIDRunLumi()) {
370  return entry_ < right.entry();
371  }
372  return orderPHIDRunLumi_ < right.orderPHIDRunLumi();
373  }
374  return orderPHIDRun_ < right.orderPHIDRun();
375  }
376 
377  private:
378  // All Runs, Lumis, and Events associated with the same
379  // ProcessHistory and Run in the same input file are processed
380  // contiguously. This parameter establishes the default order
381  // of processing of these contiguous subsets of data.
383 
384  // All Lumis and Events associated with the same
385  // ProcessHistory, Run, and Lumi in the same input file are
386  // processed contiguously. This parameter establishes the
387  // default order of processing of these contiguous subsets
388  // of data.
390 
391  // TTree entry number of Run or Lumi
392  // Always will be valid except when the IndexIntoFile was
393  // created while processing more than 1 luminosity block
394  // at a time (multiple concurrent lumis). In that case
395  // there can be multiple contiguous event ranges associated
396  // with the same lumi TTree entry. Exactly one of those will
397  // have a valid entry_ number and the rest will be set
398  // to the invalid value (-1). For a particular lumi, the
399  // invalid ones sort before the valid ones.
401 
404  LuminosityBlockNumber_t lumi_; // 0 indicates this is a run entry
405 
406  // These are entry numbers in the Events TTree
407  // Each RunOrLumiEntry is associated with one contiguous range of events.
408  // This is disjoint from the ranges associated with all other RunOrLumiEntry's
409  EntryNumber_t beginEvents_; // -1 if a run or a lumi with no events
410  EntryNumber_t endEvents_; // -1 if a run or a lumi with no events
411  };
412 
413  //*****************************************************************************
414  //*****************************************************************************
415 
417  public:
419 
421  RunNumber_t run() const { return run_; }
422  LuminosityBlockNumber_t lumi() const { return lumi_; }
423  int indexToGetEntry() const { return indexToGetEntry_; }
424  long long beginEventNumbers() const { return beginEventNumbers_; }
425  long long endEventNumbers() const { return endEventNumbers_; }
426 
427  bool isRun() const { return lumi() == invalidLumi; }
428 
430  void setEndEventNumbers(long long v) { endEventNumbers_ = v; }
431 
432  bool operator<(RunOrLumiIndexes const& right) const {
434  if (run_ == right.run()) {
435  return lumi_ < right.lumi();
436  }
437  return run_ < right.run();
438  }
440  }
441 
442  private:
445  LuminosityBlockNumber_t lumi_; // 0 indicates this is a run entry
447 
448  // The next two data members are indexes into the vectors eventNumbers_ and
449  // eventEntries_ (which both have the same number of entries in the same order,
450  // the only difference being that one contains only events numbers and is
451  // smaller in memory).
452 
453  // If there are no events, then the next two are equal (and the value is the
454  // index where the first event would have gone if there had been one)
455 
456  // Note that there can be many RunOrLumiIndexes objects where these two values are
457  // the same if there are many noncontiguous ranges of events associated with the same
458  // PHID-Run-Lumi (this one range in eventNumbers_ corresponds to the union of
459  // all the noncontiguous ranges in the Events TTree).
460  long long beginEventNumbers_; // first event this PHID-Run-Lumi (-1 if a run or not set)
461  long long endEventNumbers_; // one past last event this PHID-Run-Lumi (-1 if a run or not set)
462  };
463 
464  //*****************************************************************************
465  //*****************************************************************************
466 
467  class EventEntry {
468  public:
471 
472  EventNumber_t event() const { return event_; }
473  EntryNumber_t entry() const { return entry_; }
474 
475  bool operator<(EventEntry const& right) const { return event() < right.event(); }
476 
477  bool operator==(EventEntry const& right) const { return event() == right.event(); }
478 
479  private:
482  };
483 
484  //*****************************************************************************
485  //*****************************************************************************
486 
488  public:
490 
491  IndexIntoFile const* indexIntoFile() const { return indexIntoFile_; }
492  unsigned runOrLumi() const { return runOrLumi_; }
493 
494  bool operator==(SortedRunOrLumiItr const& right) const;
495  bool operator!=(SortedRunOrLumiItr const& right) const;
497 
498  bool isRun();
499 
500  void getRange(long long& beginEventNumbers,
501  long long& endEventNumbers,
502  EntryNumber_t& beginEventEntry,
503  EntryNumber_t& endEventEntry);
504 
505  RunOrLumiIndexes const& runOrLumiIndexes() const;
506 
507  private:
509 
510  // This is an index into runOrLumiIndexes_
511  // which gives the current position of the iteration
512  unsigned runOrLumi_;
513  };
514 
515  //*****************************************************************************
516  //*****************************************************************************
517 
519  public:
521  EntryType entryType,
522  int indexToRun,
523  int indexToLumi,
524  int indexToEventRange,
525  long long indexToEvent,
526  long long nEvents);
527  virtual ~IndexIntoFileItrImpl();
528 
529  virtual IndexIntoFileItrImpl* clone() const = 0;
530 
531  EntryType getEntryType() const { return type_; }
532 
533  void next();
534 
535  void skipEventForward(int& phIndexOfSkippedEvent,
536  RunNumber_t& runOfSkippedEvent,
537  LuminosityBlockNumber_t& lumiOfSkippedEvent,
538  EntryNumber_t& skippedEventEntry);
539 
540  void skipEventBackward(int& phIndexOfEvent,
541  RunNumber_t& runOfEvent,
542  LuminosityBlockNumber_t& lumiOfEvent,
543  EntryNumber_t& eventEntry);
544 
545  virtual int processHistoryIDIndex() const = 0;
546  virtual RunNumber_t run() const = 0;
547  virtual LuminosityBlockNumber_t lumi() const = 0;
548  virtual EntryNumber_t entry() const = 0;
549  virtual bool entryContinues() const = 0;
550  virtual LuminosityBlockNumber_t peekAheadAtLumi() const = 0;
551  virtual EntryNumber_t peekAheadAtEventEntry() const = 0;
554  virtual bool skipLumiInRun() = 0;
555  virtual bool lumiEntryValid(int index) const = 0;
556 
557  void advanceToNextRun();
558  void advanceToNextLumiOrRun();
559  bool skipToNextEventInLumi();
560  void initializeRun();
561 
562  void initializeLumi();
563 
564  bool operator==(IndexIntoFileItrImpl const& right) const;
565 
566  IndexIntoFile const* indexIntoFile() const { return indexIntoFile_; }
567  int size() const { return size_; }
568 
569  EntryType type() const { return type_; }
570  int indexToRun() const { return indexToRun_; }
571 
572  int indexToLumi() const { return indexToLumi_; }
573  int indexToEventRange() const { return indexToEventRange_; }
574  long long indexToEvent() const { return indexToEvent_; }
575  long long nEvents() const { return nEvents_; }
576 
578 
579  void getLumisInRun(std::vector<LuminosityBlockNumber_t>& lumis) const;
580 
581  protected:
582  void setInvalid();
583 
586  void setIndexToEvent(long long value) { indexToEvent_ = value; }
587  void setNEvents(long long value) { nEvents_ = value; }
588 
589  private:
590  virtual void initializeLumi_() = 0;
591  virtual bool nextEventRange() = 0;
592  virtual bool previousEventRange() = 0;
593  bool previousLumiWithEvents();
594  virtual bool setToLastEventInRange(int index) = 0;
595  virtual EntryType getRunOrLumiEntryType(int index) const = 0;
596  virtual bool isSameLumi(int index1, int index2) const = 0;
597  virtual bool isSameRun(int index1, int index2) const = 0;
598  virtual LuminosityBlockNumber_t lumi(int index) const = 0;
599 
601  int size_;
602 
607  long long indexToEvent_;
608  long long nEvents_;
609  };
610 
611  //*****************************************************************************
612  //*****************************************************************************
613 
615  public:
617  EntryType entryType,
618  int indexToRun,
619  int indexToLumi,
620  int indexToEventRange,
621  long long indexToEvent,
622  long long nEvents);
623 
624  IndexIntoFileItrImpl* clone() const override;
625 
626  int processHistoryIDIndex() const override;
627  RunNumber_t run() const override;
628  LuminosityBlockNumber_t lumi() const override;
629  EntryNumber_t entry() const override;
630  bool entryContinues() const final { return false; };
631  LuminosityBlockNumber_t peekAheadAtLumi() const override;
632  EntryNumber_t peekAheadAtEventEntry() const override;
633  bool skipLumiInRun() override;
634  bool lumiEntryValid(int index) const override;
635 
636  private:
637  void initializeLumi_() override;
638  bool nextEventRange() override;
639  bool previousEventRange() override;
640  bool setToLastEventInRange(int index) override;
641  EntryType getRunOrLumiEntryType(int index) const override;
642  bool isSameLumi(int index1, int index2) const override;
643  bool isSameRun(int index1, int index2) const override;
644  LuminosityBlockNumber_t lumi(int index) const override;
645  };
646 
647  //*****************************************************************************
648  //*****************************************************************************
649 
651  public:
653  EntryType entryType,
654  int indexToRun,
655  int indexToLumi,
656  int indexToEventRange,
657  long long indexToEvent,
658  long long nEvents);
659 
660  IndexIntoFileItrImpl* clone() const override;
661  int processHistoryIDIndex() const override;
662  RunNumber_t run() const override;
663  LuminosityBlockNumber_t lumi() const override;
664  EntryNumber_t entry() const override;
665  bool entryContinues() const final { return false; }
666  LuminosityBlockNumber_t peekAheadAtLumi() const override;
667  EntryNumber_t peekAheadAtEventEntry() const override;
668  bool skipLumiInRun() override;
669  bool lumiEntryValid(int index) const override;
670 
671  private:
672  void initializeLumi_() override;
673  bool nextEventRange() override;
674  bool previousEventRange() override;
675  bool setToLastEventInRange(int index) override;
676  EntryType getRunOrLumiEntryType(int index) const override;
677  bool isSameLumi(int index1, int index2) const override;
678  bool isSameRun(int index1, int index2) const override;
679  LuminosityBlockNumber_t lumi(int index) const override;
680  };
681 
682  //*****************************************************************************
683  //*****************************************************************************
684 
686  public:
688  EntryType entryType,
689  int indexToRun,
690  int indexToLumi,
691  int indexToEventRange,
692  long long indexToEvent,
693  long long nEvents);
694 
695  IndexIntoFileItrImpl* clone() const override;
696  int processHistoryIDIndex() const override;
697  RunNumber_t run() const override;
698  LuminosityBlockNumber_t lumi() const override;
699  EntryNumber_t entry() const override;
700  bool entryContinues() const override;
701  LuminosityBlockNumber_t peekAheadAtLumi() const override;
702  EntryNumber_t peekAheadAtEventEntry() const override;
703  bool skipLumiInRun() override;
704  bool lumiEntryValid(int index) const override;
705 
706  private:
709  }
710  void initializeLumi_() override;
711  bool nextEventRange() override;
712  bool previousEventRange() override;
713  bool setToLastEventInRange(int index) override;
714  EntryType getRunOrLumiEntryType(int index) const override;
715  bool isSameLumi(int index1, int index2) const override;
716  bool isSameRun(int index1, int index2) const override;
717  LuminosityBlockNumber_t lumi(int index) const override;
718  std::vector<EntryNumber_t> fileOrderRunOrLumiEntry_;
719  };
720 
721  //*****************************************************************************
722  //*****************************************************************************
723 
725  public:
735  SortOrder sortOrder,
736  EntryType entryType,
737  int indexToRun,
738  int indexToLumi,
739  int indexToEventRange,
740  long long indexToEvent,
741  long long nEvents);
742 
743  EntryType getEntryType() const { return impl_->getEntryType(); }
744  int processHistoryIDIndex() const { return impl_->processHistoryIDIndex(); }
745  RunNumber_t run() const { return impl_->run(); }
746  LuminosityBlockNumber_t lumi() const { return impl_->lumi(); }
747  EntryNumber_t entry() const { return impl_->entry(); }
748  bool entryContinues() const { return impl_->entryContinues(); }
749 
752  LuminosityBlockNumber_t peekAheadAtLumi() const { return impl_->peekAheadAtLumi(); }
753 
758  EntryNumber_t peekAheadAtEventEntry() const { return impl_->peekAheadAtEventEntry(); }
759 
763  EntryNumber_t firstEventEntryThisRun() { return impl_->firstEventEntryThisRun(); }
764  EntryNumber_t firstEventEntryThisLumi() { return impl_->firstEventEntryThisLumi(); }
765 
766  // This is intentionally not implemented.
767  // It would be difficult to implement for the no sort mode,
768  // either slow or using extra memory.
769  // It would be easy to implement for the sorted iteration,
770  // but I did not implement it so both cases would offer a
771  // consistent interface.
772  // It looks like in all cases where this would be needed
773  // it would not be difficult to get the event number
774  // directly from the event auxiliary.
775  // We may need to revisit this decision in the future.
776  // EventNumber_t event() const;
777 
780  impl_->next();
781  return *this;
782  }
783 
789  void skipEventForward(int& phIndexOfSkippedEvent,
790  RunNumber_t& runOfSkippedEvent,
791  LuminosityBlockNumber_t& lumiOfSkippedEvent,
792  EntryNumber_t& skippedEventEntry) {
793  impl_->skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
794  }
795 
803  void skipEventBackward(int& phIndexOfEvent,
804  RunNumber_t& runOfEvent,
805  LuminosityBlockNumber_t& lumiOfEvent,
806  EntryNumber_t& eventEntry) {
807  impl_->skipEventBackward(phIndexOfEvent, runOfEvent, lumiOfEvent, eventEntry);
808  }
809 
812  bool skipLumiInRun() { return impl_->skipLumiInRun(); }
813 
816  bool skipToNextEventInLumi() { return impl_->skipToNextEventInLumi(); }
817 
818  void advanceToNextRun() { impl_->advanceToNextRun(); }
819  void advanceToNextLumiOrRun() { impl_->advanceToNextLumiOrRun(); }
820 
821  void advanceToEvent();
822  void advanceToLumi();
823 
824  bool operator==(IndexIntoFileItr const& right) const { return *impl_ == *right.impl_; }
825 
826  bool operator!=(IndexIntoFileItr const& right) const { return !(*this == right); }
827 
829  void initializeRun() { impl_->initializeRun(); }
830 
832  void initializeLumi() { impl_->initializeLumi(); }
833 
836 
837  void getLumisInRun(std::vector<LuminosityBlockNumber_t>& lumis) const { impl_->getLumisInRun(lumis); }
838 
839  private:
840  //for testing
841  friend class ::TestIndexIntoFile;
842  friend class ::TestIndexIntoFile3;
843  friend class ::TestIndexIntoFile4;
844  friend class ::TestIndexIntoFile5;
845 
846  // The rest of these are intended to be used only by code which tests
847  // this class.
848  IndexIntoFile const* indexIntoFile() const { return impl_->indexIntoFile(); }
849  int size() const { return impl_->size(); }
850  EntryType type() const { return impl_->type(); }
851  int indexToRun() const { return impl_->indexToRun(); }
852  int indexToLumi() const { return impl_->indexToLumi(); }
853  int indexToEventRange() const { return impl_->indexToEventRange(); }
854  long long indexToEvent() const { return impl_->indexToEvent(); }
855  long long nEvents() const { return impl_->nEvents(); }
856 
858  };
859 
860  //*****************************************************************************
861  //*****************************************************************************
862 
863  class IndexRunKey {
864  public:
866 
868  RunNumber_t run() const { return run_; }
869 
870  bool operator<(IndexRunKey const& right) const {
872  return run_ < right.run();
873  }
875  }
876 
877  private:
880  };
881 
882  //*****************************************************************************
883  //*****************************************************************************
884 
886  public:
888  : processHistoryIDIndex_(index), run_(run), lumi_(lumi) {}
889 
891  RunNumber_t run() const { return run_; }
892  LuminosityBlockNumber_t lumi() const { return lumi_; }
893 
894  bool operator<(IndexRunLumiKey const& right) const {
896  if (run_ == right.run()) {
897  return lumi_ < right.lumi();
898  }
899  return run_ < right.run();
900  }
902  }
903 
904  private:
908  };
909 
910  //*****************************************************************************
911  //*****************************************************************************
912 
914  public:
916  : processHistoryIDIndex_(index), run_(run), lumi_(lumi), event_(event) {}
917 
919  RunNumber_t run() const { return run_; }
920  LuminosityBlockNumber_t lumi() const { return lumi_; }
921  EventNumber_t event() const { return event_; }
922 
923  bool operator<(IndexRunLumiEventKey const& right) const {
925  if (run_ == right.run()) {
926  if (lumi_ == right.lumi()) {
927  return event_ < right.event();
928  }
929  return lumi_ < right.lumi();
930  }
931  return run_ < right.run();
932  }
934  }
935 
936  private:
941  };
942 
943  //*****************************************************************************
944  //*****************************************************************************
945 
946  class EventFinder {
947  public:
948  virtual ~EventFinder() {}
950  };
951 
952  //*****************************************************************************
953  //*****************************************************************************
954 
955  // The next two functions are used by the output module to fill the
956  // persistent data members.
957 
965 
971 
972  //used internally by addEntry
974  //*****************************************************************************
975  //*****************************************************************************
976 
977  // The next group of functions is used by the PoolSource (or other
978  // input related code) to fill the IndexIntoFile.
979 
985  void fixIndexes(std::vector<ProcessHistoryID>& processHistoryIDs);
986 
990 
996  void setEventFinder(std::shared_ptr<EventFinder> ptr) { transient_.eventFinder_ = ptr; }
997 
1011  void fillEventNumbers() const;
1012 
1026  void fillEventEntries() const;
1027 
1033  void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const;
1034 
1038  std::vector<EventNumber_t>& unsortedEventNumbers() { return transient_.unsortedEventNumbers_; }
1039  std::vector<EventNumber_t> const& unsortedEventNumbers() const { return transient_.unsortedEventNumbers_; }
1040 
1043  void inputFileClosed();
1044 
1046  void doneFileInitialization();
1047 
1051  std::vector<RunOrLumiEntry>& setRunOrLumiEntries() { return runOrLumiEntries_; }
1052 
1056  std::vector<ProcessHistoryID>& setProcessHistoryIDs() { return processHistoryIDs_; }
1057 
1061  void reduceProcessHistoryIDs(ProcessHistoryRegistry const& processHistoryRegistry);
1062 
1063  //*****************************************************************************
1064  //*****************************************************************************
1065 
1067  std::vector<RunOrLumiEntry> const& runOrLumiEntries() const { return runOrLumiEntries_; }
1068 
1069  //*****************************************************************************
1070  //*****************************************************************************
1071 
1073 
1074  struct Transients {
1075  Transients();
1076  void reset();
1078  std::map<IndexRunKey, EntryNumber_t> runToOrder_;
1079  std::map<IndexRunLumiKey, EntryNumber_t> lumiToOrder_;
1087  std::vector<RunOrLumiIndexes> runOrLumiIndexes_;
1088  std::vector<EventNumber_t> eventNumbers_;
1089  std::vector<EventEntry> eventEntries_;
1090  std::vector<EventNumber_t> unsortedEventNumbers_;
1091  };
1092 
1093  private:
1094  //for testing
1095  friend class ::TestIndexIntoFile;
1096  friend class ::TestIndexIntoFile1;
1097  friend class ::TestIndexIntoFile2;
1098  friend class ::TestIndexIntoFile3;
1099  friend class ::TestIndexIntoFile4;
1100  friend class ::TestIndexIntoFile5;
1101 
1104  void fillRunOrLumiIndexes() const;
1105 
1106  std::vector<EventNumber_t>& unsortedEventNumbersMutable() const { return transient_.unsortedEventNumbers_; }
1107  void fillUnsortedEventNumbers() const;
1108  void resetEventFinder() const { transient_.eventFinder_ = nullptr; } // propagate_const<T> has no reset() function
1109  std::vector<EventEntry>& eventEntries() const { return transient_.eventEntries_; }
1110  std::vector<EventNumber_t>& eventNumbers() const { return transient_.eventNumbers_; }
1111  void sortEvents() const;
1112  void sortEventEntries() const;
1114  std::map<IndexRunKey, EntryNumber_t>& runToOrder() const { return transient_.runToOrder_; }
1115  std::map<IndexRunLumiKey, EntryNumber_t>& lumiToOrder() const { return transient_.lumiToOrder_; }
1118  int& currentIndex() const { return transient_.currentIndex_; }
1121  std::vector<RunOrLumiIndexes>& runOrLumiIndexes() const { return transient_.runOrLumiIndexes_; }
1122  size_t numberOfEvents() const { return transient_.numberOfEvents_; }
1124  return transient_.eventFinder_->getEventNumberOfEntry(entry);
1125  }
1126 
1127  //This class is used only by one thread at a time within the source serialized code
1129 
1130  std::vector<ProcessHistoryID> processHistoryIDs_; // of reduced process histories
1131  std::vector<RunOrLumiEntry> runOrLumiEntries_;
1132  };
1133 
1134  template <>
1135  struct value_ptr_traits<IndexIntoFile::IndexIntoFileItrImpl> {
1137  return p->clone();
1138  }
1140  };
1141 
1143  public:
1145  };
1146 
1148  public:
1150  };
1151 
1152  // This class exists only to allow forward declarations of IndexIntoFile::IndexIntoFileItr
1154  public:
1156  void getLumisInRun(std::vector<LuminosityBlockNumber_t>& lumis) const { iter_.getLumisInRun(lumis); }
1157 
1158  private:
1160  };
1161 } // namespace edm
1162 
1163 #endif
void initializeRun()
Should only be used internally and for tests.
bool operator<(EventEntry const &right) const
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
RunNumber_t & currentRun() const
LuminosityBlockNumber_t lumi() const
LuminosityBlockNumber_t peekAheadAtLumi() const override
EntryType getRunOrLumiEntryType(int index) const override
EntryNumber_t peekAheadAtEventEntry() const
EntryNumber_t entry() const
LuminosityBlockNumber_t lumi() const
EntryNumber_t endEvents() const
IndexRunLumiKey(int index, RunNumber_t run, LuminosityBlockNumber_t lumi)
#define CMS_SA_ALLOW
static constexpr int invalidIndex
EntryNumber_t entry() const override
IndexIntoFile const * indexIntoFile() const
bool isSameLumi(int index1, int index2) const override
LuminosityBlockNumber_t currentLumi_
static void destroy(IndexIntoFile::IndexIntoFileItrImpl *p)
IndexIntoFileItrEntryOrder(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
void addLumi(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EntryNumber_t entry)
std::vector< EventEntry > & eventEntries() const
EntryNumber_t beginEvents() const
bool lumiEntryValid(int index) const override
IndexIntoFileItrImpl * clone() const override
std::vector< EventNumber_t > eventNumbers_
virtual int processHistoryIDIndex() const =0
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
EventEntry(EventNumber_t event, EntryNumber_t entry)
static IndexIntoFile::IndexIntoFileItrImpl * clone(IndexIntoFile::IndexIntoFileItrImpl const *p)
bool operator<(IndexRunLumiKey const &right) const
std::vector< EventNumber_t > const & unsortedEventNumbers() const
bool operator==(SortedRunOrLumiItr const &right) const
bool lumiEntryValid(int index) const override
unsigned long long EventNumber_t
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void sortEvents() const
virtual LuminosityBlockNumber_t peekAheadAtLumi() const =0
void fillUnsortedEventNumbers() const
EntryType getRunOrLumiEntryType(int index) const override
IndexIntoFileItr begin(SortOrder sortOrder) const
IndexIntoFile::IndexIntoFileItr const & iter_
bool operator==(EventEntry const &right) const
LuminosityBlockNumber_t lumi() const
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToOrder() const
bool int lh
Definition: SIMDVec.h:20
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
IndexIntoFileItrHolder(IndexIntoFile::IndexIntoFileItr const &iIter)
EntryNumber_t orderPHIDRun() const
std::vector< EventNumber_t > unsortedEventNumbers_
virtual bool isSameLumi(int index1, int index2) const =0
LuminosityBlockNumber_t lumi() const
IndexRunLumiEventKey(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
unsigned int LuminosityBlockNumber_t
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
constexpr Matriplex::idx_t LL
Definition: Matrix.h:45
std::vector< ProcessHistoryID > const & processHistoryIDs() const
static constexpr EventNumber_t invalidEvent
virtual EntryNumber_t peekAheadAtEventEntry() const =0
std::map< IndexRunLumiKey, EntryNumber_t > lumiToOrder_
bool operator<(RunOrLumiIndexes const &right) const
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
int & previousAddedIndex() const
void sortVector_Run_Or_Lumi_Entries()
IndexIntoFileItrImpl * clone() const override
LuminosityBlockNumber_t lumi() const override
void setNumberOfEvents(EntryNumber_t nevents)
size_t numberOfEvents() const
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
IndexIntoFile const * indexIntoFile() const
bool operator<(RunOrLumiEntry const &right) const
int & currentIndex() const
long long EntryNumber_t
bool setToLastEventInRange(int index) override
IndexIntoFileItrImpl * clone() const override
virtual LuminosityBlockNumber_t lumi() const =0
RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry)
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
void setOrderPHIDRun(EntryNumber_t v)
virtual EntryType getRunOrLumiEntryType(int index) const =0
static constexpr EntryNumber_t continuedLumi
static constexpr RunNumber_t invalidRun
LuminosityBlockNumber_t peekAheadAtLumi() const override
virtual EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const =0
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
EntryNumber_t orderPHIDRunLumi() const
virtual IndexIntoFileItrImpl * clone() const =0
std::vector< RunOrLumiEntry > runOrLumiEntries_
std::map< IndexRunKey, EntryNumber_t > runToOrder_
EventNumber_t event() const
LuminosityBlockNumber_t lumi() const override
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_
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
LuminosityBlockNumber_t lumi_
virtual bool isSameRun(int index1, int index2) const =0
virtual bool lumiEntryValid(int index) const =0
void fillEventEntries() const
void setOrderPHIDRunLumi(EntryNumber_t v)
IndexIntoFileItrImpl(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
LuminosityBlockNumber_t peekAheadAtLumi() const override
void fillRunOrLumiIndexes() const
bool operator==(IndexIntoFileItrImpl const &right) const
RunOrLumiEntry const & runOrLumisEntry(EntryNumber_t iEntry) const
void set_intersection(IndexIntoFile const &indexIntoFile, std::set< IndexRunLumiEventKey > &intersection) const
virtual EntryNumber_t entry() const =0
bool isSameRun(int index1, int index2) const override
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
IndexIntoFileItr & operator++()
Move to next event to be processed.
EntryNumber_t peekAheadAtEventEntry() const override
bool isSameRun(int index1, int index2) const override
std::vector< EntryNumber_t > fileOrderRunOrLumiEntry_
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
list lumi
Definition: dqmdumpme.py:53
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)
bool operator!=(IndexIntoFileItr const &right) const
void sortEventEntries() const
IndexRunKey(int index, RunNumber_t run)
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 fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
EntryNumber_t peekAheadAtEventEntry() const override
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
bool setToLastEventInRange(int index) override
void resetEventFinder() const
static constexpr EntryNumber_t invalidEntry
IndexIntoFileItrSorted(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
std::vector< EventNumber_t > & unsortedEventNumbers()
static constexpr LuminosityBlockNumber_t invalidLumi
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
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
virtual bool entryContinues() const =0
bool operator<(IndexRunKey const &right) const
void copyPosition(IndexIntoFileItrImpl const &position)
LuminosityBlockNumber_t lumi() const override
std::vector< EventEntry > eventEntries_
void doneFileInitialization()
Clears the temporary vector of event numbers to reduce memory usage.
EntryType getRunOrLumiEntryType(int index) const override
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
void fillEventNumbers() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
bool isSameLumi(int index1, int index2) const override
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
bool isSameRun(int index1, int index2) const override
bool operator==(IndexIntoFileItr const &right) const
bool isSameLumi(int index1, int index2) const override
list entry
Definition: mps_splice.py:68
bool lumiEntryValid(int index) const override
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)
IndexIntoFile const * indexIntoFile() const
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
unsigned int RunNumber_t
bool operator<(IndexRunLumiEventKey const &right) const
SortedRunOrLumiItr endRunOrLumi() const
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
EntryNumber_t entry() const override
std::vector< EventNumber_t > & unsortedEventNumbersMutable() const
bool containsRun(RunNumber_t run) const
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void setEventFinder(std::shared_ptr< EventFinder > ptr)
EntryNumber_t entry() const
LuminosityBlockNumber_t lumi_
void getRange(long long &beginEventNumbers, long long &endEventNumbers, EntryNumber_t &beginEventEntry, EntryNumber_t &endEventEntry)
EntryNumber_t & endEvents() const
virtual RunNumber_t run() const =0
LuminosityBlockNumber_t peekAheadAtLumi() const
EntryNumber_t & beginEvents() const
value_ptr< IndexIntoFileItrImpl > impl_
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
IndexIntoFileItrNoSort(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
EntryNumber_t peekAheadAtEventEntry() const override
edm::propagate_const< std::shared_ptr< EventFinder > > eventFinder_
RunOrLumiIndexes const & runOrLumiIndexes() const