1 #ifndef DataFormats_Provenance_IndexIntoFile_h 2 #define DataFormats_Provenance_IndexIntoFile_h 243 class TestIndexIntoFile;
244 class TestIndexIntoFile1;
245 class TestIndexIntoFile2;
246 class TestIndexIntoFile3;
247 class TestIndexIntoFile4;
248 class TestIndexIntoFile5;
252 class ProcessHistoryRegistry;
566 void getRange(
long long& beginEventNumbers,
567 long long& endEventNumbers,
674 virtual bool isSameLumi(
int index1,
int index2)
const = 0;
675 virtual bool isSameRun(
int index1,
int index2)
const = 0;
721 bool isSameLumi(
int index1,
int index2)
const override;
722 bool isSameRun(
int index1,
int index2)
const override;
757 bool isSameLumi(
int index1,
int index2)
const override;
758 bool isSameRun(
int index1,
int index2)
const override;
807 bool isSameLumi(
int index1,
int index2)
const override;
808 bool isSameRun(
int index1,
int index2)
const override;
862 int endOfRunEntries);
865 std::vector<TTreeEntryAndIndex>::const_iterator& endLumisWithNoEvents,
867 bool completeAll =
false);
875 bool completeAll =
false);
957 impl_->skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
971 impl_->skipEventBackward(phIndexOfEvent, runOfEvent, lumiOfEvent, eventEntry);
1005 friend class ::TestIndexIntoFile;
1006 friend class ::TestIndexIntoFile2;
1007 friend class ::TestIndexIntoFile3;
1008 friend class ::TestIndexIntoFile4;
1009 friend class ::TestIndexIntoFile5;
1264 friend class ::TestIndexIntoFile;
1265 friend class ::TestIndexIntoFile1;
1266 friend class ::TestIndexIntoFile2;
1267 friend class ::TestIndexIntoFile3;
1268 friend class ::TestIndexIntoFile4;
1269 friend class ::TestIndexIntoFile5;
void initializeRun()
Should only be used internally and for tests.
void initializeLumi_() override
bool setToLastEventInRange(int index) override
int processHistoryIDIndex() const
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
int processHistoryIDIndex() const
std::vector< TTreeEntryAndIndex > indexesSortedByEventEntry_
LuminosityBlockNumber_t peekAheadAtLumi() const override
IndexIntoFileItr begin(SortOrder sortOrder) const
void fillIndexesSortedByEventEntry(std::vector< RunOrLumiEntry > const &)
EntryType getRunOrLumiEntryType(int index) const override
bool shouldProcessLumi() const final
bool shouldProcessEvents(EntryNumber_t iEntry) const
bool lumiIterationStartingIndex(int index) const override
EventNumber_t event() const
void handleToEndOfContiguousEventsInRun(EntryOrderInitializationInfo &info, EntryNumber_t currentRun)
IndexIntoFile::EntryNumber_t ttreeEntry_
void setIndexToLumi(int value)
virtual void initializeLumi_()=0
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
EntryNumber_t firstEventEntryThisRun()
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToOrder() const
void fillLumisWithNoRemainingEvents(std::vector< TTreeEntryAndIndex > &lumisWithNoRemainingEvents, int startingIndex, EntryNumber_t currentRun, RunOrLumiEntry const *eventSequenceRunOrLumiEntry) const
std::vector< EventNumber_t > const & unsortedEventNumbers() const
std::vector< int > startOfLastContiguousEventsInLumi_
IndexRunLumiKey(int index, RunNumber_t run, LuminosityBlockNumber_t lumi)
static constexpr int invalidIndex
EntryNumber_t entry() const override
bool skipLumiInRun() override
int & previousAddedIndex() const
bool isSameLumi(int index1, int index2) const override
LuminosityBlockNumber_t currentLumi_
static void destroy(IndexIntoFile::IndexIntoFileItrImpl *p)
bool operator==(SortedRunOrLumiItr const &right) const
EntryNumber_t endEvents() const
void handleToEndOfContiguousEventsInLumis(EntryOrderInitializationInfo &info, EntryNumber_t currentRun, int endOfRunEntries)
IndexIntoFileItrEntryOrder(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
bool skipToNextEventInLumi()
void fillEventNumbers() const
std::vector< int > firstIndexOfLumi_
void handleLumisWithNoEvents(std::vector< TTreeEntryAndIndex >::const_iterator &nextLumiWithNoEvents, std::vector< TTreeEntryAndIndex >::const_iterator &endLumisWithNoEvents, EntryNumber_t lumiTTreeEntryNumber, bool completeAll=false)
void addToFileOrder(int index, bool processRunOrLumi, bool processEvents)
void addLumi(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EntryNumber_t entry)
virtual bool previousEventRange()=0
void addRunsWithNoEvents(EntryOrderInitializationInfo &, EntryNumber_t maxRunTTreeEntry=invalidEntry)
virtual bool nextEventRange()=0
int processHistoryIDIndex() const override
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
EntryNumber_t orderPHIDRunLumi() const
IndexIntoFileItrImpl * clone() const override
void advanceToNextLumiOrRun()
void setBeginEventNumbers(long long v)
std::vector< TTreeEntryAndIndex >::const_iterator iEventSequence_
std::vector< EventNumber_t > eventNumbers_
virtual int processHistoryIDIndex() const =0
int processHistoryIDIndex() const override
bool operator!=(SortedRunOrLumiItr const &right) const
EntryNumber_t entry() const
virtual bool setToLastEventInRange(int index)=0
EntryType getEntryType() const
LuminosityBlockNumber_t lumi_
EntryNumber_t orderPHIDRun_
int processHistoryIDIndex_
long long beginEventNumbers_
bool operator<(IndexRunLumiKey const &right) const
void sortEventEntries() const
EntryNumber_t beginEvents_
RunOrLumiEntry const * eventSequenceRunOrLumiEntry_
EventEntry(EventNumber_t event, EntryNumber_t entry)
IndexIntoFile const * indexIntoFile() const
static IndexIntoFile::IndexIntoFileItrImpl * clone(IndexIntoFile::IndexIntoFileItrImpl const *p)
bool nextEventRange() override
IndexIntoFile const * indexIntoFile_
int processHistoryIDIndex_
unsigned long long EventNumber_t
virtual LuminosityBlockNumber_t peekAheadAtLumi() const =0
EntryNumber_t beginEvents_
EntryNumber_t & endEvents() const
bool shouldProcessLumi() const final
void resizeVectors(std::vector< RunOrLumiEntry > const &)
EntryType getRunOrLumiEntryType(int index) const override
IndexIntoFile::IndexIntoFileItr const & iter_
void fillEventEntries() const
void initializeLumi_() override
bool previousEventRange() override
bool operator==(EventEntry const &right) const
void nextEventSequence(std::vector< RunOrLumiEntry > const &runOrLumiEntries)
IndexIntoFile const * indexIntoFile_
RunNumber_t & currentRun() const
std::vector< EventEntry > & eventEntries() const
IndexIntoFileItrHolder(IndexIntoFile::IndexIntoFileItr const &iIter)
std::vector< EventNumber_t > unsortedEventNumbers_
virtual bool isSameLumi(int index1, int index2) const =0
long long indexToEvent() const
void setIndexToEventRange(int value)
LuminosityBlockNumber_t lumi() const
bool shouldProcessRunOrLumi(EntryNumber_t iEntry) const
IndexRunLumiEventKey(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
virtual ~IndexIntoFileItrImpl()
EntryNumber_t entry() const override
unsigned int LuminosityBlockNumber_t
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
std::vector< TTreeEntryAndIndex >::const_iterator iEventSequenceEnd_
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
static constexpr EventNumber_t invalidEvent
virtual EntryNumber_t peekAheadAtEventEntry() const =0
EntryNumber_t peekAheadAtEventEntry() const
void advanceToNextLumiOrRun()
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
std::map< IndexRunLumiKey, EntryNumber_t > lumiToOrder_
bool operator==(IndexIntoFileItrImpl const &right) const
RunNumber_t run() const override
void sortVector_Run_Or_Lumi_Entries()
IndexIntoFileItrImpl * clone() const override
void fillUnsortedEventNumbers() const
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
int processHistoryIDIndex() const
LuminosityBlockNumber_t lumi() const override
bool operator!=(IndexIntoFileItr const &right) const
std::vector< TTreeEntryAndIndex >::const_iterator nextRunWithNoEvents_
void setNEvents(long long value)
EntryNumber_t lowestInLumi(EntryOrderInitializationInfo &info, int currentLumi) const
void setNumberOfEvents(EntryNumber_t nevents)
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
LuminosityBlockNumber_t lumi() const
int & currentIndex() const
bool skipLumiInRun() override
bool setToLastEventInRange(int index) override
EntryNumber_t entry() const
IndexIntoFileItrImpl * clone() const override
void checkForMissingRunOrLumiEntry() const
Run this check just after sorting.
bool operator<(RunOrLumiEntry const &right) const
virtual LuminosityBlockNumber_t lumi() const =0
virtual bool lumiIterationStartingIndex(int index) const =0
RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry)
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
void reserveSpaceInVectors(std::vector< EntryNumber_t >::size_type)
double intersection(double r12)
void setOrderPHIDRun(EntryNumber_t v)
virtual EntryType getRunOrLumiEntryType(int index) const =0
virtual int indexedSize() const
EntryNumber_t entry() const
bool shouldProcessRun() const final
static constexpr RunNumber_t invalidRun
bool lumiIterationStartingIndex(int index) const
void setIndexToEvent(long long value)
LuminosityBlockNumber_t peekAheadAtLumi() const override
virtual EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const =0
int processHistoryIDIndex_
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
RunNumber_t run() const override
virtual IndexIntoFileItrImpl * clone() const =0
std::vector< RunOrLumiEntry > runOrLumiEntries_
std::map< IndexRunKey, EntryNumber_t > runToOrder_
LuminosityBlockNumber_t lumi() const override
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
void handleLumiWithEvents(EntryOrderInitializationInfo &info, int currentLumi, EntryNumber_t firstBeginEventsContiguousLumi)
EntryNumber_t numberOfEvents_
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
std::vector< ProcessHistoryID > processHistoryIDs_
void initializeTransients()
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
long long endEventNumbers() const
LuminosityBlockNumber_t lumi_
EntryNumber_t firstEventEntryThisLumi()
virtual bool isSameRun(int index1, int index2) const =0
bool shouldProcessRun() const
SortedRunOrLumiItr endRunOrLumi() 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
virtual bool skipLumiInRun()=0
bool operator<(EventEntry const &right) const
bool previousLumiWithEvents()
bool empty() const
True if no runs, lumis, or events are in the file.
unsigned runOrLumi() const
virtual EntryNumber_t entry() const =0
std::vector< int > startOfLastContiguousEventsInRun_
SortedRunOrLumiItr & operator++()
bool isSameRun(int index1, int index2) const override
ProcessHistoryID const & processHistoryID(int i) const
void setProcessHistoryIDIndex(int v)
IndexIntoFileItr & operator++()
Move to next event to be processed.
EventNumber_t event() const
std::vector< bool > shouldProcessRunOrLumi_
void setEndEventNumbers(long long v)
EntryNumber_t peekAheadAtEventEntry() const override
long long nEvents() const
std::vector< TTreeEntryAndIndex >::const_iterator endRunsWithNoEvents_
bool operator<(RunOrLumiIndexes const &right) const
bool operator<(IndexRunKey const &right) const
std::vector< EventNumber_t > & unsortedEventNumbersMutable() const
bool isSameRun(int index1, int index2) const override
int indexedSize() const override
std::vector< EntryNumber_t > fileOrderRunOrLumiEntry_
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
void handleLumiEntriesNoRemainingEvents(EntryOrderInitializationInfo &info, int &iLumiIndex, int currentLumi, EntryNumber_t firstBeginEventsContiguousLumi, bool completeAll=false)
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
EntryNumber_t beginEvents() const
bool operator==(IndexIntoFileItr const &right) const
SortedRunOrLumiItr(IndexIntoFile const *indexIntoFile, unsigned runOrLumi)
EntryNumber_t firstEventEntryThisLumi()
virtual bool shouldProcessRun() const =0
LuminosityBlockNumber_t lumi() const
long long nEvents() const
bool lumiIterationStartingIndex(int index) const override
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
long long beginEventNumbers() const
bool lumiIterationStartingIndex(int index) const override
IndexRunKey(int index, RunNumber_t run)
IndexIntoFile const * indexIntoFile() const
bool previousEventRange() override
void fillIndexesToLastContiguousEvents(std::vector< RunOrLumiEntry > const &)
LuminosityBlockNumber_t lumi() const
size_t numberOfEvents() const
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
EntryNumber_t peekAheadAtEventEntry() const override
std::vector< EventNumber_t > & eventNumbers() const
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
bool setToLastEventInRange(int index) override
int processHistoryIDIndex() const
bool nextEventRange() override
IndexIntoFile const * indexIntoFile() const
bool shouldProcessRun() const final
long long endEventNumbers_
static constexpr EntryNumber_t invalidEntry
LuminosityBlockNumber_t peekAheadAtLumi() const
int processHistoryIDIndex() const override
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
int indexToEventRange() const
RunNumber_t run() const override
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
void initializeLumi()
Should only be used internally and for tests.
bool operator<(IndexRunLumiEventKey const &right) const
void fillRunOrLumiIndexes() const
int indexToGetEntry() const
std::vector< ProcessHistoryID > const & processHistoryIDs() const
LuminosityBlockNumber_t lumi() const
EntryNumber_t firstEventEntryThisRun()
void copyPosition(IndexIntoFileItrImpl const &position)
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
int processHistoryIDIndex() const
LuminosityBlockNumber_t lumi() const override
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
std::vector< EventEntry > eventEntries_
EntryNumber_t orderPHIDRun() const
void doneFileInitialization()
Clears the temporary vector of event numbers to reduce memory usage.
LuminosityBlockNumber_t & currentLumi() const
EntryType getRunOrLumiEntryType(int index) const override
bool containsRun(RunNumber_t run) const
bool containsDuplicateEvents() const
Returns true if the IndexIntoFile contains 2 events with the same ProcessHistoryID index...
std::vector< bool > shouldProcessEvents_
LuminosityBlockNumber_t lumi_
static int position[264][3]
bool isSameLumi(int index1, int index2) const override
bool isSameRun(int index1, int index2) const override
long long indexToEvent() const
EntryType getEntryType() const
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
bool isSameLumi(int index1, int index2) const override
void gatherNeededInfo(std::vector< RunOrLumiEntry > const &)
bool nextEventRange() override
RunOrLumiEntry const & runOrLumisEntry(EntryNumber_t iEntry) const
std::vector< RunOrLumiIndexes > runOrLumiIndexes_
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
SortedRunOrLumiItr beginRunOrLumi() const
IndexIntoFileItr(IndexIntoFile const *indexIntoFile, SortOrder sortOrder, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
std::vector< int > firstIndexOfRun_
bool previousEventRange() override
virtual bool shouldProcessLumi() const =0
int processHistoryIDIndex() const
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
EntryNumber_t entry() const override
bool shouldProcessRun() const final
bool skipToNextEventInLumi()
EntryNumber_t orderPHIDRunLumi_
void setEventFinder(std::shared_ptr< EventFinder > ptr)
bool shouldProcessLumi() const final
LuminosityBlockNumber_t lumi_
void getRange(long long &beginEventNumbers, long long &endEventNumbers, EntryNumber_t &beginEventEntry, EntryNumber_t &endEventEntry)
RunOrLumiIndexes const & runOrLumiIndexes() const
virtual RunNumber_t run() const =0
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
void set_intersection(IndexIntoFile const &indexIntoFile, std::set< IndexRunLumiEventKey > &intersection) const
EntryNumber_t & beginEvents() const
value_ptr< IndexIntoFileItrImpl > impl_
std::vector< TTreeEntryAndIndex > runsWithNoEvents_
std::map< IndexRunKey, EntryNumber_t > & runToOrder() const
bool skipLumiInRun() override
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)
void resetEventFinder() const
bool shouldProcessLumi() const
void initializeLumi_() override
int processHistoryIDIndex_
EntryNumber_t peekAheadAtEventEntry() const override
int indexToEventRange() const
int processHistoryIDIndex_
edm::propagate_const< std::shared_ptr< EventFinder > > eventFinder_