File indexing completed on 2024-04-06 12:12:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "FWCore/Framework/src/IntersectingIOVRecordIntervalFinder.h"
0014 #include "FWCore/Utilities/interface/EDMException.h"
0015
0016 namespace edm {
0017 namespace eventsetup {
0018
0019 IntersectingIOVRecordIntervalFinder::IntersectingIOVRecordIntervalFinder(const EventSetupRecordKey& iKey) {
0020 findingRecordWithKey(iKey);
0021 }
0022
0023 IntersectingIOVRecordIntervalFinder::~IntersectingIOVRecordIntervalFinder() {}
0024
0025 void IntersectingIOVRecordIntervalFinder::swapFinders(
0026 std::vector<edm::propagate_const<std::shared_ptr<EventSetupRecordIntervalFinder>>>& iFinders) {
0027 finders_.swap(iFinders);
0028 }
0029
0030 void IntersectingIOVRecordIntervalFinder::setIntervalFor(const EventSetupRecordKey& iKey,
0031 const IOVSyncValue& iTime,
0032 ValidityInterval& oInterval) {
0033 if (finders_.empty()) {
0034 oInterval = ValidityInterval::invalidInterval();
0035 return;
0036 }
0037
0038 bool haveAValidRecord = false;
0039 bool haveUnknownEnding = false;
0040 ValidityInterval newInterval(IOVSyncValue::beginOfTime(), IOVSyncValue::endOfTime());
0041
0042 for (auto& finder : finders_) {
0043 ValidityInterval test = finder->findIntervalFor(iKey, iTime);
0044 if (test != ValidityInterval::invalidInterval()) {
0045 haveAValidRecord = true;
0046 if (newInterval.first() < test.first()) {
0047 newInterval.setFirst(test.first());
0048 }
0049 if (newInterval.last() > test.last()) {
0050 newInterval.setLast(test.last());
0051 }
0052 if (test.last() == IOVSyncValue::invalidIOVSyncValue()) {
0053 haveUnknownEnding = true;
0054 }
0055 } else {
0056
0057
0058 haveUnknownEnding = true;
0059 }
0060 }
0061
0062 if (!haveAValidRecord) {
0063
0064 newInterval = ValidityInterval::invalidInterval();
0065 } else if (haveUnknownEnding) {
0066 newInterval.setLast(IOVSyncValue::invalidIOVSyncValue());
0067 }
0068 oInterval = newInterval;
0069 }
0070
0071 void IntersectingIOVRecordIntervalFinder::doResetInterval(const eventsetup::EventSetupRecordKey& key) {
0072 for (auto& finder : finders_) {
0073 finder->resetInterval(key);
0074 }
0075 }
0076
0077 bool IntersectingIOVRecordIntervalFinder::isConcurrentFinder() const {
0078 for (auto const& finder : finders_) {
0079 if (!finder->concurrentFinder()) {
0080 return false;
0081 }
0082 }
0083 return true;
0084 }
0085
0086 bool IntersectingIOVRecordIntervalFinder::isNonconcurrentAndIOVNeedsUpdate(const EventSetupRecordKey& iKey,
0087 const IOVSyncValue& iTime) const {
0088 for (auto const& finder : finders_) {
0089 if (finder->nonconcurrentAndIOVNeedsUpdate(iKey, iTime)) {
0090 return true;
0091 }
0092 }
0093 return false;
0094 }
0095
0096 }
0097 }