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 
45  // No default for this one because the parameter value is
46  // actually used in the main function in cmsRun.cpp before
47  // the parameter set is validated here.
48  description.addOptionalUntracked<unsigned int>("sizeOfStackForThreadsInKB");
49 
50  std::vector<std::string> emptyVector;
51 
52  description.addUntracked<std::vector<std::string>>("Rethrow", emptyVector);
53  description.addUntracked<std::vector<std::string>>("SkipEvent", emptyVector);
54  description.addUntracked<std::vector<std::string>>("FailPath", emptyVector);
55  description.addUntracked<std::vector<std::string>>("IgnoreCompletely", emptyVector);
56 
57  description.addUntracked<std::vector<std::string>>("canDeleteEarly", emptyVector)
58  ->setComment("Branch names of products that the Framework can try to delete before the end of the Event");
59 
60  description.addOptionalUntracked<bool>("allowUnscheduled")
61  ->setComment(
62  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
63  description.addOptionalUntracked<std::string>("emptyRunLumiMode")
64  ->setComment(
65  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
66  description.addOptionalUntracked<bool>("makeTriggerResults")
67  ->setComment(
68  "Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
69  }
70 
72  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
73 
74  ParameterSetDescription nestedDescription;
75  nestedDescription.addWildcardUntracked<int>("*");
76  description.addOptionalNode(ParameterDescription<int>("output", false) xor
77  ParameterDescription<ParameterSetDescription>("output", nestedDescription, false),
78  false);
79  }
80 
82  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
83  }
84 
86  description.addUntracked<int>("input", -1)->setComment("Default of -1 implies no limit.");
87  }
88 
89  void validateTopLevelParameterSets(ParameterSet* processParameterSet) {
90  std::string processName = processParameterSet->getParameter<std::string>("@process_name");
91 
92  std::vector<std::string> psetNames{"options", "maxEvents", "maxLuminosityBlocks", "maxSecondsUntilRampdown"};
93 
94  for (auto const& psetName : psetNames) {
95  bool isTracked{false};
96  ParameterSet* pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
97  if (pset == nullptr) {
98  ParameterSet emptyPset;
99  processParameterSet->addUntrackedParameter<ParameterSet>(psetName, emptyPset);
100  pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
101  }
102  if (isTracked) {
103  throw Exception(errors::Configuration) << "In the configuration the top level parameter set named \'"
104  << psetName << "\' in process \'" << processName << "\' is tracked.\n"
105  << "It must be untracked";
106  }
107 
109  if (psetName == "options") {
111  } else if (psetName == "maxEvents") {
113  } else if (psetName == "maxLuminosityBlocks") {
115  } else if (psetName == "maxSecondsUntilRampdown") {
117  }
118 
119  try {
120  description.validate(*pset);
121  } catch (cms::Exception& ex) {
122  std::ostringstream ost;
123  ost << "Validating top level \'" << psetName << "\' ParameterSet for process \'" << processName << "\'";
124  ex.addContext(ost.str());
125  throw;
126  }
127  }
128  }
129 
130 } // namespace edm
cms::Exception::addContext
void addContext(std::string const &context)
Definition: Exception.cc:165
edm::validateTopLevelParameterSets
void validateTopLevelParameterSets(ParameterSet *processParameterSet)
Definition: validateTopLevelParameterSets.cc:89
edm::fillMaxEventsDescription
void fillMaxEventsDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:71
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:85
edm::fillMaxLuminosityBlocksDescription
void fillMaxLuminosityBlocksDescription(ParameterSetDescription &description)
Definition: validateTopLevelParameterSets.cc:81
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:246
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