CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
edm::IndexIntoFile Class Reference

#include <IndexIntoFile.h>

Classes

class  EventEntry
 
class  EventFinder
 
class  IndexIntoFileItr
 
class  IndexIntoFileItrImpl
 
class  IndexIntoFileItrNoSort
 
class  IndexIntoFileItrSorted
 
class  IndexRunKey
 
class  IndexRunLumiEventKey
 
class  IndexRunLumiKey
 
class  RunOrLumiEntry
 
class  RunOrLumiIndexes
 
class  SortedRunOrLumiItr
 
struct  Transients
 

Public Types

using EntryNumber_t = long long
 
enum  EntryType { kRun, kLumi, kEvent, kEnd }
 
enum  SortOrder { numericalOrder, firstAppearanceOrder }
 

Public Member Functions

void addEntry (ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
 
void addLumi (int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EntryNumber_t entry)
 
IndexIntoFileItr begin (SortOrder sortOrder) const
 
SortedRunOrLumiItr beginRunOrLumi () const
 
bool containsDuplicateEvents () const
 Returns true if the IndexIntoFile contains 2 events with the same ProcessHistoryID index, run number, lumi number and event number. More...
 
bool containsEvent (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
bool containsItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
bool containsLumi (RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
bool containsRun (RunNumber_t run) const
 
void doneFileInitialization ()
 Clears the temporary vector of event numbers to reduce memory usage. More...
 
bool empty () const
 True if no runs, lumis, or events are in the file. More...
 
IndexIntoFileItr end (SortOrder sortOrder) const
 Used to end an iteration over the Runs, Lumis, and Events in a file. More...
 
SortedRunOrLumiItr endRunOrLumi () const
 
void fillEventEntries () const
 
void fillEventNumbers () const
 
void fillEventNumbersOrEntries (bool needEventNumbers, bool needEventEntries) const
 
IndexIntoFileItr findEventPosition (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
IndexIntoFileItr findLumiPosition (RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
IndexIntoFileItr findPosition (RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
 
IndexIntoFileItr findPosition (SortOrder sortOrder, RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
 
IndexIntoFileItr findRunPosition (RunNumber_t run) const
 Same as findPosition. More...
 
void fixIndexes (std::vector< ProcessHistoryID > &processHistoryIDs)
 
 IndexIntoFile ()
 
void initializeTransients ()
 
void inputFileClosed ()
 
bool iterationWillBeInEntryOrder (SortOrder sortOrder) const
 Used to determine whether or not to disable fast cloning. More...
 
ProcessHistoryID const & processHistoryID (int i) const
 
std::vector< ProcessHistoryID > const & processHistoryIDs () const
 
void reduceProcessHistoryIDs (ProcessHistoryRegistry const &processHistoryRegistry)
 
std::vector< RunOrLumiEntry > const & runOrLumiEntries () const
 Used internally and for test purposes. More...
 
void set_intersection (IndexIntoFile const &indexIntoFile, std::set< IndexRunLumiEventKey > &intersection) const
 
void setEventFinder (std::shared_ptr< EventFinder > ptr)
 
void setNumberOfEvents (EntryNumber_t nevents)
 
std::vector< ProcessHistoryID > & setProcessHistoryIDs ()
 
std::vector< RunOrLumiEntry > & setRunOrLumiEntries ()
 
void sortVector_Run_Or_Lumi_Entries ()
 
std::vector< EventNumber_t > & unsortedEventNumbers ()
 
std::vector< EventNumber_t > const & unsortedEventNumbers () const
 
 ~IndexIntoFile ()
 

Static Public Attributes

static constexpr EntryNumber_t invalidEntry = -1LL
 
static constexpr EventNumber_t invalidEvent = 0U
 
static constexpr int invalidIndex = -1
 
static constexpr LuminosityBlockNumber_t invalidLumi = 0U
 
static constexpr RunNumber_t invalidRun = 0U
 

Private Member Functions

EntryNumber_tbeginEvents () const
 
int & currentIndex () const
 
LuminosityBlockNumber_tcurrentLumi () const
 
RunNumber_tcurrentRun () const
 
EntryNumber_tendEvents () const
 
std::vector< EventEntry > & eventEntries () const
 
std::vector< EventNumber_t > & eventNumbers () const
 
void fillRunOrLumiIndexes () const
 
void fillUnsortedEventNumbers () const
 
EventNumber_t getEventNumberOfEntry (EntryNumber_t entry) const
 
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToOrder () const
 
size_t numberOfEvents () const
 
int & previousAddedIndex () const
 
void resetEventFinder () const
 
std::vector< RunOrLumiIndexes > & runOrLumiIndexes () const
 
std::map< IndexRunKey, EntryNumber_t > & runToOrder () const
 
void sortEventEntries () const
 
void sortEvents () const
 
std::vector< EventNumber_t > & unsortedEventNumbersMutable () const
 

Private Attributes

std::vector< ProcessHistoryIDprocessHistoryIDs_
 
std::vector< RunOrLumiEntryrunOrLumiEntries_
 
Transients transient_
 

Friends

class ::TestIndexIntoFile
 
class ::TestIndexIntoFile1
 
class ::TestIndexIntoFile2
 
class ::TestIndexIntoFile3
 
class ::TestIndexIntoFile4
 
class ::TestIndexIntoFile5
 

Detailed Description

Used to quickly find the Events, Lumis, and Runs in a single ROOT format data file and step through them in the desired order.

A list of the most important functions that a client would use directly follows. There are detailed comments below with the declaration of each function.

The begin and end functions are used to start and stop an iteration loop. An argument to the iterator constructor determines the order of iteration.

The functions findPosition, findEventPosition, findRunPosition, and findLumiPosition are used to navigate directly to specific runs, lumis, and events.

The functions mentioned above return an object of type IndexIntoFileItr. The IndexIntoFileItr class has member functions which allow one to navigate forward and backward through the runs, lumis, and events in alternative ways. See more comments with the declaration of each public member function in IndexIntoFileItr.

The iterator will know what the current item is (as one would expect). This could be a run, lumi, or event. It knows more than that though, it knows all three as is explained below.

In the run state, IndexIntoFileItr knows which lumi will be processed next after the run and also which event will be processed after the lumi. These may not be the first ones in the run if the skip functions were used.

In the lumi state, the IndexIntoFileItr will always point at the last associated run and the next event to be processed after the lumi. This may not be the first event if the skip function was used.

In the event state, the IndexIntoFileItr will always point at the last corresponding run and also the last corresponding lumi.

There can be multiple run entries in a TTree associated with the same run number and ProcessHistoryID in a file. There can also be multiple lumi entries associated with the same lumi number, run number, and ProcessHistoryID. Both sorting orders will make these subgroups contiguous, but beyond that is up to the client (normally PoolSource, which passes them up to the EventProcessor) to deal with merging the multiple run (or lumi) entries together.

One final comment with regards to IndexIntoFileItr. This is not an STL iterator and it cannot be used with std:: algorithms. The data structures are complex and designed to optimize memory usage. It would be difficult or impossible implement an iterator that is STL compliant.

Here is a summary of the data structures in IndexIntoFile. The persistent data consists of two vectors.

processHistoryIDs_ is a std::vector<ProcessHistoryID> that contains the ProcessHistoryIDs with one element in the vector for each unique ProcessHistoryID. On output they are ordered as they first written out for each output file. On input they are ordered as they are first seen in each process. Note that each ProcessHistoryID is stored once in this separate vector. Everywhere else it is needed it stored as an index into this vector because the ProcessHistoryID itself is large and it would take more memory to store them repeatedly in the other vectors. Note that the ProcessHistoryID's referenced in this class are always the "reduced" ProcessHistoryID's, not the ProcessHistoryID of the full ProcessHistory. You cannot use them to directly access the ProcessHistory from the ProcessHistoryRegistry.

runOrLumiEntries_ is a std::vector<RunOrLumiEntry>. This vector holds one element per entry in the run TTree and one element per entry in the lumi TTree. When sorted, everything associated with a given run and ProcessHistoryID will be contiguous in the vector. These groups of elements will be sorted in the order they first appear in the input file. Within each of these groups the run entries come first in order, followed by the elements associated with the lumis. The lumis are also contiguous and sorted by first appearance in the input file. Within a lumi they are sorted by entry order. And each luminosity element corresponds to one contiguous sequence of Events in the Events TTree. Before we implemented concurrent processing of luminosity blocks that was the full story. After that it became more complicated because the sequence of events written to an output file that were associated with a particular luminosity block TTree entry might no longer be contiguous. Events from another concurrent luminosity block could get mixed in because with multiple events processing simultaneously, there is no longer any guarantee they will finish in the same order that they were read. This is handled by writing additional elements to the runOrLumiEntries_ vector, one for each contiguous block of events associated with a particular luminosity block. Only one of these vector elements will be associated with each entry in the luminosity block TTree and all the others will contain a TTree entry number that is invalid (note the one element with a valid entry might or might not be associated with a contiguous block of events). In the sort of elements related to a particular luminosity block, the entries with invalid entry numbers will come before the valid ones. (It has not happened yet as I am writing this, but a similar thing will likely occur for runs if/when we ever implement concurrent runs)

There are a number of transient data members also. The 3 most important of these are vectors. To save memory, these are only filled when needed.

runOrLumiIndexes_ is a std::vector<RunOrLumiIndexes>. There is a one to one correspondence between the elements of this vector and the elements of runOrLumiEntries_. The elements of this vector are sorted in numerical order using the ProcessHistoryID index, the run number, and the lumi number. This ordering allows iteration in numerical order and also fast lookup based on run number and lumi number. Each element also has indexes into the eventNumbers_ and eventEntries_ vectors which hold the information giving the event numbers and event entry numbers. Note this vector is initially formed in the identical order as runOrLumiEntries_ and then sorted with a stable sort. The fact that it is a stable sort means that within the subrange associated with a particular luminosity block the elements with an invalid TTree entry number come first and the later come the elements with a valid TTree entry number which are in order of TTree entry number.

eventNumbers_ is a std::vector containing EventNumber_t's. eventEntries_ is a std::vector containing EventEntry's. If filled, both vectors contain the same number of entries with identical event numbers sorted in the same order. The only difference is that one includes the entry numbers and thus takes more memory. Each element of runOrLumiIndexes_ associated with a luminosity block has the indexes necessary to find the range inside eventNumbers_ or eventEntries_ corresponding to its lumi. Within that range the elements are sorted by event number, which is used for the numerical order iteration and to find an event by the event number.

The details of the data structure are a little different when reading files written before release 3_8_0 (backward compatibility, see RootFile::fillIndexIntoFile for the details).

This data structure is optimized for low memory usage when there are large numbers of events. The optimal case would occur when there was was one run in a file, one luminosity block in that run and everything had the same ProcessHistoryID. If duplicate checking were off and the process simply iterated through the file in the default order, then only the persistent vectors would be filled. One vector would contain 2 elements, one for the run and the other for the lumi. The other vector would contain one element, the ProcessHistoryID. Even if there were a billion events, that would be all that would exist and take up memory. The data structure is not the optimal structure for a very sparse skim, but the overheads should be tolerable given the number of runs and luminosity blocks that should occur in CMS data.

Normally only the persistent parts of the data structure are filled in the output module. The output module fills them using two functions designed specifically for that purpose. The functions are addEntry and sortVector_Run_Or_Lumi_Entries.

There are some complexities associated with filling the data structure, mostly revolving around optimizations to minimize the per event memory usage. The client needs to know which parts of the data structure to fill. See the functions below named fixIndexes, setNumberOfEvents, setEventFinder, fillEventNumbers, fillEventEntries, and inputFileClosed.

Note that this class is not intended to be used directly by the average CMS user. PoolSource and PoolOutputModule are the main clients. Other executables that read ROOT format data files, but do not use PoolSource may also need to use it directly (FWLite, Fireworks, edmFileUtil ...). The interface is too complex for general use.

Author
W. David Dagenhart, created 19 May, 2010

Definition at line 225 of file IndexIntoFile.h.

Member Typedef Documentation

◆ EntryNumber_t

Definition at line 231 of file IndexIntoFile.h.

Member Enumeration Documentation

◆ EntryType

Enumerator
kRun 
kLumi 
kEvent 
kEnd 

Definition at line 238 of file IndexIntoFile.h.

238 { kRun, kLumi, kEvent, kEnd };

◆ SortOrder

This enum is used to specify the order of iteration. In firstAppearanceOrder there are 3 sort criteria, in order of precedence these are:

  1. firstAppearance of the ProcessHistoryID and run number in the file
  2. firstAppearance of the ProcessHistoryID, run number and lumi number in the file
  3. entry number

In numerical order the criteria are in order of precedence are:

  1. processHistoryID index (which are normally in order of appearance in the process)
  2. run number
  3. lumi number
  4. event number
  5. entry number
Enumerator
numericalOrder 
firstAppearanceOrder 

Definition at line 266 of file IndexIntoFile.h.

Constructor & Destructor Documentation

◆ IndexIntoFile()

edm::IndexIntoFile::IndexIntoFile ( )

Definition at line 51 of file IndexIntoFile.cc.

◆ ~IndexIntoFile()

edm::IndexIntoFile::~IndexIntoFile ( )

Definition at line 53 of file IndexIntoFile.cc.

53 {}

Member Function Documentation

◆ addEntry()

void edm::IndexIntoFile::addEntry ( ProcessHistoryID const &  processHistoryID,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
EntryNumber_t  entry 
)

Used by RootOutputModule to fill the persistent data. This will not work properly if entries are not added in the same order as in RootOutputModule

Definition at line 75 of file IndexIntoFile.cc.

79  {
80  int index = 0;
81  // First see if the ProcessHistoryID is the same as the previous one.
82  // This is just a performance optimization. We expect to usually get
83  // many in a row that are the same.
86  } else {
87  // If it was not the same as the previous one then search through the
88  // entire vector. If it is not there, it needs to be added at the
89  // end.
90  index = 0;
91  while (index < static_cast<int>(processHistoryIDs_.size()) && processHistoryIDs_[index] != processHistoryID) {
92  ++index;
93  }
94  if (index == static_cast<int>(processHistoryIDs_.size())) {
96  }
97  }
99 
100  assert((currentRun() == run && currentIndex() == index) || currentRun() == invalidRun);
101  if (lumi == invalidLumi) {
102  if (currentLumi() != invalidLumi) {
104  << "In IndexIntoFile::addEntry. Entries were added in illegal order.\n"
105  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
106  << "The output file will be unusable for most purposes.\n"
107  << "If this occurs after an unrelated exception was thrown in\n"
108  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
109  << "the primary exception. This is an expected side effect.\n"
110  << "Otherwise please report this to the core framework developers\n";
111  }
115  // assign each run an order value when first seen (using entry but any increasing value would work)
116  std::pair<IndexRunKey, EntryNumber_t> keyAndOrder(IndexRunKey(index, run), entry);
117  runToOrder().insert(keyAndOrder); // Does nothing if this key was already inserted
118  runOrLumiEntries_.emplace_back(
120  } else {
121  if (currentRun() == invalidRun) {
122  currentRun() = run;
123  currentIndex() = index;
124  }
125  if (event == invalidEvent) {
126  if (currentLumi() != lumi and currentLumi() != invalidLumi) {
127  //we have overlapping lumis so must inject a placeholder
129  }
131  addLumi(index, run, lumi, entry);
132  } else {
133  if (currentLumi() != lumi and currentLumi() != invalidLumi) {
134  //We have overlapping lumis so need to inject a placeholder
136  }
138  if (beginEvents() == invalidEntry) {
139  currentLumi() = lumi;
140  beginEvents() = entry;
141  endEvents() = beginEvents() + 1;
142  } else {
143  assert(currentLumi() == lumi);
144  assert(entry == endEvents());
145  ++endEvents();
146  }
147  }
148  }
149  }

References addLumi(), cms::cuda::assert(), beginEvents(), currentIndex(), currentLumi(), currentRun(), endEvents(), mps_splice::entry, Exception, invalidEntry, invalidEvent, invalidIndex, invalidLumi, invalidRun, edm::errors::LogicError, BXlumiParameters_cfi::lumi, numberOfEvents(), previousAddedIndex(), processHistoryID(), processHistoryIDs_, writedatasetfile::run, runOrLumiEntries_, runToOrder(), and setNumberOfEvents().

Referenced by edm::RootOutputFile::writeLuminosityBlock(), edm::RootOutputFile::writeOne(), and edm::RootOutputFile::writeRun().

◆ addLumi()

void edm::IndexIntoFile::addLumi ( int  index,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EntryNumber_t  entry 
)

Definition at line 59 of file IndexIntoFile.cc.

59  {
60  // assign each lumi an order value sequentially when first seen
61  std::pair<IndexRunLumiKey, EntryNumber_t> keyAndOrder(IndexRunLumiKey(index, run, lumi), lumiToOrder().size());
62  lumiToOrder().insert(keyAndOrder); // does nothing if this key already was inserted
63  runOrLumiEntries_.emplace_back(invalidEntry,
64  lumiToOrder()[IndexRunLumiKey(index, run, lumi)],
65  entry,
66  index,
67  run,
68  lumi,
69  beginEvents(),
70  endEvents());
73  }

References beginEvents(), endEvents(), mps_splice::entry, invalidEntry, lumiToOrder(), writedatasetfile::run, runOrLumiEntries_, and findQualityFiles::size.

Referenced by addEntry().

◆ begin()

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::begin ( SortOrder  sortOrder) const

Used to start an iteration over the Runs, Lumis, and Events in a file. Note the argument specifies the order

Definition at line 461 of file IndexIntoFile.cc.

461  {
462  if (empty()) {
463  return end(sortOrder);
464  }
465  IndexIntoFileItr iter(this, sortOrder, kRun, 0, invalidIndex, invalidIndex, 0, 0);
466  iter.initializeRun();
467  return iter;
468  }

References empty(), end(), edm::IndexIntoFile::IndexIntoFileItr::initializeRun(), invalidIndex, and kRun.

Referenced by containsDuplicateEvents(), findPosition(), iterationWillBeInEntryOrder(), edm::postIndexIntoFilePrintEventLists(), edm::postIndexIntoFilePrintEventsInLumis(), edm::RootFile::RootFile(), set_intersection(), sortEventEntries(), and sortEvents().

◆ beginEvents()

EntryNumber_t& edm::IndexIntoFile::beginEvents ( ) const
inlineprivate

◆ beginRunOrLumi()

IndexIntoFile::SortedRunOrLumiItr edm::IndexIntoFile::beginRunOrLumi ( ) const

Definition at line 710 of file IndexIntoFile.cc.

710 { return SortedRunOrLumiItr(this, 0); }

Referenced by containsDuplicateEvents(), fillEventNumbersOrEntries(), and set_intersection().

◆ containsDuplicateEvents()

bool edm::IndexIntoFile::containsDuplicateEvents ( ) const

Returns true if the IndexIntoFile contains 2 events with the same ProcessHistoryID index, run number, lumi number and event number.

Definition at line 818 of file IndexIntoFile.cc.

818  {
819  RunOrLumiIndexes const* previousIndexes = nullptr;
820 
821  for (SortedRunOrLumiItr iter = beginRunOrLumi(), iEnd = endRunOrLumi(); iter != iEnd; ++iter) {
822  RunOrLumiIndexes const& indexes = iter.runOrLumiIndexes();
823 
824  // Skip it if it is a run or the same lumi
825  if (indexes.isRun() || (previousIndexes && !(*previousIndexes < indexes))) {
826  continue;
827  }
828  previousIndexes = &indexes;
829 
830  long long beginEventNumbers = indexes.beginEventNumbers();
831  long long endEventNumbers = indexes.endEventNumbers();
832 
833  // there must be more than 1 event in the lumi for there to be any duplicates
834  if (beginEventNumbers + 1 >= endEventNumbers)
835  continue;
836 
837  if (!eventEntries().empty()) {
838  std::vector<EventEntry>::iterator last = eventEntries().begin() + endEventNumbers;
839  if (std::adjacent_find(eventEntries().begin() + beginEventNumbers, last) != last) {
840  return true;
841  }
842  } else {
844  std::vector<EventNumber_t>::iterator last = eventNumbers().begin() + endEventNumbers;
845  if (std::adjacent_find(eventNumbers().begin() + beginEventNumbers, last) != last) {
846  return true;
847  }
848  }
849  }
850  return false;
851  }

References begin(), edm::IndexIntoFile::RunOrLumiIndexes::beginEventNumbers(), beginRunOrLumi(), empty(), edm::IndexIntoFile::RunOrLumiIndexes::endEventNumbers(), endRunOrLumi(), eventEntries(), eventNumbers(), fillEventNumbers(), edm::IndexIntoFile::RunOrLumiIndexes::isRun(), and dqmdumpme::last.

Referenced by edm::DuplicateChecker::inputFileOpened().

◆ containsEvent()

bool edm::IndexIntoFile::containsEvent ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

◆ containsItem()

bool edm::IndexIntoFile::containsItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 696 of file IndexIntoFile.cc.

696  {
697  return (event != 0) ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
698  }

References containsEvent(), containsLumi(), containsRun(), and writedatasetfile::run.

Referenced by edm::RootFile::containsItem().

◆ containsLumi()

bool edm::IndexIntoFile::containsLumi ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const

Definition at line 704 of file IndexIntoFile.cc.

704  {
705  return findLumiPosition(run, lumi).getEntryType() != kEnd;
706  }

References findLumiPosition(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), kEnd, and writedatasetfile::run.

Referenced by containsItem().

◆ containsRun()

bool edm::IndexIntoFile::containsRun ( RunNumber_t  run) const

◆ currentIndex()

int& edm::IndexIntoFile::currentIndex ( ) const
inlineprivate

Definition at line 1074 of file IndexIntoFile.h.

1074 { return transient_.currentIndex_; }

References edm::IndexIntoFile::Transients::currentIndex_, and transient_.

Referenced by addEntry().

◆ currentLumi()

LuminosityBlockNumber_t& edm::IndexIntoFile::currentLumi ( ) const
inlineprivate

Definition at line 1076 of file IndexIntoFile.h.

1076 { return transient_.currentLumi_; }

References edm::IndexIntoFile::Transients::currentLumi_, and transient_.

Referenced by addEntry().

◆ currentRun()

RunNumber_t& edm::IndexIntoFile::currentRun ( ) const
inlineprivate

Definition at line 1075 of file IndexIntoFile.h.

1075 { return transient_.currentRun_; }

References edm::IndexIntoFile::Transients::currentRun_, and transient_.

Referenced by addEntry().

◆ doneFileInitialization()

void edm::IndexIntoFile::doneFileInitialization ( )

Clears the temporary vector of event numbers to reduce memory usage.

Definition at line 306 of file IndexIntoFile.cc.

306 { std::vector<EventNumber_t>().swap(unsortedEventNumbers()); }

References unsortedEventNumbers().

Referenced by edm::RootFile::RootFile().

◆ empty()

bool edm::IndexIntoFile::empty ( ) const

◆ end()

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::end ( SortOrder  sortOrder) const

◆ endEvents()

EntryNumber_t& edm::IndexIntoFile::endEvents ( ) const
inlineprivate

◆ endRunOrLumi()

IndexIntoFile::SortedRunOrLumiItr edm::IndexIntoFile::endRunOrLumi ( ) const

Definition at line 712 of file IndexIntoFile.cc.

712  {
713  return SortedRunOrLumiItr(this, runOrLumiEntries().size());
714  }

References runOrLumiEntries(), and findQualityFiles::size.

Referenced by containsDuplicateEvents(), fillEventNumbersOrEntries(), and set_intersection().

◆ eventEntries()

std::vector<EventEntry>& edm::IndexIntoFile::eventEntries ( ) const
inlineprivate

◆ eventNumbers()

std::vector<EventNumber_t>& edm::IndexIntoFile::eventNumbers ( ) const
inlineprivate

◆ fillEventEntries()

void edm::IndexIntoFile::fillEventEntries ( ) const

Fills a vector of objects that contain an event number and the corresponding TTree entry number for the event. Not filling it reduces the memory used by IndexIntoFile. As long as the event finder is still pointing at an open file this will automatically be called on demand (when the event numbers and entries are are needed). It makes sense for the client to fill this explicitly in advance if it is known that it will be needed, because in some cases this will prevent the event numbers vector from being unnecessarily filled (wasting memory). This vector will be needed when iterating over events in numerical order or looking up specific events. The entry numbers are needed if the events are actually read from the input file.

Definition at line 200 of file IndexIntoFile.cc.

200 { fillEventNumbersOrEntries(false, true); }

References fillEventNumbersOrEntries().

◆ fillEventNumbers()

void edm::IndexIntoFile::fillEventNumbers ( ) const

Fills a vector of event numbers. Not filling it reduces the memory used by IndexIntoFile. As long as the event finder is still pointing at an open file this will automatically be called on demand (when the event numbers are are needed). In cases, where the input file may be closed when the need arises, the client code must call this explicitly and fill the vector before the file is closed. In PoolSource, this is necessary when duplicate checking across all files and when doing lookups to see if an event is in a previously opened file. Either this vector or the one that also contains event entry numbers can be used when looking for duplicate events within the same file or looking up events in in the current file without reading them.

Definition at line 198 of file IndexIntoFile.cc.

198 { fillEventNumbersOrEntries(true, false); }

References fillEventNumbersOrEntries().

Referenced by containsDuplicateEvents(), findPosition(), edm::RootFile::goToEvent(), and set_intersection().

◆ fillEventNumbersOrEntries()

void edm::IndexIntoFile::fillEventNumbersOrEntries ( bool  needEventNumbers,
bool  needEventEntries 
) const

If needEventNumbers is true then this function does the same thing as fillEventNumbers. If NeedEventEntries is true, then this function does the same thing as fillEventEntries. If both are true, it fills both within the same loop and it uses less CPU than calling those two functions separately.

Definition at line 202 of file IndexIntoFile.cc.

202  {
203  if (numberOfEvents() == 0) {
204  return;
205  }
206 
207  if (needEventNumbers && !eventNumbers().empty()) {
208  needEventNumbers = false;
209  }
210 
211  if (needEventEntries && !eventEntries().empty()) {
212  needEventEntries = false;
213  }
214 
215  if (needEventNumbers && !eventEntries().empty()) {
217  eventNumbers().reserve(eventEntries().size());
219  eventNumbers().push_back(eventEntries()[entry].event());
220  }
221  return;
222  }
223 
224  if (!needEventNumbers && !needEventEntries) {
225  return;
226  }
227 
229 
230  if (needEventNumbers) {
232  }
233  if (needEventEntries) {
234  eventEntries().resize(numberOfEvents());
235  }
236 
237  long long offset = 0;
238  long long previousBeginEventNumbers = -1LL;
239 
240  for (SortedRunOrLumiItr runOrLumi = beginRunOrLumi(), runOrLumiEnd = endRunOrLumi(); runOrLumi != runOrLumiEnd;
241  ++runOrLumi) {
242  if (runOrLumi.isRun())
243  continue;
244 
245  long long beginEventNumbers = 0;
246  long long endEventNumbers = 0;
247  EntryNumber_t beginEventEntry = invalidEntry;
248  EntryNumber_t endEventEntry = invalidEntry;
249  runOrLumi.getRange(beginEventNumbers, endEventNumbers, beginEventEntry, endEventEntry);
250 
251  // This is true each time one hits a new lumi section (except if the previous lumi had
252  // no events, in which case the offset is still 0 anyway)
253  if (beginEventNumbers != previousBeginEventNumbers)
254  offset = 0;
255 
256  for (EntryNumber_t entry = beginEventEntry; entry != endEventEntry; ++entry) {
257  if (needEventNumbers) {
258  eventNumbers().at((entry - beginEventEntry) + offset + beginEventNumbers) = unsortedEventNumbers().at(entry);
259  }
260  if (needEventEntries) {
261  eventEntries().at((entry - beginEventEntry) + offset + beginEventNumbers) =
262  EventEntry(unsortedEventNumbers().at(entry), entry);
263  }
264  }
265 
266  previousBeginEventNumbers = beginEventNumbers;
267  offset += endEventEntry - beginEventEntry;
268  }
269  if (needEventNumbers) {
270  sortEvents();
272  }
273  if (needEventEntries) {
276  }
277  }

References cms::cuda::assert(), beginRunOrLumi(), empty(), endRunOrLumi(), mps_splice::entry, edmPickEvents::event, eventEntries(), eventNumbers(), fillUnsortedEventNumbers(), invalidEntry, invalidEvent, L1DTConfigBti_cff::LL, numberOfEvents(), hltrates_dqm_sourceclient-live_cfg::offset, findQualityFiles::size, sortEventEntries(), sortEvents(), mitigatedMETSequence_cff::U, and unsortedEventNumbers().

Referenced by fillEventEntries(), fillEventNumbers(), and edm::RootFile::validateFile().

◆ fillRunOrLumiIndexes()

void edm::IndexIntoFile::fillRunOrLumiIndexes ( ) const
private

This function will automatically get called when needed. It depends only on the fact that the persistent data has been filled already.

Definition at line 151 of file IndexIntoFile.cc.

151  {
152  if (runOrLumiEntries_.empty() || !runOrLumiIndexes().empty()) {
153  return;
154  }
155  runOrLumiIndexes().reserve(runOrLumiEntries_.size());
156 
157  int index = 0;
158  for (RunOrLumiEntry const& item : runOrLumiEntries_) {
159  runOrLumiIndexes().emplace_back(item.processHistoryIDIndex(), item.run(), item.lumi(), index);
160  ++index;
161  }
163 
164  long long beginEventNumbers = 0;
165 
166  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
167  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
168  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
169  while (true) {
170  while (beginOfLumi != iEnd && beginOfLumi->isRun()) {
171  ++beginOfLumi;
172  }
173  if (beginOfLumi == iEnd)
174  break;
175 
176  endOfLumi = beginOfLumi + 1;
177  while (endOfLumi != iEnd && beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
178  beginOfLumi->run() == endOfLumi->run() && beginOfLumi->lumi() == endOfLumi->lumi()) {
179  ++endOfLumi;
180  }
181  int nEvents = 0;
182  for (std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi; iter != endOfLumi; ++iter) {
183  if (runOrLumiEntries_[iter->indexToGetEntry()].beginEvents() != invalidEntry) {
184  nEvents += runOrLumiEntries_[iter->indexToGetEntry()].endEvents() -
185  runOrLumiEntries_[iter->indexToGetEntry()].beginEvents();
186  }
187  }
188  for (std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi; iter != endOfLumi; ++iter) {
189  iter->setBeginEventNumbers(beginEventNumbers);
190  iter->setEndEventNumbers(beginEventNumbers + nEvents);
191  }
192  beginEventNumbers += nEvents;
193  beginOfLumi = endOfLumi;
194  }
196  }

References cms::cuda::assert(), invalidEntry, B2GTnPMonitor_cfi::item, nEvents, runOrLumiEntries_, runOrLumiIndexes(), findQualityFiles::size, and edm::stable_sort_all().

Referenced by findPosition(), edm::IndexIntoFile::IndexIntoFileItrSorted::IndexIntoFileItrSorted(), set_intersection(), edm::IndexIntoFile::SortedRunOrLumiItr::SortedRunOrLumiItr(), sortEventEntries(), and sortEvents().

◆ fillUnsortedEventNumbers()

void edm::IndexIntoFile::fillUnsortedEventNumbers ( ) const
private

Definition at line 279 of file IndexIntoFile.cc.

279  {
280  if (numberOfEvents() == 0 || !unsortedEventNumbers().empty()) {
281  return;
282  }
284 
285  // The main purpose for the existence of the unsortedEventNumbers
286  // vector is that it can easily be filled by reading through
287  // the EventAuxiliary branch in the same order as the TTree
288  // entries. fillEventNumbersOrEntries can then use this information
289  // instead of using getEventNumberOfEntry directly and reading
290  // the branch in a different order.
293  }
294  }

References empty(), mps_splice::entry, getEventNumberOfEntry(), numberOfEvents(), mitigatedMETSequence_cff::U, unsortedEventNumbers(), and unsortedEventNumbersMutable().

Referenced by fillEventNumbersOrEntries().

◆ findEventPosition()

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::findEventPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Same as findPosition,except the entry type of the returned iterator will be kEvent or kEnd and the event argument must be nonzero. This means the next thing to be processed will be the event if it is found.

Definition at line 676 of file IndexIntoFile.cc.

678  {
680  IndexIntoFileItr iter = findPosition(run, lumi, event);
681  iter.advanceToEvent();
682  return iter;
683  }

References edm::IndexIntoFile::IndexIntoFileItr::advanceToEvent(), cms::cuda::assert(), findPosition(), invalidEvent, and writedatasetfile::run.

Referenced by containsEvent(), fwlite::EntryFinder::findEvent(), and edm::RootFile::setEntryAtEvent().

◆ findLumiPosition()

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::findLumiPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const

Same as findPosition,except the entry type of the returned iterator will be kLumi or kEnd and the lumi argument must be nonzero. This means the next thing to be processed will be the lumi if it is found.

Definition at line 685 of file IndexIntoFile.cc.

685  {
686  assert(lumi != invalidLumi);
687  IndexIntoFileItr iter = findPosition(run, lumi, 0U);
688  iter.advanceToLumi();
689  return iter;
690  }

References edm::IndexIntoFile::IndexIntoFileItr::advanceToLumi(), cms::cuda::assert(), findPosition(), invalidLumi, writedatasetfile::run, and mitigatedMETSequence_cff::U.

Referenced by containsLumi(), fwlite::EntryFinder::findLumi(), and edm::RootFile::setEntryAtLumi().

◆ findPosition() [1/2]

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::findPosition ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi = 0U,
EventNumber_t  event = 0U 
) const

Find a run, lumi, or event. Returns an iterator pointing at it. The iterator will always be in numericalOrder mode. If it is not found the entry type of the iterator will be kEnd. If it is found the entry type of the iterator will always be kRun so the next thing to be processed is the run containing the desired lumi or event or if looking for a run, the run itself. If the lumi and event arguments are 0 (invalid), then it will find a run. If only the event argument is 0 (invalid), then it will find a lumi. If will look for an event if all three arguments are nonzero or if only the lumi argument is 0 (invalid). Note that it will find the first match only so if there is more than one match then the others cannot be found with this method. The order of the search is by processHistoryID index, then run number, then lumi number, then event entry. If searching for a lumi the iterator will advance directly to the desired lumi after the run even if it is not the first lumi in the run. If searching for an event, the iterator will advance to the lumi containing the run and then the requested event after run even if there are other lumis earlier in that run and other events earlier in that lumi.

Definition at line 489 of file IndexIntoFile.cc.

491  {
493 
494  bool lumiMissing = (lumi == 0 && event != 0);
495 
496  std::vector<RunOrLumiIndexes>::const_iterator iEnd = runOrLumiIndexes().end();
497  std::vector<RunOrLumiIndexes>::const_iterator phEnd;
498 
499  // Loop over ranges of entries with the same ProcessHistoryID
500  for (std::vector<RunOrLumiIndexes>::const_iterator phBegin = runOrLumiIndexes().begin(); phBegin != iEnd;
501  phBegin = phEnd) {
502  RunOrLumiIndexes el(phBegin->processHistoryIDIndex(), run, lumi, 0);
503  phEnd = std::upper_bound(phBegin, iEnd, el, Compare_Index());
504 
505  std::vector<RunOrLumiIndexes>::const_iterator iRun = std::lower_bound(phBegin, phEnd, el, Compare_Index_Run());
506 
507  if (iRun == phEnd || iRun->run() != run)
508  continue;
509 
510  if (lumi == invalidLumi && event == invalidEvent) {
511  IndexIntoFileItr indexItr(
513  indexItr.initializeRun();
514  return indexItr;
515  }
516 
517  std::vector<RunOrLumiIndexes>::const_iterator iRunEnd = std::upper_bound(iRun, phEnd, el, Compare_Index_Run());
518  if (!lumiMissing) {
519  std::vector<RunOrLumiIndexes>::const_iterator iLumi = std::lower_bound(iRun, iRunEnd, el);
520  if (iLumi == iRunEnd || iLumi->lumi() != lumi)
521  continue;
522 
523  if (event == invalidEvent) {
524  IndexIntoFileItr indexItr(this,
526  kRun,
527  iRun - runOrLumiIndexes().begin(),
528  iLumi - runOrLumiIndexes().begin(),
529  invalidIndex,
530  0,
531  0);
532  indexItr.initializeLumi();
533  return indexItr;
534  }
535 
536  long long beginEventNumbers = iLumi->beginEventNumbers();
537  long long endEventNumbers = iLumi->endEventNumbers();
538  if (beginEventNumbers >= endEventNumbers)
539  continue;
540 
541  long long indexToEvent = 0;
542  if (!eventEntries().empty()) {
543  std::vector<EventEntry>::const_iterator eventIter =
544  std::lower_bound(eventEntries().begin() + beginEventNumbers,
545  eventEntries().begin() + endEventNumbers,
546  EventEntry(event, invalidEntry));
547  if (eventIter == (eventEntries().begin() + endEventNumbers) || eventIter->event() != event)
548  continue;
549 
550  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
551  } else {
553  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(
554  eventNumbers().begin() + beginEventNumbers, eventNumbers().begin() + endEventNumbers, event);
555  if (eventIter == (eventNumbers().begin() + endEventNumbers) || *eventIter != event)
556  continue;
557 
558  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
559  }
560 
561  int newIndexToLumi = iLumi - runOrLumiIndexes().begin();
562  while (runOrLumiEntries_[runOrLumiIndexes()[newIndexToLumi].indexToGetEntry()].entry() == invalidEntry) {
563  ++newIndexToLumi;
564  assert(static_cast<unsigned>(newIndexToLumi) < runOrLumiEntries_.size());
565  assert(runOrLumiIndexes()[newIndexToLumi].lumi() == lumi);
566  }
567 
568  return IndexIntoFileItr(this,
570  kRun,
571  iRun - runOrLumiIndexes().begin(),
572  newIndexToLumi,
573  iLumi - runOrLumiIndexes().begin(),
574  indexToEvent,
575  endEventNumbers - beginEventNumbers);
576  }
577  if (lumiMissing) {
578  std::vector<RunOrLumiIndexes>::const_iterator iLumi = iRun;
579  while (iLumi != iRunEnd && iLumi->lumi() == invalidLumi) {
580  ++iLumi;
581  }
582  if (iLumi == iRunEnd)
583  continue;
584 
585  std::vector<RunOrLumiIndexes>::const_iterator lumiEnd;
586  for (; iLumi != iRunEnd; iLumi = lumiEnd) {
587  RunOrLumiIndexes elWithLumi(phBegin->processHistoryIDIndex(), run, iLumi->lumi(), 0);
588  lumiEnd = std::upper_bound(iLumi, iRunEnd, elWithLumi);
589 
590  long long beginEventNumbers = iLumi->beginEventNumbers();
591  long long endEventNumbers = iLumi->endEventNumbers();
592  if (beginEventNumbers >= endEventNumbers)
593  continue;
594 
595  long long indexToEvent = 0;
596  if (!eventEntries().empty()) {
597  std::vector<EventEntry>::const_iterator eventIter =
598  std::lower_bound(eventEntries().begin() + beginEventNumbers,
599  eventEntries().begin() + endEventNumbers,
600  EventEntry(event, invalidEntry));
601  if (eventIter == (eventEntries().begin() + endEventNumbers) || eventIter->event() != event)
602  continue;
603  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
604  } else {
606  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(
607  eventNumbers().begin() + beginEventNumbers, eventNumbers().begin() + endEventNumbers, event);
608  if (eventIter == (eventNumbers().begin() + endEventNumbers) || *eventIter != event)
609  continue;
610  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
611  }
612 
613  int newIndexToLumi = iLumi - runOrLumiIndexes().begin();
614  while (runOrLumiEntries_[runOrLumiIndexes()[newIndexToLumi].indexToGetEntry()].entry() == invalidEntry) {
615  ++newIndexToLumi;
616  assert(static_cast<unsigned>(newIndexToLumi) < runOrLumiEntries_.size());
617  assert(runOrLumiIndexes()[newIndexToLumi].lumi() == iLumi->lumi());
618  }
619 
620  return IndexIntoFileItr(this,
622  kRun,
623  iRun - runOrLumiIndexes().begin(),
624  newIndexToLumi,
625  iLumi - runOrLumiIndexes().begin(),
626  indexToEvent,
627  endEventNumbers - beginEventNumbers);
628  }
629  }
630  } // Loop over ProcessHistoryIDs
631 
632  return IndexIntoFileItr(this, numericalOrder, kEnd, invalidIndex, invalidIndex, invalidIndex, 0, 0);
633  }

References cms::cuda::assert(), begin(), empty(), mps_splice::entry, edmPickEvents::event, eventEntries(), eventNumbers(), fillEventNumbers(), fillRunOrLumiIndexes(), edm::IndexIntoFile::IndexIntoFileItr::initializeLumi(), edm::IndexIntoFile::IndexIntoFileItr::initializeRun(), invalidEntry, invalidEvent, invalidIndex, invalidLumi, kEnd, kRun, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, BXlumiParameters_cfi::lumi, numericalOrder, writedatasetfile::run, runOrLumiEntries_, runOrLumiIndexes(), and pfDeepBoostedJetPreprocessParams_cfi::upper_bound.

Referenced by findEventPosition(), findLumiPosition(), findPosition(), findRunPosition(), and edm::RootFile::goToEvent().

◆ findPosition() [2/2]

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::findPosition ( SortOrder  sortOrder,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi = 0U,
EventNumber_t  event = 0U 
) const

Definition at line 635 of file IndexIntoFile.cc.

638  {
639  if (sortOrder == IndexIntoFile::numericalOrder) {
640  return findPosition(run, lumi, event); // a faster algorithm
641  }
642  IndexIntoFileItr itr = begin(sortOrder);
643  IndexIntoFileItr itrEnd = end(sortOrder);
644 
645  while (itr != itrEnd) {
646  if (itr.run() != run) {
647  itr.advanceToNextRun();
648  } else {
649  if (lumi == invalidLumi && event == invalidEvent) {
650  return itr;
651  } else if (lumi != invalidLumi && itr.peekAheadAtLumi() != lumi) {
652  if (!itr.skipLumiInRun()) {
653  itr.advanceToNextRun();
654  }
655  } else {
656  if (event == invalidEvent) {
657  return itr;
658  } else {
659  EventNumber_t eventNumber = getEventNumberOfEntry(itr.peekAheadAtEventEntry());
660  if (eventNumber == event) {
661  return itr;
662  } else {
663  if (!itr.skipToNextEventInLumi()) {
664  if (!itr.skipLumiInRun()) {
665  itr.advanceToNextRun();
666  }
667  }
668  }
669  }
670  }
671  }
672  }
673  return itrEnd;
674  }

References begin(), end(), findPosition(), getEventNumberOfEntry(), invalidEvent, invalidLumi, BXlumiParameters_cfi::lumi, numericalOrder, and writedatasetfile::run.

◆ findRunPosition()

IndexIntoFile::IndexIntoFileItr edm::IndexIntoFile::findRunPosition ( RunNumber_t  run) const

Same as findPosition.

Definition at line 692 of file IndexIntoFile.cc.

692  {
693  return findPosition(run, 0U, 0U);
694  }

References findPosition(), writedatasetfile::run, and mitigatedMETSequence_cff::U.

Referenced by containsRun(), fwlite::EntryFinder::findRun(), and edm::RootFile::setEntryAtRun().

◆ fixIndexes()

void edm::IndexIntoFile::fixIndexes ( std::vector< ProcessHistoryID > &  processHistoryIDs)

Used by PoolSource to force the ProcessHistoryID indexes to be consistent across all input files. Currently this consistency is important when duplicate checking across all input files. It may be important for other reasons in the future. It is important this be called immediately after reading in the object from the input file, before filling the transient data members or using the indexes in any way.

Definition at line 370 of file IndexIntoFile.cc.

370  {
371  std::map<int, int> oldToNewIndex;
372  for (std::vector<ProcessHistoryID>::const_iterator iter = processHistoryIDs_.begin(),
373  iEnd = processHistoryIDs_.end();
374  iter != iEnd;
375  ++iter) {
376  std::vector<ProcessHistoryID>::const_iterator iterExisting =
377  std::find(processHistoryIDs.begin(), processHistoryIDs.end(), *iter);
378  if (iterExisting == processHistoryIDs.end()) {
379  oldToNewIndex[iter - processHistoryIDs_.begin()] = processHistoryIDs.size();
380  processHistoryIDs.push_back(*iter);
381  } else {
382  oldToNewIndex[iter - processHistoryIDs_.begin()] = iterExisting - processHistoryIDs.begin();
383  }
384  }
386 
387  for (RunOrLumiEntry& item : runOrLumiEntries_) {
388  item.setProcessHistoryIDIndex(oldToNewIndex[item.processHistoryIDIndex()]);
389  }
390  }

References spr::find(), B2GTnPMonitor_cfi::item, processHistoryIDs(), processHistoryIDs_, and runOrLumiEntries_.

Referenced by edm::RootFile::validateFile().

◆ getEventNumberOfEntry()

EventNumber_t edm::IndexIntoFile::getEventNumberOfEntry ( EntryNumber_t  entry) const
inlineprivate

Definition at line 1079 of file IndexIntoFile.h.

1079  {
1080  return transient_.eventFinder_->getEventNumberOfEntry(entry);
1081  }

References mps_splice::entry, edm::IndexIntoFile::Transients::eventFinder_, and transient_.

Referenced by fillUnsortedEventNumbers(), and findPosition().

◆ initializeTransients()

void edm::IndexIntoFile::initializeTransients ( )
inline

Definition at line 1028 of file IndexIntoFile.h.

1028 { transient_.reset(); }

References edm::IndexIntoFile::Transients::reset(), and transient_.

◆ inputFileClosed()

void edm::IndexIntoFile::inputFileClosed ( )

Clear some vectors and eventFinder when an input file is closed. This reduces the memory used by IndexIntoFile

Definition at line 299 of file IndexIntoFile.cc.

299  {
300  std::vector<EventEntry>().swap(eventEntries());
301  std::vector<RunOrLumiIndexes>().swap(runOrLumiIndexes());
302  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
304  }

References eventEntries(), resetEventFinder(), runOrLumiIndexes(), and unsortedEventNumbers().

◆ iterationWillBeInEntryOrder()

bool edm::IndexIntoFile::iterationWillBeInEntryOrder ( SortOrder  sortOrder) const

Used to determine whether or not to disable fast cloning.

Definition at line 474 of file IndexIntoFile.cc.

474  {
475  EntryNumber_t maxEntry = invalidEntry;
476  for (IndexIntoFileItr it = begin(sortOrder), itEnd = end(sortOrder); it != itEnd; ++it) {
477  if (it.getEntryType() == kEvent) {
478  if (it.entry() < maxEntry) {
479  return false;
480  }
481  maxEntry = it.entry();
482  }
483  }
484  return true;
485  }

References begin(), end(), invalidEntry, and kEvent.

Referenced by edm::postIndexIntoFilePrintEventLists(), and edm::RootFile::setIfFastClonable().

◆ lumiToOrder()

std::map<IndexRunLumiKey, EntryNumber_t>& edm::IndexIntoFile::lumiToOrder ( ) const
inlineprivate

Definition at line 1071 of file IndexIntoFile.h.

1071 { return transient_.lumiToOrder_; }

References edm::IndexIntoFile::Transients::lumiToOrder_, and transient_.

Referenced by addLumi().

◆ numberOfEvents()

size_t edm::IndexIntoFile::numberOfEvents ( ) const
inlineprivate

◆ previousAddedIndex()

int& edm::IndexIntoFile::previousAddedIndex ( ) const
inlineprivate

Definition at line 1069 of file IndexIntoFile.h.

1069 { return transient_.previousAddedIndex_; }

References edm::IndexIntoFile::Transients::previousAddedIndex_, and transient_.

Referenced by addEntry().

◆ processHistoryID()

ProcessHistoryID const & edm::IndexIntoFile::processHistoryID ( int  i) const

Definition at line 55 of file IndexIntoFile.cc.

55 { return processHistoryIDs_.at(i); }

References mps_fire::i, and processHistoryIDs_.

Referenced by addEntry(), and edm::RootFile::readEvent().

◆ processHistoryIDs()

std::vector< ProcessHistoryID > const & edm::IndexIntoFile::processHistoryIDs ( ) const

Definition at line 57 of file IndexIntoFile.cc.

57 { return processHistoryIDs_; }

References processHistoryIDs_.

Referenced by fixIndexes().

◆ reduceProcessHistoryIDs()

void edm::IndexIntoFile::reduceProcessHistoryIDs ( ProcessHistoryRegistry const &  processHistoryRegistry)

Used for backward compatibility to convert objects created with releases that used the full ProcessHistoryID in IndexIntoFile to use the reduced ProcessHistoryID.

Definition at line 308 of file IndexIntoFile.cc.

308  {
309  std::vector<ProcessHistoryID> reducedPHIDs;
310 
311  std::map<ProcessHistoryID, int> reducedPHIDToIndex;
312  std::pair<ProcessHistoryID, int> mapEntry(ProcessHistoryID(), 0);
313  std::pair<std::map<ProcessHistoryID, int>::iterator, bool> insertResult;
314 
315  std::vector<int> phidIndexConverter;
316  for (auto const& phid : processHistoryIDs_) {
317  ProcessHistoryID const& reducedPHID = processHistoryRegistry.reducedProcessHistoryID(phid);
318  mapEntry.first = reducedPHID;
319  insertResult = reducedPHIDToIndex.insert(mapEntry);
320 
321  if (insertResult.second) {
322  insertResult.first->second = reducedPHIDs.size();
323  reducedPHIDs.push_back(reducedPHID);
324  }
325  phidIndexConverter.push_back(insertResult.first->second);
326  }
327  processHistoryIDs_.swap(reducedPHIDs);
328 
329  // If the size of the vector of IDs does not change
330  // then their indexes and the ordering of the Runs and
331  // and Lumis does not change, so we are done.
332  if (processHistoryIDs_.size() == reducedPHIDs.size()) {
333  return;
334  }
335 
336  std::map<IndexIntoFile::IndexRunKey, int> runOrderMap;
337  std::pair<std::map<IndexIntoFile::IndexRunKey, int>::iterator, bool> runInsertResult;
338 
339  std::map<IndexIntoFile::IndexRunLumiKey, int> lumiOrderMap;
340  std::pair<std::map<IndexIntoFile::IndexRunLumiKey, int>::iterator, bool> lumiInsertResult;
341 
342  // loop over all the RunOrLumiEntry's
343  for (auto& item : runOrLumiEntries_) {
344  // Convert the process history index so it points into the new vector of reduced IDs
345  item.setProcessHistoryIDIndex(phidIndexConverter.at(item.processHistoryIDIndex()));
346 
347  // Convert the phid-run order
348  IndexIntoFile::IndexRunKey runKey(item.processHistoryIDIndex(), item.run());
349  runInsertResult = runOrderMap.insert(std::pair<IndexIntoFile::IndexRunKey, int>(runKey, 0));
350  if (runInsertResult.second) {
351  runInsertResult.first->second = item.orderPHIDRun();
352  } else {
353  item.setOrderPHIDRun(runInsertResult.first->second);
354  }
355 
356  // Convert the phid-run-lumi order for the lumi entries
357  if (item.lumi() != 0) {
358  IndexIntoFile::IndexRunLumiKey lumiKey(item.processHistoryIDIndex(), item.run(), item.lumi());
359  lumiInsertResult = lumiOrderMap.insert(std::pair<IndexIntoFile::IndexRunLumiKey, int>(lumiKey, 0));
360  if (lumiInsertResult.second) {
361  lumiInsertResult.first->second = item.orderPHIDRunLumi();
362  } else {
363  item.setOrderPHIDRunLumi(lumiInsertResult.first->second);
364  }
365  }
366  }
367  std::stable_sort(runOrLumiEntries_.begin(), runOrLumiEntries_.end());
368  }

References B2GTnPMonitor_cfi::item, processHistoryIDs_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), and runOrLumiEntries_.

Referenced by edm::RootFile::validateFile().

◆ resetEventFinder()

void edm::IndexIntoFile::resetEventFinder ( ) const
inlineprivate

Definition at line 1064 of file IndexIntoFile.h.

1064 { transient_.eventFinder_ = nullptr; } // propagate_const<T> has no reset() function

References edm::IndexIntoFile::Transients::eventFinder_, and transient_.

Referenced by inputFileClosed().

◆ runOrLumiEntries()

std::vector<RunOrLumiEntry> const& edm::IndexIntoFile::runOrLumiEntries ( ) const
inline

◆ runOrLumiIndexes()

std::vector<RunOrLumiIndexes>& edm::IndexIntoFile::runOrLumiIndexes ( ) const
inlineprivate

◆ runToOrder()

std::map<IndexRunKey, EntryNumber_t>& edm::IndexIntoFile::runToOrder ( ) const
inlineprivate

Definition at line 1070 of file IndexIntoFile.h.

1070 { return transient_.runToOrder_; }

References edm::IndexIntoFile::Transients::runToOrder_, and transient_.

Referenced by addEntry(), and sortVector_Run_Or_Lumi_Entries().

◆ set_intersection()

void edm::IndexIntoFile::set_intersection ( IndexIntoFile const &  indexIntoFile,
std::set< IndexRunLumiEventKey > &  intersection 
) const

The intersection argument will be filled with an entry for each event in both IndexIntoFile objects. To be added the event must have the same ProcessHistoryID index, run number, lumi number and event number.

Definition at line 716 of file IndexIntoFile.cc.

717  {
718  if (empty() || indexIntoFile.empty())
719  return;
721  indexIntoFile.fillRunOrLumiIndexes();
722  RunOrLumiIndexes const& back1 = runOrLumiIndexes().back();
723  RunOrLumiIndexes const& back2 = indexIntoFile.runOrLumiIndexes().back();
724 
725  // Very quick decision if the run ranges in the two files do not overlap
726  if (back2 < runOrLumiIndexes().front())
727  return;
728  if (back1 < indexIntoFile.runOrLumiIndexes().front())
729  return;
730 
731  SortedRunOrLumiItr iter1 = beginRunOrLumi();
732  SortedRunOrLumiItr iEnd1 = endRunOrLumi();
733 
734  SortedRunOrLumiItr iter2 = indexIntoFile.beginRunOrLumi();
735  SortedRunOrLumiItr iEnd2 = indexIntoFile.endRunOrLumi();
736 
737  // Quick decision if the lumi ranges in the two files do not overlap
738  while (iter1 != iEnd1 && iter1.isRun())
739  ++iter1;
740  if (iter1 == iEnd1)
741  return;
742  if (back2 < iter1.runOrLumiIndexes())
743  return;
744 
745  while (iter2 != iEnd2 && iter2.isRun())
746  ++iter2;
747  if (iter2 == iEnd2)
748  return;
749  if (back1 < iter2.runOrLumiIndexes())
750  return;
751 
752  RunOrLumiIndexes const* previousIndexes = nullptr;
753 
754  // Loop through the both IndexIntoFile objects and look for matching lumis
755  while (iter1 != iEnd1 && iter2 != iEnd2) {
756  RunOrLumiIndexes const& indexes1 = iter1.runOrLumiIndexes();
757  RunOrLumiIndexes const& indexes2 = iter2.runOrLumiIndexes();
758  if (indexes1 < indexes2) {
759  ++iter1;
760  } else if (indexes2 < indexes1) {
761  ++iter2;
762  } else { // they are equal
763 
764  // Skip them if it is a run or the same lumi
765  if (indexes1.isRun() || (previousIndexes && !(*previousIndexes < indexes1))) {
766  ++iter1;
767  ++iter2;
768  } else {
769  previousIndexes = &indexes1;
770 
771  // Found a matching lumi, now look for matching events
772 
773  long long beginEventNumbers1 = indexes1.beginEventNumbers();
774  long long endEventNumbers1 = indexes1.endEventNumbers();
775 
776  long long beginEventNumbers2 = indexes2.beginEventNumbers();
777  long long endEventNumbers2 = indexes2.endEventNumbers();
778 
779  // there must be at least 1 event in each lumi for there to be any matches
780  if ((beginEventNumbers1 >= endEventNumbers1) || (beginEventNumbers2 >= endEventNumbers2)) {
781  ++iter1;
782  ++iter2;
783  continue;
784  }
785 
786  if (!eventEntries().empty() && !indexIntoFile.eventEntries().empty()) {
787  std::vector<EventEntry> matchingEvents;
788  std::insert_iterator<std::vector<EventEntry> > insertIter(matchingEvents, matchingEvents.begin());
789  std::set_intersection(eventEntries().begin() + beginEventNumbers1,
790  eventEntries().begin() + endEventNumbers1,
791  indexIntoFile.eventEntries().begin() + beginEventNumbers2,
792  indexIntoFile.eventEntries().begin() + endEventNumbers2,
793  insertIter);
794  for (EventEntry const& entry : matchingEvents) {
795  intersection.insert(IndexRunLumiEventKey(
796  indexes1.processHistoryIDIndex(), indexes1.run(), indexes1.lumi(), entry.event()));
797  }
798  } else {
800  indexIntoFile.fillEventNumbers();
801  std::vector<EventNumber_t> matchingEvents;
802  std::insert_iterator<std::vector<EventNumber_t> > insertIter(matchingEvents, matchingEvents.begin());
803  std::set_intersection(eventNumbers().begin() + beginEventNumbers1,
804  eventNumbers().begin() + endEventNumbers1,
805  indexIntoFile.eventNumbers().begin() + beginEventNumbers2,
806  indexIntoFile.eventNumbers().begin() + endEventNumbers2,
807  insertIter);
808  for (EventNumber_t const& eventNumber : matchingEvents) {
809  intersection.insert(
810  IndexRunLumiEventKey(indexes1.processHistoryIDIndex(), indexes1.run(), indexes1.lumi(), eventNumber));
811  }
812  }
813  }
814  }
815  }
816  }

References begin(), edm::IndexIntoFile::RunOrLumiIndexes::beginEventNumbers(), beginRunOrLumi(), empty(), edm::IndexIntoFile::RunOrLumiIndexes::endEventNumbers(), endRunOrLumi(), mps_splice::entry, eventEntries(), eventNumbers(), fillEventNumbers(), fillRunOrLumiIndexes(), reco::helper::VirtualJetProducerHelper::intersection(), edm::IndexIntoFile::RunOrLumiIndexes::isRun(), edm::IndexIntoFile::SortedRunOrLumiItr::isRun(), edm::IndexIntoFile::RunOrLumiIndexes::lumi(), edm::IndexIntoFile::RunOrLumiIndexes::processHistoryIDIndex(), edm::IndexIntoFile::RunOrLumiIndexes::run(), edm::IndexIntoFile::SortedRunOrLumiItr::runOrLumiIndexes(), and runOrLumiIndexes().

Referenced by edm::DuplicateChecker::inputFileOpened().

◆ setEventFinder()

void edm::IndexIntoFile::setEventFinder ( std::shared_ptr< EventFinder ptr)
inline

Calling this enables the functions that fill the event vectors to get the event numbers. It needs to be called before filling the events vectors This implies the client needs to define a class that inherits from EventFinder and then create one. This function is used to pass in a pointer to its base class.

Definition at line 952 of file IndexIntoFile.h.

952 { transient_.eventFinder_ = ptr; }

References edm::IndexIntoFile::Transients::eventFinder_, and transient_.

Referenced by fwlite::EntryFinder::fillIndex(), and edm::RootFile::validateFile().

◆ setNumberOfEvents()

void edm::IndexIntoFile::setNumberOfEvents ( EntryNumber_t  nevents)
inline

The number of events needs to be set before filling the transient event vectors. It is used to resize them.

Definition at line 945 of file IndexIntoFile.h.

References cmsHarvester::nevents, edm::IndexIntoFile::Transients::numberOfEvents_, and transient_.

Referenced by addEntry(), fwlite::EntryFinder::fillIndex(), and edm::RootFile::validateFile().

◆ setProcessHistoryIDs()

std::vector<ProcessHistoryID>& edm::IndexIntoFile::setProcessHistoryIDs ( )
inline

Used for backward compatibility and tests. RootFile::fillIndexIntoFile uses this to deal with input files created with releases before 3_8_0 which do not contain an IndexIntoFile.

Definition at line 1012 of file IndexIntoFile.h.

1012 { return processHistoryIDs_; }

References processHistoryIDs_.

Referenced by edm::RootFile::fillIndexIntoFile(), and edm::RootFile::validateFile().

◆ setRunOrLumiEntries()

std::vector<RunOrLumiEntry>& edm::IndexIntoFile::setRunOrLumiEntries ( )
inline

Used for backward compatibility and tests. RootFile::fillIndexIntoFile uses this to deal with input files created with releases before 3_8_0 which do not contain an IndexIntoFile.

Definition at line 1007 of file IndexIntoFile.h.

1007 { return runOrLumiEntries_; }

References runOrLumiEntries_.

Referenced by edm::RootFile::fillIndexIntoFile().

◆ sortEventEntries()

void edm::IndexIntoFile::sortEventEntries ( ) const
private

Definition at line 436 of file IndexIntoFile.cc.

436  {
438  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
439  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
440  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
441  while (true) {
442  while (beginOfLumi != iEnd && beginOfLumi->isRun()) {
443  ++beginOfLumi;
444  }
445  if (beginOfLumi == iEnd)
446  break;
447 
448  endOfLumi = beginOfLumi + 1;
449  while (endOfLumi != iEnd && beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
450  beginOfLumi->run() == endOfLumi->run() && beginOfLumi->lumi() == endOfLumi->lumi()) {
451  ++endOfLumi;
452  }
453  assert(beginOfLumi->endEventNumbers() >= 0);
454  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventEntries().size()));
455  std::sort(eventEntries().begin() + beginOfLumi->beginEventNumbers(),
456  eventEntries().begin() + beginOfLumi->endEventNumbers());
457  beginOfLumi = endOfLumi;
458  }
459  }

References cms::cuda::assert(), begin(), eventEntries(), fillRunOrLumiIndexes(), runOrLumiIndexes(), and findQualityFiles::size.

Referenced by fillEventNumbersOrEntries().

◆ sortEvents()

void edm::IndexIntoFile::sortEvents ( ) const
private

Definition at line 411 of file IndexIntoFile.cc.

411  {
413  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
414  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
415  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
416  while (true) {
417  while (beginOfLumi != iEnd && beginOfLumi->isRun()) {
418  ++beginOfLumi;
419  }
420  if (beginOfLumi == iEnd)
421  break;
422 
423  endOfLumi = beginOfLumi + 1;
424  while (endOfLumi != iEnd && beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
425  beginOfLumi->run() == endOfLumi->run() && beginOfLumi->lumi() == endOfLumi->lumi()) {
426  ++endOfLumi;
427  }
428  assert(beginOfLumi->endEventNumbers() >= 0);
429  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventNumbers().size()));
430  std::sort(eventNumbers().begin() + beginOfLumi->beginEventNumbers(),
431  eventNumbers().begin() + beginOfLumi->endEventNumbers());
432  beginOfLumi = endOfLumi;
433  }
434  }

