00001 #ifndef DataFormats_Provenance_IndexIntoFile_h
00002 #define DataFormats_Provenance_IndexIntoFile_h
00003
00168 #include "DataFormats/Provenance/interface/EventID.h"
00169 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00170 #include "DataFormats/Provenance/interface/RunID.h"
00171 #include "FWCore/Utilities/interface/value_ptr.h"
00172
00173 #include "boost/shared_ptr.hpp"
00174
00175 #include <cassert>
00176 #include <iosfwd>
00177 #include <map>
00178 #include <set>
00179 #include <vector>
00180
00181 namespace edm {
00182
00183 class RootFile;
00184
00185 class IndexIntoFile {
00186 public:
00187 class IndexIntoFileItr;
00188 class SortedRunOrLumiItr;
00189 class IndexRunLumiEventKey;
00190
00191 typedef long long EntryNumber_t;
00192 static int const invalidIndex = -1;
00193 static RunNumber_t const invalidRun = 0U;
00194 static LuminosityBlockNumber_t const invalidLumi = 0U;
00195 static EventNumber_t const invalidEvent = 0U;
00196 static EntryNumber_t const invalidEntry = -1LL;
00197
00198 enum EntryType {kRun, kLumi, kEvent, kEnd};
00199
00200 IndexIntoFile();
00201 ~IndexIntoFile();
00202
00203 ProcessHistoryID const& processHistoryID(int i) const;
00204 std::vector<ProcessHistoryID> const& processHistoryIDs() const;
00205
00226 enum SortOrder {numericalOrder, firstAppearanceOrder};
00227
00230 IndexIntoFileItr begin(SortOrder sortOrder) const;
00231
00233 IndexIntoFileItr end(SortOrder sortOrder) const;
00234
00236 bool iterationWillBeInEntryOrder(SortOrder sortOrder) const;
00237
00239 bool empty() const;
00240
00262 IndexIntoFileItr
00263 findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi = 0U, EventNumber_t event = 0U) const;
00264
00265 IndexIntoFileItr
00266 findPosition(SortOrder sortOrder, RunNumber_t run, LuminosityBlockNumber_t lumi = 0U, EventNumber_t event = 0U) const;
00267
00270 IndexIntoFileItr
00271 findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const;
00272
00275 IndexIntoFileItr
00276 findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const;
00277
00279 IndexIntoFileItr
00280 findRunPosition(RunNumber_t run) const;
00281
00282 bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const;
00283 bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const;
00284 bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const;
00285 bool containsRun(RunNumber_t run) const;
00286
00287 SortedRunOrLumiItr beginRunOrLumi() const;
00288 SortedRunOrLumiItr endRunOrLumi() const;
00289
00292 void set_intersection(IndexIntoFile const& indexIntoFile, std::set<IndexRunLumiEventKey>& intersection) const;
00293
00295 bool containsDuplicateEvents() const;
00296
00297
00298
00299
00300 class RunOrLumiEntry {
00301 public:
00302
00303 RunOrLumiEntry();
00304
00305 RunOrLumiEntry(EntryNumber_t orderPHIDRun,
00306 EntryNumber_t orderPHIDRunLumi,
00307 EntryNumber_t entry,
00308 int processHistoryIDIndex,
00309 RunNumber_t run,
00310 LuminosityBlockNumber_t lumi,
00311 EntryNumber_t beginEvents,
00312 EntryNumber_t Event);
00313
00314 EntryNumber_t orderPHIDRun() const {return orderPHIDRun_;}
00315 EntryNumber_t orderPHIDRunLumi() const {return orderPHIDRunLumi_;}
00316 EntryNumber_t entry() const {return entry_;}
00317 int processHistoryIDIndex() const {return processHistoryIDIndex_;}
00318 RunNumber_t run() const {return run_;}
00319 LuminosityBlockNumber_t lumi() const {return lumi_;}
00320 EntryNumber_t beginEvents() const {return beginEvents_;}
00321 EntryNumber_t endEvents() const {return endEvents_;}
00322
00323 bool isRun() const {return lumi() == invalidLumi;}
00324
00325 void setOrderPHIDRun(EntryNumber_t v) {orderPHIDRun_ = v;}
00326 void setOrderPHIDRunLumi(EntryNumber_t v) {orderPHIDRunLumi_ = v;}
00327 void setProcessHistoryIDIndex(int v) {processHistoryIDIndex_ = v;}
00328
00329 bool operator<(RunOrLumiEntry const& right) const {
00330 if (orderPHIDRun_ == right.orderPHIDRun()) {
00331 if (orderPHIDRunLumi_ == right.orderPHIDRunLumi()) {
00332 return entry_ < right.entry();
00333 }
00334 return orderPHIDRunLumi_ < right.orderPHIDRunLumi();
00335 }
00336 return orderPHIDRun_ < right.orderPHIDRun();
00337 }
00338
00339 private:
00340
00341
00342
00343
00344 EntryNumber_t orderPHIDRun_;
00345
00346
00347
00348
00349
00350
00351 EntryNumber_t orderPHIDRunLumi_;
00352
00353
00354 EntryNumber_t entry_;
00355
00356 int processHistoryIDIndex_;
00357 RunNumber_t run_;
00358 LuminosityBlockNumber_t lumi_;
00359
00360
00361
00362
00363 EntryNumber_t beginEvents_;
00364 EntryNumber_t endEvents_;
00365 };
00366
00367
00368
00369
00370 class RunOrLumiIndexes {
00371 public:
00372 RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry);
00373
00374 int processHistoryIDIndex() const {return processHistoryIDIndex_;}
00375 RunNumber_t run() const {return run_;}
00376 LuminosityBlockNumber_t lumi() const {return lumi_;}
00377 int indexToGetEntry() const {return indexToGetEntry_;}
00378 long long beginEventNumbers() const {return beginEventNumbers_;}
00379 long long endEventNumbers() const {return endEventNumbers_;}
00380
00381 bool isRun() const {return lumi() == invalidLumi;}
00382
00383 void setBeginEventNumbers(long long v) {beginEventNumbers_ = v;}
00384 void setEndEventNumbers(long long v) {endEventNumbers_ = v;}
00385
00386 bool operator<(RunOrLumiIndexes const& right) const {
00387 if (processHistoryIDIndex_ == right.processHistoryIDIndex()) {
00388 if (run_ == right.run()) {
00389 return lumi_ < right.lumi();
00390 }
00391 return run_ < right.run();
00392 }
00393 return processHistoryIDIndex_ < right.processHistoryIDIndex();
00394 }
00395
00396 private:
00397
00398 int processHistoryIDIndex_;
00399 RunNumber_t run_;
00400 LuminosityBlockNumber_t lumi_;
00401 int indexToGetEntry_;
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415 long long beginEventNumbers_;
00416 long long endEventNumbers_;
00417 };
00418
00419
00420
00421
00422 class EventEntry {
00423 public:
00424 EventEntry() : event_(invalidEvent), entry_(invalidEntry) {}
00425 EventEntry(EventNumber_t event, EntryNumber_t entry) : event_(event), entry_(entry) {}
00426
00427 EventNumber_t event() const {return event_;}
00428 EntryNumber_t entry() const {return entry_;}
00429
00430 bool operator<(EventEntry const& right) const {
00431 return event() < right.event();
00432 }
00433
00434 bool operator==(EventEntry const& right) const {
00435 return event() == right.event();
00436 }
00437
00438 private:
00439 EventNumber_t event_;
00440 EntryNumber_t entry_;
00441 };
00442
00443
00444
00445
00446
00447 class SortedRunOrLumiItr {
00448
00449 public:
00450 SortedRunOrLumiItr(IndexIntoFile const* indexIntoFile, unsigned runOrLumi);
00451
00452 IndexIntoFile const* indexIntoFile() const {return indexIntoFile_;}
00453 unsigned runOrLumi() const {return runOrLumi_;}
00454
00455 bool operator==(SortedRunOrLumiItr const& right) const;
00456 bool operator!=(SortedRunOrLumiItr const& right) const;
00457 SortedRunOrLumiItr& operator++();
00458
00459 bool isRun();
00460
00461 void getRange(long long& beginEventNumbers,
00462 long long& endEventNumbers,
00463 EntryNumber_t& beginEventEntry,
00464 EntryNumber_t& endEventEntry);
00465
00466 RunOrLumiIndexes const& runOrLumiIndexes() const;
00467
00468 private:
00469
00470 IndexIntoFile const* indexIntoFile_;
00471
00472
00473
00474 unsigned runOrLumi_;
00475 };
00476
00477
00478
00479
00480
00481 class IndexIntoFileItrImpl {
00482
00483 public:
00484 IndexIntoFileItrImpl(IndexIntoFile const* indexIntoFile,
00485 EntryType entryType,
00486 int indexToRun,
00487 int indexToLumi,
00488 int indexToEventRange,
00489 long long indexToEvent,
00490 long long nEvents);
00491 virtual ~IndexIntoFileItrImpl();
00492
00493 virtual IndexIntoFileItrImpl* clone() const = 0;
00494
00495 EntryType getEntryType() const {return type_;}
00496
00497 void next ();
00498
00499 void skipEventForward(int& phIndexOfSkippedEvent,
00500 RunNumber_t& runOfSkippedEvent,
00501 LuminosityBlockNumber_t& lumiOfSkippedEvent,
00502 EntryNumber_t& skippedEventEntry);
00503
00504 void skipEventBackward(int& phIndexOfEvent,
00505 RunNumber_t& runOfEvent,
00506 LuminosityBlockNumber_t& lumiOfEvent,
00507 EntryNumber_t& eventEntry);
00508
00509 virtual int processHistoryIDIndex() const = 0;
00510 virtual RunNumber_t run() const = 0;
00511 virtual LuminosityBlockNumber_t lumi() const = 0;
00512 virtual EntryNumber_t entry() const = 0;
00513 virtual LuminosityBlockNumber_t peekAheadAtLumi() const = 0;
00514 virtual EntryNumber_t peekAheadAtEventEntry() const = 0;
00515 EntryNumber_t firstEventEntryThisRun();
00516 EntryNumber_t firstEventEntryThisLumi();
00517 virtual bool skipLumiInRun() = 0;
00518
00519 void advanceToNextRun();
00520 void advanceToNextLumiOrRun();
00521 bool skipToNextEventInLumi();
00522 void initializeRun();
00523
00524 void initializeLumi() {initializeLumi_();}
00525
00526 bool operator==(IndexIntoFileItrImpl const& right) const;
00527
00528 IndexIntoFile const* indexIntoFile() const { return indexIntoFile_; }
00529 int size() const { return size_; }
00530
00531 EntryType type() const { return type_; }
00532 int indexToRun() const { return indexToRun_; }
00533
00534 int indexToLumi() const { return indexToLumi_; }
00535 int indexToEventRange() const { return indexToEventRange_; }
00536 long long indexToEvent() const { return indexToEvent_; }
00537 long long nEvents() const { return nEvents_; }
00538
00539 void copyPosition(IndexIntoFileItrImpl const& position);
00540
00541 protected:
00542
00543 void setInvalid();
00544
00545 void setIndexToLumi(int value) { indexToLumi_ = value; }
00546 void setIndexToEventRange(int value) { indexToEventRange_ = value; }
00547 void setIndexToEvent(long long value) { indexToEvent_ = value; }
00548 void setNEvents(long long value) { nEvents_ = value; }
00549
00550 private:
00551
00552 virtual void initializeLumi_() = 0;
00553 virtual bool nextEventRange() = 0;
00554 virtual bool previousEventRange() = 0;
00555 bool previousLumiWithEvents();
00556 virtual bool setToLastEventInRange(int index) = 0;
00557 virtual EntryType getRunOrLumiEntryType(int index) const = 0;
00558 virtual bool isSameLumi(int index1, int index2) const = 0;
00559 virtual bool isSameRun(int index1, int index2) const = 0;
00560
00561 IndexIntoFile const* indexIntoFile_;
00562 int size_;
00563
00564 EntryType type_;
00565 int indexToRun_;
00566 int indexToLumi_;
00567 int indexToEventRange_;
00568 long long indexToEvent_;
00569 long long nEvents_;
00570 };
00571
00572
00573
00574
00575 class IndexIntoFileItrNoSort : public IndexIntoFileItrImpl {
00576 public:
00577 IndexIntoFileItrNoSort(IndexIntoFile const* indexIntoFile,
00578 EntryType entryType,
00579 int indexToRun,
00580 int indexToLumi,
00581 int indexToEventRange,
00582 long long indexToEvent,
00583 long long nEvents);
00584
00585 virtual IndexIntoFileItrImpl* clone() const;
00586
00587 virtual int processHistoryIDIndex() const;
00588 virtual RunNumber_t run() const;
00589 virtual LuminosityBlockNumber_t lumi() const;
00590 virtual EntryNumber_t entry() const;
00591 virtual LuminosityBlockNumber_t peekAheadAtLumi() const;
00592 virtual EntryNumber_t peekAheadAtEventEntry() const;
00593 virtual bool skipLumiInRun();
00594
00595 private:
00596
00597 virtual void initializeLumi_();
00598 virtual bool nextEventRange();
00599 virtual bool previousEventRange();
00600 virtual bool setToLastEventInRange(int index);
00601 virtual EntryType getRunOrLumiEntryType(int index) const;
00602 virtual bool isSameLumi(int index1, int index2) const;
00603 virtual bool isSameRun(int index1, int index2) const;
00604 };
00605
00606
00607
00608
00609 class IndexIntoFileItrSorted : public IndexIntoFileItrImpl {
00610 public:
00611 IndexIntoFileItrSorted(IndexIntoFile const* indexIntoFile,
00612 EntryType entryType,
00613 int indexToRun,
00614 int indexToLumi,
00615 int indexToEventRange,
00616 long long indexToEvent,
00617 long long nEvents);
00618
00619 virtual IndexIntoFileItrImpl* clone() const;
00620 virtual int processHistoryIDIndex() const;
00621 virtual RunNumber_t run() const;
00622 virtual LuminosityBlockNumber_t lumi() const;
00623 virtual EntryNumber_t entry() const;
00624 virtual LuminosityBlockNumber_t peekAheadAtLumi() const;
00625 virtual EntryNumber_t peekAheadAtEventEntry() const;
00626 virtual bool skipLumiInRun();
00627
00628 private:
00629
00630 virtual void initializeLumi_();
00631 virtual bool nextEventRange();
00632 virtual bool previousEventRange();
00633 virtual bool setToLastEventInRange(int index);
00634 virtual EntryType getRunOrLumiEntryType(int index) const;
00635 virtual bool isSameLumi(int index1, int index2) const;
00636 virtual bool isSameRun(int index1, int index2) const;
00637 };
00638
00639
00640
00641
00642 class IndexIntoFileItr {
00643 public:
00652 IndexIntoFileItr(IndexIntoFile const* indexIntoFile,
00653 SortOrder sortOrder,
00654 EntryType entryType,
00655 int indexToRun,
00656 int indexToLumi,
00657 int indexToEventRange,
00658 long long indexToEvent,
00659 long long nEvents);
00660
00661
00662 EntryType getEntryType() const {return impl_->getEntryType();}
00663 int processHistoryIDIndex() const {return impl_->processHistoryIDIndex();}
00664 RunNumber_t run() const {return impl_->run();}
00665 LuminosityBlockNumber_t lumi() const {return impl_->lumi();}
00666 EntryNumber_t entry() const {return impl_->entry();}
00667
00670 LuminosityBlockNumber_t peekAheadAtLumi() const { return impl_->peekAheadAtLumi(); }
00671
00676 EntryNumber_t peekAheadAtEventEntry() const { return impl_->peekAheadAtEventEntry(); }
00677
00681 EntryNumber_t firstEventEntryThisRun() const { return impl_->firstEventEntryThisRun(); }
00682 EntryNumber_t firstEventEntryThisLumi() const { return impl_->firstEventEntryThisLumi(); }
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00698 IndexIntoFileItr& operator++() {
00699 impl_->next();
00700 return *this;
00701 }
00702
00708 void skipEventForward(int& phIndexOfSkippedEvent,
00709 RunNumber_t& runOfSkippedEvent,
00710 LuminosityBlockNumber_t& lumiOfSkippedEvent,
00711 EntryNumber_t& skippedEventEntry) {
00712 impl_->skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
00713 }
00714
00722 void skipEventBackward(int& phIndexOfEvent,
00723 RunNumber_t& runOfEvent,
00724 LuminosityBlockNumber_t& lumiOfEvent,
00725 EntryNumber_t& eventEntry) {
00726 impl_->skipEventBackward(phIndexOfEvent, runOfEvent, lumiOfEvent, eventEntry);
00727 }
00728
00731 bool skipLumiInRun() { return impl_->skipLumiInRun(); }
00732
00735 bool skipToNextEventInLumi() { return impl_->skipToNextEventInLumi(); }
00736
00737 void advanceToNextRun() {impl_->advanceToNextRun();}
00738 void advanceToNextLumiOrRun() {impl_->advanceToNextLumiOrRun();}
00739
00740 void advanceToEvent();
00741 void advanceToLumi();
00742
00743 bool operator==(IndexIntoFileItr const& right) const {
00744 return *impl_ == *right.impl_;
00745 }
00746
00747 bool operator!=(IndexIntoFileItr const& right) const {
00748 return !(*this == right);
00749 }
00750
00752 void initializeRun() {impl_->initializeRun();}
00753
00755 void initializeLumi() {impl_->initializeLumi();}
00756
00758 void copyPosition(IndexIntoFileItr const& position);
00759
00760 private:
00761
00762
00763
00764 IndexIntoFile const* indexIntoFile() const { return impl_->indexIntoFile(); }
00765 int size() const { return impl_->size(); }
00766 EntryType type() const { return impl_->type(); }
00767 int indexToRun() const { return impl_->indexToRun(); }
00768 int indexToLumi() const { return impl_->indexToLumi(); }
00769 int indexToEventRange() const { return impl_->indexToEventRange(); }
00770 long long indexToEvent() const { return impl_->indexToEvent(); }
00771 long long nEvents() const { return impl_->nEvents(); }
00772
00773 value_ptr<IndexIntoFileItrImpl> impl_;
00774 };
00775
00776
00777
00778
00779 class IndexRunKey {
00780 public:
00781 IndexRunKey(int index, RunNumber_t run) :
00782 processHistoryIDIndex_(index),
00783 run_(run) {
00784 }
00785
00786 int processHistoryIDIndex() const {return processHistoryIDIndex_;}
00787 RunNumber_t run() const {return run_;}
00788
00789 bool operator<(IndexRunKey const& right) const {
00790 if (processHistoryIDIndex_ == right.processHistoryIDIndex()) {
00791 return run_ < right.run();
00792 }
00793 return processHistoryIDIndex_ < right.processHistoryIDIndex();
00794 }
00795
00796 private:
00797 int processHistoryIDIndex_;
00798 RunNumber_t run_;
00799 };
00800
00801
00802
00803
00804 class IndexRunLumiKey {
00805 public:
00806 IndexRunLumiKey(int index, RunNumber_t run, LuminosityBlockNumber_t lumi) :
00807 processHistoryIDIndex_(index),
00808 run_(run),
00809 lumi_(lumi) {
00810 }
00811
00812 int processHistoryIDIndex() const {return processHistoryIDIndex_;}
00813 RunNumber_t run() const {return run_;}
00814 LuminosityBlockNumber_t lumi() const {return lumi_;}
00815
00816 bool operator<(IndexRunLumiKey const& right) const {
00817 if (processHistoryIDIndex_ == right.processHistoryIDIndex()) {
00818 if (run_ == right.run()) {
00819 return lumi_ < right.lumi();
00820 }
00821 return run_ < right.run();
00822 }
00823 return processHistoryIDIndex_ < right.processHistoryIDIndex();
00824 }
00825
00826 private:
00827 int processHistoryIDIndex_;
00828 RunNumber_t run_;
00829 LuminosityBlockNumber_t lumi_;
00830 };
00831
00832
00833
00834
00835 class IndexRunLumiEventKey {
00836 public:
00837 IndexRunLumiEventKey(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) :
00838 processHistoryIDIndex_(index),
00839 run_(run),
00840 lumi_(lumi),
00841 event_(event) {
00842 }
00843
00844 int processHistoryIDIndex() const {return processHistoryIDIndex_;}
00845 RunNumber_t run() const {return run_;}
00846 LuminosityBlockNumber_t lumi() const {return lumi_;}
00847 EventNumber_t event() const {return event_;}
00848
00849 bool operator<(IndexRunLumiEventKey const& right) const {
00850 if (processHistoryIDIndex_ == right.processHistoryIDIndex()) {
00851 if (run_ == right.run()) {
00852 if (lumi_ == right.lumi()) {
00853 return event_ < right.event();
00854 }
00855 return lumi_ < right.lumi();
00856 }
00857 return run_ < right.run();
00858 }
00859 return processHistoryIDIndex_ < right.processHistoryIDIndex();
00860 }
00861
00862 private:
00863 int processHistoryIDIndex_;
00864 RunNumber_t run_;
00865 LuminosityBlockNumber_t lumi_;
00866 EventNumber_t event_;
00867 };
00868
00869
00870
00871
00872 class EventFinder {
00873 public:
00874 virtual ~EventFinder() {}
00875 virtual EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const = 0;
00876 };
00877
00878
00879
00880
00881
00882
00883
00886 void addEntry(ProcessHistoryID const& processHistoryID,
00887 RunNumber_t run,
00888 LuminosityBlockNumber_t lumi,
00889 EventNumber_t event,
00890 EntryNumber_t entry);
00891
00896 void sortVector_Run_Or_Lumi_Entries();
00897
00898
00899
00900
00901
00902
00903
00909 void fixIndexes(std::vector<ProcessHistoryID>& processHistoryIDs);
00910
00913 void setNumberOfEvents(EntryNumber_t nevents) const {
00914 transient_.numberOfEvents_ = nevents;
00915 }
00916
00922 void setEventFinder(boost::shared_ptr<EventFinder> ptr) const {transient_.eventFinder_ = ptr;}
00923
00937 void fillEventNumbers() const;
00938
00952 void fillEventEntries() const;
00953
00959 void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const;
00960
00964 std::vector<EventNumber_t>& unsortedEventNumbers() const {return transient_.unsortedEventNumbers_;}
00965
00968 void inputFileClosed() const;
00969
00971 void doneFileInitialization() const;
00972
00976 std::vector<RunOrLumiEntry>& setRunOrLumiEntries() {return runOrLumiEntries_;}
00977
00981 std::vector<ProcessHistoryID>& setProcessHistoryIDs() {return processHistoryIDs_;}
00982
00986 void reduceProcessHistoryIDs();
00987
00988
00989
00990
00992 std::vector<RunOrLumiEntry> const& runOrLumiEntries() const {return runOrLumiEntries_;}
00993
00994
00995
00996
00997 void initializeTransients() const {transient_.reset();}
00998
00999 struct Transients {
01000 Transients();
01001 void reset();
01002 int previousAddedIndex_;
01003 std::map<IndexRunKey, EntryNumber_t> runToFirstEntry_;
01004 std::map<IndexRunLumiKey, EntryNumber_t> lumiToFirstEntry_;
01005 EntryNumber_t beginEvents_;
01006 EntryNumber_t endEvents_;
01007 int currentIndex_;
01008 RunNumber_t currentRun_;
01009 LuminosityBlockNumber_t currentLumi_;
01010 EntryNumber_t numberOfEvents_;
01011 boost::shared_ptr<EventFinder> eventFinder_;
01012 std::vector<RunOrLumiIndexes> runOrLumiIndexes_;
01013 std::vector<EventNumber_t> eventNumbers_;
01014 std::vector<EventEntry> eventEntries_;
01015 std::vector<EventNumber_t> unsortedEventNumbers_;
01016 };
01017
01018 private:
01019
01022 void fillRunOrLumiIndexes() const;
01023
01024 void fillUnsortedEventNumbers() const;
01025 void resetEventFinder() const {transient_.eventFinder_.reset();}
01026 std::vector<EventEntry>& eventEntries() const {return transient_.eventEntries_;}
01027 std::vector<EventNumber_t>& eventNumbers() const {return transient_.eventNumbers_;}
01028 void sortEvents() const;
01029 void sortEventEntries() const;
01030 int& previousAddedIndex() const {return transient_.previousAddedIndex_;}
01031 std::map<IndexRunKey, EntryNumber_t>& runToFirstEntry() const {return transient_.runToFirstEntry_;}
01032 std::map<IndexRunLumiKey, EntryNumber_t>& lumiToFirstEntry() const {return transient_.lumiToFirstEntry_;}
01033 EntryNumber_t& beginEvents() const {return transient_.beginEvents_;}
01034 EntryNumber_t& endEvents() const {return transient_.endEvents_;}
01035 int& currentIndex() const {return transient_.currentIndex_;}
01036 RunNumber_t& currentRun() const {return transient_.currentRun_;}
01037 LuminosityBlockNumber_t& currentLumi() const {return transient_.currentLumi_;}
01038 std::vector<RunOrLumiIndexes>& runOrLumiIndexes() const {return transient_.runOrLumiIndexes_;}
01039 size_t numberOfEvents() const {return transient_.numberOfEvents_;}
01040 EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const {
01041 return transient_.eventFinder_->getEventNumberOfEntry(entry);
01042 }
01043
01044 mutable Transients transient_;
01045
01046 std::vector<ProcessHistoryID> processHistoryIDs_;
01047 std::vector<RunOrLumiEntry> runOrLumiEntries_;
01048 };
01049
01050 template <>
01051 struct value_ptr_traits<IndexIntoFile::IndexIntoFileItrImpl> {
01052 static IndexIntoFile::IndexIntoFileItrImpl* clone(IndexIntoFile::IndexIntoFileItrImpl const* p) {return p->clone();}
01053 };
01054
01055
01056 class Compare_Index_Run {
01057 public:
01058 bool operator()(IndexIntoFile::RunOrLumiIndexes const& lh, IndexIntoFile::RunOrLumiIndexes const& rh);
01059 };
01060
01061 class Compare_Index {
01062 public:
01063 bool operator()(IndexIntoFile::RunOrLumiIndexes const& lh, IndexIntoFile::RunOrLumiIndexes const& rh);
01064 };
01065 }
01066
01067 #endif