CMS 3D CMS Logo

validateTopLevelParameterSets.cc
Go to the documentation of this file.
2 
5 
7 
8 #include <sstream>
9 #include <vector>
10 #include <string>
11 
12 namespace edm {
13 
15 
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  description.addUntracked<bool>("wantSummary", false)->
24  setComment("Set true to print a report on the trigger decisions and timing of modules");
25  description.addUntracked<std::string>("fileMode", "FULLMERGE")->
26  setComment("Legal values are 'NOMERGE' and 'FULLMERGE'");
27  description.addUntracked<bool>("forceEventSetupCacheClearOnNewRun", false);
28  description.addUntracked<bool>("throwIfIllegalParameter", true)->
29  setComment("Set false to disable exception throws when configuration validation detects illegal parameters");
30  description.addUntracked<bool>("printDependencies", false)->
31  setComment("Print data dependencies between modules");
32 
33 
34  // No default for this one because the parameter value is
35  // actually used in the main function in cmsRun.cpp before
36  // the parameter set is validated here.
37  description.addOptionalUntracked<unsigned int>("sizeOfStackForThreadsInKB");
38 
39  std::vector<std::string> emptyVector;
40 
41  description.addUntracked<std::vector<std::string>>("Rethrow", emptyVector);
42  description.addUntracked<std::vector<std::string>>("SkipEvent", emptyVector);
43  description.addUntracked<std::vector<std::string>>("FailPath", emptyVector);
44  description.addUntracked<std::vector<std::string>>("IgnoreCompletely", emptyVector);
45 
46  description.addUntracked<std::vector<std::string>>("canDeleteEarly", emptyVector)->
47  setComment("Branch names of products that the Framework can try to delete before the end of the Event");
48 
49  description.addOptionalUntracked<bool>("allowUnscheduled")->
50  setComment("Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
51  description.addOptionalUntracked<std::string>("emptyRunLumiMode")->
52  setComment("Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
53  description.addOptionalUntracked<bool>("makeTriggerResults")->
54  setComment("Obsolete. Has no effect. Allowed only for backward compatibility for old Python configuration files.");
55 }
56 
58  description.addUntracked<int>("input", -1)->
59  setComment("Default of -1 implies no limit.");
60 
61  ParameterSetDescription nestedDescription;
62  nestedDescription.addWildcardUntracked<int>("*");
63  description.addOptionalNode(ParameterDescription<int>("output", false) xor
64  ParameterDescription<ParameterSetDescription>("output", nestedDescription, false), false);
65 }
66 
68  description.addUntracked<int>("input", -1)->
69  setComment("Default of -1 implies no limit.");
70 }
71 
73  description.addUntracked<int>("input", -1)->
74  setComment("Default of -1 implies no limit.");
75 }
76 
77 void validateTopLevelParameterSets(ParameterSet* processParameterSet) {
78 
79  std::string processName = processParameterSet->getParameter<std::string>("@process_name");
80 
81  std::vector<std::string> psetNames {"options", "maxEvents", "maxLuminosityBlocks", "maxSecondsUntilRampdown"};
82 
83  for (auto const& psetName : psetNames) {
84 
85  bool isTracked {false};
86  ParameterSet* pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
87  if (pset == nullptr) {
88  ParameterSet emptyPset;
89  processParameterSet->addUntrackedParameter<ParameterSet>(psetName, emptyPset);
90  pset = processParameterSet->getPSetForUpdate(psetName, isTracked);
91  }
92  if (isTracked) {
94  << "In the configuration the top level parameter set named \'" << psetName << "\' in process \'" << processName << "\' is tracked.\n"
95  << "It must be untracked";
96  }
97 
99  if (psetName == "options") {
100  fillOptionsDescription(description);
101  } else if (psetName == "maxEvents") {
102  fillMaxEventsDescription(description);
103  } else if (psetName == "maxLuminosityBlocks") {
105  } else if (psetName == "maxSecondsUntilRampdown") {
107  }
108 
109  try {
110  description.validate(*pset);
111  } catch(cms::Exception& ex) {
112  std::ostringstream ost;
113  ost << "Validating top level \'" << psetName << "\' ParameterSet for process \'" << processName << "\'";
114  ex.addContext(ost.str());
115  throw;
116  }
117  }
118 }
119 
120 }
T getParameter(std::string const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void validate(ParameterSet &pset) const
ParameterWildcardBase * addWildcardUntracked(U const &pattern)
void validateTopLevelParameterSets(ParameterSet *processParameterSet)
void fillOptionsDescription(ParameterSetDescription &description)
void fillMaxEventsDescription(ParameterSetDescription &description)
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
constexpr unsigned int s_defaultNumberOfThreads
void fillMaxLuminosityBlocksDescription(ParameterSetDescription &description)
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208
void addContext(std::string const &context)
Definition: Exception.cc:227
HLT enums.
void fillMaxSecondsUntilRampdownDescription(ParameterSetDescription &description)
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)