CMS 3D CMS Logo

IndexIntoFile.cc
Go to the documentation of this file.
5 
6 #include <algorithm>
7 #include <iomanip>
8 #include <ostream>
9 
10 namespace edm {
11 
17 
18  IndexIntoFile::Transients::Transients() : previousAddedIndex_(invalidIndex),
19  runToOrder_(),
20  lumiToOrder_(),
21  beginEvents_(invalidEntry),
22  endEvents_(invalidEntry),
23  currentIndex_(invalidIndex),
24  currentRun_(invalidRun),
25  currentLumi_(invalidLumi),
26  numberOfEvents_(0),
27  eventFinder_(),
28  runOrLumiIndexes_(),
29  eventNumbers_(),
30  eventEntries_(),
31  unsortedEventNumbers_() {
32  }
33 
34  void
37  runToOrder_.clear();
38  lumiToOrder_.clear();
44  numberOfEvents_ = 0;
45  eventFinder_ = nullptr; // propagate_const<T> has no reset() function
46  runOrLumiIndexes_.clear();
47  eventNumbers_.clear();
48  eventEntries_.clear();
49  unsortedEventNumbers_.clear();
50  }
51 
55  }
56 
58  }
59 
61  return processHistoryIDs_.at(i);
62  }
63 
64  std::vector<ProcessHistoryID> const& IndexIntoFile::processHistoryIDs() const {
65  return processHistoryIDs_;
66  }
67 
68  void
70  // assign each lumi an order value sequentially when first seen
71  std::pair<IndexRunLumiKey, EntryNumber_t> keyAndOrder(IndexRunLumiKey(index, run, lumi), lumiToOrder().size());
72  lumiToOrder().insert(keyAndOrder); // does nothing if this key already was inserted
73  runOrLumiEntries_.emplace_back(
75  lumiToOrder()[IndexRunLumiKey(index, run, lumi)],
76  entry, index,
77  run, lumi,
78  beginEvents(), endEvents());
81 
82  }
83 
84  void
90  int index = 0;
91  // First see if the ProcessHistoryID is the same as the previous one.
92  // This is just a performance optimization. We expect to usually get
93  // many in a row that are the same.
95  processHistoryID == processHistoryIDs_[previousAddedIndex()]) {
96  index = previousAddedIndex();
97  } else {
98  // If it was not the same as the previous one then search through the
99  // entire vector. If it is not there, it needs to be added at the
100  // end.
101  index = 0;
102  while(index < static_cast<int>(processHistoryIDs_.size()) &&
103  processHistoryIDs_[index] != processHistoryID) {
104  ++index;
105  }
106  if(index == static_cast<int>(processHistoryIDs_.size())) {
107  processHistoryIDs_.push_back(processHistoryID);
108  }
109  }
111 
112  assert((currentRun() == run && currentIndex() == index) || currentRun() == invalidRun);
113  if(lumi == invalidLumi) {
114  if(currentLumi() != invalidLumi) {
116  << "In IndexIntoFile::addEntry. Entries were added in illegal order.\n"
117  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
118  << "The output file will be unusable for most purposes.\n"
119  << "If this occurs after an unrelated exception was thrown in\n"
120  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
121  << "the primary exception. This is an expected side effect.\n"
122  << "Otherwise please report this to the core framework developers\n";
123  }
127  // assign each run an order value when first seen (using entry but any increasing value would work)
128  std::pair<IndexRunKey, EntryNumber_t> keyAndOrder(IndexRunKey(index, run), entry);
129  runToOrder().insert(keyAndOrder); // Does nothing if this key was already inserted
130  runOrLumiEntries_.emplace_back(runToOrder()[IndexRunKey(index, run)], invalidEntry, entry, index, run, lumi, invalidEntry, invalidEntry);
131  } else {
132  if(currentRun() == invalidRun) {
133  currentRun() = run;
134  currentIndex() = index;
135  }
136  if(event == invalidEvent) {
137  if(currentLumi() != lumi and currentLumi() != invalidLumi) {
138  //we have overlapping lumis so must inject a placeholder
139  addLumi(index,run,currentLumi(),invalidEntry);
140  }
142  addLumi(index,run,lumi,entry);
143  } else {
144  if(currentLumi() != lumi and currentLumi() != invalidLumi) {
145  //We have overlapping lumis so need to inject a placeholder
146  addLumi(index,run,currentLumi(),invalidEntry);
147  }
149  if(beginEvents() == invalidEntry) {
150  currentLumi() = lumi;
151  beginEvents() = entry;
152  endEvents() = beginEvents() + 1;
153  }
154  else {
155  assert(currentLumi() == lumi);
156  assert(entry == endEvents());
157  ++endEvents();
158  }
159  }
160  }
161  }
162 
164  if(runOrLumiEntries_.empty() || !runOrLumiIndexes().empty()) {
165  return;
166  }
167  runOrLumiIndexes().reserve(runOrLumiEntries_.size());
168 
169  int index = 0;
170  for(RunOrLumiEntry const& item : runOrLumiEntries_) {
171  runOrLumiIndexes().emplace_back(item.processHistoryIDIndex(),
172  item.run(),
173  item.lumi(),
174  index);
175  ++index;
176  }
178 
179  long long beginEventNumbers = 0;
180 
181  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
182  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
183  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
184  while(true) {
185  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
186  ++beginOfLumi;
187  }
188  if(beginOfLumi == iEnd) break;
189 
190  endOfLumi = beginOfLumi + 1;
191  while(endOfLumi != iEnd &&
192  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
193  beginOfLumi->run() == endOfLumi->run() &&
194  beginOfLumi->lumi() == endOfLumi->lumi()) {
195  ++endOfLumi;
196  }
197  int nEvents = 0;
198  for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
199  iter != endOfLumi;
200  ++iter) {
201  if(runOrLumiEntries_[iter->indexToGetEntry()].beginEvents() != invalidEntry) {
202  nEvents += runOrLumiEntries_[iter->indexToGetEntry()].endEvents() -
203  runOrLumiEntries_[iter->indexToGetEntry()].beginEvents();
204  }
205  }
206  for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
207  iter != endOfLumi;
208  ++iter) {
209  iter->setBeginEventNumbers(beginEventNumbers);
210  iter->setEndEventNumbers(beginEventNumbers + nEvents);
211  }
212  beginEventNumbers += nEvents;
213  beginOfLumi = endOfLumi;
214  }
215  assert(runOrLumiIndexes().size() == runOrLumiEntries_.size());
216  }
217 
218  void
220  fillEventNumbersOrEntries(true, false);
221  }
222 
223  void
225  fillEventNumbersOrEntries(false, true);
226  }
227 
228  void
229  IndexIntoFile::fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const {
230  if(numberOfEvents() == 0) {
231  return;
232  }
233 
234  if(needEventNumbers && !eventNumbers().empty()) {
235  needEventNumbers = false;
236  }
237 
238  if(needEventEntries && !eventEntries().empty()) {
239  needEventEntries = false;
240  }
241 
242  if(needEventNumbers && !eventEntries().empty()) {
243  assert(numberOfEvents() == eventEntries().size());
244  eventNumbers().reserve(eventEntries().size());
246  eventNumbers().push_back(eventEntries()[entry].event());
247  }
248  return;
249  }
250 
251  if(!needEventNumbers && !needEventEntries) {
252  return;
253  }
254 
256 
257  if(needEventNumbers) {
258  eventNumbers().resize(numberOfEvents(), IndexIntoFile::invalidEvent);
259  }
260  if(needEventEntries) {
261  eventEntries().resize(numberOfEvents());
262  }
263 
264  long long offset = 0;
265  long long previousBeginEventNumbers = -1LL;
266 
267  for(SortedRunOrLumiItr runOrLumi = beginRunOrLumi(), runOrLumiEnd = endRunOrLumi();
268  runOrLumi != runOrLumiEnd; ++runOrLumi) {
269 
270  if(runOrLumi.isRun()) continue;
271 
272  long long beginEventNumbers = 0;
273  long long endEventNumbers = 0;
274  EntryNumber_t beginEventEntry = invalidEntry;
275  EntryNumber_t endEventEntry = invalidEntry;
276  runOrLumi.getRange(beginEventNumbers, endEventNumbers, beginEventEntry, endEventEntry);
277 
278  // This is true each time one hits a new lumi section (except if the previous lumi had
279  // no events, in which case the offset is still 0 anyway)
280  if(beginEventNumbers != previousBeginEventNumbers) offset = 0;
281 
282  for(EntryNumber_t entry = beginEventEntry; entry != endEventEntry; ++entry) {
283  if(needEventNumbers) {
284  eventNumbers().at((entry - beginEventEntry) + offset + beginEventNumbers) = unsortedEventNumbers().at(entry);
285  }
286  if(needEventEntries) {
287  eventEntries().at((entry - beginEventEntry) + offset + beginEventNumbers) =
289  }
290  }
291 
292  previousBeginEventNumbers = beginEventNumbers;
293  offset += endEventEntry - beginEventEntry;
294  }
295  if(needEventNumbers) {
296  sortEvents();
297  assert(numberOfEvents() == eventNumbers().size());
298  }
299  if(needEventEntries) {
301  assert(numberOfEvents() == eventEntries().size());
302  }
303  }
304 
305  void
307  if(numberOfEvents() == 0 || !unsortedEventNumbers().empty()) {
308  return;
309  }
311 
312  // The main purpose for the existence of the unsortedEventNumbers
313  // vector is that it can easily be filled by reading through
314  // the EventAuxiliary branch in the same order as the TTree
315  // entries. fillEventNumbersOrEntries can then use this information
316  // instead of using getEventNumberOfEntry directly and reading
317  // the branch in a different order.
320  }
321  }
322 
323  // We are closing the input file, but we need to keep event numbers.
324  // We can delete the other transient collections by using the swap trick.
325 
326  void
328  std::vector<EventEntry>().swap(eventEntries());
329  std::vector<RunOrLumiIndexes>().swap(runOrLumiIndexes());
330  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
332  }
333 
334  void
336  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
337  }
338 
339  void
341 
342  std::vector<ProcessHistoryID> reducedPHIDs;
343 
344  std::map<ProcessHistoryID, int> reducedPHIDToIndex;
345  std::pair<ProcessHistoryID, int> mapEntry(ProcessHistoryID(), 0);
346  std::pair<std::map<ProcessHistoryID, int>::iterator, bool> insertResult;
347 
348  std::vector<int> phidIndexConverter;
349  for(auto const& phid : processHistoryIDs_) {
350 
351  ProcessHistoryID const& reducedPHID = processHistoryRegistry.reducedProcessHistoryID(phid);
352  mapEntry.first = reducedPHID;
353  insertResult = reducedPHIDToIndex.insert(mapEntry);
354 
355  if(insertResult.second) {
356  insertResult.first->second = reducedPHIDs.size();
357  reducedPHIDs.push_back(reducedPHID);
358  }
359  phidIndexConverter.push_back(insertResult.first->second);
360  }
361  processHistoryIDs_.swap(reducedPHIDs);
362 
363  // If the size of the vector of IDs does not change
364  // then their indexes and the ordering of the Runs and
365  // and Lumis does not change, so we are done.
366  if(processHistoryIDs_.size() == reducedPHIDs.size()) {
367  return;
368  }
369 
370  std::map<IndexIntoFile::IndexRunKey, int> runOrderMap;
371  std::pair<std::map<IndexIntoFile::IndexRunKey, int>::iterator, bool> runInsertResult;
372 
373  std::map<IndexIntoFile::IndexRunLumiKey, int> lumiOrderMap;
374  std::pair<std::map<IndexIntoFile::IndexRunLumiKey, int>::iterator, bool> lumiInsertResult;
375 
376  // loop over all the RunOrLumiEntry's
377  for(auto& item : runOrLumiEntries_) {
378 
379  // Convert the process history index so it points into the new vector of reduced IDs
380  item.setProcessHistoryIDIndex(phidIndexConverter.at(item.processHistoryIDIndex()));
381 
382  // Convert the phid-run order
383  IndexIntoFile::IndexRunKey runKey(item.processHistoryIDIndex(), item.run());
384  runInsertResult = runOrderMap.insert(std::pair<IndexIntoFile::IndexRunKey, int>(runKey,0));
385  if(runInsertResult.second) {
386  runInsertResult.first->second = item.orderPHIDRun();
387  } else {
388  item.setOrderPHIDRun(runInsertResult.first->second);
389  }
390 
391  // Convert the phid-run-lumi order for the lumi entries
392  if(item.lumi() != 0) {
393  IndexIntoFile::IndexRunLumiKey lumiKey(item.processHistoryIDIndex(), item.run(), item.lumi());
394  lumiInsertResult = lumiOrderMap.insert(std::pair<IndexIntoFile::IndexRunLumiKey, int>(lumiKey,0));
395  if(lumiInsertResult.second) {
396  lumiInsertResult.first->second = item.orderPHIDRunLumi();
397  } else {
398  item.setOrderPHIDRunLumi(lumiInsertResult.first->second);
399  }
400  }
401  }
402  std::stable_sort(runOrLumiEntries_.begin(), runOrLumiEntries_.end());
403  }
404 
405  void
406  IndexIntoFile::fixIndexes(std::vector<ProcessHistoryID> & processHistoryIDs) {
407 
408  std::map<int, int> oldToNewIndex;
409  for(std::vector<ProcessHistoryID>::const_iterator iter = processHistoryIDs_.begin(),
410  iEnd = processHistoryIDs_.end();
411  iter != iEnd;
412  ++iter) {
413  std::vector<ProcessHistoryID>::const_iterator iterExisting =
414  std::find(processHistoryIDs.begin(), processHistoryIDs.end(), *iter);
415  if(iterExisting == processHistoryIDs.end()) {
416  oldToNewIndex[iter - processHistoryIDs_.begin()] = processHistoryIDs.size();
417  processHistoryIDs.push_back(*iter);
418  } else {
419  oldToNewIndex[iter - processHistoryIDs_.begin()] = iterExisting - processHistoryIDs.begin();
420  }
421  }
423 
424  for(RunOrLumiEntry& item : runOrLumiEntries_) {
425  item.setProcessHistoryIDIndex(oldToNewIndex[item.processHistoryIDIndex()]);
426  }
427  }
428 
430  for(RunOrLumiEntry& item : runOrLumiEntries_) {
431  std::map<IndexRunKey, EntryNumber_t>::const_iterator keyAndOrder =
432  runToOrder().find(IndexRunKey(item.processHistoryIDIndex(), item.run()));
433  if(keyAndOrder == runToOrder().end()) {
435  << "In IndexIntoFile::sortVector_Run_Or_Lumi_Entries. A run entry is missing.\n"
436  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
437  << "The output file will be unusable for most purposes.\n"
438  << "If this occurs after an unrelated exception was thrown in\n"
439  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
440  << "the primary exception. This is an expected side effect.\n"
441  << "Otherwise please report this to the core framework developers\n";
442  }
443  item.setOrderPHIDRun(keyAndOrder->second);
444  }
445  stable_sort_all(runOrLumiEntries_);
446  }
447 
450  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
451  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
452  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
453  while(true) {
454  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
455  ++beginOfLumi;
456  }
457  if(beginOfLumi == iEnd) break;
458 
459  endOfLumi = beginOfLumi + 1;
460  while(endOfLumi != iEnd &&
461  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
462  beginOfLumi->run() == endOfLumi->run() &&
463  beginOfLumi->lumi() == endOfLumi->lumi()) {
464  ++endOfLumi;
465  }
466  assert(beginOfLumi->endEventNumbers() >= 0);
467  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventNumbers().size()));
468  std::sort(eventNumbers().begin() + beginOfLumi->beginEventNumbers(),
469  eventNumbers().begin() + beginOfLumi->endEventNumbers());
470  beginOfLumi = endOfLumi;
471  }
472  }
473 
476  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
477  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
478  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
479  while(true) {
480  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
481  ++beginOfLumi;
482  }
483  if(beginOfLumi == iEnd) break;
484 
485  endOfLumi = beginOfLumi + 1;
486  while(endOfLumi != iEnd &&
487  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
488  beginOfLumi->run() == endOfLumi->run() &&
489  beginOfLumi->lumi() == endOfLumi->lumi()) {
490  ++endOfLumi;
491  }
492  assert(beginOfLumi->endEventNumbers() >= 0);
493  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventEntries().size()));
494  std::sort(eventEntries().begin() + beginOfLumi->beginEventNumbers(),
495  eventEntries().begin() + beginOfLumi->endEventNumbers());
496  beginOfLumi = endOfLumi;
497  }
498  }
499 
501  if(empty()) {
502  return end(sortOrder);
503  }
504  IndexIntoFileItr iter(this,
505  sortOrder,
506  kRun,
507  0,
508  invalidIndex,
509  invalidIndex,
510  0,
511  0);
512  iter.initializeRun();
513  return iter;
514  }
515 
517  return IndexIntoFileItr(this,
518  sortOrder,
519  kEnd,
520  invalidIndex,
521  invalidIndex,
522  invalidIndex,
523  0,
524  0);
525  }
526 
528  EntryNumber_t maxEntry = invalidEntry;
529  for(IndexIntoFileItr it = begin(sortOrder), itEnd = end(sortOrder); it != itEnd; ++it) {
530  if(it.getEntryType() == kEvent) {
531  if(it.entry() < maxEntry) {
532  return false;
533  }
534  maxEntry = it.entry();
535  }
536  }
537  return true;
538  }
539 
540  bool IndexIntoFile::empty() const {
541  return runOrLumiEntries().empty();
542  }
543 
547 
548  bool lumiMissing = (lumi == 0 && event != 0);
549 
550  std::vector<RunOrLumiIndexes>::const_iterator iEnd = runOrLumiIndexes().end();
551  std::vector<RunOrLumiIndexes>::const_iterator phEnd;
552 
553  // Loop over ranges of entries with the same ProcessHistoryID
554  for(std::vector<RunOrLumiIndexes>::const_iterator phBegin = runOrLumiIndexes().begin();
555  phBegin != iEnd;
556  phBegin = phEnd) {
557 
558  RunOrLumiIndexes el(phBegin->processHistoryIDIndex(), run, lumi, 0);
559  phEnd = std::upper_bound(phBegin, iEnd, el, Compare_Index());
560 
561  std::vector<RunOrLumiIndexes>::const_iterator iRun = std::lower_bound(phBegin, phEnd, el, Compare_Index_Run());
562 
563  if(iRun == phEnd || iRun->run() != run) continue;
564 
565  if(lumi == invalidLumi && event == invalidEvent) {
566  IndexIntoFileItr indexItr(this,
568  kRun,
569  iRun - runOrLumiIndexes().begin(),
570  invalidIndex,
571  invalidIndex,
572  0,
573  0);
574  indexItr.initializeRun();
575  return indexItr;
576  }
577 
578  std::vector<RunOrLumiIndexes>::const_iterator iRunEnd = std::upper_bound(iRun, phEnd, el, Compare_Index_Run());
579  if(!lumiMissing) {
580 
581  std::vector<RunOrLumiIndexes>::const_iterator iLumi = std::lower_bound(iRun, iRunEnd, el);
582  if(iLumi == iRunEnd || iLumi->lumi() != lumi) continue;
583 
584  if(event == invalidEvent) {
585  IndexIntoFileItr indexItr(this,
587  kRun,
588  iRun - runOrLumiIndexes().begin(),
589  iLumi - runOrLumiIndexes().begin(),
590  invalidIndex,
591  0,
592  0);
593  indexItr.initializeLumi();
594  return indexItr;
595  }
596 
597  long long beginEventNumbers = iLumi->beginEventNumbers();
598  long long endEventNumbers = iLumi->endEventNumbers();
599  if(beginEventNumbers >= endEventNumbers) continue;
600 
601 
602  long long indexToEvent = 0;
603  if(!eventEntries().empty()) {
604  std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(eventEntries().begin() + beginEventNumbers,
605  eventEntries().begin() + endEventNumbers,
606  EventEntry(event, invalidEntry));
607  if(eventIter == (eventEntries().begin() + endEventNumbers) ||
608  eventIter->event() != event) continue;
609 
610  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
611  } else {
613  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(eventNumbers().begin() + beginEventNumbers,
614  eventNumbers().begin() + endEventNumbers,
615  event);
616  if(eventIter == (eventNumbers().begin() + endEventNumbers) ||
617  *eventIter != event) continue;
618 
619  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
620  }
621 
622  int newIndexToLumi = iLumi - runOrLumiIndexes().begin();
623  while (runOrLumiEntries_[runOrLumiIndexes()[newIndexToLumi].indexToGetEntry()].entry() == invalidEntry) {
624  ++newIndexToLumi;
625  assert(static_cast<unsigned>(newIndexToLumi) < runOrLumiEntries_.size());
626  assert(runOrLumiIndexes()[newIndexToLumi].lumi() == lumi);
627  }
628 
629  return IndexIntoFileItr(this,
631  kRun,
632  iRun - runOrLumiIndexes().begin(),
633  newIndexToLumi,
634  iLumi - runOrLumiIndexes().begin(),
635  indexToEvent,
636  endEventNumbers - beginEventNumbers);
637  }
638  if(lumiMissing) {
639 
640  std::vector<RunOrLumiIndexes>::const_iterator iLumi = iRun;
641  while(iLumi != iRunEnd && iLumi->lumi() == invalidLumi) {
642  ++iLumi;
643  }
644  if(iLumi == iRunEnd) continue;
645 
646  std::vector<RunOrLumiIndexes>::const_iterator lumiEnd;
647  for( ;
648  iLumi != iRunEnd;
649  iLumi = lumiEnd) {
650 
651  RunOrLumiIndexes elWithLumi(phBegin->processHistoryIDIndex(), run, iLumi->lumi(), 0);
652  lumiEnd = std::upper_bound(iLumi, iRunEnd, elWithLumi);
653 
654  long long beginEventNumbers = iLumi->beginEventNumbers();
655  long long endEventNumbers = iLumi->endEventNumbers();
656  if(beginEventNumbers >= endEventNumbers) continue;
657 
658  long long indexToEvent = 0;
659  if(!eventEntries().empty()) {
660  std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(eventEntries().begin() + beginEventNumbers,
661  eventEntries().begin() + endEventNumbers,
662  EventEntry(event, invalidEntry));
663  if(eventIter == (eventEntries().begin() + endEventNumbers) ||
664  eventIter->event() != event) continue;
665  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
666  } else {
668  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(eventNumbers().begin() + beginEventNumbers,
669  eventNumbers().begin() + endEventNumbers,
670  event);
671  if(eventIter == (eventNumbers().begin() + endEventNumbers) ||
672  *eventIter != event) continue;
673  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
674  }
675 
676  int newIndexToLumi = iLumi - runOrLumiIndexes().begin();
677  while (runOrLumiEntries_[runOrLumiIndexes()[newIndexToLumi].indexToGetEntry()].entry() == invalidEntry) {
678  ++newIndexToLumi;
679  assert(static_cast<unsigned>(newIndexToLumi) < runOrLumiEntries_.size());
680  assert(runOrLumiIndexes()[newIndexToLumi].lumi() == iLumi->lumi());
681  }
682 
683  return IndexIntoFileItr(this,
685  kRun,
686  iRun - runOrLumiIndexes().begin(),
687  newIndexToLumi,
688  iLumi - runOrLumiIndexes().begin(),
689  indexToEvent,
690  endEventNumbers - beginEventNumbers);
691  }
692  }
693  } // Loop over ProcessHistoryIDs
694 
695  return IndexIntoFileItr(this,
697  kEnd,
698  invalidIndex,
699  invalidIndex,
700  invalidIndex,
701  0,
702  0);
703 
704  }
705 
708  if(sortOrder == IndexIntoFile::numericalOrder) {
709  return findPosition(run, lumi, event); // a faster algorithm
710  }
711  IndexIntoFileItr itr = begin(sortOrder);
712  IndexIntoFileItr itrEnd = end(sortOrder);
713 
714  while(itr != itrEnd) {
715  if(itr.run() != run) {
716  itr.advanceToNextRun();
717  } else {
718  if(lumi == invalidLumi && event == invalidEvent) {
719  return itr;
720  } else if(lumi != invalidLumi && itr.peekAheadAtLumi() != lumi) {
721  if(!itr.skipLumiInRun()) {
722  itr.advanceToNextRun();
723  }
724  } else {
725  if(event == invalidEvent) {
726  return itr;
727  } else {
729  if(eventNumber == event) {
730  return itr;
731  } else {
732  if(!itr.skipToNextEventInLumi()) {
733  if(!itr.skipLumiInRun()) {
734  itr.advanceToNextRun();
735  }
736  }
737  }
738  }
739  }
740  }
741  }
742  return itrEnd;
743  }
744 
747  assert(event != invalidEvent);
748  IndexIntoFileItr iter = findPosition(run, lumi, event);
749  iter.advanceToEvent();
750  return iter;
751  }
752 
755  assert(lumi != invalidLumi);
756  IndexIntoFileItr iter = findPosition(run, lumi, 0U);
757  iter.advanceToLumi();
758  return iter;
759  }
760 
763  return findPosition(run, 0U, 0U);
764  }
765 
766  bool
768  return (event != 0) ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
769  }
770 
771  bool
773  return findEventPosition(run, lumi, event).getEntryType() != kEnd;
774  }
775 
776  bool
778  return findLumiPosition(run, lumi).getEntryType() != kEnd;
779  }
780 
781  bool
783  return findRunPosition(run).getEntryType() != kEnd;
784  }
785 
787  return SortedRunOrLumiItr(this, 0);
788  }
789 
791  return SortedRunOrLumiItr(this, runOrLumiEntries().size());
792  }
793 
795  std::set<IndexRunLumiEventKey> & intersection) const {
796 
797  if(empty() || indexIntoFile.empty()) return;
799  indexIntoFile.fillRunOrLumiIndexes();
800  RunOrLumiIndexes const& back1 = runOrLumiIndexes().back();
801  RunOrLumiIndexes const& back2 = indexIntoFile.runOrLumiIndexes().back();
802 
803  // Very quick decision if the run ranges in the two files do not overlap
804  if(back2 < runOrLumiIndexes().front()) return;
805  if(back1 < indexIntoFile.runOrLumiIndexes().front()) return;
806 
809 
810  SortedRunOrLumiItr iter2 = indexIntoFile.beginRunOrLumi();
811  SortedRunOrLumiItr iEnd2 = indexIntoFile.endRunOrLumi();
812 
813  // Quick decision if the lumi ranges in the two files do not overlap
814  while(iter1 != iEnd1 && iter1.isRun()) ++iter1;
815  if(iter1 == iEnd1) return;
816  if(back2 < iter1.runOrLumiIndexes()) return;
817 
818  while(iter2 != iEnd2 && iter2.isRun()) ++iter2;
819  if(iter2 == iEnd2) return;
820  if(back1 < iter2.runOrLumiIndexes()) return;
821 
822  RunOrLumiIndexes const* previousIndexes = nullptr;
823 
824  // Loop through the both IndexIntoFile objects and look for matching lumis
825  while(iter1 != iEnd1 && iter2 != iEnd2) {
826 
827  RunOrLumiIndexes const& indexes1 = iter1.runOrLumiIndexes();
828  RunOrLumiIndexes const& indexes2 = iter2.runOrLumiIndexes();
829  if(indexes1 < indexes2) {
830  ++iter1;
831  } else if(indexes2 < indexes1) {
832  ++iter2;
833  } else { // they are equal
834 
835  // Skip them if it is a run or the same lumi
836  if(indexes1.isRun() ||
837  (previousIndexes && !(*previousIndexes < indexes1))) {
838  ++iter1;
839  ++iter2;
840  } else {
841  previousIndexes = &indexes1;
842 
843  // Found a matching lumi, now look for matching events
844 
845  long long beginEventNumbers1 = indexes1.beginEventNumbers();
846  long long endEventNumbers1 = indexes1.endEventNumbers();
847 
848  long long beginEventNumbers2 = indexes2.beginEventNumbers();
849  long long endEventNumbers2 = indexes2.endEventNumbers();
850 
851  // there must be at least 1 event in each lumi for there to be any matches
852  if((beginEventNumbers1 >= endEventNumbers1) ||
853  (beginEventNumbers2 >= endEventNumbers2)) {
854  ++iter1;
855  ++iter2;
856  continue;
857  }
858 
859  if(!eventEntries().empty() && !indexIntoFile.eventEntries().empty()) {
860  std::vector<EventEntry> matchingEvents;
861  std::insert_iterator<std::vector<EventEntry> > insertIter(matchingEvents, matchingEvents.begin());
862  std::set_intersection(eventEntries().begin() + beginEventNumbers1,
863  eventEntries().begin() + endEventNumbers1,
864  indexIntoFile.eventEntries().begin() + beginEventNumbers2,
865  indexIntoFile.eventEntries().begin() + endEventNumbers2,
866  insertIter);
867  for(EventEntry const& entry : matchingEvents) {
868  intersection.insert(IndexRunLumiEventKey(indexes1.processHistoryIDIndex(),
869  indexes1.run(),
870  indexes1.lumi(),
871  entry.event()));
872  }
873  } else {
875  indexIntoFile.fillEventNumbers();
876  std::vector<EventNumber_t> matchingEvents;
877  std::insert_iterator<std::vector<EventNumber_t> > insertIter(matchingEvents, matchingEvents.begin());
878  std::set_intersection(eventNumbers().begin() + beginEventNumbers1,
879  eventNumbers().begin() + endEventNumbers1,
880  indexIntoFile.eventNumbers().begin() + beginEventNumbers2,
881  indexIntoFile.eventNumbers().begin() + endEventNumbers2,
882  insertIter);
883  for(EventNumber_t const& eventNumber : matchingEvents) {
884  intersection.insert(IndexRunLumiEventKey(indexes1.processHistoryIDIndex(),
885  indexes1.run(),
886  indexes1.lumi(),
887  eventNumber));
888  }
889  }
890  }
891  }
892  }
893  }
894 
896 
897  RunOrLumiIndexes const* previousIndexes = nullptr;
898 
899  for(SortedRunOrLumiItr iter = beginRunOrLumi(),
900  iEnd = endRunOrLumi();
901  iter != iEnd; ++iter) {
902 
903  RunOrLumiIndexes const& indexes = iter.runOrLumiIndexes();
904 
905  // Skip it if it is a run or the same lumi
906  if(indexes.isRun() ||
907  (previousIndexes && !(*previousIndexes < indexes))) {
908  continue;
909  }
910  previousIndexes = &indexes;
911 
912  long long beginEventNumbers = indexes.beginEventNumbers();
913  long long endEventNumbers = indexes.endEventNumbers();
914 
915  // there must be more than 1 event in the lumi for there to be any duplicates
916  if(beginEventNumbers + 1 >= endEventNumbers) continue;
917 
918  if(!eventEntries().empty()) {
919  std::vector<EventEntry>::iterator last = eventEntries().begin() + endEventNumbers;
920  if(std::adjacent_find(eventEntries().begin() + beginEventNumbers, last) != last) {
921  return true;
922  }
923  } else {
925  std::vector<EventNumber_t>::iterator last = eventNumbers().begin() + endEventNumbers;
926  if(std::adjacent_find(eventNumbers().begin() + beginEventNumbers, last) != last) {
927  return true;
928  }
929  }
930  }
931  return false;
932  }
933 
935  orderPHIDRun_(invalidEntry),
936  orderPHIDRunLumi_(invalidEntry),
937  entry_(invalidEntry),
938  processHistoryIDIndex_(invalidIndex),
939  run_(invalidRun),
940  lumi_(invalidLumi),
941  beginEvents_(invalidEntry),
942  endEvents_(invalidEntry) {
943  }
944 
953  orderPHIDRun_(orderPHIDRun),
954  orderPHIDRunLumi_(orderPHIDRunLumi),
955  entry_(entry),
956  processHistoryIDIndex_(processHistoryIDIndex),
957  run_(run),
958  lumi_(lumi),
959  beginEvents_(beginEvents),
960  endEvents_(endEvents) {
961  }
962 
966  int indexToGetEntry) :
967  processHistoryIDIndex_(processHistoryIDIndex),
968  run_(run),
969  lumi_(lumi),
970  indexToGetEntry_(indexToGetEntry),
971  beginEventNumbers_(-1),
972  endEventNumbers_(-1)
973  {
974  }
975 
976  IndexIntoFile::SortedRunOrLumiItr::SortedRunOrLumiItr(IndexIntoFile const* indexIntoFile, unsigned runOrLumi) :
977  indexIntoFile_(indexIntoFile), runOrLumi_(runOrLumi) {
978  assert(runOrLumi_ <= indexIntoFile_->runOrLumiEntries().size());
980  }
981 
983  return indexIntoFile_ == right.indexIntoFile() &&
984  runOrLumi_ == right.runOrLumi();
985  }
986 
988  return indexIntoFile_ != right.indexIntoFile() ||
989  runOrLumi_ != right.runOrLumi();
990  }
991 
993  if(runOrLumi_ != indexIntoFile_->runOrLumiEntries().size()) {
994  ++runOrLumi_;
995  }
996  return *this;
997  }
998 
1000  return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).lumi() == invalidLumi;
1001  }
1002 
1003  void IndexIntoFile::SortedRunOrLumiItr::getRange(long long & beginEventNumbers,
1004  long long & endEventNumbers,
1005  EntryNumber_t & beginEventEntry,
1006  EntryNumber_t & endEventEntry) {
1007  beginEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).beginEventNumbers();
1008  endEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).endEventNumbers();
1009 
1010  int indexToGetEntry = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).indexToGetEntry();
1011  beginEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).beginEvents();
1012  endEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).endEvents();
1013  }
1014 
1018  }
1019 
1021  EntryType entryType,
1022  int indexToRun,
1023  int indexToLumi,
1024  int indexToEventRange,
1025  long long indexToEvent,
1026  long long nEvents) :
1027  indexIntoFile_(indexIntoFile),
1028  size_(static_cast<int>(indexIntoFile_->runOrLumiEntries_.size())),
1029  type_(entryType),
1030  indexToRun_(indexToRun),
1031  indexToLumi_(indexToLumi),
1032  indexToEventRange_(indexToEventRange),
1033  indexToEvent_(indexToEvent),
1034  nEvents_(nEvents) {
1035  }
1036 
1038 
1040 
1041  if(type_ == kEvent) {
1042  if((indexToEvent_ + 1) < nEvents_) {
1043  ++indexToEvent_;
1044  } else {
1045  bool found = nextEventRange();
1046 
1047  if(!found) {
1049 
1050  if(type_ == kLumi) {
1051  ++indexToLumi_;
1052  initializeLumi();
1053  } else if(type_ == kRun) {
1054  indexToRun_ = indexToLumi_ + 1;
1055  initializeRun();
1056  } else {
1057  setInvalid(); // type_ is kEnd
1058  }
1059  }
1060  }
1061  } else if(type_ == kLumi) {
1062 
1063  if(indexToLumi_ + 1 == size_) {
1064  if(indexToEvent_ < nEvents_) {
1065  type_ = kEvent;
1066  } else {
1067  setInvalid();
1068  }
1069  } else {
1070 
1072 
1073  if(nextType == kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
1074  ++indexToLumi_;
1075  } else if(indexToEvent_ < nEvents_) {
1076  type_ = kEvent;
1077  } else if(nextType == kRun) {
1078  type_ = kRun;
1079  indexToRun_ = indexToLumi_ + 1;
1080  initializeRun();
1081  } else {
1082  ++indexToLumi_;
1083  initializeLumi();
1084  }
1085  }
1086  } else if(type_ == kRun) {
1088  bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
1089  if(nextType == kRun && sameRun) {
1090  ++indexToRun_;
1091  } else if(nextType == kRun && !sameRun) {
1092  ++indexToRun_;
1093  initializeRun();
1094  } else if(nextType == kLumi) {
1095  type_ = kLumi;
1096  } else {
1097  setInvalid();
1098  }
1099  }
1100  }
1101 
1103  RunNumber_t & runOfSkippedEvent,
1104  LuminosityBlockNumber_t & lumiOfSkippedEvent,
1105  EntryNumber_t & skippedEventEntry) {
1106  if(indexToEvent_ < nEvents_) {
1107  phIndexOfSkippedEvent = processHistoryIDIndex();
1108  runOfSkippedEvent = run();
1109  lumiOfSkippedEvent = peekAheadAtLumi();
1110  skippedEventEntry = peekAheadAtEventEntry();
1111 
1112  if((indexToEvent_ + 1) < nEvents_) {
1113  ++indexToEvent_;
1114  return;
1115  } else if(nextEventRange()) {
1116  return;
1117  } else if(type_ == kRun || type_ == kLumi) {
1118  if(skipLumiInRun()) {
1119  return;
1120  }
1121  } else if(type_ == kEvent) {
1122  next();
1123  return;
1124  }
1125  advanceToNextRun();
1126  return;
1127  }
1128 
1129  if(type_ == kRun) {
1130  while(skipLumiInRun()) {
1131  if(indexToEvent_ < nEvents_) {
1132  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1133  return;
1134  }
1135  }
1136  }
1137 
1138  while(indexToEvent_ >= nEvents_ && type_ != kEnd) {
1139  while(skipLumiInRun()) {
1140  if(indexToEvent_ < nEvents_) {
1141  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1142  return;
1143  }
1144  }
1145  advanceToNextRun();
1146  }
1147  if(type_ == kEnd) {
1148  phIndexOfSkippedEvent = invalidIndex;
1149  runOfSkippedEvent = invalidRun;
1150  lumiOfSkippedEvent = invalidLumi;
1151  skippedEventEntry = invalidEntry;
1152  return;
1153  }
1154  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1155  return;
1156  }
1157 
1159  RunNumber_t& runOfEvent,
1160  LuminosityBlockNumber_t& lumiOfEvent,
1161  EntryNumber_t& eventEntry) {
1162  // Look for previous events in the current lumi
1163  if(indexToEvent_ > 0) {
1164  --indexToEvent_;
1165  } else if(!previousEventRange()) {
1166 
1167  // Look for previous events in previous lumis
1168  if(!previousLumiWithEvents()) {
1169 
1170  // If we get here there are no previous events in the file
1171 
1172  if(!indexIntoFile_->empty()) {
1173  // Set the iterator to the beginning of the file
1174  type_ = kRun;
1175  indexToRun_ = 0;
1176  initializeRun();
1177  }
1178  phIndexOfEvent = invalidIndex;
1179  runOfEvent = invalidRun;
1180  lumiOfEvent = invalidLumi;
1181  eventEntry = invalidEntry;
1182  return;
1183  }
1184  }
1185  // Found a previous event and we have set the iterator so that this event
1186  // will be the next event process. (There may or may not be a run and/or
1187  // a lumi processed first).
1188  // Return information about this event
1189  phIndexOfEvent = processHistoryIDIndex();
1190  runOfEvent = run();
1191  lumiOfEvent = peekAheadAtLumi();
1192  eventEntry = peekAheadAtEventEntry();
1193  }
1194 
1196  // Find the correct place to start the search
1197  int newLumi = indexToLumi();
1198  if(newLumi == invalidIndex) {
1199  newLumi = indexToRun() == invalidIndex ? size() - 1 : indexToRun();
1200  } else {
1201  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1202  isSameLumi(newLumi, newLumi - 1)) {
1203  --newLumi;
1204  }
1205  --newLumi;
1206  }
1207  if(newLumi <= 0) return false;
1208 
1209  // Look backwards for a lumi with events
1210  for( ; newLumi > 0; --newLumi) {
1211  if(getRunOrLumiEntryType(newLumi) == kRun) {
1212  continue;
1213  }
1214  if(setToLastEventInRange(newLumi)) {
1215  break; // found it
1216  }
1217  }
1218  if(newLumi == 0) return false;
1219 
1220  // Finish initializing the iterator
1221  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1222  isSameLumi(newLumi, newLumi - 1) &&
1223  lumiEntryValid(newLumi - 1)) {
1224  --newLumi;
1225  }
1226  setIndexToLumi(newLumi);
1227 
1228  if(type() != kEnd &&
1229  isSameRun(newLumi, indexToRun())) {
1230  if(type() == kEvent) type_ = kLumi;
1231  return true;
1232  }
1233  int newRun = newLumi;
1234  while(newRun > 0 && getRunOrLumiEntryType(newRun - 1) == kLumi) {
1235  --newRun;
1236  }
1237  --newRun;
1238  assert(getRunOrLumiEntryType(newRun) == kRun);
1239  while(getRunOrLumiEntryType(newRun - 1) == kRun &&
1240  isSameRun(newRun - 1, newLumi)) {
1241  --newRun;
1242  }
1243  indexToRun_ = newRun;
1244  type_ = kRun;
1245  return true;
1246  }
1247 
1249  if(indexToLumi() == invalidIndex) return invalidEntry;
1250 
1251  int saveIndexToLumi = indexToLumi();
1252  int saveIndexToEventRange = indexToEventRange();
1253  long long saveIndexToEvent = indexToEvent();
1254  long long saveNEvents = nEvents();
1255 
1256  initializeRun();
1257 
1259 
1260  do {
1261  if(indexToEvent() < nEvents()) {
1262  returnValue = peekAheadAtEventEntry();
1263  break;
1264  }
1265  } while(skipLumiInRun());
1266 
1267  setIndexToLumi(saveIndexToLumi);
1268  setIndexToEventRange(saveIndexToEventRange);
1269  setIndexToEvent(saveIndexToEvent);
1270  setNEvents(saveNEvents);
1271 
1272  return returnValue;
1273  }
1274 
1276  if(indexToLumi() == invalidIndex) return invalidEntry;
1277 
1278  int saveIndexToLumi = indexToLumi();
1279  int saveIndexToEventRange = indexToEventRange();
1280  long long saveIndexToEvent = indexToEvent();
1281  long long saveNEvents = nEvents();
1282 
1283  while (indexToLumi() - 1 > 0) {
1284  if(getRunOrLumiEntryType(indexToLumi() - 1) == kRun) break;
1285  if(!isSameLumi(indexToLumi(), indexToLumi() - 1)) break;
1286  --indexToLumi_;
1287  }
1288  initializeLumi();
1289 
1291 
1292  if(indexToEvent() < nEvents()) {
1293  returnValue = peekAheadAtEventEntry();
1294  }
1295 
1296  setIndexToLumi(saveIndexToLumi);
1297  setIndexToEventRange(saveIndexToEventRange);
1298  setIndexToEvent(saveIndexToEvent);
1299  setNEvents(saveNEvents);
1300 
1301  return returnValue;
1302  }
1303 
1305  if(type_ == kEnd) return;
1306  for(int i = 1; indexToRun_ + i < size_; ++i) {
1308  if(!isSameRun(indexToRun_, indexToRun_ + i)) {
1309  type_ = kRun;
1310  indexToRun_ += i;
1311  initializeRun();
1312  return;
1313  }
1314  }
1315  }
1316  setInvalid();
1317  }
1318 
1320  if(type_ == kEnd) return;
1321  assert(indexToRun_ != invalidIndex);
1322 
1323  // A preliminary step is to advance to the last run entry for
1324  // this run (actually this step is not needed in the
1325  // context I expect this to be called in, just being careful)
1326  int startSearch = indexToRun_;
1327  for(int i = 1; startSearch + i < size_; ++i) {
1328  if(getRunOrLumiEntryType(startSearch + i) == kRun &&
1329  isSameRun(indexToRun_, startSearch + i)) {
1330  indexToRun_ = startSearch + i;
1331  } else {
1332  break;
1333  }
1334  }
1335 
1336  if(type_ == kRun && indexToLumi_ != invalidIndex) {
1337  type_ = kLumi;
1338  return;
1339  }
1340 
1341  startSearch = indexToLumi_;
1342  if(startSearch == invalidIndex) startSearch = indexToRun_;
1343  for(int i = 1; startSearch + i < size_; ++i) {
1344  if(getRunOrLumiEntryType(startSearch + i) == kRun) {
1345  if(!isSameRun(indexToRun_, startSearch + i)) {
1346  type_ = kRun;
1347  indexToRun_ = startSearch + i;
1348  initializeRun();
1349  return;
1350  }
1351  } else if(indexToLumi_ != invalidIndex) {
1352  if(!isSameLumi(indexToLumi_, startSearch + i)) {
1353  type_ = kLumi;
1354  indexToLumi_ = startSearch + i;
1355  initializeLumi();
1356  return;
1357  }
1358  }
1359  }
1360  setInvalid();
1361  }
1362 
1364  if(indexToEvent_ >= nEvents_) return false;
1365  if((indexToEvent_ + 1) < nEvents_) {
1366  ++indexToEvent_;
1367  return true;
1368  }
1369  return nextEventRange();
1370  }
1371 
1373 
1376  indexToEvent_ = 0;
1377  nEvents_ = 0;
1378 
1379  for(int i = 1; (i + indexToRun_) < size_; ++i) {
1381  bool sameRun = isSameRun(indexToRun_, indexToRun_ + i);
1382 
1383  if(entryType == kRun) {
1384  if(sameRun) {
1385  continue;
1386  } else {
1387  break;
1388  }
1389  } else {
1391  initializeLumi();
1392  return;
1393  }
1394  }
1395  }
1396 
1398  initializeLumi_();
1399  //See if entry number is invalid, this can happen if events from
1400  // different lumis overlap when doing concurrent lumi processing
1401  auto oldLumi = lumi();
1402  while( not lumiEntryValid(indexToLumi_) ) {
1403  ++indexToLumi_;
1404  }
1405  assert(oldLumi == lumi());
1406  }
1407 
1409  return (indexIntoFile_ == right.indexIntoFile_ &&
1410  size_ == right.size_ &&
1411  type_ == right.type_ &&
1412  indexToRun_ == right.indexToRun_ &&
1413  indexToLumi_ == right.indexToLumi_ &&
1415  indexToEvent_ == right.indexToEvent_ &&
1416  nEvents_ == right.nEvents_);
1417  }
1418 
1419  void
1421  type_ = position.type_;
1422  indexToRun_ = position.indexToRun_;
1423  indexToLumi_ = position.indexToLumi_;
1425  indexToEvent_ = position.indexToEvent_;
1426  nEvents_ = position.nEvents_;
1427  }
1428 
1429  void
1430  IndexIntoFile::IndexIntoFileItrImpl::getLumisInRun(std::vector<LuminosityBlockNumber_t> & lumis) const {
1431 
1432  lumis.clear();
1433 
1434  if (type_ == kEnd) return;
1435 
1436  LuminosityBlockNumber_t previousLumi = invalidLumi;
1437 
1438  for (int i = 1; (i + indexToRun_) < size_; ++i) {
1439  int index = i + indexToRun_;
1440  EntryType entryType = getRunOrLumiEntryType(index);
1441 
1442  if(entryType == kRun) {
1443  if(isSameRun(indexToRun_, index)) {
1444  continue;
1445  } else {
1446  break;
1447  }
1448  } else {
1449  LuminosityBlockNumber_t luminosityBlock = lumi(index);
1450  if (luminosityBlock != invalidLumi &&
1451  luminosityBlock != previousLumi) {
1452  lumis.push_back(luminosityBlock);
1453  previousLumi = luminosityBlock;
1454  }
1455  }
1456  }
1457  std::sort(lumis.begin(), lumis.end());
1458  lumis.erase(std::unique(lumis.begin(), lumis.end()), lumis.end());
1459  }
1460 
1462  type_ = kEnd;
1466  indexToEvent_ = 0;
1467  nEvents_ = 0;
1468  }
1469 
1471  EntryType entryType,
1472  int indexToRun,
1473  int indexToLumi,
1474  int indexToEventRange,
1475  long long indexToEvent,
1476  long long nEvents) :
1477  IndexIntoFileItrImpl(indexIntoFile,
1478  entryType,
1479  indexToRun,
1480  indexToLumi,
1481  indexToEventRange,
1482  indexToEvent,
1483  nEvents)
1484  {
1485  }
1486 
1489  return new IndexIntoFileItrNoSort(*this);
1490  }
1491 
1492  int
1494  if(type() == kEnd) return invalidIndex;
1495  return indexIntoFile()->runOrLumiEntries()[indexToRun()].processHistoryIDIndex();
1496  }
1497 
1499  if(type() == kEnd) return invalidRun;
1500  return indexIntoFile()->runOrLumiEntries()[indexToRun()].run();
1501  }
1502 
1504  if(type() == kEnd || type() == kRun) return invalidLumi;
1505  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1506  }
1507 
1509  if(type() == kEnd) return invalidEntry;
1510  if(type() == kRun) return indexIntoFile()->runOrLumiEntries()[indexToRun()].entry();
1511  if(type() == kLumi) return indexIntoFile()->runOrLumiEntries()[indexToLumi()].entry();
1512  return
1513  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1514  indexToEvent();
1515  }
1516 
1518  if(indexToLumi() == invalidIndex) return invalidLumi;
1519  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1520  }
1521 
1523  if(indexToLumi() == invalidIndex) return invalidEntry;
1524  if(indexToEvent() >= nEvents()) return invalidEntry;
1525  return
1526  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1527  indexToEvent();
1528  }
1529 
1531  assert(indexToLumi() != invalidIndex);
1532 
1534  setIndexToEvent(0);
1535  setNEvents(0);
1536 
1537  for(int i = 0; indexToLumi() + i < size(); ++i) {
1538  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].isRun()) {
1539  break;
1540  } else if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].lumi() ==
1541  indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1542  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].beginEvents() == invalidEntry) {
1543  continue;
1544  }
1546  setIndexToEvent(0);
1549  break;
1550  } else {
1551  break;
1552  }
1553  }
1554  }
1555 
1557  if(indexToEventRange() == invalidIndex) return false;
1558 
1559  // Look for the next event range, same lumi but different entry
1560  for(int i = 1; indexToEventRange() + i < size(); ++i) {
1561  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i ].isRun()) {
1562  return false; // hit next run
1563  } else if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].lumi() ==
1565  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].beginEvents() == invalidEntry) {
1566  continue; // same lumi but has no events, keep looking
1567  }
1569  setIndexToEvent(0);
1572  return true; // found more events in this lumi
1573  }
1574  return false; // hit next lumi
1575  }
1576  return false; // hit the end of the IndexIntoFile
1577  }
1578 
1580  if(indexToEventRange() == invalidIndex) return false;
1581  assert(indexToEventRange() < size());
1582 
1583  // Look backward for a previous event range with events, same lumi but different entry
1584  for(int i = 1; indexToEventRange() - i > 0; ++i) {
1585  int newRange = indexToEventRange() - i;
1586  if(indexIntoFile()->runOrLumiEntries()[newRange].isRun()) {
1587  return false; // hit run
1588  } else if(isSameLumi(newRange, indexToEventRange())) {
1589  if(indexIntoFile()->runOrLumiEntries()[newRange].beginEvents() == invalidEntry) {
1590  continue; // same lumi but has no events, keep looking
1591  }
1592  setIndexToEventRange(newRange);
1595  setIndexToEvent(nEvents() - 1);
1596  return true; // found previous event in this lumi
1597  }
1598  return false; // hit previous lumi
1599  }
1600  return false; // hit the beginning of the IndexIntoFile, 0th entry has to be a run
1601  }
1602 
1605  return false;
1606  }
1607  setIndexToEventRange(index);
1610  assert(nEvents() > 0);
1611  setIndexToEvent(nEvents() - 1);
1612  return true;
1613  }
1614 
1616  if(indexToLumi() == invalidIndex) return false;
1617  for(int i = 1; indexToLumi() + i < size(); ++i) {
1618  int newLumi = indexToLumi() + i;
1619  if(indexIntoFile()->runOrLumiEntries()[newLumi].isRun()) {
1620  return false; // hit next run
1621  } else if(indexIntoFile()->runOrLumiEntries()[newLumi].lumi() ==
1623  continue;
1624  }
1625  setIndexToLumi(newLumi);
1626  initializeLumi();
1627  return true; // hit next lumi
1628  }
1629  return false; // hit the end of the IndexIntoFile
1630  }
1631 
1633  return indexIntoFile()->runOrLumiEntries()[index].entry() != invalidEntry;
1634  }
1635 
1637  if(index < 0 || index >= size()) {
1638  return kEnd;
1639  } else if(indexIntoFile()->runOrLumiEntries()[index].isRun()) {
1640  return kRun;
1641  }
1642  return kLumi;
1643  }
1644 
1645  bool IndexIntoFile::IndexIntoFileItrNoSort::isSameLumi(int index1, int index2) const {
1646  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1647  return false;
1648  }
1649  return indexIntoFile()->runOrLumiEntries()[index1].lumi() ==
1650  indexIntoFile()->runOrLumiEntries()[index2].lumi();
1651  }
1652 
1653  bool IndexIntoFile::IndexIntoFileItrNoSort::isSameRun(int index1, int index2) const {
1654  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1655  return false;
1656  }
1657  return indexIntoFile()->runOrLumiEntries()[index1].run() ==
1658  indexIntoFile()->runOrLumiEntries()[index2].run() &&
1659  indexIntoFile()->runOrLumiEntries()[index1].processHistoryIDIndex() ==
1660  indexIntoFile()->runOrLumiEntries()[index2].processHistoryIDIndex();
1661  }
1662 
1664  if(index < 0 || index >= size()) {
1665  return invalidLumi;
1666  }
1667  return indexIntoFile()->runOrLumiEntries()[index].lumi();
1668  }
1669 
1671  EntryType entryType,
1672  int indexToRun,
1673  int indexToLumi,
1674  int indexToEventRange,
1675  long long indexToEvent,
1676  long long nEvents) :
1677  IndexIntoFileItrImpl(indexIntoFile,
1678  entryType,
1679  indexToRun,
1680  indexToLumi,
1681  indexToEventRange,
1682  indexToEvent,
1683  nEvents) {
1684  indexIntoFile->fillRunOrLumiIndexes();
1685  }
1686 
1688  return new IndexIntoFileItrSorted(*this);
1689  }
1690 
1692  if(type() == kEnd) return invalidIndex;
1693  return indexIntoFile()->runOrLumiIndexes()[indexToRun()].processHistoryIDIndex();
1694  }
1695 
1697  if(type() == kEnd) return invalidRun;
1698  return indexIntoFile()->runOrLumiIndexes()[indexToRun()].run();
1699  }
1700 
1702  if(type() == kEnd || type() == kRun) return invalidLumi;
1703  return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1704  }
1705 
1707  if(type() == kEnd) return invalidEntry;
1708  if(type() == kRun) {
1709  int i = indexIntoFile()->runOrLumiIndexes()[indexToRun()].indexToGetEntry();
1710  return indexIntoFile()->runOrLumiEntries()[i].entry();
1711  }
1712  if(type() == kLumi) {
1713  int i = indexIntoFile()->runOrLumiIndexes()[indexToLumi()].indexToGetEntry();
1714  return indexIntoFile()->runOrLumiEntries()[i].entry();
1715  }
1716  long long eventNumberIndex =
1717  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1718  indexToEvent();
1720  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1721  }
1722 
1724  if(indexToLumi() == invalidIndex) return invalidLumi;
1725  return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1726  }
1727 
1729  if(indexToLumi() == invalidIndex) return invalidEntry;
1730  if(indexToEvent() >= nEvents()) return invalidEntry;
1731  long long eventNumberIndex =
1732  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1733  indexToEvent();
1735  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1736  }
1737 
1739  assert(indexToLumi() != invalidIndex);
1741  setIndexToEvent(0);
1742  setNEvents(
1743  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].endEventNumbers() -
1744  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].beginEventNumbers());
1745  if(nEvents() == 0){
1747  }
1748  }
1749 
1751  return false;
1752  }
1753 
1755  return false;
1756  }
1757 
1759  long long nEventsInRange =
1760  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1761  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers();
1762  if(nEventsInRange == 0) {
1763  return false;
1764  }
1765  while(index > 0 &&
1766  !indexIntoFile()->runOrLumiIndexes()[index - 1].isRun() &&
1767  isSameLumi(index, index - 1)) {
1768  --index;
1769  }
1770  assert(nEventsInRange ==
1771  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1772  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers());
1773 
1774  setIndexToEventRange(index);
1775  setNEvents(nEventsInRange);
1776  assert(nEvents() > 0);
1777  setIndexToEvent(nEventsInRange - 1);
1778  return true;
1779  }
1780 
1782  if(indexToLumi() == invalidIndex) return false;
1783  for(int i = 1; indexToLumi() + i < size(); ++i) {
1784  int newLumi = indexToLumi() + i;
1785  if(indexIntoFile()->runOrLumiIndexes()[newLumi].isRun()) {
1786  return false; // hit next run
1787  } else if(indexIntoFile()->runOrLumiIndexes()[newLumi].lumi() ==
1789  continue;
1790  }
1791  setIndexToLumi(newLumi);
1792  initializeLumi();
1793  return true; // hit next lumi
1794  }
1795  return false; // hit the end of the IndexIntoFile
1796  }
1797 
1799  return indexIntoFile()->runOrLumiEntries()[indexIntoFile()->runOrLumiIndexes()[index].indexToGetEntry()].entry() != invalidEntry;
1800  }
1801 
1803  if(index < 0 || index >= size()) {
1804  return kEnd;
1805  } else if(indexIntoFile()->runOrLumiIndexes()[index].isRun()) {
1806  return kRun;
1807  }
1808  return kLumi;
1809  }
1810 
1811  bool IndexIntoFile::IndexIntoFileItrSorted::isSameLumi(int index1, int index2) const {
1812  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1813  return false;
1814  }
1815  return indexIntoFile()->runOrLumiIndexes()[index1].lumi() ==
1816  indexIntoFile()->runOrLumiIndexes()[index2].lumi();
1817  }
1818 
1819  bool IndexIntoFile::IndexIntoFileItrSorted::isSameRun(int index1, int index2) const {
1820  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1821  return false;
1822  }
1823  return indexIntoFile()->runOrLumiIndexes()[index1].run() ==
1824  indexIntoFile()->runOrLumiIndexes()[index2].run() &&
1825  indexIntoFile()->runOrLumiIndexes()[index1].processHistoryIDIndex() ==
1826  indexIntoFile()->runOrLumiIndexes()[index2].processHistoryIDIndex();
1827  }
1828 
1830  if(index < 0 || index >= size()) {
1831  return invalidLumi;
1832  }
1833  return indexIntoFile()->runOrLumiIndexes()[index].lumi();
1834  }
1835 
1837  SortOrder sortOrder,
1838  EntryType entryType,
1839  int indexToRun,
1840  int indexToLumi,
1841  int indexToEventRange,
1842  long long indexToEvent,
1843  long long nEvents) :
1844  impl_() {
1845  if(sortOrder == numericalOrder) {
1847  entryType,
1848  indexToRun,
1849  indexToLumi,
1850  indexToEventRange,
1851  indexToEvent,
1852  nEvents
1853  ));
1854  swap(temp, impl_);
1855  } else {
1857  entryType,
1858  indexToRun,
1859  indexToLumi,
1860  indexToEventRange,
1861  indexToEvent,
1862  nEvents));
1863  swap(temp, impl_);
1864  }
1865  }
1866 
1868  for(EntryType entryType = getEntryType();
1869  entryType != kEnd && entryType != kEvent;
1870  entryType = getEntryType()) {
1871  impl_->next();
1872  }
1873  }
1874 
1876  for(EntryType entryType = getEntryType();
1877  entryType != kEnd && entryType != kLumi;
1878  entryType = getEntryType()) {
1879  impl_->next();
1880  }
1881  }
1882 
1883  void
1885  impl_->copyPosition(*position.impl_);
1886  }
1887 
1889  if(lh.processHistoryIDIndex() == rh.processHistoryIDIndex()) {
1890  return lh.run() < rh.run();
1891  }
1892  return lh.processHistoryIDIndex() < rh.processHistoryIDIndex();
1893  }
1894 
1896  return lh.processHistoryIDIndex() < rh.processHistoryIDIndex();
1897  }
1898 }
void initializeRun()
Should only be used internally and for tests.
size
Write out results.
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
RunNumber_t & currentRun() const
virtual bool isSameLumi(int index1, int index2) const =0
EntryNumber_t peekAheadAtEventEntry() const
bool isSameLumi(int index1, int index2) const override
EntryNumber_t endEvents() const
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
static constexpr int invalidIndex
IndexIntoFile const * indexIntoFile() const
IndexIntoFileItrImpl * clone() const override
LuminosityBlockNumber_t currentLumi_
bool isSameRun(int index1, int index2) const override
void addLumi(int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EntryNumber_t entry)
std::vector< EventEntry > & eventEntries() const
Definition: Hash.h:43
EntryNumber_t beginEvents() const
EntryNumber_t entry() const override
std::vector< EventNumber_t > eventNumbers_
virtual bool setToLastEventInRange(int index)=0
SortedRunOrLumiItr beginRunOrLumi() const
bool empty() const
True if no runs, lumis, or events are in the file.
LuminosityBlockNumber_t & currentLumi() const
bool isSameLumi(int index1, int index2) const override
bool operator==(SortedRunOrLumiItr const &right) const
unsigned long long EventNumber_t
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void sortEvents() const
void fillUnsortedEventNumbers() const
EntryNumber_t peekAheadAtEventEntry() const override
IndexIntoFileItr begin(SortOrder sortOrder) const
void swap(Hash< I > &other)
Definition: Hash.h:210
LuminosityBlockNumber_t lumi() const
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToOrder() const
bool int lh
Definition: SIMDVec.h:21
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
LuminosityBlockNumber_t peekAheadAtLumi() const override
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
EntryNumber_t orderPHIDRun() const
std::vector< EventNumber_t > unsortedEventNumbers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EntryNumber_t entry() const override
virtual LuminosityBlockNumber_t lumi() const =0
uint16_t size_type
unsigned int LuminosityBlockNumber_t
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
std::vector< ProcessHistoryID > const & processHistoryIDs() const
static constexpr EventNumber_t invalidEvent
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
virtual bool lumiEntryValid(int index) const =0
std::map< IndexRunLumiKey, EntryNumber_t > lumiToOrder_
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
virtual bool isSameRun(int index1, int index2) const =0
int & previousAddedIndex() const
void sortVector_Run_Or_Lumi_Entries()
EntryType getRunOrLumiEntryType(int index) const override
size_t numberOfEvents() const
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
IndexIntoFile const * indexIntoFile() const
int & currentIndex() const
long long EntryNumber_t
bool setToLastEventInRange(int index) override
RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry)
LuminosityBlockNumber_t lumi() const override
static constexpr RunNumber_t invalidRun
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
EntryNumber_t orderPHIDRunLumi() const
std::vector< RunOrLumiEntry > runOrLumiEntries_
std::map< IndexRunKey, EntryNumber_t > runToOrder_
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
std::vector< ProcessHistoryID > processHistoryIDs_
LuminosityBlockNumber_t lumi_
def unique(seq, keepstr=True)
Definition: tier0.py:25
bool isSameRun(int index1, int index2) const override
void fillEventEntries() const
IndexIntoFileItrImpl(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
EntryType getRunOrLumiEntryType(int index) const override
void fillRunOrLumiIndexes() const
bool operator==(IndexIntoFileItrImpl const &right) const
bool lumiEntryValid(int index) const override
void set_intersection(IndexIntoFile const &indexIntoFile, std::set< IndexRunLumiEventKey > &intersection) const
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
void getLumisInRun(std::vector< LuminosityBlockNumber_t > &lumis) const
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
virtual EntryType getRunOrLumiEntryType(int index) const =0
LuminosityBlockNumber_t lumi() const override
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool operator!=(SortedRunOrLumiItr const &right) const
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
SortedRunOrLumiItr(IndexIntoFile const *indexIntoFile, unsigned runOrLumi)
Hash< ProcessHistoryType > ProcessHistoryID
void sortEventEntries() const
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
bool containsDuplicateEvents() const
Returns true if the IndexIntoFile contains 2 events with the same ProcessHistoryID index...
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void inputFileClosed() const
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
bool setToLastEventInRange(int index) override
void resetEventFinder() const
std::vector< EventNumber_t > & unsortedEventNumbers() const
static constexpr EntryNumber_t invalidEntry
EntryNumber_t peekAheadAtEventEntry() const override
IndexIntoFileItrSorted(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
virtual RunNumber_t run() const =0
static constexpr LuminosityBlockNumber_t invalidLumi
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
void initializeLumi()
Should only be used internally and for tests.
ProcessHistoryID const & processHistoryID(int i) const
std::map< IndexRunKey, EntryNumber_t > & runToOrder() const
void copyPosition(IndexIntoFileItrImpl const &position)
IndexIntoFileItrImpl * clone() const override
std::vector< EventEntry > eventEntries_
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
HLT enums.
bool lumiEntryValid(int index) const override
void fillEventNumbers() const
static int position[264][3]
Definition: ReadPGInfo.cc:509
LuminosityBlockNumber_t peekAheadAtLumi() const override
void setNumberOfEvents(EntryNumber_t nevents) const
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
std::vector< EventNumber_t > & eventNumbers() const
std::vector< RunOrLumiIndexes > runOrLumiIndexes_
IndexIntoFileItr(IndexIntoFile const *indexIntoFile, SortOrder sortOrder, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
unsigned int RunNumber_t
virtual int processHistoryIDIndex() const =0
virtual LuminosityBlockNumber_t peekAheadAtLumi() const =0
SortedRunOrLumiItr endRunOrLumi() const
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
UInt_t nEvents
Definition: hcalCalib.cc:42
bool containsRun(RunNumber_t run) const
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
EntryNumber_t entry() const
void getRange(long long &beginEventNumbers, long long &endEventNumbers, EntryNumber_t &beginEventEntry, EntryNumber_t &endEventEntry)
EntryNumber_t & endEvents() const
LuminosityBlockNumber_t peekAheadAtLumi() const
EntryNumber_t & beginEvents() const
virtual EntryNumber_t peekAheadAtEventEntry() const =0
value_ptr< IndexIntoFileItrImpl > impl_
IndexIntoFileItrNoSort(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
Definition: event.py:1
edm::propagate_const< std::shared_ptr< EventFinder > > eventFinder_
RunOrLumiIndexes const & runOrLumiIndexes() const