CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IndexIntoFile.cc
Go to the documentation of this file.
6 
7 #include <algorithm>
8 #include <iomanip>
9 #include <ostream>
10 
11 namespace edm {
12 
18 
19  IndexIntoFile::Transients::Transients() : previousAddedIndex_(invalidIndex),
20  runToFirstEntry_(),
21  lumiToFirstEntry_(),
22  beginEvents_(invalidEntry),
23  endEvents_(invalidEntry),
24  currentIndex_(invalidIndex),
25  currentRun_(invalidRun),
26  currentLumi_(invalidLumi),
27  numberOfEvents_(0),
28  eventFinder_(),
29  runOrLumiIndexes_(),
30  eventNumbers_(),
31  eventEntries_(),
32  unsortedEventNumbers_() {
33  }
34 
35  void
37  previousAddedIndex_ = invalidIndex;
38  runToFirstEntry_.clear();
39  lumiToFirstEntry_.clear();
40  beginEvents_ = invalidEntry;
41  endEvents_ = invalidEntry;
42  currentIndex_ = invalidIndex;
43  currentRun_ = invalidRun;
44  currentLumi_ = invalidLumi;
45  numberOfEvents_ = 0;
46  eventFinder_.reset();
47  runOrLumiIndexes_.clear();
48  eventNumbers_.clear();
49  eventEntries_.clear();
50  unsortedEventNumbers_.clear();
51  }
52 
56  }
57 
59  }
60 
62  return processHistoryIDs_.at(i);
63  }
64 
65  std::vector<ProcessHistoryID> const& IndexIntoFile::processHistoryIDs() const {
66  return processHistoryIDs_;
67  }
68 
69  void
70  IndexIntoFile::addEntry(ProcessHistoryID const& processHistoryID,
75  int index = 0;
76  // First see if the ProcessHistoryID is the same as the previous one.
77  // This is just a performance optimization. We expect to usually get
78  // many in a row that are the same.
80  processHistoryID == processHistoryIDs_[previousAddedIndex()]) {
81  index = previousAddedIndex();
82  } else {
83  // If it was not the same as the previous one then search through the
84  // entire vector. If it is not there, it needs to be added at the
85  // end.
86  index = 0;
87  while(index < static_cast<int>(processHistoryIDs_.size()) &&
88  processHistoryIDs_[index] != processHistoryID) {
89  ++index;
90  }
91  if(index == static_cast<int>(processHistoryIDs_.size())) {
92  processHistoryIDs_.push_back(processHistoryID);
93  }
94  }
96 
97  assert((currentRun() == run && currentIndex() == index) || currentRun() == invalidRun);
98  if(lumi == invalidLumi) {
99  if(currentLumi() != invalidLumi) {
101  << "In IndexIntoFile::addEntry. Entries were added in illegal order.\n"
102  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
103  << "The output file will be unusable for most purposes.\n"
104  << "If this occurs after an unrelated exception was thrown in\n"
105  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
106  << "the primary exception. This is an expected side effect.\n"
107  << "Otherwise please report this to the core framework developers\n";
108  }
112  std::pair<IndexRunKey, EntryNumber_t> firstRunEntry(IndexRunKey(index, run), entry);
113  runToFirstEntry().insert(firstRunEntry);
114  RunOrLumiEntry runEntry(runToFirstEntry()[IndexRunKey(index, run)], invalidEntry, entry, index, run, lumi, invalidEntry, invalidEntry);
115  runOrLumiEntries_.push_back(runEntry);
116  } else {
117  assert(currentLumi() == lumi || currentLumi() == invalidLumi);
118  if(currentRun() == invalidRun) {
119  currentRun() = run;
120  currentIndex() = index;
121  }
122  if(event == invalidEvent) {
124  std::pair<IndexRunLumiKey, EntryNumber_t> firstLumiEntry(IndexRunLumiKey(index, run, lumi), entry);
125  lumiToFirstEntry().insert(firstLumiEntry);
126  RunOrLumiEntry lumiEntry(invalidEntry, lumiToFirstEntry()[IndexRunLumiKey(index, run, lumi)],
127  entry, index, run, lumi, beginEvents(), endEvents());
128  runOrLumiEntries_.push_back(lumiEntry);
131  } else {
133  if(beginEvents() == invalidEntry) {
134  currentLumi() = lumi;
135  beginEvents() = entry;
136  endEvents() = beginEvents() + 1;
137  }
138  else {
139  assert(currentLumi() == lumi);
140  assert(entry == endEvents());
141  ++endEvents();
142  }
143  }
144  }
145  }
146 
148  if(runOrLumiEntries_.empty() || !runOrLumiIndexes().empty()) {
149  return;
150  }
151  runOrLumiIndexes().reserve(runOrLumiEntries_.size());
152 
153  int index = 0;
154  for(std::vector<RunOrLumiEntry>::const_iterator iter = runOrLumiEntries_.begin(),
155  iEnd = runOrLumiEntries_.end();
156  iter != iEnd;
157  ++iter, ++index) {
158  runOrLumiIndexes().push_back(RunOrLumiIndexes(iter->processHistoryIDIndex(),
159  iter->run(),
160  iter->lumi(),
161  index));
162  }
164 
165  long long beginEventNumbers = 0;
166 
167  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
168  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
169  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
170  while(true) {
171  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
172  ++beginOfLumi;
173  }
174  if(beginOfLumi == iEnd) break;
175 
176  endOfLumi = beginOfLumi + 1;
177  while(endOfLumi != iEnd &&
178  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
179  beginOfLumi->run() == endOfLumi->run() &&
180  beginOfLumi->lumi() == endOfLumi->lumi()) {
181  ++endOfLumi;
182  }
183  int nEvents = 0;
184  for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
185  iter != endOfLumi;
186  ++iter) {
187  if(runOrLumiEntries_[iter->indexToGetEntry()].beginEvents() != invalidEntry) {
188  nEvents += runOrLumiEntries_[iter->indexToGetEntry()].endEvents() -
189  runOrLumiEntries_[iter->indexToGetEntry()].beginEvents();
190  }
191  }
192  for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
193  iter != endOfLumi;
194  ++iter) {
195  iter->setBeginEventNumbers(beginEventNumbers);
196  iter->setEndEventNumbers(beginEventNumbers + nEvents);
197  }
198  beginEventNumbers += nEvents;
199  beginOfLumi = endOfLumi;
200  }
201  assert(runOrLumiIndexes().size() == runOrLumiEntries_.size());
202  }
203 
204  void
206  fillEventNumbersOrEntries(true, false);
207  }
208 
209  void
211  fillEventNumbersOrEntries(false, true);
212  }
213 
214  void
215  IndexIntoFile::fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const {
216  if(numberOfEvents() == 0) {
217  return;
218  }
219 
220  if(needEventNumbers && !eventNumbers().empty()) {
221  needEventNumbers = false;
222  }
223 
224  if(needEventEntries && !eventEntries().empty()) {
225  needEventEntries = false;
226  }
227 
228  if(needEventNumbers && !eventEntries().empty()) {
229  assert(numberOfEvents() == eventEntries().size());
230  eventNumbers().reserve(eventEntries().size());
232  eventNumbers().push_back(eventEntries()[entry].event());
233  }
234  return;
235  }
236 
237  if(!needEventNumbers && !needEventEntries) {
238  return;
239  }
240 
242 
243  if(needEventNumbers) {
245  }
246  if(needEventEntries) {
247  eventEntries().resize(numberOfEvents());
248  }
249 
250  long long offset = 0;
251  long long previousBeginEventNumbers = -1LL;
252 
253  for(SortedRunOrLumiItr runOrLumi = beginRunOrLumi(), runOrLumiEnd = endRunOrLumi();
254  runOrLumi != runOrLumiEnd; ++runOrLumi) {
255 
256  if(runOrLumi.isRun()) continue;
257 
258  long long beginEventNumbers = 0;
259  long long endEventNumbers = 0;
260  EntryNumber_t beginEventEntry = -1LL;
261  EntryNumber_t endEventEntry = -1LL;
262  runOrLumi.getRange(beginEventNumbers, endEventNumbers, beginEventEntry, endEventEntry);
263 
264  // This is true each time one hits a new lumi section (except if the previous lumi had
265  // no events, in which case the offset is still 0 anyway)
266  if(beginEventNumbers != previousBeginEventNumbers) offset = 0;
267 
268  for(EntryNumber_t entry = beginEventEntry; entry != endEventEntry; ++entry) {
269  if(needEventNumbers) {
270  eventNumbers().at((entry - beginEventEntry) + offset + beginEventNumbers) = unsortedEventNumbers().at(entry);
271  }
272  if(needEventEntries) {
273  eventEntries().at((entry - beginEventEntry) + offset + beginEventNumbers) =
275  }
276  }
277 
278  previousBeginEventNumbers = beginEventNumbers;
279  offset += endEventEntry - beginEventEntry;
280  }
281  if(needEventNumbers) {
282  sortEvents();
283  assert(numberOfEvents() == eventNumbers().size());
284  }
285  if(needEventEntries) {
287  assert(numberOfEvents() == eventEntries().size());
288  }
289  }
290 
291  void
293  if(numberOfEvents() == 0 || !unsortedEventNumbers().empty()) {
294  return;
295  }
297 
298  // The main purpose for the existence of the unsortedEventNumbers
299  // vector is that it can easily be filled by reading through
300  // the EventAuxiliary branch in the same order as the TTree
301  // entries. fillEventNumbersOrEntries can then use this information
302  // instead of using getEventNumberOfEntry directly and reading
303  // the branch in a different order.
306  }
307  }
308 
309  // We are closing the input file, but we need to keep event numbers.
310  // We can delete the other transient collections by using the swap trick.
311 
312  void
314  std::vector<EventEntry>().swap(eventEntries());
315  std::vector<RunOrLumiIndexes>().swap(runOrLumiIndexes());
316  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
318  }
319 
320  void
322  std::vector<EventNumber_t>().swap(unsortedEventNumbers());
323  }
324 
325  void
327 
329 
330  std::vector<ProcessHistoryID> reducedPHIDs;
331 
332  std::map<ProcessHistoryID, int> reducedPHIDToIndex;
333  std::pair<ProcessHistoryID, int> mapEntry(ProcessHistoryID(), 0);
334  std::pair<std::map<ProcessHistoryID, int>::iterator, bool> insertResult;
335 
336  std::vector<int> phidIndexConverter;
337  for(std::vector<ProcessHistoryID>::const_iterator phid = processHistoryIDs_.begin(),
338  iEnd = processHistoryIDs_.end();
339  phid != iEnd; ++phid) {
340 
341  ProcessHistoryID const& reducedPHID = phidConverter.reduceProcessHistoryID(*phid);
342  mapEntry.first = reducedPHID;
343  insertResult = reducedPHIDToIndex.insert(mapEntry);
344 
345  if(insertResult.second) {
346  insertResult.first->second = reducedPHIDs.size();
347  reducedPHIDs.push_back(reducedPHID);
348  }
349  phidIndexConverter.push_back(insertResult.first->second);
350  }
351  processHistoryIDs_.swap(reducedPHIDs);
352 
353  // If the size of the vector of IDs does not change
354  // then their indexes and the ordering of the Runs and
355  // and Lumis does not change, so we are done.
356  if(processHistoryIDs_.size() == reducedPHIDs.size()) {
357  return;
358  }
359 
360  std::map<IndexIntoFile::IndexRunKey, int> runOrderMap;
361  std::pair<std::map<IndexIntoFile::IndexRunKey, int>::iterator, bool> runInsertResult;
362 
363  std::map<IndexIntoFile::IndexRunLumiKey, int> lumiOrderMap;
364  std::pair<std::map<IndexIntoFile::IndexRunLumiKey, int>::iterator, bool> lumiInsertResult;
365 
366  // loop over all the RunOrLumiEntry's
367  for(std::vector<RunOrLumiEntry>::iterator i = runOrLumiEntries_.begin(),
368  iterEnd = runOrLumiEntries_.end();
369  i != iterEnd; ++i) {
370 
371  // Convert the process history index so it points into the new vector of reduced IDs
372  i->setProcessHistoryIDIndex(phidIndexConverter.at(i->processHistoryIDIndex()));
373 
374  // Convert the phid-run order
375  IndexIntoFile::IndexRunKey runKey(i->processHistoryIDIndex(), i->run());
376  runInsertResult = runOrderMap.insert(std::pair<IndexIntoFile::IndexRunKey, int>(runKey,0));
377  if(runInsertResult.second) {
378  runInsertResult.first->second = i->orderPHIDRun();
379  } else {
380  i->setOrderPHIDRun(runInsertResult.first->second);
381  }
382 
383  // Convert the phid-run-lumi order for the lumi entries
384  if(i->lumi() != 0) {
385  IndexIntoFile::IndexRunLumiKey lumiKey(i->processHistoryIDIndex(), i->run(), i->lumi());
386  lumiInsertResult = lumiOrderMap.insert(std::pair<IndexIntoFile::IndexRunLumiKey, int>(lumiKey,0));
387  if(lumiInsertResult.second) {
388  lumiInsertResult.first->second = i->orderPHIDRunLumi();
389  } else {
390  i->setOrderPHIDRunLumi(lumiInsertResult.first->second);
391  }
392  }
393  }
394  std::stable_sort(runOrLumiEntries_.begin(), runOrLumiEntries_.end());
395  }
396 
397  void
398  IndexIntoFile::fixIndexes(std::vector<ProcessHistoryID> & processHistoryIDs) {
399 
400  std::map<int, int> oldToNewIndex;
401  for(std::vector<ProcessHistoryID>::const_iterator iter = processHistoryIDs_.begin(),
402  iEnd = processHistoryIDs_.end();
403  iter != iEnd;
404  ++iter) {
405  std::vector<ProcessHistoryID>::const_iterator iterExisting =
406  std::find(processHistoryIDs.begin(), processHistoryIDs.end(), *iter);
407  if(iterExisting == processHistoryIDs.end()) {
408  oldToNewIndex[iter - processHistoryIDs_.begin()] = processHistoryIDs.size();
409  processHistoryIDs.push_back(*iter);
410  } else {
411  oldToNewIndex[iter - processHistoryIDs_.begin()] = iterExisting - processHistoryIDs.begin();
412  }
413  }
415 
416  for(std::vector<RunOrLumiEntry>::iterator iter = runOrLumiEntries_.begin(),
417  iEnd = runOrLumiEntries_.end();
418  iter != iEnd;
419  ++iter) {
420  iter->setProcessHistoryIDIndex(oldToNewIndex[iter->processHistoryIDIndex()]);
421  }
422  }
423 
425  for(std::vector<RunOrLumiEntry>::iterator iter = runOrLumiEntries_.begin(),
426  iEnd = runOrLumiEntries_.end();
427  iter != iEnd;
428  ++iter) {
429  std::map<IndexRunKey, EntryNumber_t>::const_iterator firstRunEntry =
430  runToFirstEntry().find(IndexRunKey(iter->processHistoryIDIndex(), iter->run()));
431  if(firstRunEntry == runToFirstEntry().end()) {
433  << "In IndexIntoFile::sortVector_Run_Or_Lumi_Entries. A run entry is missing.\n"
434  << "This means the IndexIntoFile product in the output file will be corrupted.\n"
435  << "The output file will be unusable for most purposes.\n"
436  << "If this occurs after an unrelated exception was thrown in\n"
437  << "endLuminosityBlock or endRun then ignore this exception and fix\n"
438  << "the primary exception. This is an expected side effect.\n"
439  << "Otherwise please report this to the core framework developers\n";
440  }
441  iter->setOrderPHIDRun(firstRunEntry->second);
442  }
444  }
445 
448  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
449  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
450  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
451  while(true) {
452  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
453  ++beginOfLumi;
454  }
455  if(beginOfLumi == iEnd) break;
456 
457  endOfLumi = beginOfLumi + 1;
458  while(endOfLumi != iEnd &&
459  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
460  beginOfLumi->run() == endOfLumi->run() &&
461  beginOfLumi->lumi() == endOfLumi->lumi()) {
462  ++endOfLumi;
463  }
464  assert(beginOfLumi->endEventNumbers() >= 0);
465  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventNumbers().size()));
466  std::sort(eventNumbers().begin() + beginOfLumi->beginEventNumbers(),
467  eventNumbers().begin() + beginOfLumi->endEventNumbers());
468  beginOfLumi = endOfLumi;
469  }
470  }
471 
474  std::vector<RunOrLumiIndexes>::iterator beginOfLumi = runOrLumiIndexes().begin();
475  std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
476  std::vector<RunOrLumiIndexes>::iterator iEnd = runOrLumiIndexes().end();
477  while(true) {
478  while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
479  ++beginOfLumi;
480  }
481  if(beginOfLumi == iEnd) break;
482 
483  endOfLumi = beginOfLumi + 1;
484  while(endOfLumi != iEnd &&
485  beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
486  beginOfLumi->run() == endOfLumi->run() &&
487  beginOfLumi->lumi() == endOfLumi->lumi()) {
488  ++endOfLumi;
489  }
490  assert(beginOfLumi->endEventNumbers() >= 0);
491  assert(beginOfLumi->endEventNumbers() <= static_cast<long long>(eventEntries().size()));
492  std::sort(eventEntries().begin() + beginOfLumi->beginEventNumbers(),
493  eventEntries().begin() + beginOfLumi->endEventNumbers());
494  beginOfLumi = endOfLumi;
495  }
496  }
497 
499  if(empty()) {
500  return end(sortOrder);
501  }
502  IndexIntoFileItr iter(this,
503  sortOrder,
504  kRun,
505  0,
506  invalidIndex,
507  invalidIndex,
508  0,
509  0);
510  iter.initializeRun();
511  return iter;
512  }
513 
515  return IndexIntoFileItr(this,
516  sortOrder,
517  kEnd,
518  invalidIndex,
519  invalidIndex,
520  invalidIndex,
521  0,
522  0);
523  }
524 
526  EntryNumber_t maxEntry = invalidEntry;
527  for(IndexIntoFileItr it = begin(sortOrder), itEnd = end(sortOrder); it != itEnd; ++it) {
528  if(it.getEntryType() == kEvent) {
529  if(it.entry() < maxEntry) {
530  return false;
531  }
532  maxEntry = it.entry();
533  }
534  }
535  return true;
536  }
537 
538  bool IndexIntoFile::empty() const {
539  return runOrLumiEntries().empty();
540  }
541 
545 
546  bool lumiMissing = (lumi == 0 && event != 0);
547 
548  std::vector<RunOrLumiIndexes>::const_iterator it;
549  std::vector<RunOrLumiIndexes>::const_iterator iEnd = runOrLumiIndexes().end();
550  std::vector<RunOrLumiIndexes>::const_iterator phEnd;
551 
552  // Loop over ranges of entries with the same ProcessHistoryID
553  for(std::vector<RunOrLumiIndexes>::const_iterator phBegin = runOrLumiIndexes().begin();
554  phBegin != iEnd;
555  phBegin = phEnd) {
556 
557  RunOrLumiIndexes el(phBegin->processHistoryIDIndex(), run, lumi, 0);
558  phEnd = std::upper_bound(phBegin, iEnd, el, Compare_Index());
559 
560  std::vector<RunOrLumiIndexes>::const_iterator iRun = std::lower_bound(phBegin, phEnd, el, Compare_Index_Run());
561 
562  if(iRun == phEnd || iRun->run() != run) continue;
563 
564  if(lumi == invalidLumi && event == invalidEvent) {
565  IndexIntoFileItr indexItr(this,
567  kRun,
568  iRun - runOrLumiIndexes().begin(),
569  invalidIndex,
570  invalidIndex,
571  0,
572  0);
573  indexItr.initializeRun();
574  return indexItr;
575  }
576 
577  std::vector<RunOrLumiIndexes>::const_iterator iRunEnd = std::upper_bound(iRun, phEnd, el, Compare_Index_Run());
578  if(!lumiMissing) {
579 
580  std::vector<RunOrLumiIndexes>::const_iterator iLumi = std::lower_bound(iRun, iRunEnd, el);
581  if(iLumi == iRunEnd || iLumi->lumi() != lumi) continue;
582 
583  if(event == invalidEvent) {
584  IndexIntoFileItr indexItr(this,
586  kRun,
587  iRun - runOrLumiIndexes().begin(),
588  iLumi - runOrLumiIndexes().begin(),
589  invalidIndex,
590  0,
591  0);
592  indexItr.initializeLumi();
593  return indexItr;
594  }
595 
596  long long beginEventNumbers = iLumi->beginEventNumbers();
597  long long endEventNumbers = iLumi->endEventNumbers();
598  if(beginEventNumbers >= endEventNumbers) continue;
599 
600 
601  long long indexToEvent = 0;
602  if(!eventEntries().empty()) {
603  std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(eventEntries().begin() + beginEventNumbers,
604  eventEntries().begin() + endEventNumbers,
605  EventEntry(event, invalidEntry));
606  if(eventIter == (eventEntries().begin() + endEventNumbers) ||
607  eventIter->event() != event) continue;
608 
609  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
610  } else {
612  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(eventNumbers().begin() + beginEventNumbers,
613  eventNumbers().begin() + endEventNumbers,
614  event);
615  if(eventIter == (eventNumbers().begin() + endEventNumbers) ||
616  *eventIter != event) continue;
617 
618  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
619  }
620  return IndexIntoFileItr(this,
622  kRun,
623  iRun - runOrLumiIndexes().begin(),
624  iLumi - runOrLumiIndexes().begin(),
625  iLumi - runOrLumiIndexes().begin(),
626  indexToEvent,
627  endEventNumbers - beginEventNumbers);
628  }
629  if(lumiMissing) {
630 
631  std::vector<RunOrLumiIndexes>::const_iterator iLumi = iRun;
632  while(iLumi != iRunEnd && iLumi->lumi() == invalidLumi) {
633  ++iLumi;
634  }
635  if(iLumi == iRunEnd) continue;
636 
637  std::vector<RunOrLumiIndexes>::const_iterator lumiEnd;
638  for( ;
639  iLumi != iRunEnd;
640  iLumi = lumiEnd) {
641 
642  RunOrLumiIndexes elWithLumi(phBegin->processHistoryIDIndex(), run, iLumi->lumi(), 0);
643  lumiEnd = std::upper_bound(iLumi, iRunEnd, elWithLumi);
644 
645  long long beginEventNumbers = iLumi->beginEventNumbers();
646  long long endEventNumbers = iLumi->endEventNumbers();
647  if(beginEventNumbers >= endEventNumbers) continue;
648 
649  long long indexToEvent = 0;
650  if(!eventEntries().empty()) {
651  std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(eventEntries().begin() + beginEventNumbers,
652  eventEntries().begin() + endEventNumbers,
653  EventEntry(event, invalidEntry));
654  if(eventIter == (eventEntries().begin() + endEventNumbers) ||
655  eventIter->event() != event) continue;
656  indexToEvent = eventIter - eventEntries().begin() - beginEventNumbers;
657  } else {
659  std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(eventNumbers().begin() + beginEventNumbers,
660  eventNumbers().begin() + endEventNumbers,
661  event);
662  if(eventIter == (eventNumbers().begin() + endEventNumbers) ||
663  *eventIter != event) continue;
664  indexToEvent = eventIter - eventNumbers().begin() - beginEventNumbers;
665  }
666  return IndexIntoFileItr(this,
668  kRun,
669  iRun - runOrLumiIndexes().begin(),
670  iLumi - runOrLumiIndexes().begin(),
671  iLumi - runOrLumiIndexes().begin(),
672  indexToEvent,
673  endEventNumbers - beginEventNumbers);
674  }
675  }
676  } // Loop over ProcessHistoryIDs
677 
678  return IndexIntoFileItr(this,
680  kEnd,
681  invalidIndex,
682  invalidIndex,
683  invalidIndex,
684  0,
685  0);
686 
687  }
688 
691  if(sortOrder == IndexIntoFile::numericalOrder) {
692  return findPosition(run, lumi, event); // a faster algorithm
693  }
694  IndexIntoFileItr itr = begin(sortOrder);
695  IndexIntoFileItr itrEnd = end(sortOrder);
696 
697  while(itr != itrEnd) {
698  if(itr.run() != run) {
699  itr.advanceToNextRun();
700  } else {
701  if(lumi == invalidLumi && event == invalidEvent) {
702  return itr;
703  } else if(lumi != invalidLumi && itr.peekAheadAtLumi() != lumi) {
704  if(!itr.skipLumiInRun()) {
705  itr.advanceToNextRun();
706  }
707  } else {
708  if(event == invalidEvent) {
709  return itr;
710  } else {
712  if(eventNumber == event) {
713  return itr;
714  } else {
715  if(!itr.skipToNextEventInLumi()) {
716  if(!itr.skipLumiInRun()) {
717  itr.advanceToNextRun();
718  }
719  }
720  }
721  }
722  }
723  }
724  }
725  return itrEnd;
726  }
727 
730  assert(event != invalidEvent);
731  IndexIntoFileItr iter = findPosition(run, lumi, event);
732  iter.advanceToEvent();
733  return iter;
734  }
735 
738  assert(lumi != invalidLumi);
739  IndexIntoFileItr iter = findPosition(run, lumi, 0U);
740  iter.advanceToLumi();
741  return iter;
742  }
743 
746  return findPosition(run, 0U, 0U);
747  }
748 
749  bool
751  return event ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
752  }
753 
754  bool
756  return findEventPosition(run, lumi, event).getEntryType() != kEnd;
757  }
758 
759  bool
761  return findLumiPosition(run, lumi).getEntryType() != kEnd;
762  }
763 
764  bool
766  return findRunPosition(run).getEntryType() != kEnd;
767  }
768 
770  return SortedRunOrLumiItr(this, 0);
771  }
772 
774  return SortedRunOrLumiItr(this, runOrLumiEntries().size());
775  }
776 
778  std::set<IndexRunLumiEventKey> & intersection) const {
779 
780  if(empty() || indexIntoFile.empty()) return;
782  indexIntoFile.fillRunOrLumiIndexes();
783  RunOrLumiIndexes const& back1 = runOrLumiIndexes().back();
784  RunOrLumiIndexes const& back2 = indexIntoFile.runOrLumiIndexes().back();
785 
786  // Very quick decision if the run ranges in the two files do not overlap
787  if(back2 < runOrLumiIndexes().front()) return;
788  if(back1 < indexIntoFile.runOrLumiIndexes().front()) return;
789 
792 
793  SortedRunOrLumiItr iter2 = indexIntoFile.beginRunOrLumi();
794  SortedRunOrLumiItr iEnd2 = indexIntoFile.endRunOrLumi();
795 
796  // Quick decision if the lumi ranges in the two files do not overlap
797  while(iter1 != iEnd1 && iter1.isRun()) ++iter1;
798  if(iter1 == iEnd1) return;
799  if(back2 < iter1.runOrLumiIndexes()) return;
800 
801  while(iter2 != iEnd2 && iter2.isRun()) ++iter2;
802  if(iter2 == iEnd2) return;
803  if(back1 < iter2.runOrLumiIndexes()) return;
804 
805  RunOrLumiIndexes const* previousIndexes = 0;
806 
807  // Loop through the both IndexIntoFile objects and look for matching lumis
808  while(iter1 != iEnd1 && iter2 != iEnd2) {
809 
810  RunOrLumiIndexes const& indexes1 = iter1.runOrLumiIndexes();
811  RunOrLumiIndexes const& indexes2 = iter2.runOrLumiIndexes();
812  if(indexes1 < indexes2) {
813  ++iter1;
814  } else if(indexes2 < indexes1) {
815  ++iter2;
816  } else { // they are equal
817 
818  // Skip them if it is a run or the same lumi
819  if(indexes1.isRun() ||
820  (previousIndexes && !(*previousIndexes < indexes1))) {
821  ++iter1;
822  ++iter2;
823  } else {
824  previousIndexes = &indexes1;
825 
826  // Found a matching lumi, now look for matching events
827 
828  long long beginEventNumbers1 = indexes1.beginEventNumbers();
829  long long endEventNumbers1 = indexes1.endEventNumbers();
830 
831  long long beginEventNumbers2 = indexes2.beginEventNumbers();
832  long long endEventNumbers2 = indexes2.endEventNumbers();
833 
834  // there must be at least 1 event in each lumi for there to be any matches
835  if((beginEventNumbers1 >= endEventNumbers1) ||
836  (beginEventNumbers2 >= endEventNumbers2)) {
837  ++iter1;
838  ++iter2;
839  continue;
840  }
841 
842  if(!eventEntries().empty() && !indexIntoFile.eventEntries().empty()) {
843  std::vector<EventEntry> matchingEvents;
844  std::insert_iterator<std::vector<EventEntry> > insertIter(matchingEvents, matchingEvents.begin());
845  std::set_intersection(eventEntries().begin() + beginEventNumbers1,
846  eventEntries().begin() + endEventNumbers1,
847  indexIntoFile.eventEntries().begin() + beginEventNumbers2,
848  indexIntoFile.eventEntries().begin() + endEventNumbers2,
849  insertIter);
850  for(std::vector<EventEntry>::const_iterator iEvent = matchingEvents.begin(),
851  iEnd = matchingEvents.end();
852  iEvent != iEnd; ++iEvent) {
853  intersection.insert(IndexRunLumiEventKey(indexes1.processHistoryIDIndex(),
854  indexes1.run(),
855  indexes1.lumi(),
856  iEvent->event()));
857  }
858  } else {
860  indexIntoFile.fillEventNumbers();
861  std::vector<EventNumber_t> matchingEvents;
862  std::insert_iterator<std::vector<EventNumber_t> > insertIter(matchingEvents, matchingEvents.begin());
863  std::set_intersection(eventNumbers().begin() + beginEventNumbers1,
864  eventNumbers().begin() + endEventNumbers1,
865  indexIntoFile.eventNumbers().begin() + beginEventNumbers2,
866  indexIntoFile.eventNumbers().begin() + endEventNumbers2,
867  insertIter);
868  for(std::vector<EventNumber_t>::const_iterator iEvent = matchingEvents.begin(),
869  iEnd = matchingEvents.end();
870  iEvent != iEnd; ++iEvent) {
871  intersection.insert(IndexRunLumiEventKey(indexes1.processHistoryIDIndex(),
872  indexes1.run(),
873  indexes1.lumi(),
874  *iEvent));
875  }
876  }
877  }
878  }
879  }
880  }
881 
883 
884  RunOrLumiIndexes const* previousIndexes = 0;
885 
886  for(SortedRunOrLumiItr iter = beginRunOrLumi(),
887  iEnd = endRunOrLumi();
888  iter != iEnd; ++iter) {
889 
890  RunOrLumiIndexes const& indexes = iter.runOrLumiIndexes();
891 
892  // Skip it if it is a run or the same lumi
893  if(indexes.isRun() ||
894  (previousIndexes && !(*previousIndexes < indexes))) {
895  continue;
896  }
897  previousIndexes = &indexes;
898 
899  long long beginEventNumbers = indexes.beginEventNumbers();
900  long long endEventNumbers = indexes.endEventNumbers();
901 
902  // there must be more than 1 event in the lumi for there to be any duplicates
903  if(beginEventNumbers + 1 >= endEventNumbers) continue;
904 
905  if(!eventEntries().empty()) {
906  std::vector<EventEntry>::iterator last = eventEntries().begin() + endEventNumbers;
907  if(std::adjacent_find(eventEntries().begin() + beginEventNumbers, last) != last) {
908  return true;
909  }
910  } else {
912  std::vector<EventNumber_t>::iterator last = eventNumbers().begin() + endEventNumbers;
913  if(std::adjacent_find(eventNumbers().begin() + beginEventNumbers, last) != last) {
914  return true;
915  }
916  }
917  }
918  return false;
919  }
920 
922  orderPHIDRun_(invalidEntry),
923  orderPHIDRunLumi_(invalidEntry),
924  entry_(invalidEntry),
925  processHistoryIDIndex_(invalidIndex),
926  run_(invalidRun),
927  lumi_(invalidLumi),
928  beginEvents_(invalidEntry),
929  endEvents_(invalidEntry) {
930  }
931 
933  EntryNumber_t orderPHIDRunLumi,
935  int processHistoryIDIndex,
940  orderPHIDRun_(orderPHIDRun),
941  orderPHIDRunLumi_(orderPHIDRunLumi),
942  entry_(entry),
943  processHistoryIDIndex_(processHistoryIDIndex),
944  run_(run),
945  lumi_(lumi),
946  beginEvents_(beginEvents),
947  endEvents_(endEvents) {
948  }
949 
953  int indexToGetEntry) :
954  processHistoryIDIndex_(processHistoryIDIndex),
955  run_(run),
956  lumi_(lumi),
957  indexToGetEntry_(indexToGetEntry),
958  beginEventNumbers_(-1),
959  endEventNumbers_(-1)
960  {
961  }
962 
963  IndexIntoFile::SortedRunOrLumiItr::SortedRunOrLumiItr(IndexIntoFile const* indexIntoFile, unsigned runOrLumi) :
964  indexIntoFile_(indexIntoFile), runOrLumi_(runOrLumi) {
965  assert(runOrLumi_ <= indexIntoFile_->runOrLumiEntries().size());
967  }
968 
970  return indexIntoFile_ == right.indexIntoFile() &&
971  runOrLumi_ == right.runOrLumi();
972  }
973 
975  return indexIntoFile_ != right.indexIntoFile() ||
976  runOrLumi_ != right.runOrLumi();
977  }
978 
980  if(runOrLumi_ != indexIntoFile_->runOrLumiEntries().size()) {
981  ++runOrLumi_;
982  }
983  return *this;
984  }
985 
987  return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).lumi() == invalidLumi;
988  }
989 
990  void IndexIntoFile::SortedRunOrLumiItr::getRange(long long & beginEventNumbers,
991  long long & endEventNumbers,
992  EntryNumber_t & beginEventEntry,
993  EntryNumber_t & endEventEntry) {
994  beginEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).beginEventNumbers();
995  endEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).endEventNumbers();
996 
997  int indexToGetEntry = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).indexToGetEntry();
998  beginEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).beginEvents();
999  endEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).endEvents();
1000  }
1001 
1004  return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_);
1005  }
1006 
1008  EntryType entryType,
1009  int indexToRun,
1010  int indexToLumi,
1011  int indexToEventRange,
1012  long long indexToEvent,
1013  long long nEvents) :
1014  indexIntoFile_(indexIntoFile),
1015  size_(static_cast<int>(indexIntoFile_->runOrLumiEntries_.size())),
1016  type_(entryType),
1017  indexToRun_(indexToRun),
1018  indexToLumi_(indexToLumi),
1019  indexToEventRange_(indexToEventRange),
1020  indexToEvent_(indexToEvent),
1021  nEvents_(nEvents) {
1022  }
1023 
1025 
1027 
1028  if(type_ == kEvent) {
1029  if((indexToEvent_ + 1) < nEvents_) {
1030  ++indexToEvent_;
1031  } else {
1032  bool found = nextEventRange();
1033 
1034  if(!found) {
1035  type_ = getRunOrLumiEntryType(indexToLumi_ + 1);
1036 
1037  if(type_ == kLumi) {
1038  ++indexToLumi_;
1039  initializeLumi();
1040  } else if(type_ == kRun) {
1041  indexToRun_ = indexToLumi_ + 1;
1042  initializeRun();
1043  } else {
1044  setInvalid(); // type_ is kEnd
1045  }
1046  }
1047  }
1048  } else if(type_ == kLumi) {
1049 
1050  if(indexToLumi_ + 1 == size_) {
1051  if(indexToEvent_ < nEvents_) {
1052  type_ = kEvent;
1053  } else {
1054  setInvalid();
1055  }
1056  } else {
1057 
1058  EntryType nextType = getRunOrLumiEntryType(indexToLumi_ + 1);
1059 
1060  if(nextType == kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
1061  ++indexToLumi_;
1062  } else if(indexToEvent_ < nEvents_) {
1063  type_ = kEvent;
1064  } else if(nextType == kRun) {
1065  type_ = kRun;
1066  indexToRun_ = indexToLumi_ + 1;
1067  initializeRun();
1068  } else {
1069  ++indexToLumi_;
1070  initializeLumi();
1071  }
1072  }
1073  } else if(type_ == kRun) {
1074  EntryType nextType = getRunOrLumiEntryType(indexToRun_ + 1);
1075  bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
1076  if(nextType == kRun && sameRun) {
1077  ++indexToRun_;
1078  } else if(nextType == kRun && !sameRun) {
1079  ++indexToRun_;
1080  initializeRun();
1081  } else if(nextType == kLumi) {
1082  type_ = kLumi;
1083  } else {
1084  setInvalid();
1085  }
1086  }
1087  }
1088 
1090  RunNumber_t & runOfSkippedEvent,
1091  LuminosityBlockNumber_t & lumiOfSkippedEvent,
1092  EntryNumber_t & skippedEventEntry) {
1093  if(indexToEvent_ < nEvents_) {
1094  phIndexOfSkippedEvent = processHistoryIDIndex();
1095  runOfSkippedEvent = run();
1096  lumiOfSkippedEvent = peekAheadAtLumi();
1097  skippedEventEntry = peekAheadAtEventEntry();
1098 
1099  if((indexToEvent_ + 1) < nEvents_) {
1100  ++indexToEvent_;
1101  return;
1102  } else if(nextEventRange()) {
1103  return;
1104  } else if(type_ == kRun || type_ == kLumi) {
1105  if(skipLumiInRun()) {
1106  return;
1107  }
1108  } else if(type_ == kEvent) {
1109  next();
1110  return;
1111  }
1112  advanceToNextRun();
1113  return;
1114  }
1115 
1116  if(type_ == kRun) {
1117  while(skipLumiInRun()) {
1118  if(indexToEvent_ < nEvents_) {
1119  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1120  return;
1121  }
1122  }
1123  }
1124 
1125  while(indexToEvent_ >= nEvents_ && type_ != kEnd) {
1126  while(skipLumiInRun()) {
1127  if(indexToEvent_ < nEvents_) {
1128  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1129  return;
1130  }
1131  }
1132  advanceToNextRun();
1133  }
1134  if(type_ == kEnd) {
1135  phIndexOfSkippedEvent = invalidIndex;
1136  runOfSkippedEvent = invalidRun;
1137  lumiOfSkippedEvent = invalidLumi;
1138  skippedEventEntry = invalidEntry;
1139  return;
1140  }
1141  skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1142  return;
1143  }
1144 
1146  RunNumber_t& runOfEvent,
1147  LuminosityBlockNumber_t& lumiOfEvent,
1148  EntryNumber_t& eventEntry) {
1149  // Look for previous events in the current lumi
1150  if(indexToEvent_ > 0) {
1151  --indexToEvent_;
1152  } else if(!previousEventRange()) {
1153 
1154  // Look for previous events in previous lumis
1155  if(!previousLumiWithEvents()) {
1156 
1157  // If we get here there are no previous events in the file
1158 
1159  if(!indexIntoFile_->empty()) {
1160  // Set the iterator to the beginning of the file
1161  type_ = kRun;
1162  indexToRun_ = 0;
1163  initializeRun();
1164  }
1165  phIndexOfEvent = invalidIndex;
1166  runOfEvent = invalidRun;
1167  lumiOfEvent = invalidLumi;
1168  eventEntry = invalidEntry;
1169  return;
1170  }
1171  }
1172  // Found a previous event and we have set the iterator so that this event
1173  // will be the next event process. (There may or may not be a run and/or
1174  // a lumi processed first).
1175  // Return information about this event
1176  phIndexOfEvent = processHistoryIDIndex();
1177  runOfEvent = run();
1178  lumiOfEvent = peekAheadAtLumi();
1179  eventEntry = peekAheadAtEventEntry();
1180  }
1181 
1183  // Find the correct place to start the search
1184  int newLumi = indexToLumi();
1185  if(newLumi == invalidIndex) {
1186  newLumi = indexToRun() == invalidIndex ? size() - 1 : indexToRun();
1187  } else {
1188  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1189  isSameLumi(newLumi, newLumi - 1)) {
1190  --newLumi;
1191  }
1192  --newLumi;
1193  }
1194  if(newLumi <= 0) return false;
1195 
1196  // Look backwards for a lumi with events
1197  for( ; newLumi > 0; --newLumi) {
1198  if(getRunOrLumiEntryType(newLumi) == kRun) {
1199  continue;
1200  }
1201  if(setToLastEventInRange(newLumi)) {
1202  break; // found it
1203  }
1204  }
1205  if(newLumi == 0) return false;
1206 
1207  // Finish initializing the iterator
1208  while(getRunOrLumiEntryType(newLumi - 1) == kLumi &&
1209  isSameLumi(newLumi, newLumi - 1)) {
1210  --newLumi;
1211  }
1212  setIndexToLumi(newLumi);
1213 
1214  if(type() != kEnd &&
1215  isSameRun(newLumi, indexToRun())) {
1216  if(type() == kEvent) type_ = kLumi;
1217  return true;
1218  }
1219  int newRun = newLumi;
1220  while(newRun > 0 && getRunOrLumiEntryType(newRun - 1) == kLumi) {
1221  --newRun;
1222  }
1223  --newRun;
1224  assert(getRunOrLumiEntryType(newRun) == kRun);
1225  while(getRunOrLumiEntryType(newRun - 1) == kRun &&
1226  isSameRun(newRun - 1, newLumi)) {
1227  --newRun;
1228  }
1229  indexToRun_ = newRun;
1230  type_ = kRun;
1231  return true;
1232  }
1233 
1235  if(indexToLumi() == invalidIndex) return invalidEntry;
1236 
1237  int saveIndexToLumi = indexToLumi();
1238  int saveIndexToEventRange = indexToEventRange();
1239  long long saveIndexToEvent = indexToEvent();
1240  long long saveNEvents = nEvents();
1241 
1242  initializeRun();
1243 
1245 
1246  do {
1247  if(indexToEvent() < nEvents()) {
1248  returnValue = peekAheadAtEventEntry();
1249  break;
1250  }
1251  } while(skipLumiInRun());
1252 
1253  setIndexToLumi(saveIndexToLumi);
1254  setIndexToEventRange(saveIndexToEventRange);
1255  setIndexToEvent(saveIndexToEvent);
1256  setNEvents(saveNEvents);
1257 
1258  return returnValue;
1259  }
1260 
1262  if(indexToLumi() == invalidIndex) return invalidEntry;
1263 
1264  int saveIndexToLumi = indexToLumi();
1265  int saveIndexToEventRange = indexToEventRange();
1266  long long saveIndexToEvent = indexToEvent();
1267  long long saveNEvents = nEvents();
1268 
1269  for(int i = 1; indexToLumi() - i > 0; ++i) {
1270  if(getRunOrLumiEntryType(indexToLumi_ - i) == kRun) break;
1271  if(!isSameLumi(indexToLumi(), indexToLumi() - i)) break;
1272  indexToLumi_ = indexToLumi_ - i;
1273  }
1274  initializeLumi();
1275 
1277 
1278  if(indexToEvent() < nEvents()) {
1279  returnValue = peekAheadAtEventEntry();
1280  }
1281 
1282  setIndexToLumi(saveIndexToLumi);
1283  setIndexToEventRange(saveIndexToEventRange);
1284  setIndexToEvent(saveIndexToEvent);
1285  setNEvents(saveNEvents);
1286 
1287  return returnValue;
1288  }
1289 
1291  if(type_ == kEnd) return;
1292  for(int i = 1; indexToRun_ + i < size_; ++i) {
1293  if(getRunOrLumiEntryType(indexToRun_ + i) == kRun) {
1294  if(!isSameRun(indexToRun_, indexToRun_ + i)) {
1295  type_ = kRun;
1296  indexToRun_ += i;
1297  initializeRun();
1298  return;
1299  }
1300  }
1301  }
1302  setInvalid();
1303  }
1304 
1306  if(type_ == kEnd) return;
1307  assert(indexToRun_ != invalidIndex);
1308 
1309  // A preliminary step is to advance to the last run entry for
1310  // this run (actually this step is not needed in the
1311  // context I expect this to be called in, just being careful)
1312  int startSearch = indexToRun_;
1313  for(int i = 1; startSearch + i < size_; ++i) {
1314  if(getRunOrLumiEntryType(startSearch + i) == kRun &&
1315  isSameRun(indexToRun_, startSearch + i)) {
1316  indexToRun_ = startSearch + i;
1317  } else {
1318  break;
1319  }
1320  }
1321 
1322  if(type_ == kRun && indexToLumi_ != invalidIndex) {
1323  type_ = kLumi;
1324  return;
1325  }
1326 
1327  startSearch = indexToLumi_;
1328  if(startSearch == invalidIndex) startSearch = indexToRun_;
1329  for(int i = 1; startSearch + i < size_; ++i) {
1330  if(getRunOrLumiEntryType(startSearch + i) == kRun) {
1331  if(!isSameRun(indexToRun_, startSearch + i)) {
1332  type_ = kRun;
1333  indexToRun_ = startSearch + i;
1334  initializeRun();
1335  return;
1336  }
1337  } else if(indexToLumi_ != invalidIndex) {
1338  if(!isSameLumi(indexToLumi_, startSearch + i)) {
1339  type_ = kLumi;
1340  indexToLumi_ = startSearch + i;
1341  initializeLumi();
1342  return;
1343  }
1344  }
1345  }
1346  setInvalid();
1347  }
1348 
1350  if(indexToEvent_ >= nEvents_) return false;
1351  if((indexToEvent_ + 1) < nEvents_) {
1352  ++indexToEvent_;
1353  return true;
1354  }
1355  return nextEventRange();
1356  }
1357 
1359 
1360  indexToLumi_ = invalidIndex;
1361  indexToEventRange_ = invalidIndex;
1362  indexToEvent_ = 0;
1363  nEvents_ = 0;
1364 
1365  for(int i = 1; (i + indexToRun_) < size_; ++i) {
1366  EntryType entryType = getRunOrLumiEntryType(indexToRun_ + i);
1367  bool sameRun = isSameRun(indexToRun_, indexToRun_ + i);
1368 
1369  if(entryType == kRun) {
1370  if(sameRun) {
1371  continue;
1372  } else {
1373  break;
1374  }
1375  } else {
1376  indexToLumi_ = indexToRun_ + i;
1377  initializeLumi();
1378  return;
1379  }
1380  }
1381  }
1382 
1384  return (indexIntoFile_ == right.indexIntoFile_ &&
1385  size_ == right.size_ &&
1386  type_ == right.type_ &&
1387  indexToRun_ == right.indexToRun_ &&
1388  indexToLumi_ == right.indexToLumi_ &&
1389  indexToEventRange_ == right.indexToEventRange_ &&
1390  indexToEvent_ == right.indexToEvent_ &&
1391  nEvents_ == right.nEvents_);
1392  }
1393 
1394  void
1396  type_ = position.type_;
1397  indexToRun_ = position.indexToRun_;
1398  indexToLumi_ = position.indexToLumi_;
1399  indexToEventRange_ = position.indexToEventRange_;
1400  indexToEvent_ = position.indexToEvent_;
1401  nEvents_ = position.nEvents_;
1402  }
1403 
1405  type_ = kEnd;
1406  indexToRun_ = invalidIndex;
1407  indexToLumi_ = invalidIndex;
1408  indexToEventRange_ = invalidIndex;
1409  indexToEvent_ = 0;
1410  nEvents_ = 0;
1411  }
1412 
1414  EntryType entryType,
1415  int indexToRun,
1416  int indexToLumi,
1417  int indexToEventRange,
1418  long long indexToEvent,
1419  long long nEvents) :
1420  IndexIntoFileItrImpl(indexIntoFile,
1421  entryType,
1422  indexToRun,
1423  indexToLumi,
1424  indexToEventRange,
1425  indexToEvent,
1426  nEvents)
1427  {
1428  }
1429 
1432  return new IndexIntoFileItrNoSort(*this);
1433  }
1434 
1435  int
1437  if(type() == kEnd) return invalidIndex;
1438  return indexIntoFile()->runOrLumiEntries()[indexToRun()].processHistoryIDIndex();
1439  }
1440 
1442  if(type() == kEnd) return invalidRun;
1443  return indexIntoFile()->runOrLumiEntries()[indexToRun()].run();
1444  }
1445 
1447  if(type() == kEnd || type() == kRun) return invalidLumi;
1448  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1449  }
1450 
1452  if(type() == kEnd) return invalidEntry;
1453  if(type() == kRun) return indexIntoFile()->runOrLumiEntries()[indexToRun()].entry();
1454  if(type() == kLumi) return indexIntoFile()->runOrLumiEntries()[indexToLumi()].entry();
1455  return
1456  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1457  indexToEvent();
1458  }
1459 
1461  if(indexToLumi() == invalidIndex) return invalidLumi;
1462  return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1463  }
1464 
1466  if(indexToLumi() == invalidIndex) return invalidEntry;
1467  if(indexToEvent() >= nEvents()) return invalidEntry;
1468  return
1469  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1470  indexToEvent();
1471  }
1472 
1474  assert(indexToLumi() != invalidIndex);
1475 
1476  setIndexToEventRange(invalidIndex);
1477  setIndexToEvent(0);
1478  setNEvents(0);
1479 
1480  for(int i = 0; indexToLumi() + i < size(); ++i) {
1481  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].isRun()) {
1482  break;
1483  } else if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].lumi() ==
1484  indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1485  if(indexIntoFile()->runOrLumiEntries()[indexToLumi() + i].beginEvents() == invalidEntry) {
1486  continue;
1487  }
1488  setIndexToEventRange(indexToLumi() + i);
1489  setIndexToEvent(0);
1490  setNEvents(indexIntoFile()->runOrLumiEntries()[indexToEventRange()].endEvents() -
1491  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents());
1492  break;
1493  } else {
1494  break;
1495  }
1496  }
1497  }
1498 
1500  if(indexToEventRange() == invalidIndex) return false;
1501 
1502  // Look for the next event range, same lumi but different entry
1503  for(int i = 1; indexToEventRange() + i < size(); ++i) {
1504  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i ].isRun()) {
1505  return false; // hit next run
1506  } else if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].lumi() ==
1507  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].lumi()) {
1508  if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() + i].beginEvents() == invalidEntry) {
1509  continue; // same lumi but has no events, keep looking
1510  }
1511  setIndexToEventRange(indexToEventRange() + i);
1512  setIndexToEvent(0);
1513  setNEvents(indexIntoFile()->runOrLumiEntries()[indexToEventRange()].endEvents() -
1514  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents());
1515  return true; // found more events in this lumi
1516  }
1517  return false; // hit next lumi
1518  }
1519  return false; // hit the end of the IndexIntoFile
1520  }
1521 
1523  if(indexToEventRange() == invalidIndex) return false;
1524  assert(indexToEventRange() < size());
1525 
1526  // Look backward for a previous event range with events, same lumi but different entry
1527  for(int i = 1; indexToEventRange() - i > 0; ++i) {
1528  int newRange = indexToEventRange() - i;
1529  if(indexIntoFile()->runOrLumiEntries()[newRange].isRun()) {
1530  return false; // hit run
1531  } else if(isSameLumi(newRange, indexToEventRange())) {
1532  if(indexIntoFile()->runOrLumiEntries()[newRange].beginEvents() == invalidEntry) {
1533  continue; // same lumi but has no events, keep looking
1534  }
1535  setIndexToEventRange(newRange);
1536  setNEvents(indexIntoFile()->runOrLumiEntries()[indexToEventRange()].endEvents() -
1537  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents());
1538  setIndexToEvent(nEvents() - 1);
1539  return true; // found previous event in this lumi
1540  }
1541  return false; // hit previous lumi
1542  }
1543  return false; // hit the beginning of the IndexIntoFile, 0th entry has to be a run
1544  }
1545 
1547  if(indexIntoFile()->runOrLumiEntries()[index].beginEvents() == invalidEntry) {
1548  return false;
1549  }
1550  setIndexToEventRange(index);
1551  setNEvents(indexIntoFile()->runOrLumiEntries()[indexToEventRange()].endEvents() -
1552  indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents());
1553  assert(nEvents() > 0);
1554  setIndexToEvent(nEvents() - 1);
1555  return true;
1556  }
1557 
1559  if(indexToLumi() == invalidIndex) return false;
1560  for(int i = 1; indexToLumi() + i < size(); ++i) {
1561  int newLumi = indexToLumi() + i;
1562  if(indexIntoFile()->runOrLumiEntries()[newLumi].isRun()) {
1563  return false; // hit next run
1564  } else if(indexIntoFile()->runOrLumiEntries()[newLumi].lumi() ==
1565  indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1566  continue;
1567  }
1568  setIndexToLumi(newLumi);
1569  initializeLumi();
1570  return true; // hit next lumi
1571  }
1572  return false; // hit the end of the IndexIntoFile
1573  }
1574 
1576  if(index < 0 || index >= size()) {
1577  return kEnd;
1578  } else if(indexIntoFile()->runOrLumiEntries()[index].isRun()) {
1579  return kRun;
1580  }
1581  return kLumi;
1582  }
1583 
1584  bool IndexIntoFile::IndexIntoFileItrNoSort::isSameLumi(int index1, int index2) const {
1585  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1586  return false;
1587  }
1588  return indexIntoFile()->runOrLumiEntries()[index1].lumi() ==
1589  indexIntoFile()->runOrLumiEntries()[index2].lumi();
1590  }
1591 
1592  bool IndexIntoFile::IndexIntoFileItrNoSort::isSameRun(int index1, int index2) const {
1593  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1594  return false;
1595  }
1596  return indexIntoFile()->runOrLumiEntries()[index1].run() ==
1597  indexIntoFile()->runOrLumiEntries()[index2].run() &&
1598  indexIntoFile()->runOrLumiEntries()[index1].processHistoryIDIndex() ==
1599  indexIntoFile()->runOrLumiEntries()[index2].processHistoryIDIndex();
1600  }
1601 
1603  EntryType entryType,
1604  int indexToRun,
1605  int indexToLumi,
1606  int indexToEventRange,
1607  long long indexToEvent,
1608  long long nEvents) :
1609  IndexIntoFileItrImpl(indexIntoFile,
1610  entryType,
1611  indexToRun,
1612  indexToLumi,
1613  indexToEventRange,
1614  indexToEvent,
1615  nEvents) {
1616  indexIntoFile->fillRunOrLumiIndexes();
1617  }
1618 
1620  return new IndexIntoFileItrSorted(*this);
1621  }
1622 
1624  if(type() == kEnd) return invalidIndex;
1625  return indexIntoFile()->runOrLumiIndexes()[indexToRun()].processHistoryIDIndex();
1626  }
1627 
1629  if(type() == kEnd) return invalidRun;
1630  return indexIntoFile()->runOrLumiIndexes()[indexToRun()].run();
1631  }
1632 
1634  if(type() == kEnd || type() == kRun) return invalidLumi;
1635  return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1636  }
1637 
1639  if(type() == kEnd) return invalidEntry;
1640  if(type() == kRun) {
1641  int i = indexIntoFile()->runOrLumiIndexes()[indexToRun()].indexToGetEntry();
1642  return indexIntoFile()->runOrLumiEntries()[i].entry();
1643  }
1644  if(type() == kLumi) {
1645  int i = indexIntoFile()->runOrLumiIndexes()[indexToLumi()].indexToGetEntry();
1646  return indexIntoFile()->runOrLumiEntries()[i].entry();
1647  }
1648  long long eventNumberIndex =
1649  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1650  indexToEvent();
1651  indexIntoFile()->fillEventEntries();
1652  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1653  }
1654 
1656  if(indexToLumi() == invalidIndex) return invalidLumi;
1657  return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1658  }
1659 
1661  if(indexToLumi() == invalidIndex) return invalidEntry;
1662  if(indexToEvent() >= nEvents()) return invalidEntry;
1663  long long eventNumberIndex =
1664  indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1665  indexToEvent();
1666  indexIntoFile()->fillEventEntries();
1667  return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1668  }
1669 
1671  assert(indexToLumi() != invalidIndex);
1672  setIndexToEventRange(indexToLumi());
1673  setIndexToEvent(0);
1674  setNEvents(
1675  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].endEventNumbers() -
1676  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].beginEventNumbers());
1677  if(nEvents() == 0){
1678  setIndexToEventRange(invalidIndex);
1679  }
1680  }
1681 
1683  return false;
1684  }
1685 
1687  return false;
1688  }
1689 
1691  long long nEventsInRange =
1692  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1693  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers();
1694  if(nEventsInRange == 0) {
1695  return false;
1696  }
1697  while(index > 0 &&
1698  !indexIntoFile()->runOrLumiIndexes()[index - 1].isRun() &&
1699  isSameLumi(index, index - 1)) {
1700  --index;
1701  }
1702  assert(nEventsInRange ==
1703  indexIntoFile()->runOrLumiIndexes()[index].endEventNumbers() -
1704  indexIntoFile()->runOrLumiIndexes()[index].beginEventNumbers());
1705 
1706  setIndexToEventRange(index);
1707  setNEvents(nEventsInRange);
1708  assert(nEvents() > 0);
1709  setIndexToEvent(nEventsInRange - 1);
1710  return true;
1711  }
1712 
1714  if(indexToLumi() == invalidIndex) return false;
1715  for(int i = 1; indexToLumi() + i < size(); ++i) {
1716  int newLumi = indexToLumi() + i;
1717  if(indexIntoFile()->runOrLumiIndexes()[newLumi].isRun()) {
1718  return false; // hit next run
1719  } else if(indexIntoFile()->runOrLumiIndexes()[newLumi].lumi() ==
1720  indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi()) {
1721  continue;
1722  }
1723  setIndexToLumi(newLumi);
1724  initializeLumi();
1725  return true; // hit next lumi
1726  }
1727  return false; // hit the end of the IndexIntoFile
1728  }
1729 
1731  if(index < 0 || index >= size()) {
1732  return kEnd;
1733  } else if(indexIntoFile()->runOrLumiIndexes()[index].isRun()) {
1734  return kRun;
1735  }
1736  return kLumi;
1737  }
1738 
1739  bool IndexIntoFile::IndexIntoFileItrSorted::isSameLumi(int index1, int index2) const {
1740  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1741  return false;
1742  }
1743  return indexIntoFile()->runOrLumiIndexes()[index1].lumi() ==
1744  indexIntoFile()->runOrLumiIndexes()[index2].lumi();
1745  }
1746 
1747  bool IndexIntoFile::IndexIntoFileItrSorted::isSameRun(int index1, int index2) const {
1748  if(index1 < 0 || index1 >= size() || index2 < 0 || index2 >= size()) {
1749  return false;
1750  }
1751  return indexIntoFile()->runOrLumiIndexes()[index1].run() ==
1752  indexIntoFile()->runOrLumiIndexes()[index2].run() &&
1753  indexIntoFile()->runOrLumiIndexes()[index1].processHistoryIDIndex() ==
1754  indexIntoFile()->runOrLumiIndexes()[index2].processHistoryIDIndex();
1755  }
1756 
1758  SortOrder sortOrder,
1759  EntryType entryType,
1760  int indexToRun,
1761  int indexToLumi,
1762  int indexToEventRange,
1763  long long indexToEvent,
1764  long long nEvents) :
1765  impl_() {
1766  if(sortOrder == numericalOrder) {
1768  entryType,
1769  indexToRun,
1770  indexToLumi,
1771  indexToEventRange,
1772  indexToEvent,
1773  nEvents
1774  ));
1775  swap(temp, impl_);
1776  } else {
1778  entryType,
1779  indexToRun,
1780  indexToLumi,
1781  indexToEventRange,
1782  indexToEvent,
1783  nEvents));
1784  swap(temp, impl_);
1785  }
1786  }
1787 
1789  for(EntryType entryType = getEntryType();
1790  entryType != kEnd && entryType != kEvent;
1791  entryType = getEntryType()) {
1792  impl_->next();
1793  }
1794  }
1795 
1797  for(EntryType entryType = getEntryType();
1798  entryType != kEnd && entryType != kLumi;
1799  entryType = getEntryType()) {
1800  impl_->next();
1801  }
1802  }
1803 
1804  void
1806  impl_->copyPosition(*position.impl_);
1807  }
1808 
1810  if(lh.processHistoryIDIndex() == rh.processHistoryIDIndex()) {
1811  return lh.run() < rh.run();
1812  }
1813  return lh.processHistoryIDIndex() < rh.processHistoryIDIndex();
1814  }
1815 
1817  return lh.processHistoryIDIndex() < rh.processHistoryIDIndex();
1818  }
1819 }
void initializeRun()
Should only be used internally and for tests.
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
RunNumber_t & currentRun() const
type
Definition: HCALResponse.h:22
virtual bool isSameLumi(int index1, int index2) const
virtual EntryNumber_t entry() const
int i
Definition: DBlmapReader.cc:9
EntryNumber_t peekAheadAtEventEntry() const
ProcessHistoryID const & reduceProcessHistoryID(ProcessHistoryID const &fullID)
Use to obtain reduced ProcessHistoryID&#39;s from full ProcessHistoryID&#39;s.
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
static int const invalidIndex
virtual LuminosityBlockNumber_t lumi() const
virtual EntryNumber_t peekAheadAtEventEntry() const
virtual EntryNumber_t entry() const
virtual bool isSameRun(int index1, int index2) const
unsigned int EventNumber_t
Definition: EventID.h:30
std::vector< EventEntry > & eventEntries() const
Definition: Hash.h:41
static ThreadSafeRegistry * instance()
tuple lumi
Definition: fjr2json.py:35
virtual EntryType getRunOrLumiEntryType(int index) const
SortedRunOrLumiItr beginRunOrLumi() const
bool empty() const
True if no runs, lumis, or events are in the file.
LuminosityBlockNumber_t & currentLumi() const
virtual LuminosityBlockNumber_t peekAheadAtLumi() const
bool operator==(SortedRunOrLumiItr const &right) const
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void sortEvents() const
void fillUnsortedEventNumbers() const
void reduceProcessHistoryIDs()
IndexIntoFileItr begin(SortOrder sortOrder) const
LuminosityBlockNumber_t lumi() const
bool int lh
Definition: SSEVec.h:55
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual IndexIntoFileItrImpl * clone() const
uint16_t size_type
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
std::vector< ProcessHistoryID > const & processHistoryIDs() const
long long EntryNumber_t
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
static EventNumber_t const invalidEvent
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
int & previousAddedIndex() const
void sortVector_Run_Or_Lumi_Entries()
size_t numberOfEvents() const
IndexIntoFile const * indexIntoFile() const
int & currentIndex() const
int iEvent
Definition: GenABIO.cc:243
RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry)
static RunNumber_t const invalidRun
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
std::vector< RunOrLumiEntry > runOrLumiEntries_
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_
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
void fillEventEntries() const
IndexIntoFileItrImpl(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
virtual EntryNumber_t peekAheadAtEventEntry() const
void fillRunOrLumiIndexes() const
virtual bool isSameRun(int index1, int index2) const
bool operator==(IndexIntoFileItrImpl const &right) const
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.
virtual IndexIntoFileItrImpl * clone() const
unsigned int offset(bool)
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)
void resetEventFinder() const
std::map< IndexRunKey, EntryNumber_t > & runToFirstEntry() const
std::vector< EventNumber_t > & unsortedEventNumbers() const
static EntryNumber_t const invalidEntry
virtual bool isSameLumi(int index1, int index2) const
virtual EntryType getRunOrLumiEntryType(int index) const
IndexIntoFileItrSorted(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
virtual LuminosityBlockNumber_t peekAheadAtLumi() const
static LuminosityBlockNumber_t const 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
void copyPosition(IndexIntoFileItrImpl const &position)
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
virtual LuminosityBlockNumber_t lumi() const
void fillEventNumbers() const
void setNumberOfEvents(EntryNumber_t nevents) const
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
std::vector< EventNumber_t > & eventNumbers() const
IndexIntoFileItr(IndexIntoFile const *indexIntoFile, SortOrder sortOrder, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
size_(0)
Definition: OwnArray.h:181
unsigned int RunNumber_t
Definition: EventRange.h:32
SortedRunOrLumiItr endRunOrLumi() const
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
UInt_t nEvents
Definition: hcalCalib.cc:43
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToFirstEntry() const
bool containsRun(RunNumber_t run) const
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) 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
value_ptr< IndexIntoFileItrImpl > impl_
tuple size
Write out results.
IndexIntoFileItrNoSort(IndexIntoFile const *indexIntoFile, EntryType entryType, int indexToRun, int indexToLumi, int indexToEventRange, long long indexToEvent, long long nEvents)
list at
Definition: asciidump.py:428
RunOrLumiIndexes const & runOrLumiIndexes() const