CMS 3D CMS Logo

MessageServicePSetValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Services
4 // Class : MessageServicePSetValidation
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: M. Fischler
10 // Created: Wed May 20 2009
11 //
12 //
13 
14 // system include files
15 
16 #include <algorithm>
17 
18 // user include files
19 
21 
22 using namespace edm;
23 using namespace edm::service;
24 
25 namespace edm {
26  namespace service {
27 
29  messageLoggerPSet(pset);
30  return flaws_.str();
31  } // operator() to validate the PSet passed in
32 
34  // See if new config API is being used
35  if (pset.exists("files") or
36  (not(pset.exists("destinations") or pset.existsAs<std::vector<std::string>>("statistics", true) or
37  pset.existsAs<std::vector<std::string>>("statistics", false) or pset.exists("categories")))) {
38  return;
39  }
40 
41  // Four types of material are allowed at the MessageLogger level:
42  // PSet lists (such as destinations or categories
43  // Suppression lists, such as SuppressInfo or debugModules
44  // General parameters, such as threshold or messageSummaryToJobReport
45  // Nested PSets, such as those for each destination
46 
47  // PSet lists
48 
49  psetLists(pset);
50 
51  // Suppression lists
52 
53  suppressionLists(pset);
54 
55  // No other vstrings
56 
57  vStringsCheck(pset, "MessageLogger");
58 
59  // General Parameters
60 
61  check<bool>(pset, "MessageLogger", "messageSummaryToJobReport");
62  std::string dumps = check<std::string>(pset, "MessageLogger", "generate_preconfiguration_message");
63  std::string thresh = check<std::string>(pset, "MessageLogger", "threshold");
64  if (!thresh.empty())
65  validateThreshold(thresh, "MessageLogger");
66  check<unsigned int>(pset, "MessageLogger", "waiting_threshold");
67 
68  // Nested PSets
69 
70  destinationPSets(pset);
71  defaultPSet(pset);
72  statisticsPSets(pset);
73  categoryPSets(pset, "MessageLogger");
74 
75  // No other PSets -- unless they contain optionalPSet or placeholder=True
76 
77  noOtherPsets(pset);
78 
79  // Nothing else -- look for int, unsigned int, bool, float, double, string
80 
81  noneExcept<int>(pset, "MessageLogger", "int");
82  noneExcept<unsigned int>(pset, "MessageLogger", "unsigned int", "waiting_threshold");
83  noneExcept<bool>(pset, "MessageLogger", "bool", "messageSummaryToJobReport");
84  // Note - at this, the upper MessageLogger PSet level, the use of
85  // optionalPSet makes no sense, so we are OK letting that be a flaw
86  noneExcept<float>(pset, "MessageLogger", "float");
87  noneExcept<double>(pset, "MessageLogger", "double");
88  noneExcept<std::string>(pset, "MessageLogger", "string", "threshold", "generate_preconfiguration_message");
89 
90  // Append explanatory information if flaws were found
91 
92  if (!flaws_.str().empty()) {
93  flaws_ << "\nThe above are from MessageLogger configuration validation.\n"
94  << "In most cases, these involve lines that the logger configuration code\n"
95  << "would not process, but which the cfg creator obviously meant to have "
96  << "effect.\n";
97  }
98 
99  } // messageLoggerPSet
100 
102  destinations_ = check<vString>(pset, "MessageLogger", "destinations");
103  noDuplicates(destinations_, "MessageLogger", "destinations");
104  noKeywords(destinations_, "MessageLogger", "destinations");
105  noNonPSetUsage(pset, destinations_, "MessageLogger", "destinations");
106  // REMOVED: noCoutCerrClash(destinations_,"MessageLogger", "destinations");
107 
108  statistics_ = check<vString>(pset, "MessageLogger", "statistics");
109  noDuplicates(statistics_, "MessageLogger", "statistics");
110  noKeywords(statistics_, "MessageLogger", "statistics");
111  noNonPSetUsage(pset, statistics_, "MessageLogger", "statistics");
112 
113  categories_ = check<vString>(pset, "MessageLogger", "categories");
114  noDuplicates(categories_, "MessageLogger", "categories");
115  noKeywords(categories_, "MessageLogger", "categories");
116  noNonPSetUsage(pset, categories_, "MessageLogger", "categories");
117  noDuplicates(categories_, destinations_, "MessageLogger", "categories", "destinations");
118  noDuplicates(categories_, statistics_, "MessageLogger", "categories", "statistics");
119 
120  } // psetLists
121 
123  debugModules_ = check<vString>(pset, "MessageLogger", "debugModules");
124  bool dmStar = wildcard(debugModules_);
125  if (dmStar && debugModules_.size() != 1) {
126  flaws_ << "MessageLogger"
127  << " PSet: \n"
128  << "debugModules contains wildcard character *"
129  << " and also " << debugModules_.size() - 1 << " other entries - * must be alone\n";
130  }
131  suppressDebug_ = check<vString>(pset, "MessageLogger", "suppressDebug");
132  if ((!suppressDebug_.empty()) && (!dmStar)) {
133  flaws_ << "MessageLogger"
134  << " PSet: \n"
135  << "suppressDebug contains modules, but debugModules is not *\n"
136  << "Unless all the debugModules are enabled,\n"
137  << "suppressing specific modules is meaningless\n";
138  }
139  if (wildcard(suppressDebug_)) {
140  flaws_ << "MessageLogger"
141  << " PSet: \n"
142  << "Use of wildcard (*) in suppressDebug is not supported\n"
143  << "By default, LogDebug is suppressed for all modules\n";
144  }
145  suppressInfo_ = check<vString>(pset, "MessageLogger", "suppressInfo");
146  if (wildcard(suppressInfo_)) {
147  flaws_ << "MessageLogger"
148  << " PSet: \n"
149  << "Use of wildcard (*) in suppressInfo is not supported\n";
150  }
151  suppressFwkInfo_ = check<vString>(pset, "MessageLogger", "suppressFwkInfo");
152  if (wildcard(suppressFwkInfo_)) {
153  flaws_ << "MessageLogger"
154  << " PSet: \n"
155  << "Use of wildcard (*) in suppressFwkInfo is not supported\n";
156  }
157  suppressWarning_ = check<vString>(pset, "MessageLogger", "suppressWarning");
158  if (wildcard(suppressWarning_)) {
159  flaws_ << "MessageLogger"
160  << " PSet: \n"
161  << "Use of wildcard (*) in suppressWarning is not supported\n";
162  }
163  suppressError_ = check<vString>(pset, "MessageLogger", "suppressError");
164  if (wildcard(suppressError_)) {
165  flaws_ << "MessageLogger"
166  << " PSet: \n"
167  << "Use of wildcard (*) in suppressError is not supported\n";
168  }
169 
170  } // suppressionLists
171 
173  std::string const& /*psetName*/) {
174  vString vStrings = pset.getParameterNamesForType<vString>(false);
175  vString::const_iterator end = vStrings.end();
176  for (vString::const_iterator i = vStrings.begin(); i != end; ++i) {
177  if (!allowedVstring(*i)) {
178  flaws_ << "MessageLogger"
179  << " PSet: \n"
180  << (*i) << " is used as a vstring, "
181  << "but no such vstring is recognized\n";
182  }
183  }
184  vStrings = pset.getParameterNamesForType<vString>(true);
185  end = vStrings.end();
186  for (vString::const_iterator i = vStrings.begin(); i != end; ++i) {
187  flaws_ << "MessageLogger"
188  << " PSet: \n"
189  << (*i) << " is used as a tracked vstring: "
190  << "tracked parameters not allowed here\n";
191  }
192  } // vStringsCheck
193 
195  if (s == "destinations")
196  return true;
197  if (s == "statistics")
198  return true;
199  if (s == "destinations")
200  return true;
201  if (s == "categories")
202  return true;
203  if (s == "debugModules")
204  return true;
205  if (s == "suppressInfo")
206  return true;
207  if (s == "suppressFwkInfo")
208  return true;
209  if (s == "suppressDebug")
210  return true;
211  if (s == "suppressWarning")
212  return true;
213  if (s == "suppressError")
214  return true;
215  return false;
216  } // allowedVstring
217 
219  std::string const& psetName) {
220  if (checkThreshold(thresh))
221  return true;
222  flaws_ << psetName << " PSet: \n"
223  << "threshold has value " << thresh << " which is not among {DEBUG, INFO, FWKINFO, WARNING, ERROR}\n";
224  return false;
225  } // validateThreshold
226 
228  if (thresh == "WARNING")
229  return true;
230  if (thresh == "INFO")
231  return true;
232  if (thresh == "FWKINFO")
233  return true;
234  if (thresh == "ERROR")
235  return true;
236  if (thresh == "DEBUG")
237  return true;
238  return false;
239  }
240 
242  std::string const& psetName,
243  std::string const& parameterLabel) {
244  vString::const_iterator end = v.end();
245  for (vString::const_iterator i = v.begin(); i != end; ++i) {
246  for (vString::const_iterator j = i + 1; j != end; ++j) {
247  if (*i == *j) {
248  flaws_ << psetName << " PSet: \n"
249  << "in vString " << parameterLabel << " duplication of the string " << *i << "\n";
250  }
251  }
252  }
253  } // noDuplicates(v)
254 
256  vString const& v2,
257  std::string const& psetName,
258  std::string const& p1,
259  std::string const& p2) {
260  vString::const_iterator end1 = v1.end();
261  vString::const_iterator end2 = v2.end();
262  for (vString::const_iterator i = v1.begin(); i != end1; ++i) {
263  for (vString::const_iterator j = v2.begin(); j != end2; ++j) {
264  if (*i == *j) {
265  flaws_ << psetName << " PSet: \n"
266  << "in vStrings " << p1 << " and " << p2 << " duplication of the string " << *i << "\n";
267  }
268  }
269  }
270  } // noDuplicates(v1,v2)
271 
273  std::string const& psetName,
274  std::string const& parameterLabel) {
275  vString::const_iterator end = v.end();
276  bool coutPresent = false;
277  bool cerrPresent = false;
278  for (vString::const_iterator i = v.begin(); i != end; ++i) {
279  if (*i == "cout")
280  coutPresent = true;
281  if (*i == "cerr")
282  cerrPresent = true;
283  }
284  if (coutPresent && cerrPresent) {
285  flaws_ << psetName << " PSet: \n"
286  << "vString " << parameterLabel << " has both cout and cerr \n";
287  }
288  } // noCoutCerrClash(v)
289 
291  std::string const& psetName,
292  std::string const& parameterLabel) {
293  vString::const_iterator end = v.end();
294  for (vString::const_iterator i = v.begin(); i != end; ++i) {
295  if (!keywordCheck(*i)) {
296  flaws_ << psetName << " PSet: \n"
297  << "vString " << parameterLabel << " should not contain the keyword " << *i << "\n";
298  }
299  }
300  } // noKeywords(v)
301 
303  if (word == "default")
304  return false;
305  if (word == "categories")
306  return false;
307  if (word == "destinations")
308  return false;
309  if (word == "statistics")
310  return false;
311  if (word == "debugModules")
312  return false;
313  if (word == "suppressInfo")
314  return false;
315  if (word == "suppressFwkInfo")
316  return false;
317  if (word == "suppressDebug")
318  return false;
319  if (word == "suppressWarning")
320  return false;
321  if (word == "suppressError")
322  return false;
323  if (word == "threshold")
324  return false;
325  if (word == "ERROR")
326  return false;
327  if (word == "WARNING")
328  return false;
329  if (word == "FWKINFO")
330  return false;
331  if (word == "INFO")
332  return false;
333  if (word == "DEBUG")
334  return false;
335  if (word == "placeholder")
336  return false;
337  if (word == "limit")
338  return false;
339  if (word == "reportEvery")
340  return false;
341  if (word == "timespan")
342  return false;
343  if (word == "noLineBreaks")
344  return false;
345  if (word == "lineLength")
346  return false;
347  if (word == "noTimeStamps")
348  return false;
349  if (word == "output")
350  return false;
351  if (word == "filename")
352  return false;
353  if (word == "extension")
354  return false;
355  if (word == "reset")
356  return false;
357  if (word == "optionalPSet")
358  return false;
359  if (word == "enableStatistics")
360  return false;
361  if (word == "statisticsThreshold")
362  return false;
363  if (word == "resetStatistics")
364  return false;
365  return true;
366  } // keywordCheck
367 
369  vString const& v,
370  std::string const& psetName,
371  std::string const& parameterLabel) {
372  disallowedParam<int>(pset, v, psetName, parameterLabel, "int");
373  disallowedParam<unsigned int>(pset, v, psetName, parameterLabel, "uint");
374  disallowedParam<bool>(pset, v, psetName, parameterLabel, "bool");
375  disallowedParam<float>(pset, v, psetName, parameterLabel, "float");
376  disallowedParam<double>(pset, v, psetName, parameterLabel, "double");
377  disallowedParam<std::string>(pset, v, psetName, parameterLabel, "string");
378  disallowedParam<std::vector<std::string>>(pset, v, psetName, parameterLabel, "vstring");
379  } // noNonPSetUsage
380 
382  vString const& params,
383  std::string const& psetName,
384  std::string const& parameterLabel,
385  std::string const& type) {
386  vString::const_iterator end1 = v.end();
387  vString::const_iterator end2 = params.end();
388  for (vString::const_iterator i = v.begin(); i != end1; ++i) {
389  for (vString::const_iterator j = params.begin(); j != end2; ++j) {
390  if (*i == *j) {
391  flaws_ << psetName << " PSet: \n"
392  << *i << " (listed in vstring " << parameterLabel << ")\n"
393  << "is used as a parameter of type " << type << " instead of as a PSet \n";
394  }
395  }
396  }
397 
398  } // noBadParams
399 
401  vString::const_iterator end = v.end();
402  for (vString::const_iterator i = v.begin(); i != end; ++i) {
403  if ((*i) == "*")
404  return true;
405  }
406  return false;
407  }
408 
410  vString psnames;
411  pset.getParameterSetNames(psnames, false);
412  vString::const_iterator end = psnames.end();
413  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
414  if (lookForMatch(destinations_, *i))
415  continue;
416  if (lookForMatch(statistics_, *i))
417  continue;
418  if (lookForMatch(categories_, *i))
419  continue;
420  if ((*i) == "default")
421  continue;
422  ParameterSet empty_PSet;
423  bool ok_optionalPSet = false;
424  try {
425  ParameterSet const& culprit = pset.getUntrackedParameterSet((*i), empty_PSet);
426  ok_optionalPSet = culprit.getUntrackedParameter<bool>("placeholder", ok_optionalPSet);
427  ok_optionalPSet = culprit.getUntrackedParameter<bool>("optionalPSet", ok_optionalPSet);
428  } catch (cms::Exception& e) {
429  }
430  if (ok_optionalPSet)
431  continue;
432  flaws_ << "MessageLogger "
433  << " PSet: \n"
434  << *i << " is an unrecognized name for a PSet\n";
435  }
436  psnames.clear();
437  unsigned int n = pset.getParameterSetNames(psnames, true);
438  if (n > 0) {
439  end = psnames.end();
440  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
441  flaws_ << "MessageLogger "
442  << " PSet: \n"
443  << "PSet " << *i << " is tracked - not allowed\n";
444  }
445  }
446  }
447 
449  vString::const_iterator begin = v.begin();
450  vString::const_iterator end = v.end();
451  return (std::find(begin, end, s) != end);
452  }
453 
455  ParameterSet empty_PSet;
456  std::vector<std::string>::const_iterator end = destinations_.end();
457  for (std::vector<std::string>::const_iterator i = destinations_.begin(); i != end; ++i) {
458  ParameterSet const& d = pset.getUntrackedParameterSet(*i, empty_PSet);
459  destinationPSet(d, *i);
460  }
461  } // destinationPSets
462 
464  std::string const& psetName) {
465  // Category PSets
466 
467  categoryPSets(pset, psetName);
468 
469  // No other PSets -- unless they contain optionalPSet or placeholder=True
470 
471  noNoncategoryPsets(pset, psetName);
472 
473  // General parameters
474 
475  check<bool>(pset, psetName, "placeholder");
476  {
477  std::string thresh = check<std::string>(pset, "psetName", "statisticsThreshold");
478  if (!thresh.empty())
479  validateThreshold(thresh, psetName);
480  }
481  std::string thresh = check<std::string>(pset, "psetName", "threshold");
482  if (!thresh.empty())
483  validateThreshold(thresh, psetName);
484  check<bool>(pset, psetName, "noLineBreaks");
485  check<int>(pset, psetName, "lineLength");
486  check<bool>(pset, psetName, "noTimeStamps");
487  check<bool>(pset, psetName, "enableStatistics");
488  check<bool>(pset, psetName, "resetStatistics");
489  std::string s = check<std::string>(pset, "psetName", "filename");
490  if ((s == "cerr") || (s == "cout")) {
491  flaws_ << psetName << " PSet: \n" << s << " is not allowed as a value of filename \n";
492  }
493  s = check<std::string>(pset, "psetName", "extension");
494  if ((s == "cerr") || (s == "cout")) {
495  flaws_ << psetName << " PSet: \n" << s << " is not allowed as a value of extension \n";
496  }
497  s = check<std::string>(pset, "psetName", "output");
498 
499  // No other parameters
500 
501  noneExcept<int>(pset, psetName, "int", "lineLength");
502 
503  vString okbool;
504  okbool.push_back("placeholder");
505  okbool.push_back("optionalPSet");
506  okbool.push_back("noLineBreaks");
507  okbool.push_back("noTimeStamps");
508  okbool.push_back("enableStatistics");
509  okbool.push_back("resetStatistics");
510  noneExcept<bool>(pset, psetName, "bool", okbool);
511  vString okstring;
512  okstring.push_back("statisticsThreshold");
513  okstring.push_back("threshold");
514  okstring.push_back("output");
515  okstring.push_back("filename");
516  okstring.push_back("extension");
517  noneExcept<std::string>(pset, psetName, "string", okstring);
518 
519  } // destinationPSet
520 
522  ParameterSet empty_PSet;
523  ParameterSet const& pset = main_pset.getUntrackedParameterSet("default", empty_PSet);
524  std::string psetName = "default (at MessageLogger main level)";
525 
526  // Category PSets
527 
528  categoryPSets(pset, psetName);
529 
530  // No other PSets -- unless they contain optionalPSet or placeholder=True
531 
532  noNoncategoryPsets(pset, psetName);
533 
534  // Parameters applying to the default category
535 
536  catInts(pset, psetName, "default");
537 
538  // General parameters
539 
540  check<bool>(pset, psetName, "placeholder");
541  std::string thresh = check<std::string>(pset, "psetName", "threshold");
542  if (!thresh.empty())
543  validateThreshold(thresh, psetName);
544  check<bool>(pset, psetName, "noLineBreaks");
545  check<int>(pset, psetName, "limit");
546  check<int>(pset, psetName, "reportEvery");
547  check<int>(pset, psetName, "timespan");
548  check<int>(pset, psetName, "lineLength");
549  check<bool>(pset, psetName, "noTimeStamps");
550 
551  // No other parameters
552  vString okint;
553  okint.push_back("limit");
554  okint.push_back("reportEvery");
555  okint.push_back("timespan");
556  okint.push_back("lineLength");
557  noneExcept<int>(pset, psetName, "int", okint);
558  vString okbool;
559  okbool.push_back("placeholder");
560  okbool.push_back("optionalPSet");
561  okbool.push_back("noLineBreaks");
562  okbool.push_back("noTimeStamps");
563  noneExcept<bool>(pset, psetName, "bool", okbool);
564  vString okstring;
565  okstring.push_back("threshold");
566  noneExcept<std::string>(pset, psetName, "string", okstring);
567 
568  } // defaultPSet
569 
571  ParameterSet empty_PSet;
572  std::vector<std::string>::const_iterator end = statistics_.end();
573  for (std::vector<std::string>::const_iterator i = statistics_.begin(); i != end; ++i) {
574  if (lookForMatch(destinations_, *i))
575  continue;
576  ParameterSet const& d = pset.getUntrackedParameterSet(*i, empty_PSet);
577  statisticsPSet(d, *i);
578  }
579  } // statisticsPSets
580 
582  std::string const& psetName) {
583  // Category PSets
584 
585  categoryPSets(pset, psetName);
586 
587  // No other PSets -- unless they contain optionalPSet or placeholder=True
588 
589  noNoncategoryPsets(pset, psetName);
590 
591  // General parameters
592 
593  std::string thresh = check<std::string>(pset, "psetName", "threshold");
594  if (!thresh.empty())
595  validateThreshold(thresh, psetName);
596  check<bool>(pset, psetName, "placeholder");
597  check<bool>(pset, psetName, "reset");
598  std::string s = check<std::string>(pset, "psetName", "filename");
599  if ((s == "cerr") || (s == "cout")) {
600  flaws_ << psetName << " PSet: \n" << s << " is not allowed as a value of filename \n";
601  }
602  s = check<std::string>(pset, "psetName", "extension");
603  if ((s == "cerr") || (s == "cout")) {
604  flaws_ << psetName << " PSet: \n" << s << " is not allowed as a value of extension \n";
605  }
606  s = check<std::string>(pset, "psetName", "output");
607 
608  // No other parameters
609 
610  noneExcept<int>(pset, psetName, "int");
611 
612  vString okbool;
613  okbool.push_back("placeholder");
614  okbool.push_back("optionalPSet");
615  okbool.push_back("reset");
616  noneExcept<bool>(pset, psetName, "bool", okbool);
617  vString okstring;
618  okstring.push_back("output");
619  okstring.push_back("filename");
620  okstring.push_back("extension");
621  okstring.push_back("threshold");
622  noneExcept<std::string>(pset, psetName, "string", okstring);
623 
624  } // statisticsPSet
625 
627  std::string const& psetName) {
628  vString psnames;
629  pset.getParameterSetNames(psnames, false);
630  vString::const_iterator end = psnames.end();
631  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
632  if (lookForMatch(categories_, *i))
633  continue;
634  if ((*i) == "default")
635  continue;
636  if ((*i) == "ERROR")
637  continue;
638  if ((*i) == "WARNING")
639  continue;
640  if ((*i) == "FWKINFO")
641  continue;
642  if ((*i) == "INFO")
643  continue;
644  if ((*i) == "DEBUG")
645  continue;
646  ParameterSet empty_PSet;
647  bool ok_optionalPSet = false;
648  try {
649  ParameterSet const& culprit = pset.getUntrackedParameterSet((*i), empty_PSet);
650  ok_optionalPSet = culprit.getUntrackedParameter<bool>("placeholder", ok_optionalPSet);
651  ok_optionalPSet = culprit.getUntrackedParameter<bool>("optionalPSet", ok_optionalPSet);
652  } catch (cms::Exception& e) {
653  }
654  if (ok_optionalPSet)
655  continue;
656  flaws_ << psetName << " PSet: \n" << *i << " is an unrecognized name for a PSet in this context \n";
657  }
658  psnames.clear();
659  unsigned int n = pset.getParameterSetNames(psnames, true);
660  if (n > 0) {
661  end = psnames.end();
662  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
663  flaws_ << psetName << " PSet: \n"
664  << "PSet " << *i << " is tracked - not allowed\n";
665  }
666  }
667  } // noNoncategoryPsets
668 
670  std::string const& psetName) {
671  categoryPSet(pset, psetName, "ERROR");
672  categoryPSet(pset, psetName, "WARNING");
673  categoryPSet(pset, psetName, "FWKINFO");
674  categoryPSet(pset, psetName, "INFO");
675  categoryPSet(pset, psetName, "DEBUG");
676  if (psetName != "MessageLogger")
677  categoryPSet(pset, psetName, "default");
678  // The above conditional is because default in the main level is treated
679  // as a set of defaults differnt from those of a simple category.
680  std::vector<std::string>::const_iterator end = categories_.end();
681  for (std::vector<std::string>::const_iterator i = categories_.begin(); i != end; ++i) {
682  categoryPSet(pset, psetName, *i);
683  }
684  } // categoryPSets
685 
687  std::string const& OuterPsetName,
688  std::string const& categoryName) {
689  if (pset.existsAs<ParameterSet>(categoryName, true)) {
690  flaws_ << OuterPsetName << " PSet: \n"
691  << "Category PSet " << categoryName << " is tracked - not allowed\n";
692  return;
693  }
694  ParameterSet empty_PSet;
695  ParameterSet const& c = pset.getUntrackedParameterSet(categoryName, empty_PSet);
696  std::string const& psetName(OuterPsetName);
697  catInts(c, psetName, categoryName);
698  catNone<unsigned int>(c, psetName, categoryName, "unsigned int");
699  catBoolRestriction(c, psetName, categoryName, "bool");
700  catNone<float>(c, psetName, categoryName, "float");
701  catNone<double>(c, psetName, categoryName, "double");
702  catNone<std::string>(c, psetName, categoryName, "string");
703  catNone<vString>(c, psetName, categoryName, "vSting");
704  catNoPSets(c, psetName, categoryName);
705  } // categoryPSet
706 
708  std::string const& psetName,
709  std::string const& categoryName) {
710  vString x = pset.getParameterNamesForType<int>(false);
711  vString::const_iterator end = x.end();
712  for (vString::const_iterator i = x.begin(); i != end; ++i) {
713  if (*i == "limit")
714  continue;
715  if (*i == "reportEvery")
716  continue;
717  if (*i == "timespan")
718  continue;
719  flaws_ << categoryName << " category PSet nested in " << psetName << " PSet: \n"
720  << (*i) << " is not an allowed parameter within a category PSet \n";
721  }
722  x = pset.getParameterNamesForType<int>(true);
723  end = x.end();
724  for (vString::const_iterator i = x.begin(); i != end; ++i) {
725  flaws_ << categoryName << " category PSet nested in " << psetName << " PSet: \n"
726  << (*i) << " is used as a tracked int \n"
727  << "Tracked parameters not allowed here \n";
728  }
729  } // catInts()
730 
732  std::string const& psetName,
733  std::string const& categoryName) {
734  vString psnames;
735  pset.getParameterSetNames(psnames, false);
736  vString::const_iterator end = psnames.end();
737  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
738  flaws_ << categoryName << " category PSet nested in " << psetName << " PSet: \n"
739  << *i << " is used as a PSet\n"
740  << "PSets not allowed within a category PSet\n";
741  }
742  psnames.clear();
743  unsigned int n = pset.getParameterSetNames(psnames, true);
744  if (n > 0) {
745  end = psnames.end();
746  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
747  flaws_ << categoryName << " category PSet nested in " << psetName << " PSet: \n"
748  << *i << " is used as a tracked PSet\n"
749  << "tracked parameters not permitted, and "
750  << "PSets not allowed within a category PSet\n";
751  }
752  }
753  } // catNoPSets
754 
756  std::string const& psetName,
757  std::string const& categoryName,
758  std::string const& type) {
759  vString x = pset.getParameterNamesForType<bool>(false);
760  vString::const_iterator end = x.end();
761  for (vString::const_iterator i = x.begin(); i != end; ++i) {
762  if (((*i) == "placeholder") || ((*i) == "optionalPSet"))
763  continue;
764  flaws_ << categoryName << " category PSet nested in " << psetName << " PSet: \n"
765  << (*i) << " is used as a " << type << "\n"
766  << "Usage of " << type << " is not recognized here\n";
767  }
768  x = pset.getParameterNamesForType<bool>(true);
769  end = x.end();
770  for (vString::const_iterator i = x.begin(); i != end; ++i) {
771  flaws_ << categoryName << " category PSet nested in " << psetName << " PSet: \n"
772  << (*i) << " is used as a tracked " << type << "\n"
773  << "Tracked parameters not allowed here, "
774  << " and even untracked it would not be recognized\n";
775  }
776  } // catBoolRestriction()
777 
778  } // end of namespace service
779 } // end of namespace edm
void statisticsPSet(ParameterSet const &pset, std::string const &psetName)
bool lookForMatch(vString const &v, std::string const &s)
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
void destinationPSet(ParameterSet const &pset, std::string const &psetName)
void vStringsCheck(ParameterSet const &pset, std::string const &psetName)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void noCoutCerrClash(vString const &v, std::string const &psetName, std::string const &parameterLabel)
T getUntrackedParameter(std::string const &, T const &) const
uint64_t word
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void noKeywords(vString const &v, std::string const &psetName, std::string const &parameterLabel)
void noDuplicates(vString const &v, std::string const &psetName, std::string const &parameterLabel)
void catNoPSets(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
d
Definition: ztail.py:151
void noBadParams(vString const &v, vString const &params, std::string const &psetName, std::string const &parameterLabel, std::string const &type)
void noNonPSetUsage(ParameterSet const &pset, vString const &v, std::string const &psetName, std::string const &parameterLabel)
std::string operator()(ParameterSet const &pset)
bool validateThreshold(std::string const &thresh, std::string const &psetName)
void noNoncategoryPsets(ParameterSet const &pset, std::string const &psetName)
HLT enums.
void catBoolRestriction(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName, std::string const &type)
float x
void categoryPSet(ParameterSet const &pset, std::string const &OuterPsetName, std::string const &categoryName)
void catInts(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)