References cms::cuda::assert(), begin(), eventNumbers(), fillRunOrLumiIndexes(), runOrLumiIndexes(), and findQualityFiles::size.

Referenced by fillEventNumbersOrEntries().

◆ sortVector_Run_Or_Lumi_Entries()

void edm::IndexIntoFile::sortVector_Run_Or_Lumi_Entries ( )

Used by RootOutputModule after all entries have been added. This only works after the correct sequence of addEntry calls, because it makes some corrections before sorting. A std::stable_sort works in cases where those corrections are not needed.

Definition at line 392 of file IndexIntoFile.cc.

392  {
393  for (RunOrLumiEntry& item : runOrLumiEntries_) {
394  std::map<IndexRunKey, EntryNumber_t>::const_iterator keyAndOrder =
395  runToOrder().find(IndexRunKey(item.processHistoryIDIndex(), item.run()));
396  if (keyAndOrder == runToOrder().end()) {
398  << "In IndexIntoFile::sortVector_Run_Or_Lumi_Entries. A run entry is missing.\n"
399  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
400  << "The output file will be unusable for most purposes.\n"
401  << "If this occurs after an unrelated exception was thrown in\n"
402  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
403  << "the primary exception. This is an expected side effect.\n"
404  << "Otherwise please report this to the core framework developers\n";
405  }
406  item.setOrderPHIDRun(keyAndOrder->second);
407  }
409  }

