22 beginEvents_(invalidEntry),
23 endEvents_(invalidEntry),
24 currentIndex_(invalidIndex),
25 currentRun_(invalidRun),
26 currentLumi_(invalidLumi),
32 unsortedEventNumbers_() {
38 runToFirstEntry_.clear();
39 lumiToFirstEntry_.clear();
47 runOrLumiIndexes_.clear();
48 eventNumbers_.clear();
49 eventEntries_.clear();
50 unsortedEventNumbers_.clear();
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";
112 std::pair<IndexRunKey, EntryNumber_t> firstRunEntry(
IndexRunKey(index, run), entry);
124 std::pair<IndexRunLumiKey, EntryNumber_t> firstLumiEntry(
IndexRunLumiKey(index, run, lumi), entry);
154 for(std::vector<RunOrLumiEntry>::const_iterator iter =
runOrLumiEntries_.begin(),
165 long long beginEventNumbers = 0;
167 std::vector<RunOrLumiIndexes>::iterator beginOfLumi =
runOrLumiIndexes().begin();
168 std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
171 while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
174 if(beginOfLumi == iEnd)
break;
176 endOfLumi = beginOfLumi + 1;
177 while(endOfLumi != iEnd &&
178 beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
179 beginOfLumi->run() == endOfLumi->run() &&
180 beginOfLumi->lumi() == endOfLumi->lumi()) {
184 for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
192 for(std::vector<RunOrLumiIndexes>::iterator iter = beginOfLumi;
195 iter->setBeginEventNumbers(beginEventNumbers);
196 iter->setEndEventNumbers(beginEventNumbers + nEvents);
199 beginOfLumi = endOfLumi;
221 needEventNumbers =
false;
225 needEventEntries =
false;
237 if(!needEventNumbers && !needEventEntries) {
243 if(needEventNumbers) {
246 if(needEventEntries) {
251 long long previousBeginEventNumbers = -1LL;
254 runOrLumi != runOrLumiEnd; ++runOrLumi) {
256 if(runOrLumi.isRun())
continue;
258 long long beginEventNumbers = 0;
259 long long endEventNumbers = 0;
262 runOrLumi.getRange(beginEventNumbers, endEventNumbers, beginEventEntry, endEventEntry);
266 if(beginEventNumbers != previousBeginEventNumbers) offset = 0;
269 if(needEventNumbers) {
272 if(needEventEntries) {
278 previousBeginEventNumbers = beginEventNumbers;
279 offset += endEventEntry - beginEventEntry;
281 if(needEventNumbers) {
285 if(needEventEntries) {
330 std::vector<ProcessHistoryID> reducedPHIDs;
332 std::map<ProcessHistoryID, int> reducedPHIDToIndex;
334 std::pair<std::map<ProcessHistoryID, int>::iterator,
bool> insertResult;
336 std::vector<int> phidIndexConverter;
339 phid != iEnd; ++phid) {
342 mapEntry.first = reducedPHID;
343 insertResult = reducedPHIDToIndex.insert(mapEntry);
345 if(insertResult.second) {
346 insertResult.first->second = reducedPHIDs.size();
347 reducedPHIDs.push_back(reducedPHID);
349 phidIndexConverter.push_back(insertResult.first->second);
360 std::map<IndexIntoFile::IndexRunKey, int> runOrderMap;
361 std::pair<std::map<IndexIntoFile::IndexRunKey, int>::iterator,
bool> runInsertResult;
363 std::map<IndexIntoFile::IndexRunLumiKey, int> lumiOrderMap;
364 std::pair<std::map<IndexIntoFile::IndexRunLumiKey, int>::iterator,
bool> lumiInsertResult;
372 i->setProcessHistoryIDIndex(phidIndexConverter.at(
i->processHistoryIDIndex()));
376 runInsertResult = runOrderMap.insert(std::pair<IndexIntoFile::IndexRunKey, int>(runKey,0));
377 if(runInsertResult.second) {
378 runInsertResult.first->second =
i->orderPHIDRun();
380 i->setOrderPHIDRun(runInsertResult.first->second);
386 lumiInsertResult = lumiOrderMap.insert(std::pair<IndexIntoFile::IndexRunLumiKey, int>(lumiKey,0));
387 if(lumiInsertResult.second) {
388 lumiInsertResult.first->second =
i->orderPHIDRunLumi();
390 i->setOrderPHIDRunLumi(lumiInsertResult.first->second);
400 std::map<int, int> oldToNewIndex;
405 std::vector<ProcessHistoryID>::const_iterator iterExisting =
406 std::find(processHistoryIDs.begin(), processHistoryIDs.end(), *iter);
407 if(iterExisting == processHistoryIDs.end()) {
409 processHistoryIDs.push_back(*iter);
411 oldToNewIndex[iter -
processHistoryIDs_.begin()] = iterExisting - processHistoryIDs.begin();
420 iter->setProcessHistoryIDIndex(oldToNewIndex[iter->processHistoryIDIndex()]);
429 std::map<IndexRunKey, EntryNumber_t>::const_iterator firstRunEntry =
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";
441 iter->setOrderPHIDRun(firstRunEntry->second);
448 std::vector<RunOrLumiIndexes>::iterator beginOfLumi =
runOrLumiIndexes().begin();
449 std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
452 while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
455 if(beginOfLumi == iEnd)
break;
457 endOfLumi = beginOfLumi + 1;
458 while(endOfLumi != iEnd &&
459 beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
460 beginOfLumi->run() == endOfLumi->run() &&
461 beginOfLumi->lumi() == endOfLumi->lumi()) {
464 assert(beginOfLumi->endEventNumbers() >= 0);
465 assert(beginOfLumi->endEventNumbers() <=
static_cast<long long>(
eventNumbers().size()));
467 eventNumbers().begin() + beginOfLumi->endEventNumbers());
468 beginOfLumi = endOfLumi;
474 std::vector<RunOrLumiIndexes>::iterator beginOfLumi =
runOrLumiIndexes().begin();
475 std::vector<RunOrLumiIndexes>::iterator endOfLumi = beginOfLumi;
478 while(beginOfLumi != iEnd && beginOfLumi->isRun()) {
481 if(beginOfLumi == iEnd)
break;
483 endOfLumi = beginOfLumi + 1;
484 while(endOfLumi != iEnd &&
485 beginOfLumi->processHistoryIDIndex() == endOfLumi->processHistoryIDIndex() &&
486 beginOfLumi->run() == endOfLumi->run() &&
487 beginOfLumi->lumi() == endOfLumi->lumi()) {
490 assert(beginOfLumi->endEventNumbers() >= 0);
491 assert(beginOfLumi->endEventNumbers() <=
static_cast<long long>(
eventEntries().size()));
493 eventEntries().begin() + beginOfLumi->endEventNumbers());
494 beginOfLumi = endOfLumi;
500 return end(sortOrder);
528 if(it.getEntryType() ==
kEvent) {
529 if(it.entry() < maxEntry) {
532 maxEntry = it.entry();
546 bool lumiMissing = (lumi == 0 &&
event != 0);
548 std::vector<RunOrLumiIndexes>::const_iterator it;
549 std::vector<RunOrLumiIndexes>::const_iterator iEnd =
runOrLumiIndexes().end();
550 std::vector<RunOrLumiIndexes>::const_iterator phEnd;
558 phEnd = std::upper_bound(phBegin, iEnd, el,
Compare_Index());
560 std::vector<RunOrLumiIndexes>::const_iterator iRun = std::lower_bound(phBegin, phEnd, el,
Compare_Index_Run());
562 if(iRun == phEnd || iRun->run() !=
run)
continue;
577 std::vector<RunOrLumiIndexes>::const_iterator iRunEnd = std::upper_bound(iRun, phEnd, el,
Compare_Index_Run());
580 std::vector<RunOrLumiIndexes>::const_iterator iLumi = std::lower_bound(iRun, iRunEnd, el);
581 if(iLumi == iRunEnd || iLumi->lumi() !=
lumi)
continue;
596 long long beginEventNumbers = iLumi->beginEventNumbers();
597 long long endEventNumbers = iLumi->endEventNumbers();
598 if(beginEventNumbers >= endEventNumbers)
continue;
601 long long indexToEvent = 0;
603 std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(
eventEntries().
begin() + beginEventNumbers,
607 eventIter->event() !=
event)
continue;
609 indexToEvent = eventIter -
eventEntries().begin() - beginEventNumbers;
612 std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(
eventNumbers().
begin() + beginEventNumbers,
616 *eventIter != event)
continue;
618 indexToEvent = eventIter -
eventNumbers().begin() - beginEventNumbers;
627 endEventNumbers - beginEventNumbers);
631 std::vector<RunOrLumiIndexes>::const_iterator iLumi = iRun;
632 while(iLumi != iRunEnd && iLumi->lumi() ==
invalidLumi) {
635 if(iLumi == iRunEnd)
continue;
637 std::vector<RunOrLumiIndexes>::const_iterator lumiEnd;
643 lumiEnd = std::upper_bound(iLumi, iRunEnd, elWithLumi);
645 long long beginEventNumbers = iLumi->beginEventNumbers();
646 long long endEventNumbers = iLumi->endEventNumbers();
647 if(beginEventNumbers >= endEventNumbers)
continue;
649 long long indexToEvent = 0;
651 std::vector<EventEntry>::const_iterator eventIter = std::lower_bound(
eventEntries().
begin() + beginEventNumbers,
655 eventIter->event() !=
event)
continue;
656 indexToEvent = eventIter -
eventEntries().begin() - beginEventNumbers;
659 std::vector<EventNumber_t>::const_iterator eventIter = std::lower_bound(
eventNumbers().
begin() + beginEventNumbers,
663 *eventIter != event)
continue;
664 indexToEvent = eventIter -
eventNumbers().begin() - beginEventNumbers;
673 endEventNumbers - beginEventNumbers);
697 while(itr != itrEnd) {
712 if(eventNumber == event) {
797 while(iter1 != iEnd1 && iter1.
isRun()) ++iter1;
798 if(iter1 == iEnd1)
return;
801 while(iter2 != iEnd2 && iter2.
isRun()) ++iter2;
802 if(iter2 == iEnd2)
return;
808 while(iter1 != iEnd1 && iter2 != iEnd2) {
812 if(indexes1 < indexes2) {
814 }
else if(indexes2 < indexes1) {
819 if(indexes1.
isRun() ||
820 (previousIndexes && !(*previousIndexes < indexes1))) {
824 previousIndexes = &indexes1;
835 if((beginEventNumbers1 >= endEventNumbers1) ||
836 (beginEventNumbers2 >= endEventNumbers2)) {
843 std::vector<EventEntry> matchingEvents;
844 std::insert_iterator<std::vector<EventEntry> > insertIter(matchingEvents, matchingEvents.begin());
847 indexIntoFile.
eventEntries().begin() + beginEventNumbers2,
848 indexIntoFile.
eventEntries().begin() + endEventNumbers2,
850 for(std::vector<EventEntry>::const_iterator
iEvent = matchingEvents.begin(),
851 iEnd = matchingEvents.end();
861 std::vector<EventNumber_t> matchingEvents;
862 std::insert_iterator<std::vector<EventNumber_t> > insertIter(matchingEvents, matchingEvents.begin());
865 indexIntoFile.
eventNumbers().begin() + beginEventNumbers2,
866 indexIntoFile.
eventNumbers().begin() + endEventNumbers2,
868 for(std::vector<EventNumber_t>::const_iterator
iEvent = matchingEvents.begin(),
869 iEnd = matchingEvents.end();
888 iter != iEnd; ++iter) {
893 if(indexes.
isRun() ||
894 (previousIndexes && !(*previousIndexes < indexes))) {
897 previousIndexes = &indexes;
903 if(beginEventNumbers + 1 >= endEventNumbers)
continue;
906 std::vector<EventEntry>::iterator
last =
eventEntries().begin() + endEventNumbers;
907 if(std::adjacent_find(
eventEntries().
begin() + beginEventNumbers, last) != last) {
912 std::vector<EventNumber_t>::iterator
last =
eventNumbers().begin() + endEventNumbers;
913 if(std::adjacent_find(
eventNumbers().
begin() + beginEventNumbers, last) != last) {
922 orderPHIDRun_(invalidEntry),
923 orderPHIDRunLumi_(invalidEntry),
924 entry_(invalidEntry),
925 processHistoryIDIndex_(invalidIndex),
928 beginEvents_(invalidEntry),
929 endEvents_(invalidEntry) {
935 int processHistoryIDIndex,
940 orderPHIDRun_(orderPHIDRun),
941 orderPHIDRunLumi_(orderPHIDRunLumi),
943 processHistoryIDIndex_(processHistoryIDIndex),
946 beginEvents_(beginEvents),
947 endEvents_(endEvents) {
953 int indexToGetEntry) :
954 processHistoryIDIndex_(processHistoryIDIndex),
957 indexToGetEntry_(indexToGetEntry),
958 beginEventNumbers_(-1),
964 indexIntoFile_(indexIntoFile), runOrLumi_(runOrLumi) {
980 if(runOrLumi_ != indexIntoFile_->runOrLumiEntries().size()) {
987 return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).lumi() ==
invalidLumi;
991 long long & endEventNumbers,
994 beginEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).beginEventNumbers();
995 endEventNumbers = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).endEventNumbers();
997 int indexToGetEntry = indexIntoFile_->runOrLumiIndexes().at(runOrLumi_).indexToGetEntry();
998 beginEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).beginEvents();
999 endEventEntry = indexIntoFile_->runOrLumiEntries_.at(indexToGetEntry).endEvents();
1004 return indexIntoFile_->runOrLumiIndexes().at(runOrLumi_);
1011 int indexToEventRange,
1012 long long indexToEvent,
1014 indexIntoFile_(indexIntoFile),
1017 indexToRun_(indexToRun),
1018 indexToLumi_(indexToLumi),
1019 indexToEventRange_(indexToEventRange),
1020 indexToEvent_(indexToEvent),
1029 if((indexToEvent_ + 1) < nEvents_) {
1032 bool found = nextEventRange();
1035 type_ = getRunOrLumiEntryType(indexToLumi_ + 1);
1037 if(type_ ==
kLumi) {
1040 }
else if(type_ ==
kRun) {
1041 indexToRun_ = indexToLumi_ + 1;
1048 }
else if(type_ ==
kLumi) {
1050 if(indexToLumi_ + 1 ==
size_) {
1051 if(indexToEvent_ < nEvents_) {
1058 EntryType nextType = getRunOrLumiEntryType(indexToLumi_ + 1);
1060 if(nextType ==
kLumi && isSameLumi(indexToLumi_, indexToLumi_ + 1)) {
1062 }
else if(indexToEvent_ < nEvents_) {
1064 }
else if(nextType ==
kRun) {
1066 indexToRun_ = indexToLumi_ + 1;
1073 }
else if(type_ ==
kRun) {
1074 EntryType nextType = getRunOrLumiEntryType(indexToRun_ + 1);
1075 bool sameRun = isSameRun(indexToRun_, indexToRun_ + 1);
1076 if(nextType ==
kRun && sameRun) {
1078 }
else if(nextType ==
kRun && !sameRun) {
1081 }
else if(nextType ==
kLumi) {
1093 if(indexToEvent_ < nEvents_) {
1094 phIndexOfSkippedEvent = processHistoryIDIndex();
1095 runOfSkippedEvent =
run();
1096 lumiOfSkippedEvent = peekAheadAtLumi();
1097 skippedEventEntry = peekAheadAtEventEntry();
1099 if((indexToEvent_ + 1) < nEvents_) {
1102 }
else if(nextEventRange()) {
1104 }
else if(type_ ==
kRun || type_ ==
kLumi) {
1105 if(skipLumiInRun()) {
1108 }
else if(type_ ==
kEvent) {
1117 while(skipLumiInRun()) {
1118 if(indexToEvent_ < nEvents_) {
1119 skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1125 while(indexToEvent_ >= nEvents_ && type_ !=
kEnd) {
1126 while(skipLumiInRun()) {
1127 if(indexToEvent_ < nEvents_) {
1128 skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1141 skipEventForward(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1150 if(indexToEvent_ > 0) {
1152 }
else if(!previousEventRange()) {
1155 if(!previousLumiWithEvents()) {
1159 if(!indexIntoFile_->empty()) {
1176 phIndexOfEvent = processHistoryIDIndex();
1178 lumiOfEvent = peekAheadAtLumi();
1179 eventEntry = peekAheadAtEventEntry();
1184 int newLumi = indexToLumi();
1188 while(getRunOrLumiEntryType(newLumi - 1) ==
kLumi &&
1189 isSameLumi(newLumi, newLumi - 1)) {
1194 if(newLumi <= 0)
return false;
1197 for( ; newLumi > 0; --newLumi) {
1198 if(getRunOrLumiEntryType(newLumi) ==
kRun) {
1201 if(setToLastEventInRange(newLumi)) {
1205 if(newLumi == 0)
return false;
1208 while(getRunOrLumiEntryType(newLumi - 1) ==
kLumi &&
1209 isSameLumi(newLumi, newLumi - 1)) {
1212 setIndexToLumi(newLumi);
1215 isSameRun(newLumi, indexToRun())) {
1219 int newRun = newLumi;
1220 while(newRun > 0 && getRunOrLumiEntryType(newRun - 1) ==
kLumi) {
1224 assert(getRunOrLumiEntryType(newRun) ==
kRun);
1225 while(getRunOrLumiEntryType(newRun - 1) ==
kRun &&
1226 isSameRun(newRun - 1, newLumi)) {
1229 indexToRun_ = newRun;
1237 int saveIndexToLumi = indexToLumi();
1238 int saveIndexToEventRange = indexToEventRange();
1239 long long saveIndexToEvent = indexToEvent();
1240 long long saveNEvents =
nEvents();
1247 if(indexToEvent() <
nEvents()) {
1248 returnValue = peekAheadAtEventEntry();
1251 }
while(skipLumiInRun());
1253 setIndexToLumi(saveIndexToLumi);
1254 setIndexToEventRange(saveIndexToEventRange);
1255 setIndexToEvent(saveIndexToEvent);
1256 setNEvents(saveNEvents);
1264 int saveIndexToLumi = indexToLumi();
1265 int saveIndexToEventRange = indexToEventRange();
1266 long long saveIndexToEvent = indexToEvent();
1267 long long saveNEvents =
nEvents();
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;
1278 if(indexToEvent() <
nEvents()) {
1279 returnValue = peekAheadAtEventEntry();
1282 setIndexToLumi(saveIndexToLumi);
1283 setIndexToEventRange(saveIndexToEventRange);
1284 setIndexToEvent(saveIndexToEvent);
1285 setNEvents(saveNEvents);
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)) {
1306 if(type_ ==
kEnd)
return;
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;
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)) {
1333 indexToRun_ = startSearch +
i;
1338 if(!isSameLumi(indexToLumi_, startSearch +
i)) {
1340 indexToLumi_ = startSearch +
i;
1350 if(indexToEvent_ >= nEvents_)
return false;
1351 if((indexToEvent_ + 1) < nEvents_) {
1355 return nextEventRange();
1365 for(
int i = 1; (
i + indexToRun_) <
size_; ++
i) {
1366 EntryType entryType = getRunOrLumiEntryType(indexToRun_ +
i);
1367 bool sameRun = isSameRun(indexToRun_, indexToRun_ +
i);
1369 if(entryType ==
kRun) {
1376 indexToLumi_ = indexToRun_ +
i;
1386 type_ == right.
type_ &&
1396 type_ = position.
type_;
1417 int indexToEventRange,
1418 long long indexToEvent,
1438 return indexIntoFile()->runOrLumiEntries()[indexToRun()].processHistoryIDIndex();
1443 return indexIntoFile()->runOrLumiEntries()[indexToRun()].run();
1448 return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1453 if(
type() ==
kRun)
return indexIntoFile()->runOrLumiEntries()[indexToRun()].entry();
1454 if(
type() ==
kLumi)
return indexIntoFile()->runOrLumiEntries()[indexToLumi()].entry();
1456 indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1462 return indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi();
1469 indexIntoFile()->runOrLumiEntries()[indexToEventRange()].beginEvents() +
1480 for(
int i = 0; indexToLumi() +
i <
size(); ++
i) {
1481 if(indexIntoFile()->runOrLumiEntries()[indexToLumi() +
i].isRun()) {
1483 }
else if(indexIntoFile()->runOrLumiEntries()[indexToLumi() +
i].lumi() ==
1484 indexIntoFile()->runOrLumiEntries()[indexToLumi()].lumi()) {
1485 if(indexIntoFile()->runOrLumiEntries()[indexToLumi() +
i].beginEvents() ==
invalidEntry) {
1488 setIndexToEventRange(indexToLumi() +
i);
1503 for(
int i = 1; indexToEventRange() +
i <
size(); ++
i) {
1504 if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() +
i ].isRun()) {
1506 }
else if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() +
i].lumi() ==
1507 indexIntoFile()->runOrLumiEntries()[indexToEventRange()].lumi()) {
1508 if(indexIntoFile()->runOrLumiEntries()[indexToEventRange() +
i].beginEvents() ==
invalidEntry) {
1511 setIndexToEventRange(indexToEventRange() +
i);
1524 assert(indexToEventRange() <
size());
1527 for(
int i = 1; indexToEventRange() -
i > 0; ++
i) {
1528 int newRange = indexToEventRange() -
i;
1531 }
else if(isSameLumi(newRange, indexToEventRange())) {
1535 setIndexToEventRange(newRange);
1538 setIndexToEvent(
nEvents() - 1);
1550 setIndexToEventRange(index);
1554 setIndexToEvent(
nEvents() - 1);
1560 for(
int i = 1; indexToLumi() +
i <
size(); ++
i) {
1561 int newLumi = indexToLumi() +
i;
1568 setIndexToLumi(newLumi);
1576 if(index < 0 || index >=
size()) {
1585 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1588 return indexIntoFile()->runOrLumiEntries()[index1].lumi() ==
1589 indexIntoFile()->runOrLumiEntries()[index2].lumi();
1593 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1596 return indexIntoFile()->runOrLumiEntries()[index1].run() ==
1597 indexIntoFile()->runOrLumiEntries()[index2].run() &&
1598 indexIntoFile()->runOrLumiEntries()[index1].processHistoryIDIndex() ==
1599 indexIntoFile()->runOrLumiEntries()[index2].processHistoryIDIndex();
1606 int indexToEventRange,
1607 long long indexToEvent,
1625 return indexIntoFile()->runOrLumiIndexes()[indexToRun()].processHistoryIDIndex();
1630 return indexIntoFile()->runOrLumiIndexes()[indexToRun()].run();
1635 return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1641 int i = indexIntoFile()->runOrLumiIndexes()[indexToRun()].indexToGetEntry();
1642 return indexIntoFile()->runOrLumiEntries()[
i].entry();
1645 int i = indexIntoFile()->runOrLumiIndexes()[indexToLumi()].indexToGetEntry();
1646 return indexIntoFile()->runOrLumiEntries()[
i].entry();
1648 long long eventNumberIndex =
1649 indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1651 indexIntoFile()->fillEventEntries();
1652 return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1657 return indexIntoFile()->runOrLumiIndexes()[indexToLumi()].lumi();
1663 long long eventNumberIndex =
1664 indexIntoFile()->runOrLumiIndexes()[indexToEventRange()].beginEventNumbers() +
1666 indexIntoFile()->fillEventEntries();
1667 return indexIntoFile()->eventEntries().at(eventNumberIndex).entry();
1672 setIndexToEventRange(indexToLumi());
1691 long long nEventsInRange =
1692 indexIntoFile()->runOrLumiIndexes()[
index].endEventNumbers() -
1693 indexIntoFile()->runOrLumiIndexes()[
index].beginEventNumbers();
1694 if(nEventsInRange == 0) {
1699 isSameLumi(index, index - 1)) {
1702 assert(nEventsInRange ==
1706 setIndexToEventRange(index);
1707 setNEvents(nEventsInRange);
1709 setIndexToEvent(nEventsInRange - 1);
1715 for(
int i = 1; indexToLumi() +
i <
size(); ++
i) {
1716 int newLumi = indexToLumi() +
i;
1723 setIndexToLumi(newLumi);
1731 if(index < 0 || index >=
size()) {
1740 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1743 return indexIntoFile()->runOrLumiIndexes()[index1].lumi() ==
1744 indexIntoFile()->runOrLumiIndexes()[index2].lumi();
1748 if(index1 < 0 || index1 >=
size() || index2 < 0 || index2 >=
size()) {
1751 return indexIntoFile()->runOrLumiIndexes()[index1].run() ==
1752 indexIntoFile()->runOrLumiIndexes()[index2].run() &&
1753 indexIntoFile()->runOrLumiIndexes()[index1].processHistoryIDIndex() ==
1754 indexIntoFile()->runOrLumiIndexes()[index2].processHistoryIDIndex();
1762 int indexToEventRange,
1763 long long indexToEvent,
1789 for(
EntryType entryType = getEntryType();
1791 entryType = getEntryType()) {
1797 for(
EntryType entryType = getEntryType();
1798 entryType !=
kEnd && entryType !=
kLumi;
1799 entryType = getEntryType()) {
1806 impl_->copyPosition(*position.
impl_);
1811 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
ProcessHistoryID const & reduceProcessHistoryID(ProcessHistoryID const &fullID)
Use to obtain reduced ProcessHistoryID's from full ProcessHistoryID'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
bool skipToNextEventInLumi()
unsigned int EventNumber_t
std::vector< EventEntry > & eventEntries() const
virtual bool skipLumiInRun()
static ThreadSafeRegistry * instance()
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
std::vector< RunOrLumiIndexes > & runOrLumiIndexes() const
void fillUnsortedEventNumbers() const
void reduceProcessHistoryIDs()
IndexIntoFileItr begin(SortOrder sortOrder) const
IndexIntoFile const * indexIntoFile_
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 int position[TOTALCHAMBERS][3]
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
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_
std::pair< std::string, MonitorElement * > entry
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()
virtual RunNumber_t run() 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)
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
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