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