21 beginEvents_(invalidEntry),
22 endEvents_(invalidEntry),
23 currentIndex_(invalidIndex),
24 currentRun_(invalidRun),
25 currentLumi_(invalidLumi),
31 unsortedEventNumbers_() {
37 runToFirstEntry_.clear();
38 lumiToFirstEntry_.clear();
46 runOrLumiIndexes_.clear();
47 eventNumbers_.clear();
48 eventEntries_.clear();
49 unsortedEventNumbers_.clear();
100 <<
"In IndexIntoFile::addEntry. Entries were added in illegal order.\n"
101 <<
"This means the IndexIntoFile product in the output file will be corrupted.\n"
102 <<
"The output file will be unusable for most purposes.\n"
103 <<
"If this occurs after an unrelated exception was thrown in\n"
104 <<
"endLuminosityBlock or endRun then ignore this exception and fix\n"
105 <<
"the primary exception. This is an expected side effect.\n"
106 <<
"Otherwise please report this to the core framework developers\n";
111 std::pair<IndexRunKey, EntryNumber_t> firstRunEntry(
IndexRunKey(index, run), entry);
123 std::pair<IndexRunLumiKey, EntryNumber_t> firstLumiEntry(
IndexRunLumiKey(index, run, lumi), entry);
162 long long beginEventNumbers = 0;
164 std::vector<RunOrLumiIndexes>::iterator beginOfLumi =
runOrLumiIndexes().begin();
165 std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
168 while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
171 if(beginOfLumi == iEnd)
break;
173 endOfLumi = beginOfLumi + 1;
174 while(endOfLumi != iEnd &&
175 beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
176 beginOfLumi->run() == endOfLumi->run() &&
177 beginOfLumi->lumi() == endOfLumi->lumi()) {
181 for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
184 if(runOrLumiEntries_[iter->indexToGetEntry()].beginEvents() !=
invalidEntry) {
185 nEvents += runOrLumiEntries_[iter->indexToGetEntry()].endEvents() -
186 runOrLumiEntries_[iter->indexToGetEntry()].beginEvents();
189 for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
192 iter->setBeginEventNumbers(beginEventNumbers);
193 iter->setEndEventNumbers(beginEventNumbers + nEvents);
196 beginOfLumi = endOfLumi;
218 needEventNumbers =
false;
222 needEventEntries =
false;
234 if(!needEventNumbers && !needEventEntries) {
240 if(needEventNumbers) {
243 if(needEventEntries) {
248 long long previousBeginEventNumbers = -1LL;
251 runOrLumi != runOrLumiEnd; ++runOrLumi) {
253 if(runOrLumi.isRun())
continue;
255 long long beginEventNumbers = 0;
256 long long endEventNumbers = 0;
259 runOrLumi.getRange(beginEventNumbers, endEventNumbers, beginEventEntry, endEventEntry);
263 if(beginEventNumbers != previousBeginEventNumbers) offset = 0;
265 for(
EntryNumber_t entry = beginEventEntry; entry != endEventEntry; ++entry) {
266 if(needEventNumbers) {
269 if(needEventEntries) {
270 eventEntries().at((entry - beginEventEntry) + offset + beginEventNumbers) =
275 previousBeginEventNumbers = beginEventNumbers;
276 offset += endEventEntry - beginEventEntry;
278 if(needEventNumbers) {
282 if(needEventEntries) {
325 std::vector<ProcessHistoryID> reducedPHIDs;
327 std::map<ProcessHistoryID, int> reducedPHIDToIndex;
329 std::pair<std::map<ProcessHistoryID, int>::iterator,
bool> insertResult;
331 std::vector<int> phidIndexConverter;
335 mapEntry.first = reducedPHID;
336 insertResult = reducedPHIDToIndex.insert(mapEntry);
338 if(insertResult.second) {
339 insertResult.first->second = reducedPHIDs.size();
340 reducedPHIDs.push_back(reducedPHID);
342 phidIndexConverter.push_back(insertResult.first->second);
344 processHistoryIDs_.
swap(reducedPHIDs);
349 if(processHistoryIDs_.size() == reducedPHIDs.size()) {
353 std::map<IndexIntoFile::IndexRunKey, int> runOrderMap;
354 std::pair<std::map<IndexIntoFile::IndexRunKey, int>::iterator,
bool> runInsertResult;
356 std::map<IndexIntoFile::IndexRunLumiKey, int> lumiOrderMap;
357 std::pair<std::map<IndexIntoFile::IndexRunLumiKey, int>::iterator,
bool> lumiInsertResult;
363 item.setProcessHistoryIDIndex(phidIndexConverter.at(item.processHistoryIDIndex()));
367 runInsertResult = runOrderMap.insert(std::pair<IndexIntoFile::IndexRunKey, int>(runKey,0));
368 if(runInsertResult.second) {
369 runInsertResult.first->second = item.orderPHIDRun();
371 item.setOrderPHIDRun(runInsertResult.first->second);
375 if(item.lumi() != 0) {
377 lumiInsertResult = lumiOrderMap.insert(std::pair<IndexIntoFile::IndexRunLumiKey, int>(lumiKey,0));
378 if(lumiInsertResult.second) {
379 lumiInsertResult.first->second = item.orderPHIDRunLumi();
381 item.setOrderPHIDRunLumi(lumiInsertResult.first->second);
385 std::stable_sort(runOrLumiEntries_.begin(), runOrLumiEntries_.end());
391 std::map<int, int> oldToNewIndex;
396 std::vector<ProcessHistoryID>::const_iterator iterExisting =
397 std::find(processHistoryIDs.begin(), processHistoryIDs.end(), *iter);
398 if(iterExisting == processHistoryIDs.end()) {
400 processHistoryIDs.push_back(*iter);
402 oldToNewIndex[iter -
processHistoryIDs_.begin()] = iterExisting - processHistoryIDs.begin();
408 item.setProcessHistoryIDIndex(oldToNewIndex[item.processHistoryIDIndex()]);
414 std::map<IndexRunKey, EntryNumber_t>::const_iterator firstRunEntry =
418 <<
"In IndexIntoFile::sortVector_Run_Or_Lumi_Entries. A run entry is missing.\n"
419 <<
"This means the IndexIntoFile product in the output file will be corrupted.\n"
420 <<
"The output file will be unusable for most purposes.\n"
421 <<
"If this occurs after an unrelated exception was thrown in\n"
422 <<
"endLuminosityBlock or endRun then ignore this exception and fix\n"
423 <<
"the primary exception. This is an expected side effect.\n"
424 <<
"Otherwise please report this to the core framework developers\n";
426 item.setOrderPHIDRun(firstRunEntry->second);
433 std::vector<RunOrLumiIndexes>::iterator beginOfLumi =
runOrLumiIndexes().begin();
434 std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
437 while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
440 if(beginOfLumi == iEnd)
break;
442 endOfLumi = beginOfLumi + 1;
443 while(endOfLumi != iEnd &&
444 beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
445 beginOfLumi->run() == endOfLumi->run() &&
446 beginOfLumi->lumi() == endOfLumi->lumi()) {
449 assert(beginOfLumi->endEventNumbers() >= 0);
450 assert(beginOfLumi->endEventNumbers() <=
static_cast<long long>(
eventNumbers().size()));
452 eventNumbers().begin() + beginOfLumi->endEventNumbers());
453 beginOfLumi = endOfLumi;
459 std::vector<RunOrLumiIndexes>::iterator beginOfLumi =
runOrLumiIndexes().begin();
460 std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
463 while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
466 if(beginOfLumi == iEnd)
break;
468 endOfLumi = beginOfLumi + 1;
469 while(endOfLumi != iEnd &&
470 beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
471 beginOfLumi->run() == endOfLumi->run() &&
472 beginOfLumi->lumi() == endOfLumi->lumi()) {
475 assert(beginOfLumi->endEventNumbers() >= 0);
476 assert(beginOfLumi->endEventNumbers() <=
static_cast<long long>(
eventEntries().size()));
478 eventEntries().begin() + beginOfLumi->endEventNumbers());
479 beginOfLumi = endOfLumi;
485 return end(sortOrder);
513 if(it.getEntryType() ==
kEvent) {
514 if(it.entry() < maxEntry) {
517 maxEntry = it.entry();
531 bool lumiMissing = (lumi == 0 &&
event != 0);
533 std::vector<RunOrLumiIndexes>::const_iterator it;
534 std::vector<RunOrLumiIndexes>::const_iterator iEnd =
runOrLumiIndexes().end();
535 std::vector<RunOrLumiIndexes>::const_iterator phEnd;
543 phEnd = std::upper_bound(phBegin, iEnd, el,
Compare_Index());
545 std::vector<RunOrLumiIndexes>::const_iterator iRun = std::lower_bound(phBegin, phEnd, el,
Compare_Index_Run());
547 if(iRun == phEnd || iRun->run() !=
run)
continue;
562 std::vector<RunOrLumiIndexes>::const_iterator iRunEnd = std::upper_bound(iRun, phEnd, el,
Compare_Index_Run());
565 std::vector<RunOrLumiIndexes>::const_iterator iLumi = std::lower_bound(iRun, iRunEnd, el);
566 if(iLumi == iRunEnd || iLumi->lumi() !=
lumi)
continue;
581 long long beginEventNumbers = iLumi->beginEventNumbers();
582 long long endEventNumbers = iLumi->endEventNumbers();
583 if(beginEventNumbers >= endEventNumbers)
continue;
586 long long indexToEvent = 0;
588 std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(
eventEntries().
begin() + beginEventNumbers,
592 eventIter->event() !=
event)
continue;
594 indexToEvent = eventIter -
eventEntries().begin() - beginEventNumbers;
597 std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(
eventNumbers().
begin() + beginEventNumbers,
601 *eventIter != event)
continue;
603 indexToEvent = eventIter -
eventNumbers().begin() - beginEventNumbers;
612 endEventNumbers - beginEventNumbers);
616 std::vector<RunOrLumiIndexes>::const_iterator iLumi = iRun;
617 while(iLumi != iRunEnd && iLumi->lumi() ==
invalidLumi) {
620 if(iLumi == iRunEnd)
continue;
622 std::vector<RunOrLumiIndexes>::const_iterator lumiEnd;
628 lumiEnd = std::upper_bound(iLumi, iRunEnd, elWithLumi);
630 long long beginEventNumbers = iLumi->beginEventNumbers();
631 long long endEventNumbers = iLumi->endEventNumbers();
632 if(beginEventNumbers >= endEventNumbers)
continue;
634 long long indexToEvent = 0;
636 std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(
eventEntries().
begin() + beginEventNumbers,
640 eventIter->event() !=
event)
continue;
641 indexToEvent = eventIter -
eventEntries().begin() - beginEventNumbers;
644 std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(
eventNumbers().
begin() + beginEventNumbers,
648 *eventIter != event)
continue;
649 indexToEvent = eventIter -
eventNumbers().begin() - beginEventNumbers;
658 endEventNumbers - beginEventNumbers);
682 while(itr != itrEnd) {
697 if(eventNumber == event) {
782 while(iter1 != iEnd1 && iter1.
isRun()) ++iter1;
783 if(iter1 == iEnd1)
return;
786 while(iter2 != iEnd2 && iter2.
isRun()) ++iter2;
787 if(iter2 == iEnd2)
return;
793 while(iter1 != iEnd1 && iter2 != iEnd2) {
797 if(indexes1 < indexes2) {
799 }
else if(indexes2 < indexes1) {
804 if(indexes1.
isRun() ||
805 (previousIndexes && !(*previousIndexes < indexes1))) {
809 previousIndexes = &indexes1;
820 if((beginEventNumbers1 >= endEventNumbers1) ||
821 (beginEventNumbers2 >= endEventNumbers2)) {
828 std::vector<EventEntry> matchingEvents;
829 std::insert_iterator<std::vector<EventEntry> > insertIter(matchingEvents, matchingEvents.begin());
832 indexIntoFile.
eventEntries().begin() + beginEventNumbers2,
833 indexIntoFile.
eventEntries().begin() + endEventNumbers2,
835 for(
EventEntry const& entry : matchingEvents) {
844 std::vector<EventNumber_t> matchingEvents;
845 std::insert_iterator<std::vector<EventNumber_t> > insertIter(matchingEvents, matchingEvents.begin());
848 indexIntoFile.
eventNumbers().begin() + beginEventNumbers2,
849 indexIntoFile.
eventNumbers().begin() + endEventNumbers2,
869 iter != iEnd; ++iter) {
874 if(indexes.
isRun() ||
875 (previousIndexes && !(*previousIndexes < indexes))) {
878 previousIndexes = &indexes;
884 if(beginEventNumbers + 1 >= endEventNumbers)
continue;
887 std::vector<EventEntry>::iterator
last =
eventEntries().begin() + endEventNumbers;
888 if(std::adjacent_find(
eventEntries().
begin() + beginEventNumbers, last) != last) {
893 std::vector<EventNumber_t>::iterator
last =
eventNumbers().begin() + endEventNumbers;
894 if(std::adjacent_find(
eventNumbers().
begin() + beginEventNumbers, last) != last) {
903 orderPHIDRun_(invalidEntry),
904 orderPHIDRunLumi_(invalidEntry),
905 entry_(invalidEntry),
906 processHistoryIDIndex_(invalidIndex),
909 beginEvents_(invalidEntry),
910 endEvents_(invalidEntry) {
916 int processHistoryIDIndex,
921 orderPHIDRun_(orderPHIDRun),
922 orderPHIDRunLumi_(orderPHIDRunLumi),
924 processHistoryIDIndex_(processHistoryIDIndex),
927 beginEvents_(beginEvents),
928 endEvents_(endEvents) {
934 int indexToGetEntry) :
935 processHistoryIDIndex_(processHistoryIDIndex),
938 indexToGetEntry_(indexToGetEntry),
939 beginEventNumbers_(-1),
945 indexIntoFile_(indexIntoFile), runOrLumi_(runOrLumi) {
961 if(runOrLumi_ != indexIntoFile_->runOrLumiEntries().size()) {
968 return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).lumi() ==
invalidLumi;
972 long long & endEventNumbers,
975 beginEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).beginEventNumbers();
976 endEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).endEventNumbers();
978 int indexToGetEntry = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).indexToGetEntry();
979 beginEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).beginEvents();
980 endEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).endEvents();
985 return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_);
992 int indexToEventRange,
993 long long indexToEvent,
995 indexIntoFile_(indexIntoFile),
998 indexToRun_(indexToRun),
999 indexToLumi_(indexToLumi),
1000 indexToEventRange_(indexToEventRange),
1001 indexToEvent_(indexToEvent),
1010 if((indexToEvent_ + 1) < nEvents_) {
1013 bool found = nextEventRange();
1016 type_ = getRunOrLumiEntryType(indexToLumi_ + 1);
1018 if(type_ ==
kLumi) {
1021 }
else if(type_ ==
kRun) {
1022 indexToRun_ = indexToLumi_ + 1;
1029 }
else if(type_ ==
kLumi) {
1031 if(indexToLumi_ + 1 ==
size_) {
1032 if(indexToEvent_ < nEvents_) {
1039 EntryType nextType = getRunOrLumiEntryType(indexToLumi_ + 1);
1041 if(nextType ==
kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
1043 }
else if(indexToEvent_ < nEvents_) {
1045 }
else if(nextType ==
kRun) {
1047 indexToRun_ = indexToLumi_ + 1;
1054 }
else if(type_ ==
kRun) {
1055 EntryType nextType = getRunOrLumiEntryType(indexToRun_ + 1);
1056 bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
1057 if(nextType ==
kRun && sameRun) {
1059 }
else if(nextType ==
kRun && !sameRun) {
1062 }
else if(nextType ==
kLumi) {
1074 if(indexToEvent_ < nEvents_) {
1075 phIndexOfSkippedEvent = processHistoryIDIndex();
1076 runOfSkippedEvent =
run();
1077 lumiOfSkippedEvent = peekAheadAtLumi();
1078 skippedEventEntry = peekAheadAtEventEntry();
1080 if((indexToEvent_ + 1) < nEvents_) {
1083 }
else if(nextEventRange()) {
1085 }
else if(type_ ==
kRun || type_ ==
kLumi) {
1086 if(skipLumiInRun()) {
1089 }
else if(type_ ==
kEvent) {
1098 while(skipLumiInRun()) {
1099 if(indexToEvent_ < nEvents_) {
1100 skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1106 while(indexToEvent_ >= nEvents_ && type_ !=
kEnd) {
1107 while(skipLumiInRun()) {
1108 if(indexToEvent_ < nEvents_) {
1109 skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1122 skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1131 if(indexToEvent_ > 0) {
1133 }
else if(!previousEventRange()) {
1136 if(!previousLumiWithEvents()) {
1140 if(!indexIntoFile_->empty()) {
1157 phIndexOfEvent = processHistoryIDIndex();
1159 lumiOfEvent = peekAheadAtLumi();
1160 eventEntry = peekAheadAtEventEntry();
1165 int newLumi = indexToLumi();
1169 while(getRunOrLumiEntryType(newLumi - 1) ==
kLumi &&
1170 isSameLumi(newLumi, newLumi - 1)) {
1175 if(newLumi <= 0)
return false;
1178 for( ; newLumi > 0; --newLumi) {
1179 if(getRunOrLumiEntryType(newLumi) ==
kRun) {
1182 if(setToLastEventInRange(newLumi)) {
1186 if(newLumi == 0)
return false;
1189 while(getRunOrLumiEntryType(newLumi - 1) ==
kLumi &&
1190 isSameLumi(newLumi, newLumi - 1)) {
1193 setIndexToLumi(newLumi);
1196 isSameRun(newLumi, indexToRun())) {
1200 int newRun = newLumi;
1201 while(newRun > 0 && getRunOrLumiEntryType(newRun - 1) ==
kLumi) {
1205 assert(getRunOrLumiEntryType(newRun) ==
kRun);
1206 while(getRunOrLumiEntryType(newRun - 1) ==
kRun &&
1207 isSameRun(newRun - 1, newLumi)) {
1210 indexToRun_ = newRun;
1218 int saveIndexToLumi = indexToLumi();
1219 int saveIndexToEventRange = indexToEventRange();
1220 long long saveIndexToEvent = indexToEvent();
1221 long long saveNEvents =
nEvents();
1228 if(indexToEvent() <
nEvents()) {
1229 returnValue = peekAheadAtEventEntry();
1232 }
while(skipLumiInRun());
1234 setIndexToLumi(saveIndexToLumi);
1235 setIndexToEventRange(saveIndexToEventRange);
1236 setIndexToEvent(saveIndexToEvent);
1237 setNEvents(saveNEvents);
1245 int saveIndexToLumi = indexToLumi();
1246 int saveIndexToEventRange = indexToEventRange();
1247 long long saveIndexToEvent = indexToEvent();
1248 long long saveNEvents =
nEvents();
1250 for(
int i = 1; indexToLumi() -
i > 0; ++
i) {
1251 if(getRunOrLumiEntryType(indexToLumi_ -
i) ==
kRun)
break;
1252 if(!isSameLumi(indexToLumi(), indexToLumi() -
i))
break;
1253 indexToLumi_ = indexToLumi_ -
i;
1259 if(indexToEvent() <
nEvents()) {
1260 returnValue = peekAheadAtEventEntry();
1263 setIndexToLumi(saveIndexToLumi);
1264 setIndexToEventRange(saveIndexToEventRange);
1265 setIndexToEvent(saveIndexToEvent);
1266 setNEvents(saveNEvents);
1272 if(type_ ==
kEnd)
return;
1273 for(
int i = 1; indexToRun_ +
i <
size_; ++
i) {
1274 if(getRunOrLumiEntryType(indexToRun_ +
i) ==
kRun) {
1275 if(!isSameRun(indexToRun_, indexToRun_ +
i)) {
1287 if(type_ ==
kEnd)
return;
1293 int startSearch = indexToRun_;
1294 for(
int i = 1; startSearch +
i <
size_; ++
i) {
1295 if(getRunOrLumiEntryType(startSearch +
i) ==
kRun &&
1296 isSameRun(indexToRun_, startSearch +
i)) {
1297 indexToRun_ = startSearch +
i;
1308 startSearch = indexToLumi_;
1309 if(startSearch ==
invalidIndex) startSearch = indexToRun_;
1310 for(
int i = 1; startSearch +
i <
size_; ++
i) {
1311 if(getRunOrLumiEntryType(startSearch +
i) ==
kRun) {
1312 if(!isSameRun(indexToRun_, startSearch +
i)) {
1314 indexToRun_ = startSearch +
i;
1319 if(!isSameLumi(indexToLumi_, startSearch +
i)) {
1321 indexToLumi_ = startSearch +
i;
1331 if(indexToEvent_ >= nEvents_)
return false;
1332 if((indexToEvent_ + 1) < nEvents_) {
1336 return nextEventRange();
1346 for(
int i = 1; (
i + indexToRun_) <
size_; ++
i) {
1347 EntryType entryType = getRunOrLumiEntryType(indexToRun_ +
i);
1348 bool sameRun = isSameRun(indexToRun_, indexToRun_ +
i);
1350 if(entryType ==
kRun) {
1357 indexToLumi_ = indexToRun_ +
i;
1367 type_ == right.
type_ &&
1377 type_ = position.
type_;
1398 int indexToEventRange,
1399 long long indexToEvent,
1419 return indexIntoFile()->runOrLumiEntries()[indexToRun()].processHistoryIDIndex();
1424 return indexIntoFile()->runOrLumiEntries()[indexToRun()].run();
1429 return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1434 if(
type() ==
kRun)
return indexIntoFile()->runOrLumiEntries()[indexToRun()].entry();
1435 if(
type() ==
kLumi)
return indexIntoFile()->runOrLumiEntries()[indexToLumi()].entry();
1437 indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1443 return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1450 indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1461 for(
int i = 0; indexToLumi() +
i <
size(); ++
i) {
1462 if(indexIntoFile()->runOrLumiEntries()[indexToLumi() +
i].isRun()) {
1464 }
else if(indexIntoFile()->runOrLumiEntries()[indexToLumi() +
i].lumi() ==
1465 indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1466 if(indexIntoFile()->runOrLumiEntries()[indexToLumi() +
i].beginEvents() ==
invalidEntry) {
1469 setIndexToEventRange(indexToLumi() +
i);
1484 for(
int i = 1; indexToEventRange() +
i <
size(); ++
i) {
1485 if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() +
i ].isRun()) {
1487 }
else if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() +
i].lumi() ==
1488 indexIntoFile()->runOrLumiEntries()[indexToEventRange()].lumi()) {
1489 if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() +
i].beginEvents() ==
invalidEntry) {
1492 setIndexToEventRange(indexToEventRange() +
i);
1508 for(
int i = 1; indexToEventRange() -
i > 0; ++
i) {
1509 int newRange = indexToEventRange() -
i;
1512 }
else if(isSameLumi(newRange, indexToEventRange())) {
1516 setIndexToEventRange(newRange);
1519 setIndexToEvent(
nEvents() - 1);
1531 setIndexToEventRange(index);
1535 setIndexToEvent(
nEvents() - 1);
1541 for(
int i = 1; indexToLumi() +
i <
size(); ++
i) {
1542 int newLumi = indexToLumi() +
i;
1549 setIndexToLumi(newLumi);
1557 if(index < 0 || index >=
size()) {
1566 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1569 return indexIntoFile()->runOrLumiEntries()[index1].lumi() ==
1570 indexIntoFile()->runOrLumiEntries()[index2].lumi();
1574 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1577 return indexIntoFile()->runOrLumiEntries()[index1].run() ==
1578 indexIntoFile()->runOrLumiEntries()[index2].run() &&
1579 indexIntoFile()->runOrLumiEntries()[index1].processHistoryIDIndex() ==
1580 indexIntoFile()->runOrLumiEntries()[index2].processHistoryIDIndex();
1587 int indexToEventRange,
1588 long long indexToEvent,
1606 return indexIntoFile()->runOrLumiIndexes()[indexToRun()].processHistoryIDIndex();
1611 return indexIntoFile()->runOrLumiIndexes()[indexToRun()].run();
1616 return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1622 int i = indexIntoFile()->runOrLumiIndexes()[indexToRun()].indexToGetEntry();
1623 return indexIntoFile()->runOrLumiEntries()[
i].entry();
1626 int i = indexIntoFile()->runOrLumiIndexes()[indexToLumi()].indexToGetEntry();
1627 return indexIntoFile()->runOrLumiEntries()[
i].entry();
1629 long long eventNumberIndex =
1630 indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1632 indexIntoFile()->fillEventEntries();
1633 return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1638 return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1644 long long eventNumberIndex =
1645 indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1647 indexIntoFile()->fillEventEntries();
1648 return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1653 setIndexToEventRange(indexToLumi());
1672 long long nEventsInRange =
1673 indexIntoFile()->runOrLumiIndexes()[
index].endEventNumbers() -
1674 indexIntoFile()->runOrLumiIndexes()[
index].beginEventNumbers();
1675 if(nEventsInRange == 0) {
1680 isSameLumi(index, index - 1)) {
1687 setIndexToEventRange(index);
1688 setNEvents(nEventsInRange);
1690 setIndexToEvent(nEventsInRange - 1);
1696 for(
int i = 1; indexToLumi() +
i <
size(); ++
i) {
1697 int newLumi = indexToLumi() +
i;
1704 setIndexToLumi(newLumi);
1712 if(index < 0 || index >=
size()) {
1721 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1724 return indexIntoFile()->runOrLumiIndexes()[index1].lumi() ==
1725 indexIntoFile()->runOrLumiIndexes()[index2].lumi();
1729 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1732 return indexIntoFile()->runOrLumiIndexes()[index1].run() ==
1733 indexIntoFile()->runOrLumiIndexes()[index2].run() &&
1734 indexIntoFile()->runOrLumiIndexes()[index1].processHistoryIDIndex() ==
1735 indexIntoFile()->runOrLumiIndexes()[index2].processHistoryIDIndex();
1743 int indexToEventRange,
1744 long long indexToEvent,
1770 for(
EntryType entryType = getEntryType();
1772 entryType = getEntryType()) {
1778 for(
EntryType entryType = getEntryType();
1779 entryType !=
kEnd && entryType !=
kLumi;
1780 entryType = getEntryType()) {
1787 impl_->copyPosition(*position.
impl_);
1792 return lh.
run() < rh.
run();
void initializeRun()
Should only be used internally and for tests.
virtual bool nextEventRange()
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
RunNumber_t & currentRun() const
int processHistoryIDIndex() const
virtual bool isSameLumi(int index1, int index2) const
virtual EntryNumber_t entry() const
EntryNumber_t peekAheadAtEventEntry() const
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
bool skipToNextEventInLumi()
std::vector< EventEntry > & eventEntries() const
virtual bool skipLumiInRun()
void advanceToNextLumiOrRun()
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
EntryType getEntryType() const
virtual bool setToLastEventInRange(int index)
virtual bool nextEventRange()
virtual RunNumber_t run() const
virtual void initializeLumi_()
IndexIntoFile const * indexIntoFile_
bool operator==(SortedRunOrLumiItr const &right) const
unsigned long long EventNumber_t
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void fillUnsortedEventNumbers() const
IndexIntoFileItr begin(SortOrder sortOrder) const
IndexIntoFile const * indexIntoFile_
void swap(Hash< I > &other)
LuminosityBlockNumber_t lumi() const
std::vector< RunOrLumiEntry > const & runOrLumiEntries() const
Used internally and for test purposes.
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
virtual int processHistoryIDIndex() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual IndexIntoFileItrImpl * clone() const
virtual ~IndexIntoFileItrImpl()
unsigned int LuminosityBlockNumber_t
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
std::vector< ProcessHistoryID > const & processHistoryIDs() const
static EventNumber_t const invalidEvent
void swap(Association< C > &lhs, Association< C > &rhs)
long long beginEventNumbers() const
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
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
IndexIntoFile const * indexIntoFile() const
int & currentIndex() const
RunOrLumiIndexes(int processHistoryIDIndex, RunNumber_t run, LuminosityBlockNumber_t lumi, int indexToGetEntry)
double intersection(double r12)
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_
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
bool previousLumiWithEvents()
void set_intersection(IndexIntoFile const &indexIntoFile, std::set< IndexRunLumiEventKey > &intersection) const
SortedRunOrLumiItr & operator++()
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
virtual IndexIntoFileItrImpl * clone() const
virtual bool skipLumiInRun()
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
virtual RunNumber_t run() const
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)
long long endEventNumbers() const
SortedRunOrLumiItr(IndexIntoFile const *indexIntoFile, unsigned runOrLumi)
EntryNumber_t firstEventEntryThisLumi()
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
unsigned runOrLumi() const
void initializeLumi()
Should only be used internally and for tests.
ProcessHistoryID const & processHistoryID(int i) const
EntryNumber_t firstEventEntryThisRun()
void copyPosition(IndexIntoFileItrImpl const &position)
virtual bool previousEventRange()
EventNumber_t getEventNumberOfEntry(EntryNumber_t entry) const
virtual int processHistoryIDIndex() const
virtual LuminosityBlockNumber_t lumi() const
void fillEventNumbers() const
static int position[264][3]
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)
SortedRunOrLumiItr endRunOrLumi() const
bool operator()(IndexIntoFile::RunOrLumiIndexes const &lh, IndexIntoFile::RunOrLumiIndexes const &rh)
bool skipToNextEventInLumi()
std::map< IndexRunLumiKey, EntryNumber_t > & lumiToFirstEntry() const
virtual bool previousEventRange()
bool containsRun(RunNumber_t run) const
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
virtual bool setToLastEventInRange(int index)
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)
virtual void initializeLumi_()
RunOrLumiIndexes const & runOrLumiIndexes() const