CMS 3D CMS Logo

validateTopLevelParameterSets.cc
Go to the documentation of this file.
2 
6 
8 
9 #include <sstream>
10 #include <vector>
11 #include <string>
12 
13 namespace edm {
14 
16  description.addUntracked<unsigned int>("numberOfThreads", s_defaultNumberOfThreads)
17  ->setComment("If zero, let TBB use its default which is normally the number of CPUs on the machine");
18  description.addUntracked<unsigned int>("numberOfStreams", 0)
19  ->setComment("If zero, then set the number of streams to be the same as the number of threads");
20  description.addUntracked<unsigned int>("numberOfConcurrentRuns", 1);
21  description.addUntracked<unsigned int>("numberOfConcurrentLuminosityBlocks", 1)
22  ->setComment("If zero, then set the same as the number of runs");
23 
24  edm::ParameterSetDescription eventSetupDescription;
25  eventSetupDescription.addUntracked<unsigned int>("numberOfConcurrentIOVs", 1)
26  ->setComment(
27  "If zero, set to 1. Can be overridden by hard coded static in record C++ definition or by "
28  "forceNumberOfConcurrentIOVs");
29  edm::ParameterSetDescription nestedDescription;
30  nestedDescription.addWildcardUntracked<unsigned int>("*")->setComment(
31  "Parameter names should be record names and the values are the number of concurrent IOVS for each record."
32  " Overrides all other methods of setting number of concurrent IOVs.");
33  eventSetupDescription.addUntracked<edm::ParameterSetDescription>("forceNumberOfConcurrentIOVs", nestedDescription);
34  description.addUntracked<edm::ParameterSetDescription>("eventSetup", eventSetupDescription);
35 
36  description.addUntracked<bool>("wantSummary", false)
37  ->setComment("Set true to print a report on the trigger decisions and timing of modules");
38  description.addUntracked<std::string>("fileMode", "FULLMERGE")
39  ->setComment("Legal values are 'NOMERGE' and 'FULLMERGE'");
40  description.addUntracked<bool>("forceEventSetupCacheClearOnNewRun", false);
41  description.addUntracked<bool>("throwIfIllegalParameter", true)
42  ->setComment("Set false to disable exception throws when configuration validation detects illegal parameters");
43  description.addUntracked<bool>("printDependencies", false)->setComment("Print data dependencies between modules");
44  description.addUntracked<bool>("deleteNonConsumedUnscheduledModules", true)
45  ->setComment(
46  "Delete modules that are unscheduled, i.e. only in Tasks, whose products are not consumed by any other "
47  "otherwise-running module");
48 
49  // No default for this one because the parameter value is
50  // actually used in the main function in cmsRun.cpp before
51  // the parameter set is validated here.
52  description.addOptionalUntracked<unsigned int>("sizeOfStackForThreadsInKB");
53 
54  std::vector<std::string> emptyVector;
55 
56  description.addUntracked<std::vector<std::string>>("Rethrow", emptyVector);
57  description.addUntracked<std::vector<std::string>>("SkipEvent", emptyVector);
58  description.addUntracked<std::vector<std::string>>("FailPath", emptyVector);
59  description.addUntracked<std::vector<std::string>>("IgnoreCompletely", emptyVector);
60 
61  description.addUntracked<std::vector<std::string>>("canDeleteEarly", emptyVector)
62  ->setComment("Branch names of products that the Framework can try to delete before the end of the Event");
63 
64  description.addOptionalUntracked<bool>("allowUnscheduled")
65  ->setComment(
66  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
67  description.addOptionalUntracked<std::string>("emptyRunLumiMode")
68  ->setComment(
69  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
70  description.addOptionalUntracked<bool>("makeTriggerResults")
71  ->setComment(
72  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
73  }
74 
76  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
77 
78  ParameterSetDescription nestedDescription;
79  nestedDescription.addWildcardUntracked<int>("*");
80  description.addOptionalNode(ParameterDescription<int>("output", false) xor
81  ParameterDescription<ParameterSetDescription>("output", nestedDescription, false),
82  false);
83  }
84 
86  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
87  }
88 
90  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
91  }
92 
93  void validateTopLevelParameterSets(ParameterSet* processParameterSet) {
94  std::string processName = processParameterSet->getParameter<std::string>("@process_name");
95 
96  std::vector<std::string> psetNames{"options", "maxEvents", "maxLuminosityBlocks", "maxSecondsUntilRampdown"};
97 
98  for (auto const& psetName : psetNames) {
99  bool isTracked{false};
100  ParameterSet* pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
101  if (pset == nullptr) {
102  ParameterSet emptyPset;
103  processParameterSet->addUntrackedParameter<ParameterSet>(psetName, emptyPset);
104  pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
105  }
106  if (isTracked) {
107  throw Exception(errors::Configuration) << "In the configuration the top level parameter set named \'"
108  << psetName << "\' in process \'" << processName << "\' is tracked.\n"
109  << "It must be untracked";
110  }
111 
113  if (psetName == "options") {
115  } else if (psetName == "maxEvents") {
117  } else if (psetName == "maxLuminosityBlocks") {
119  } else if (psetName == "maxSecondsUntilRampdown") {
121  }
122 
123  try {
124  description.validate(*pset);
125  } catch (cms::Exception& ex) {
126  std::ostringstream ost;
127  ost << "Validating top level \'" << psetName << "\' ParameterSet for process \'" << processName << "\'";
128  ex.addContext(ost.str());
129  throw;
130  }
131  }
132  }
133 
134 } // namespace edm
cms::Exception::addContext
void addContext(std::string const &context)
Definition: Exception.cc:165
edm::validateTopLevelParameterSets
void validateTopLevelParameterSets(ParameterSet *processParameterSet)
Definition: validateTopLevelParameterSets.cc:93
edm::fillMaxEventsDescription
void fillMaxEventsDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:75
edm::s_defaultNumberOfThreads
constexpr unsigned int s_defaultNumberOfThreads
Definition: ThreadsInfo.h:9
edm
HLT enums.
Definition: AlignableModifier.h:19
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ParameterDescription< ParameterSetDescription >
Definition: ParameterDescription.h:199
edm::ParameterSet::addUntrackedParameter
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:192
EDMException.h
edm::fillMaxSecondsUntilRampdownDescription
void fillMaxSecondsUntilRampdownDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:89
edm::fillMaxLuminosityBlocksDescription
void fillMaxLuminosityBlocksDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:85
edm::ParameterSetDescription::addWildcardUntracked
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
Definition: ParameterSetDescription.h:204
ParameterSetDescription.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::fillOptionsDescription
void fillOptionsDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:15
validateTopLevelParameterSets.h
cms::Exception
Definition: Exception.h:70
ParameterSet.h
edm::ParameterSet::getPSetForUpdate
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
Definition: ParameterSet.cc:457
edm::ParameterDescription
Definition: ParameterDescription.h:110
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ThreadsInfo.h