23 using namespace edm::service;
29 messageLoggerPSet(pset);
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")))) {
53 suppressionLists(pset);
57 vStringsCheck(pset,
"MessageLogger");
61 check<bool>(
pset,
"MessageLogger",
"messageSummaryToJobReport");
62 std::string dumps = check<std::string>(
pset,
"MessageLogger",
"generate_preconfiguration_message");
65 validateThreshold(thresh,
"MessageLogger");
66 check<unsigned int>(
pset,
"MessageLogger",
"waiting_threshold");
70 destinationPSets(pset);
72 statisticsPSets(pset);
73 categoryPSets(pset,
"MessageLogger");
81 noneExcept<int>(
pset,
"MessageLogger",
"int");
82 noneExcept<unsigned int>(
pset,
"MessageLogger",
"unsigned int",
"waiting_threshold");
83 noneExcept<bool>(
pset,
"MessageLogger",
"bool",
"messageSummaryToJobReport");
86 noneExcept<float>(
pset,
"MessageLogger",
"float");
87 noneExcept<double>(
pset,
"MessageLogger",
"double");
88 noneExcept<std::string>(
pset,
"MessageLogger",
"string",
"threshold",
"generate_preconfiguration_message");
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 "
102 destinations_ = check<vString>(
pset,
"MessageLogger",
"destinations");
103 noDuplicates(destinations_,
"MessageLogger",
"destinations");
104 noKeywords(destinations_,
"MessageLogger",
"destinations");
105 noNonPSetUsage(pset, destinations_,
"MessageLogger",
"destinations");
108 statistics_ = check<vString>(
pset,
"MessageLogger",
"statistics");
109 noDuplicates(statistics_,
"MessageLogger",
"statistics");
110 noKeywords(statistics_,
"MessageLogger",
"statistics");
111 noNonPSetUsage(pset, statistics_,
"MessageLogger",
"statistics");
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");
123 debugModules_ = check<vString>(
pset,
"MessageLogger",
"debugModules");
124 bool dmStar = wildcard(debugModules_);
125 if (dmStar && debugModules_.size() != 1) {
126 flaws_ <<
"MessageLogger"
128 <<
"debugModules contains wildcard character *"
129 <<
" and also " << debugModules_.size() - 1 <<
" other entries - * must be alone\n";
131 suppressDebug_ = check<vString>(
pset,
"MessageLogger",
"suppressDebug");
132 if ((!suppressDebug_.empty()) && (!dmStar)) {
133 flaws_ <<
"MessageLogger"
135 <<
"suppressDebug contains modules, but debugModules is not *\n"
136 <<
"Unless all the debugModules are enabled,\n"
137 <<
"suppressing specific modules is meaningless\n";
139 if (wildcard(suppressDebug_)) {
140 flaws_ <<
"MessageLogger"
142 <<
"Use of wildcard (*) in suppressDebug is not supported\n"
143 <<
"By default, LogDebug is suppressed for all modules\n";
145 suppressInfo_ = check<vString>(
pset,
"MessageLogger",
"suppressInfo");
146 if (wildcard(suppressInfo_)) {
147 flaws_ <<
"MessageLogger"
149 <<
"Use of wildcard (*) in suppressInfo is not supported\n";
151 suppressFwkInfo_ = check<vString>(
pset,
"MessageLogger",
"suppressFwkInfo");
152 if (wildcard(suppressFwkInfo_)) {
153 flaws_ <<
"MessageLogger"
155 <<
"Use of wildcard (*) in suppressFwkInfo is not supported\n";
157 suppressWarning_ = check<vString>(
pset,
"MessageLogger",
"suppressWarning");
158 if (wildcard(suppressWarning_)) {
159 flaws_ <<
"MessageLogger"
161 <<
"Use of wildcard (*) in suppressWarning is not supported\n";
163 suppressError_ = check<vString>(
pset,
"MessageLogger",
"suppressError");
164 if (wildcard(suppressError_)) {
165 flaws_ <<
"MessageLogger"
167 <<
"Use of wildcard (*) in suppressError is not supported\n";
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"
180 << (*i) <<
" is used as a vstring, "
181 <<
"but no such vstring is recognized\n";
185 end = vStrings.end();
186 for (vString::const_iterator
i = vStrings.begin();
i !=
end; ++
i) {
187 flaws_ <<
"MessageLogger"
189 << (*i) <<
" is used as a tracked vstring: "
190 <<
"tracked parameters not allowed here\n";
195 if (s ==
"destinations")
197 if (s ==
"statistics")
199 if (s ==
"destinations")
201 if (s ==
"categories")
203 if (s ==
"debugModules")
205 if (s ==
"suppressInfo")
207 if (s ==
"suppressFwkInfo")
209 if (s ==
"suppressDebug")
211 if (s ==
"suppressWarning")
213 if (s ==
"suppressError")
220 if (checkThreshold(thresh))
222 flaws_ << psetName <<
" PSet: \n"
223 <<
"threshold has value " << thresh <<
" which is not among {DEBUG, INFO, FWKINFO, WARNING, ERROR}\n";
228 if (thresh ==
"WARNING")
230 if (thresh ==
"INFO")
232 if (thresh ==
"FWKINFO")
234 if (thresh ==
"ERROR")
236 if (thresh ==
"DEBUG")
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) {
248 flaws_ << psetName <<
" PSet: \n"
249 <<
"in vString " << parameterLabel <<
" duplication of the string " << *
i <<
"\n";
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) {
265 flaws_ << psetName <<
" PSet: \n"
266 <<
"in vStrings " << p1 <<
" and " << p2 <<
" duplication of the string " << *
i <<
"\n";
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) {
284 if (coutPresent && cerrPresent) {
285 flaws_ << psetName <<
" PSet: \n"
286 <<
"vString " << parameterLabel <<
" has both cout and cerr \n";
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";
303 if (word ==
"default")
305 if (word ==
"categories")
307 if (word ==
"destinations")
309 if (word ==
"statistics")
311 if (word ==
"debugModules")
313 if (word ==
"suppressInfo")
315 if (word ==
"suppressFwkInfo")
317 if (word ==
"suppressDebug")
319 if (word ==
"suppressWarning")
321 if (word ==
"suppressError")
323 if (word ==
"threshold")
327 if (word ==
"WARNING")
329 if (word ==
"FWKINFO")
335 if (word ==
"placeholder")
339 if (word ==
"reportEvery")
341 if (word ==
"timespan")
343 if (word ==
"noLineBreaks")
345 if (word ==
"lineLength")
347 if (word ==
"noTimeStamps")
349 if (word ==
"output")
351 if (word ==
"filename")
353 if (word ==
"extension")
357 if (word ==
"optionalPSet")
359 if (word ==
"enableStatistics")
361 if (word ==
"statisticsThreshold")
363 if (word ==
"resetStatistics")
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");
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) {
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";
401 vString::const_iterator
end = v.end();
402 for (vString::const_iterator
i = v.begin();
i !=
end; ++
i) {
412 vString::const_iterator
end = psnames.end();
413 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
414 if (lookForMatch(destinations_, *
i))
416 if (lookForMatch(statistics_, *
i))
418 if (lookForMatch(categories_, *
i))
420 if ((*
i) ==
"default")
423 bool ok_optionalPSet =
false;
432 flaws_ <<
"MessageLogger "
434 << *
i <<
" is an unrecognized name for a PSet\n";
440 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
441 flaws_ <<
"MessageLogger "
443 <<
"PSet " << *
i <<
" is tracked - not allowed\n";
449 vString::const_iterator
begin = v.begin();
450 vString::const_iterator
end = v.end();
451 return (
std::find(begin, end, s) != end);
456 std::vector<std::string>::const_iterator
end = destinations_.end();
457 for (std::vector<std::string>::const_iterator
i = destinations_.begin();
i !=
end; ++
i) {
459 destinationPSet(d, *
i);
467 categoryPSets(pset, psetName);
471 noNoncategoryPsets(pset, psetName);
475 check<bool>(
pset, psetName,
"placeholder");
479 validateThreshold(thresh, psetName);
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");
490 if ((s ==
"cerr") || (s ==
"cout")) {
491 flaws_ << psetName <<
" PSet: \n" << s <<
" is not allowed as a value of filename \n";
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";
497 s = check<std::string>(
pset,
"psetName",
"output");
501 noneExcept<int>(
pset, psetName,
"int",
"lineLength");
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);
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);
524 std::string psetName =
"default (at MessageLogger main level)";
528 categoryPSets(pset, psetName);
532 noNoncategoryPsets(pset, psetName);
536 catInts(pset, psetName,
"default");
540 check<bool>(
pset, psetName,
"placeholder");
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");
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);
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);
565 okstring.push_back(
"threshold");
566 noneExcept<std::string>(
pset, psetName,
"string", okstring);
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))
577 statisticsPSet(d, *
i);
585 categoryPSets(pset, psetName);
589 noNoncategoryPsets(pset, psetName);
595 validateThreshold(thresh, psetName);
596 check<bool>(
pset, psetName,
"placeholder");
597 check<bool>(
pset, psetName,
"reset");
599 if ((s ==
"cerr") || (s ==
"cout")) {
600 flaws_ << psetName <<
" PSet: \n" << s <<
" is not allowed as a value of filename \n";
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";
606 s = check<std::string>(
pset,
"psetName",
"output");
610 noneExcept<int>(
pset, psetName,
"int");
613 okbool.push_back(
"placeholder");
614 okbool.push_back(
"optionalPSet");
615 okbool.push_back(
"reset");
616 noneExcept<bool>(
pset, psetName,
"bool", okbool);
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);
630 vString::const_iterator
end = psnames.end();
631 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
632 if (lookForMatch(categories_, *
i))
634 if ((*
i) ==
"default")
638 if ((*
i) ==
"WARNING")
640 if ((*
i) ==
"FWKINFO")
647 bool ok_optionalPSet =
false;
656 flaws_ << psetName <<
" PSet: \n" << *
i <<
" is an unrecognized name for a PSet in this context \n";
662 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
663 flaws_ << psetName <<
" PSet: \n"
664 <<
"PSet " << *
i <<
" is tracked - not allowed\n";
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");
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);
690 flaws_ << OuterPsetName <<
" PSet: \n"
691 <<
"Category PSet " << categoryName <<
" is tracked - not allowed\n";
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);
711 vString::const_iterator
end = x.end();
712 for (vString::const_iterator
i = x.begin();
i !=
end; ++
i) {
715 if (*
i ==
"reportEvery")
717 if (*
i ==
"timespan")
719 flaws_ << categoryName <<
" category PSet nested in " << psetName <<
" PSet: \n"
720 << (*i) <<
" is not an allowed parameter within a category PSet \n";
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";
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";
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";
760 vString::const_iterator
end = x.end();
761 for (vString::const_iterator
i = x.begin();
i !=
end; ++
i) {
762 if (((*
i) ==
"placeholder") || ((*i) ==
"optionalPSet"))
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";
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";
void psetLists(ParameterSet const &pset)
T getUntrackedParameter(std::string const &, T const &) const
void statisticsPSet(ParameterSet const &pset, std::string const &psetName)
const edm::EventSetup & c
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool lookForMatch(vString const &v, std::string const &s)
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
bool wildcard(vString const &v)
void destinationPSet(ParameterSet const &pset, std::string const &psetName)
void vStringsCheck(ParameterSet const &pset, std::string const &psetName)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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)
std::vector< String > vString
void noCoutCerrClash(vString const &v, std::string const &psetName, std::string const ¶meterLabel)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
void noKeywords(vString const &v, std::string const &psetName, std::string const ¶meterLabel)
void noDuplicates(vString const &v, std::string const &psetName, std::string const ¶meterLabel)
void catNoPSets(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
bool keywordCheck(std::string const &word)
void noBadParams(vString const &v, vString const ¶ms, std::string const &psetName, std::string const ¶meterLabel, std::string const &type)
void noNonPSetUsage(ParameterSet const &pset, vString const &v, std::string const &psetName, std::string const ¶meterLabel)
void destinationPSets(ParameterSet const &pset)
void noOtherPsets(ParameterSet const &pset)
bool checkThreshold(std::string const &thresh)
std::string operator()(ParameterSet const &pset)
bool validateThreshold(std::string const &thresh, std::string const &psetName)
bool allowedVstring(std::string const &s)
void noNoncategoryPsets(ParameterSet const &pset, std::string const &psetName)
void catBoolRestriction(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName, std::string const &type)
void statisticsPSets(ParameterSet const &pset)
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)
void messageLoggerPSet(ParameterSet const &pset)
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
void defaultPSet(ParameterSet const &main_pset)
void suppressionLists(ParameterSet const &pset)