CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edm::eventsetup::ESRecordsToProxyIndices Class Reference

#include <ESRecordsToProxyIndices.h>

Public Member Functions

ComponentDescription const * component (EventSetupRecordKey const &iRK, DataKey const &iDK) const noexcept
 
unsigned int dataKeysInRecord (unsigned int iRecordIndex, EventSetupRecordKey const &iRecord, std::vector< DataKey > const &iDataKeys, std::vector< ComponentDescription const * > const &iComponents)
 
 ESRecordsToProxyIndices (std::vector< EventSetupRecordKey > iRecords)
 
ESProxyIndex indexInRecord (EventSetupRecordKey const &iRK, DataKey const &iDK) const noexcept
 If the index is not found, returns missingProxyIndex() More...
 
ESRecordIndex recordIndexFor (EventSetupRecordKey const &iRK) const noexcept
 

Static Public Member Functions

static constexpr ESProxyIndex missingProxyIndex () noexcept
 
static constexpr ESRecordIndex missingRecordIndex () noexcept
 

Private Attributes

std::vector< ComponentDescription const * > components_
 
std::vector< DataKeydataKeys_
 
std::vector< EventSetupRecordKeyrecordKeys_
 
std::vector< unsigned int > recordOffsets_
 

Detailed Description

Definition at line 34 of file ESRecordsToProxyIndices.h.

Constructor & Destructor Documentation

ESRecordsToProxyIndices::ESRecordsToProxyIndices ( std::vector< EventSetupRecordKey iRecords)

Definition at line 25 of file ESRecordsToProxyIndices.cc.

References eostools::move(), recordKeys_, and recordOffsets_.

26  : recordKeys_{std::move(iRecords)} {
27  assert(std::is_sorted(iRecords.begin(), iRecords.end()));
28  recordOffsets_.reserve(recordKeys_.size() + 1);
29  recordOffsets_.push_back(0);
30  }
std::vector< EventSetupRecordKey > recordKeys_
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

ComponentDescription const * ESRecordsToProxyIndices::component ( EventSetupRecordKey const &  iRK,
DataKey const &  iDK 
) const
noexcept

Definition at line 76 of file ESRecordsToProxyIndices.cc.

References components_, dataKeys_, SoftLeptonByDistance_cfi::distance, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, or, recordKeys_, and recordOffsets_.

Referenced by edm::EDConsumerBase::updateLookup(), and edm::ESProducer::updateLookup().

77  {
78  auto it = std::lower_bound(recordKeys_.begin(), recordKeys_.end(), iRK);
79  if (it == recordKeys_.end() or *it != iRK) {
80  return nullptr;
81  }
82 
83  auto beginOffset = recordOffsets_[std::distance(recordKeys_.begin(), it)];
84  ++it;
85  auto endOffset = recordOffsets_[std::distance(recordKeys_.begin(), it)];
86 
87  auto itDK = std::lower_bound(dataKeys_.begin() + beginOffset, dataKeys_.begin() + endOffset, iDK);
88  if (itDK == dataKeys_.begin() + endOffset or *itDK != iDK) {
89  return nullptr;
90  }
91  return components_[std::distance(dataKeys_.begin(), itDK)];
92  }
std::vector< EventSetupRecordKey > recordKeys_
std::vector< ComponentDescription const * > components_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
unsigned int ESRecordsToProxyIndices::dataKeysInRecord ( unsigned int  iRecordIndex,
EventSetupRecordKey const &  iRecord,
std::vector< DataKey > const &  iDataKeys,
std::vector< ComponentDescription const * > const &  iComponents 
)

This should be called for all records in the list passed to the constructor and in the same order as the list.

Definition at line 32 of file ESRecordsToProxyIndices.cc.

References components_, dataKeys_, recordKeys_, and recordOffsets_.

Referenced by missingRecordIndex(), and edm::eventsetup::EventSetupProvider::recordsToProxyIndices().