References Exception, B2GTnPMonitor_cfi::item, edm::errors::LogicError, runOrLumiEntries_, runToOrder(), and edm::stable_sort_all().

Referenced by edm::RootOutputFile::writeIndexIntoFile().

◆ unsortedEventNumbers() [1/2]

std::vector<EventNumber_t>& edm::IndexIntoFile::unsortedEventNumbers ( )
inline

If something external to IndexIntoFile is reading through the EventAuxiliary then it could use this to fill in the event numbers so that IndexIntoFile will not read through it again.

Definition at line 994 of file IndexIntoFile.h.

References transient_, and edm::IndexIntoFile::Transients::unsortedEventNumbers_.

Referenced by doneFileInitialization(), fillEventNumbersOrEntries(), edm::RootFile::fillIndexIntoFile(), fillUnsortedEventNumbers(), and inputFileClosed().

◆ unsortedEventNumbers() [2/2]

std::vector<EventNumber_t> const& edm::IndexIntoFile::unsortedEventNumbers ( ) const
inline

◆ unsortedEventNumbersMutable()

std::vector<EventNumber_t>& edm::IndexIntoFile::unsortedEventNumbersMutable ( ) const
inlineprivate

Friends And Related Function Documentation

◆ ::TestIndexIntoFile

friend class ::TestIndexIntoFile
friend

