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