CMS 3D CMS Logo

IntersectingIOVRecordIntervalFinder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Framework
4 // Class : IntersectingIOVRecordIntervalFinder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Aug 19 13:20:41 EDT 2008
11 //
12 
13 // system include files
14 
15 // user include files
17 namespace edm {
18  namespace eventsetup {
19 
20  //
21  // constants, enums and typedefs
22  //
23 
24  //
25  // static data member definitions
26  //
27 
28  //
29  // constructors and destructor
30  //
33  }
34 
35  // IntersectingIOVRecordIntervalFinder::IntersectingIOVRecordIntervalFinder(const IntersectingIOVRecordIntervalFinder& rhs)
36  // {
37  // // do actual copying here;
38  // }
39 
41 
42  //
43  // assignment operators
44  //
45  // const IntersectingIOVRecordIntervalFinder& IntersectingIOVRecordIntervalFinder::operator=(const IntersectingIOVRecordIntervalFinder& rhs)
46  // {
47  // //An exception safe implementation is
48  // IntersectingIOVRecordIntervalFinder temp(rhs);
49  // swap(rhs);
50  //
51  // return *this;
52  // }
53 
54  //
55  // member functions
56  //
58  std::vector<edm::propagate_const<std::shared_ptr<EventSetupRecordIntervalFinder>>>& iFinders) {
59  finders_.swap(iFinders);
60  }
61 
63  const IOVSyncValue& iTime,
64  ValidityInterval& oInterval) {
65  if (finders_.empty()) {
67  return;
68  }
69 
70  bool haveAValidRecord = false;
71  bool haveUnknownEnding = false;
73 
74  for (auto& finder : finders_) {
75  ValidityInterval test = finder->findIntervalFor(iKey, iTime);
76  if (test != ValidityInterval::invalidInterval()) {
77  haveAValidRecord = true;
78  if (newInterval.first() < test.first()) {
79  newInterval.setFirst(test.first());
80  }
81  if (newInterval.last() > test.last()) {
82  newInterval.setLast(test.last());
83  }
84  if (test.last() == IOVSyncValue::invalidIOVSyncValue()) {
85  haveUnknownEnding = true;
86  }
87  } else {
88  //if it is invalid then we must check on each new IOVSyncValue so that
89  // we can find the time when it is valid
90  haveUnknownEnding = true;
91  }
92  }
93 
94  if (!haveAValidRecord) {
95  //If no Finder has a valid time, then this record is also invalid for this time
96  newInterval = ValidityInterval::invalidInterval();
97  } else if (haveUnknownEnding) {
99  }
100  oInterval = newInterval;
101  }
102 
103  //
104  // const member functions
105  //
106 
107  //
108  // static member functions
109  //
110  } // namespace eventsetup
111 } // namespace edm
void setFirst(const IOVSyncValue &iTime)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
const IOVSyncValue & last() const
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
void setIntervalFor(const EventSetupRecordKey &, const IOVSyncValue &, ValidityInterval &) override
void setLast(const IOVSyncValue &iTime)
void swapFinders(std::vector< edm::propagate_const< std::shared_ptr< EventSetupRecordIntervalFinder >>> &)
std::vector< edm::propagate_const< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
HLT enums.
static const ValidityInterval & invalidInterval()
const IOVSyncValue & first() const
void findingRecordWithKey(const eventsetup::EventSetupRecordKey &)
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:78