Definition at line 1051 of file IndexIntoFile.h.

◆ ::TestIndexIntoFile1

friend class ::TestIndexIntoFile1
friend

Definition at line 1052 of file IndexIntoFile.h.

◆ ::TestIndexIntoFile2

friend class ::TestIndexIntoFile2
friend

Definition at line 1053 of file IndexIntoFile.h.

◆ ::TestIndexIntoFile3

friend class ::TestIndexIntoFile3
friend

Definition at line 1054 of file IndexIntoFile.h.

◆ ::TestIndexIntoFile4

friend class ::TestIndexIntoFile4
friend

Definition at line 1055 of file IndexIntoFile.h.

◆ ::TestIndexIntoFile5

friend class ::TestIndexIntoFile5
friend

Definition at line 1056 of file IndexIntoFile.h.

Member Data Documentation

◆ invalidEntry

const IndexIntoFile::EntryNumber_t edm::IndexIntoFile::invalidEntry = -1LL
staticconstexpr

Definition at line 236 of file IndexIntoFile.h.

Referenced by addEntry(), addLumi(), edm::IndexIntoFile::IndexIntoFileItrNoSort::entry(), edm::IndexIntoFile::IndexIntoFileItrSorted::entry(), fillEventNumbersOrEntries(), edm::RootFile::fillIndexIntoFile(), fillRunOrLumiIndexes(), findPosition(), edm::IndexIntoFile::IndexIntoFileItrImpl::firstEventEntryThisLumi(), edm::IndexIntoFile::IndexIntoFileItrImpl::firstEventEntryThisRun(), edm::RootFile::initializeDuplicateChecker(), edm::IndexIntoFile::IndexIntoFileItrNoSort::initializeLumi_(), iterationWillBeInEntryOrder(), edm::IndexIntoFile::IndexIntoFileItrNoSort::lumiEntryValid(), edm::IndexIntoFile::IndexIntoFileItrSorted::lumiEntryValid(), edm::IndexIntoFile::IndexIntoFileItrNoSort::nextEventRange(), edm::IndexIntoFile::IndexIntoFileItrNoSort::peekAheadAtEventEntry(), edm::IndexIntoFile::IndexIntoFileItrSorted::peekAheadAtEventEntry(), edm::IndexIntoFile::IndexIntoFileItrNoSort::previousEventRange(), edm::RootFile::readLuminosityBlockAuxiliary_(), edm::RootEmbeddedFileSequence::readOneSequential(), edm::RootFile::readRunAuxiliary_(), edm::IndexIntoFile::Transients::reset(), edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence(), edm::IndexIntoFile::IndexIntoFileItrNoSort::setToLastEventInRange(), edm::RootEmbeddedFileSequence::skipEntries(), edm::IndexIntoFile::IndexIntoFileItrImpl::skipEventBackward(), edm::IndexIntoFile::IndexIntoFileItrImpl::skipEventForward(), edm::RootFile::skipEvents(), and edm::RootFile::wasFirstEventJustRead().

