CMS 3D CMS Logo

EventSetupTestHelper.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/TestProcessor
4 // Class : EventSetupTestHelper
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: root
10 // Created: Tue, 08 May 2018 18:33:15 GMT
11 //
12 
13 // system include files
14 
15 // user include files
18 
19 namespace edm {
20  namespace test {
21 
22  //
23  // constants, enums and typedefs
24  //
25 
26  //
27  // static data member definitions
28  //
29 
30  //
31  // constructors and destructor
32  //
33  EventSetupTestHelper::EventSetupTestHelper(std::vector<ESProduceEntry> iProxies) : proxies_{std::move(iProxies)} {
34  //Deal with duplicates
35  std::set<eventsetup::EventSetupRecordKey> records;
36  for (auto const& p : proxies_) {
37  records.insert(p.recordKey_);
38  }
39  for (auto const& k : records) {
42  }
43  }
44 
46  const ValidityInterval&) {}
47 
49  const IOVSyncValue& iSync,
50  ValidityInterval& oIOV) {
51  if (iSync.luminosityBlockNumber() == 0) {
52  //make valid through first run
53  oIOV = ValidityInterval(iSync, IOVSyncValue(EventID(iSync.eventID().run(), 1, 1)));
54  } else if (iSync.eventID().event() == 0) {
55  oIOV =
56  ValidityInterval(iSync, IOVSyncValue(EventID(iSync.eventID().run(), iSync.eventID().luminosityBlock(), 1)));
57  } else {
58  //Make valid for only this point
59  oIOV = ValidityInterval(iSync, iSync);
60  }
61  }
62 
64  KeyedProxies& aProxyList) {
65  for (auto const& p : proxies_) {
66  if (p.recordKey_ == iRecordKey) {
67  aProxyList.emplace_back(p.dataKey_, p.proxy_);
68  }
69  }
70  }
71 
72  std::shared_ptr<eventsetup::DataProxy> EventSetupTestHelper::getProxy(unsigned int iIndex) {
73  return proxies_[iIndex].proxy_;
74  }
75 
77  for (auto const& p : proxies_) {
78  p.proxy_->invalidate();
79  }
80  }
81 
82  } // namespace test
83 } // namespace edm
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
const EventID & eventID() const
Definition: IOVSyncValue.h:40
void setIntervalFor(const eventsetup::EventSetupRecordKey &, const IOVSyncValue &, ValidityInterval &) final
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
void usingRecordWithKey(const EventSetupRecordKey &)
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
std::vector< ESProduceEntry > proxies_
void newInterval(const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) final
called when a new interval of validity occurs for iRecordType
LuminosityBlockNumber_t luminosityBlockNumber() const
Definition: IOVSyncValue.h:41
EventSetupTestHelper(std::vector< ESProduceEntry >)
int k[5][pyjets_maxn]
std::shared_ptr< eventsetup::DataProxy > getProxy(unsigned int index)
void registerProxies(const eventsetup::EventSetupRecordKey &iRecordKey, KeyedProxies &aProxyList) final
HLT enums.
def move(src, dest)
Definition: eostools.py:511
void findingRecordWithKey(const eventsetup::EventSetupRecordKey &)