35  {
36  assert(iRecord == recordKeys_[iRecordIndex]);
37  assert(iDataKeys.size() == iComponents.size());
38  assert(iRecordIndex + 1 == recordOffsets_.size());
39  dataKeys_.insert(dataKeys_.end(), iDataKeys.begin(), iDataKeys.end());
40  ++iRecordIndex;
41  components_.insert(components_.end(), iComponents.begin(), iComponents.end());
42  recordOffsets_.push_back(dataKeys_.size());
43  return iRecordIndex;
44  }
std::vector< EventSetupRecordKey > recordKeys_
std::vector< ComponentDescription const * > components_
ESProxyIndex ESRecordsToProxyIndices::indexInRecord ( EventSetupRecordKey const &  iRK,
DataKey const &  iDK 
) const
noexcept

If the index is not found, returns missingProxyIndex()

Definition at line 49 of file ESRecordsToProxyIndices.cc.

References dataKeys_, SoftLeptonByDistance_cfi::distance, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, missingProxyIndex(), or, recordKeys_, and recordOffsets_.

Referenced by edm::EDConsumerBase::updateLookup(), and edm::ESProducer::updateLookup().

50  {
51  auto it = std::lower_bound(recordKeys_.begin(), recordKeys_.end(), iRK);
52  if (it == recordKeys_.end() or *it != iRK) {
53  return missingProxyIndex();
54  }
55 
56  auto beginOffset = recordOffsets_[std::distance(recordKeys_.begin(), it)];
57  ++it;
58  auto endOffset = recordOffsets_[std::distance(recordKeys_.begin(), it)];
59 
60  auto itDK = std::lower_bound(dataKeys_.begin() + beginOffset, dataKeys_.begin() + endOffset, iDK);
61  if (itDK == dataKeys_.begin() + endOffset or *itDK != iDK) {
62  return missingProxyIndex();
63  }
64 
65  return ESProxyIndex{static_cast<int>(std::distance(dataKeys_.begin() + beginOffset, itDK))};
66  }
std::vector< EventSetupRecordKey > recordKeys_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static constexpr ESProxyIndex missingProxyIndex() noexcept
static constexpr ESProxyIndex edm::eventsetup::ESRecordsToProxyIndices::missingProxyIndex ( )
inlinestaticnoexcept
static constexpr ESRecordIndex edm::eventsetup::ESRecordsToProxyIndices::missingRecordIndex ( )
inlinestaticnoexcept
ESRecordIndex ESRecordsToProxyIndices::recordIndexFor ( EventSetupRecordKey const &  iRK) const
noexcept

Definition at line 68 of file ESRecordsToProxyIndices.cc.

References pfDeepBoostedJetPreprocessParams_cfi::lower_bound, missingRecordIndex(), or, and recordKeys_.

Referenced by missingRecordIndex(), and edm::ESProducer::updateLookup().

68  {
69  auto it = std::lower_bound(recordKeys_.begin(), recordKeys_.end(), iRK);
70  if (it == recordKeys_.end() or *it != iRK) {
71  return missingRecordIndex();
72  }
73  return ESRecordIndex{static_cast<ESRecordIndex::Value_t>(it - recordKeys_.begin())};
74  }
unsigned int Value_t
Definition: ESIndices.h:81
std::vector< EventSetupRecordKey > recordKeys_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static constexpr ESRecordIndex missingRecordIndex() noexcept

Member Data Documentation

std::vector<ComponentDescription const*> edm::eventsetup::ESRecordsToProxyIndices::components_
private

Definition at line 67 of file ESRecordsToProxyIndices.h.

Referenced by component(), and dataKeysInRecord().

std::vector<DataKey> edm::eventsetup::ESRecordsToProxyIndices::dataKeys_
private

Definition at line 66 of file ESRecordsToProxyIndices.h.

Referenced by component(), dataKeysInRecord(), and indexInRecord().

std::vector<EventSetupRecordKey> edm::eventsetup::ESRecordsToProxyIndices::recordKeys_
private
std::vector<unsigned int> edm::eventsetup::ESRecordsToProxyIndices::recordOffsets_
private