◆ invalidEvent

const EventNumber_t edm::IndexIntoFile::invalidEvent = 0U
staticconstexpr

◆ invalidIndex

const int edm::IndexIntoFile::invalidIndex = -1
staticconstexpr

◆ invalidLumi

const LuminosityBlockNumber_t edm::IndexIntoFile::invalidLumi = 0U
staticconstexpr

◆ invalidRun

const RunNumber_t edm::IndexIntoFile::invalidRun = 0U
staticconstexpr

◆ processHistoryIDs_

std::vector<ProcessHistoryID> edm::IndexIntoFile::processHistoryIDs_
private

◆ runOrLumiEntries_

std::vector<RunOrLumiEntry> edm::IndexIntoFile::runOrLumiEntries_
private

◆ transient_

Transients edm::IndexIntoFile::transient_
mutableprivate
cmsHarvester.nevents
nevents
Definition: cmsHarvester.py:3177
edm::IndexIntoFile::fillRunOrLumiIndexes
void fillRunOrLumiIndexes() const
Definition: IndexIntoFile.cc:151
edm::IndexIntoFile::numberOfEvents
size_t numberOfEvents() const
Definition: IndexIntoFile.h:1078
pfDeepBoostedJetPreprocessParams_cfi.upper_bound
upper_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:16
edm::IndexIntoFile::kLumi
Definition: IndexIntoFile.h:238
edm::IndexIntoFile::runOrLumiEntries_
std::vector< RunOrLumiEntry > runOrLumiEntries_
Definition: IndexIntoFile.h:1087
mps_fire.i
i
Definition: mps_fire.py:428
edm::IndexIntoFile::currentLumi
LuminosityBlockNumber_t & currentLumi() const
Definition: IndexIntoFile.h:1076
edm::IndexIntoFile::eventNumbers
std::vector< EventNumber_t > & eventNumbers() const
Definition: IndexIntoFile.h:1066
edm::IndexIntoFile::findRunPosition
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
Definition: IndexIntoFile.cc:692
edm::IndexIntoFile::unsortedEventNumbersMutable
std::vector< EventNumber_t > & unsortedEventNumbersMutable() const
Definition: IndexIntoFile.h:1062
edm::errors::LogicError
Definition: EDMException.h:37
edm::IndexIntoFile::Transients::eventNumbers_
std::vector< EventNumber_t > eventNumbers_
Definition: IndexIntoFile.h:1044
edm::IndexIntoFile::kEvent
Definition: IndexIntoFile.h:238
edm::IndexIntoFile::setNumberOfEvents
void setNumberOfEvents(EntryNumber_t nevents)
Definition: IndexIntoFile.h:945
edm::IndexIntoFile::Transients::eventFinder_
edm::propagate_const< std::shared_ptr< EventFinder > > eventFinder_
Definition: IndexIntoFile.h:1042
edm::IndexIntoFile::numericalOrder
Definition: IndexIntoFile.h:266
mps_splice.entry
entry
Definition: mps_splice.py:68
edm::IndexIntoFile::Transients::previousAddedIndex_
int previousAddedIndex_
Definition: IndexIntoFile.h:1033
edm::IndexIntoFile::invalidEntry
static constexpr EntryNumber_t invalidEntry
Definition: IndexIntoFile.h:236
edm::IndexIntoFile::processHistoryID
ProcessHistoryID const & processHistoryID(int i) const
Definition: IndexIntoFile.cc:55
edm::IndexIntoFile::unsortedEventNumbers
std::vector< EventNumber_t > & unsortedEventNumbers()
Definition: IndexIntoFile.h:994
cms::cuda::assert
assert(be >=bs)
edm::IndexIntoFile::endRunOrLumi
SortedRunOrLumiItr endRunOrLumi() const
Definition: IndexIntoFile.cc:712
edm::IndexIntoFile::Transients::currentIndex_
int currentIndex_
Definition: IndexIntoFile.h:1038
edm::IndexIntoFile::containsRun
bool containsRun(RunNumber_t run) const
Definition: IndexIntoFile.cc:708
edm::IndexIntoFile::sortEvents
void sortEvents() const
Definition: IndexIntoFile.cc:411
edm::IndexIntoFile::containsLumi
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: IndexIntoFile.cc:704
edm::IndexIntoFile::Transients::beginEvents_
EntryNumber_t beginEvents_
Definition: IndexIntoFile.h:1036
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::IndexIntoFile::findPosition
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: IndexIntoFile.cc:489
edm::IndexIntoFile::empty
bool empty() const
True if no runs, lumis, or events are in the file.
Definition: IndexIntoFile.cc:487
edm::IndexIntoFile::Transients::runToOrder_
std::map< IndexRunKey, EntryNumber_t > runToOrder_
Definition: IndexIntoFile.h:1034
edm::IndexIntoFile::Transients::unsortedEventNumbers_
std::vector< EventNumber_t > unsortedEventNumbers_
Definition: IndexIntoFile.h:1046
BXlumiParameters_cfi.lumi
lumi
Definition: BXlumiParameters_cfi.py:6
dqmdumpme.last
last
Definition: dqmdumpme.py:56
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::IndexIntoFile::invalidIndex
static constexpr int invalidIndex
Definition: IndexIntoFile.h:232
edm::IndexIntoFile::Transients::currentRun_
RunNumber_t currentRun_
Definition: IndexIntoFile.h:1039
edm::IndexIntoFile::kRun
Definition: IndexIntoFile.h:238
edm::IndexIntoFile::Transients::numberOfEvents_
EntryNumber_t numberOfEvents_
Definition: IndexIntoFile.h:1041
edm::IndexIntoFile::eventEntries
std::vector< EventEntry > & eventEntries() const
Definition: IndexIntoFile.h:1065
edm::IndexIntoFile::resetEventFinder
void resetEventFinder() const
Definition: IndexIntoFile.h:1064
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::IndexIntoFile::lumiToOrder
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToOrder() const
Definition: IndexIntoFile.h:1071
edm::IndexIntoFile::Transients::lumiToOrder_
std::map< IndexRunLumiKey, EntryNumber_t > lumiToOrder_
Definition: IndexIntoFile.h:1035
edm::IndexIntoFile::beginRunOrLumi
SortedRunOrLumiItr beginRunOrLumi() const
Definition: IndexIntoFile.cc:710
edm::IndexIntoFile::invalidLumi
static constexpr LuminosityBlockNumber_t invalidLumi
Definition: IndexIntoFile.h:234
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::IndexIntoFile::begin
IndexIntoFileItr begin(SortOrder sortOrder) const
Definition: IndexIntoFile.cc:461
edm::IndexIntoFile::containsEvent
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: IndexIntoFile.cc:700
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
edm::IndexIntoFile::invalidEvent
static constexpr EventNumber_t invalidEvent
Definition: IndexIntoFile.h:235
edm::IndexIntoFile::beginEvents
EntryNumber_t & beginEvents() const
Definition: IndexIntoFile.h:1072
edm::IndexIntoFile::firstAppearanceOrder
Definition: IndexIntoFile.h:266
edm::IndexIntoFile::transient_
Transients transient_
Definition: IndexIntoFile.h:1084
edmPickEvents.event
event
Definition: edmPickEvents.py:273
edm::IndexIntoFile::runToOrder
std::map< IndexRunKey, EntryNumber_t > & runToOrder() const
Definition: IndexIntoFile.h:1070
edm::IndexIntoFile::findLumiPosition
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: IndexIntoFile.cc:685
edm::IndexIntoFile::currentIndex
int & currentIndex() const
Definition: IndexIntoFile.h:1074
edm::IndexIntoFile::processHistoryIDs
std::vector< ProcessHistoryID > const & processHistoryIDs() const
Definition: IndexIntoFile.cc:57
edm::IndexIntoFile::currentRun
RunNumber_t & currentRun() const
Definition: IndexIntoFile.h:1075
edm::IndexIntoFile::addLumi
void addLumi(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EntryNumber_t entry)
Definition: IndexIntoFile.cc:59
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::IndexIntoFile::end
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
Definition: IndexIntoFile.cc:470
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
edm::IndexIntoFile::endEvents
EntryNumber_t & endEvents() const
Definition: IndexIntoFile.h:1073
edm::IndexIntoFile::findEventPosition
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: IndexIntoFile.cc:676
edm::IndexIntoFile::runOrLumiIndexes
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
Definition: IndexIntoFile.h:1077
edm::IndexIntoFile::fillUnsortedEventNumbers
void fillUnsortedEventNumbers() const
Definition: IndexIntoFile.cc:279
edm::IndexIntoFile::IndexIntoFileItr::getEntryType
EntryType getEntryType() const
Definition: IndexIntoFile.h:700
L1DTConfigBti_cff.LL
LL
Definition: L1DTConfigBti_cff.py:25
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::IndexIntoFile::Transients::endEvents_
EntryNumber_t endEvents_
Definition: IndexIntoFile.h:1037
edm::ProcessHistoryID
Hash< ProcessHistoryType > ProcessHistoryID
Definition: ProcessHistoryID.h:8
edm::IndexIntoFile::Transients::reset
void reset()
Definition: IndexIntoFile.cc:34
Exception
Definition: hltDiff.cc:246
edm::IndexIntoFile::fillEventNumbersOrEntries
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
Definition: IndexIntoFile.cc:202
edm::IndexIntoFile::Transients::eventEntries_
std::vector< EventEntry > eventEntries_
Definition: IndexIntoFile.h:1045
edm::IndexIntoFile::Transients::runOrLumiIndexes_
std::vector< RunOrLumiIndexes > runOrLumiIndexes_
Definition: IndexIntoFile.h:1043
edm::IndexIntoFile::processHistoryIDs_
std::vector< ProcessHistoryID > processHistoryIDs_
Definition: IndexIntoFile.h:1086
edm::IndexIntoFile::EntryNumber_t
long long EntryNumber_t
Definition: IndexIntoFile.h:231
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::IndexIntoFile::kEnd
Definition: IndexIntoFile.h:238
edm::stable_sort_all
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:103
edm::IndexIntoFile::runOrLumiEntries
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
Definition: IndexIntoFile.h:1023
edm::IndexIntoFile::sortEventEntries
void sortEventEntries() const
Definition: IndexIntoFile.cc:436
event
Definition: event.py:1
nEvents
UInt_t nEvents
Definition: hcalCalib.cc:41
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
lumi
Definition: LumiSectionData.h:20
edm::IndexIntoFile::previousAddedIndex
int & previousAddedIndex() const
Definition: IndexIntoFile.h:1069
reco::helper::VirtualJetProducerHelper::intersection
double intersection(double r12)
Definition: VirtualJetProducerHelper.h:14
edm::IndexIntoFile::Transients::currentLumi_
LuminosityBlockNumber_t currentLumi_
Definition: IndexIntoFile.h:1040
edm::IndexIntoFile::getEventNumberOfEntry
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
Definition: IndexIntoFile.h:1079
edm::IndexIntoFile::invalidRun
static constexpr RunNumber_t invalidRun
Definition: IndexIntoFile.h:233
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
edm::IndexIntoFile::fillEventNumbers
void fillEventNumbers() const
Definition: IndexIntoFile.cc:198