CMS 3D CMS Logo

NumberOfConcurrentIOVs.cc
Go to the documentation of this file.
1 
3 
9 
10 #include <algorithm>
11 #include <cassert>
12 #include <string>
13 
14 namespace edm {
15  namespace eventsetup {
16 
17  NumberOfConcurrentIOVs::NumberOfConcurrentIOVs() : numberConcurrentIOVs_(1) {}
18 
20  unsigned int maxConcurrentIOVs,
21  bool dumpOptions) {
22  if (eventSetupPset) { // this condition is false for SubProcesses
23  maxConcurrentIOVs_ = maxConcurrentIOVs;
24  numberConcurrentIOVs_ = eventSetupPset->getUntrackedParameter<unsigned int>("numberOfConcurrentIOVs");
25  if (numberConcurrentIOVs_ == 0 || numberConcurrentIOVs_ > maxConcurrentIOVs) {
26  numberConcurrentIOVs_ = maxConcurrentIOVs;
27  }
28  if (dumpOptions) {
29  LogAbsolute("Options") << "Number of Concurrent IOVs = " << numberConcurrentIOVs_;
30  }
31 
32  ParameterSet const& pset(eventSetupPset->getUntrackedParameterSet("forceNumberOfConcurrentIOVs"));
33  std::vector<std::string> recordNames = pset.getParameterNames();
34  forceNumberOfConcurrentIOVs_.reserve(recordNames.size());
35  for (auto const& recordName : recordNames) {
37  forceNumberOfConcurrentIOVs_.emplace_back(recordKey, pset.getUntrackedParameter<unsigned int>(recordName));
38  }
41  [](auto const& left, auto const& right) { return left.first < right.first; });
42  }
43  }
44 
47  }
48 
50  bool printInfoMsg) const {
54  std::make_pair(eventSetupKey, 0u),
55  [](auto const& left, auto const& right) { return left.first < right.first; });
56  if (iter != forceNumberOfConcurrentIOVs_.end() && iter->first == eventSetupKey) {
57  if (printInfoMsg && iter->second > maxConcurrentIOVs_) {
58  LogInfo("Configuration") << "For record " << eventSetupKey.name() << " you have configured " << iter->second
59  << " concurrent IOVs.\n"
60  << "But you cannot have more concurrent IOVs than lumis or streams.\n"
61  << "There will not be more than " << maxConcurrentIOVs_ << " concurrent IOVs.\n";
62  }
63  return std::min(iter->second, maxConcurrentIOVs_);
64  }
66  return 1;
67  }
68  if (printInfoMsg && numberConcurrentIOVs_ > maxConcurrentIOVs_) {
69  LogInfo("Configuration") << "For record " << eventSetupKey.name() << " you have configured "
70  << numberConcurrentIOVs_ << " concurrent IOVs.\n"
71  << "But you cannot have more concurrent IOVs than lumis or streams.\n"
72  << "There will not be more than " << maxConcurrentIOVs_ << " concurrent IOVs.\n";
73  }
74  return numberConcurrentIOVs_;
75  }
76 
78  // Mark this as invalid
80 
81  // Free up memory
83  std::vector<std::pair<EventSetupRecordKey, unsigned int>>().swap(forceNumberOfConcurrentIOVs_);
84  }
85  } // namespace eventsetup
86 } // namespace edm
edm::eventsetup::heterocontainer::HCTypeTag::findType
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121
MessageLogger.h
EventSetupProvider.h
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
min
T min(T a, T b)
Definition: MathUtil.h:58
edm
HLT enums.
Definition: AlignableModifier.h:19
align_cfg.recordName
recordName
Definition: align_cfg.py:66
cms::cuda::assert
assert(be >=bs)
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::eventsetup::EventSetupProvider
Definition: EventSetupProvider.h:50
edm::eventsetup::EventSetupRecordKey::name
const char * name() const
Definition: EventSetupRecordKey.h:46
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
edm::ParameterSet
Definition: ParameterSet.h:47
edm::eventsetup::EventSetupProvider::fillRecordsNotAllowingConcurrentIOVs
void fillRecordsNotAllowingConcurrentIOVs(std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
Definition: EventSetupProvider.cc:653
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::eventsetup::NumberOfConcurrentIOVs::recordsNotAllowingConcurrentIOVs_
std::set< EventSetupRecordKey > recordsNotAllowingConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:67
edm::LogAbsolute
Log< level::System, true > LogAbsolute
Definition: MessageLogger.h:134
edm::eventsetup::NumberOfConcurrentIOVs::numberOfConcurrentIOVs
unsigned int numberOfConcurrentIOVs(EventSetupRecordKey const &, bool printInfoMsg=false) const
Definition: NumberOfConcurrentIOVs.cc:49
edm::eventsetup::NumberOfConcurrentIOVs::clear
void clear()
Definition: NumberOfConcurrentIOVs.cc:77
edm::eventsetup::NumberOfConcurrentIOVs::fillRecordsNotAllowingConcurrentIOVs
void fillRecordsNotAllowingConcurrentIOVs(EventSetupProvider const &)
Definition: NumberOfConcurrentIOVs.cc:45
edm::eventsetup::NumberOfConcurrentIOVs::readConfigurationParameters
void readConfigurationParameters(ParameterSet const *eventSetupPset, unsigned int maxConcurrentIOVs, bool dumpOptions)
Definition: NumberOfConcurrentIOVs.cc:19
edm::eventsetup::swap
void swap(DataKey &a, DataKey &b)
Definition: DataKey.h:85
edm::eventsetup::NumberOfConcurrentIOVs::NumberOfConcurrentIOVs
NumberOfConcurrentIOVs()
Definition: NumberOfConcurrentIOVs.cc:17
Exception.h
ParameterSet.h
edm::eventsetup::NumberOfConcurrentIOVs::maxConcurrentIOVs_
unsigned int maxConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:78
NumberOfConcurrentIOVs.h
edm::eventsetup::NumberOfConcurrentIOVs::numberConcurrentIOVs_
unsigned int numberConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:56
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::eventsetup::NumberOfConcurrentIOVs::forceNumberOfConcurrentIOVs_
std::vector< std::pair< EventSetupRecordKey, unsigned int > > forceNumberOfConcurrentIOVs_
Definition: NumberOfConcurrentIOVs.h:76
HCTypeTag.h