25 using namespace edm::service;
34 messageLoggerPSet (pset);
54 suppressionLists(pset);
58 vStringsCheck(pset,
"MessageLogger");
63 (
pset,
"MessageLogger",
"messageSummaryToJobReport" );
65 (
pset,
"MessageLogger",
"generate_preconfiguration_message" );
67 (
pset,
"MessageLogger",
"threshold" );
68 if (!thresh.empty()) validateThreshold(thresh,
"MessageLogger");
72 destinationPSets(pset);
74 statisticsPSets(pset);
75 fwkJobReportPSets(pset);
76 categoryPSets(pset,
"MessageLogger");
84 noneExcept <int> (
pset,
"MessageLogger",
"int");
85 noneExcept <unsigned int> (
pset,
"MessageLogger",
"unsigned int");
86 noneExcept <bool> (
pset,
"MessageLogger",
"bool",
"messageSummaryToJobReport");
89 noneExcept <float> (
pset,
"MessageLogger",
"float");
90 noneExcept <double> (
pset,
"MessageLogger",
"double");
91 noneExcept <std::string> (
pset,
"MessageLogger",
"string",
92 "threshold",
"generate_preconfiguration_message");
96 if (!flaws.str().empty()) {
97 flaws <<
"\nThe above are from MessageLogger configuration validation.\n"
98 <<
"In most cases, these involve lines that the logger configuration code\n"
99 <<
"would not process, but which the cfg creator obviously meant to have "
110 (
pset,
"MessageLogger",
"destinations");
111 noDuplicates(
destinations,
"MessageLogger",
"destinations");
112 noKeywords(
destinations,
"MessageLogger",
"destinations");
113 noNonPSetUsage(pset,
destinations,
"MessageLogger",
"destinations");
117 (
pset,
"MessageLogger",
"statistics");
118 noDuplicates(
statistics,
"MessageLogger",
"statistics");
119 noKeywords(
statistics,
"MessageLogger",
"statistics");
120 noNonPSetUsage(pset,
statistics,
"MessageLogger",
"statistics");
123 (
pset,
"MessageLogger",
"fwkJobReports");
124 noDuplicates(
fwkJobReports,
"MessageLogger",
"fwkJobReports");
126 noNonPSetUsage(pset,
fwkJobReports,
"MessageLogger",
"fwkJobReports");
128 "MessageLogger",
"fwkJobReports",
"destinations");
130 "MessageLogger",
"fwkJobReports",
"statistics");
133 (
pset,
"MessageLogger",
"categories");
134 noDuplicates(
categories,
"MessageLogger",
"categories");
135 noKeywords(
categories,
"MessageLogger",
"categories");
136 noNonPSetUsage(pset,
categories,
"MessageLogger",
"categories");
138 "MessageLogger",
"categories",
"destinations");
140 "MessageLogger",
"categories",
"statistics");
142 "MessageLogger",
"categories",
"fwkJobReports");
144 messageIDs = check<vString>
145 (
pset,
"MessageLogger",
"messageIDs");
146 noDuplicates(messageIDs,
"MessageLogger",
"messageIDs");
147 noKeywords(messageIDs,
"MessageLogger",
"messageIDs");
148 noNonPSetUsage(pset, messageIDs,
"MessageLogger",
"messageIDs");
150 "MessageLogger",
"messageIDs",
"destinations");
152 "MessageLogger",
"messageIDs",
"statistics");
154 "MessageLogger",
"messageIDs",
"fwkJobReports");
156 "MessageLogger",
"messageIDs",
"categories");
165 (
pset,
"MessageLogger",
"debugModules");
168 flaws <<
"MessageLogger" <<
" PSet: \n"
169 <<
"debugModules contains wildcard character *"
171 <<
" other entries - * must be alone\n";
174 (
pset,
"MessageLogger",
"suppressDebug");
176 flaws <<
"MessageLogger" <<
" PSet: \n"
177 <<
"suppressDebug contains modules, but debugModules is not *\n"
178 <<
"Unless all the debugModules are enabled,\n"
179 <<
"suppressing specific modules is meaningless\n";
182 flaws <<
"MessageLogger" <<
" PSet: \n"
183 <<
"Use of wildcard (*) in suppressDebug is not supported\n"
184 <<
"By default, LogDebug is suppressed for all modules\n";
187 (
pset,
"MessageLogger",
"suppressInfo");
189 flaws <<
"MessageLogger" <<
" PSet: \n"
190 <<
"Use of wildcard (*) in suppressInfo is not supported\n";
193 (
pset,
"MessageLogger",
"suppressWarning");
195 flaws <<
"MessageLogger" <<
" PSet: \n"
196 <<
"Use of wildcard (*) in suppressWarning is not supported\n";
198 suppressError = check<vString>
199 (
pset,
"MessageLogger",
"suppressError");
200 if (wildcard(suppressError)) {
201 flaws <<
"MessageLogger" <<
" PSet: \n"
202 <<
"Use of wildcard (*) in suppressError is not supported\n";
213 vString::const_iterator
end = vStrings.end();
214 for ( vString::const_iterator
i = vStrings.begin();
i !=
end; ++
i ) {
215 if ( !allowedVstring(*
i) ) {
216 flaws <<
"MessageLogger" <<
" PSet: \n"
217 << (*i) <<
" is used as a vstring, "
218 <<
"but no such vstring is recognized\n";
222 end = vStrings.end();
223 for ( vString::const_iterator
i = vStrings.begin();
i !=
end; ++
i ) {
224 flaws <<
"MessageLogger" <<
" PSet: \n"
225 << (*i) <<
" is used as a tracked vstring: "
226 <<
"tracked parameters not allowed here\n";
234 if (s ==
"destinations")
return true;
235 if (s ==
"statistics")
return true;
236 if (s ==
"destinations")
return true;
237 if (s ==
"fwkJobReports")
return true;
238 if (s ==
"categories")
return true;
239 if (s ==
"messageIDs")
return true;
240 if (s ==
"debugModules")
return true;
241 if (s ==
"suppressInfo")
return true;
242 if (s ==
"suppressDebug")
return true;
243 if (s ==
"suppressWarning")
return true;
244 if (s ==
"suppressError")
return true;
254 if (checkThreshold(thresh))
return true;
255 flaws << psetName <<
" PSet: \n"
256 <<
"threshold has value " << thresh
257 <<
" which is not among {DEBUG, INFO, WARNING, ERROR}\n";
265 if (thresh ==
"WARNING")
return true;
266 if (thresh ==
"INFO")
return true;
267 if (thresh ==
"ERROR")
return true;
268 if (thresh ==
"DEBUG")
return true;
277 vString::const_iterator
end = v.end();
278 for (vString::const_iterator
i = v.begin();
i !=
end; ++
i) {
279 for (vString::const_iterator
j =
i+1;
j !=
end; ++
j) {
281 flaws << psetName <<
" PSet: \n"
282 <<
"in vString " << parameterLabel
283 <<
" duplication of the string " << *
i <<
"\n";
295 vString::const_iterator end1 = v1.end();
296 vString::const_iterator end2 = v2.end();
297 for (vString::const_iterator
i = v1.begin();
i != end1; ++
i) {
298 for (vString::const_iterator
j = v2.begin();
j != end2; ++
j) {
300 flaws << psetName <<
" PSet: \n"
301 <<
"in vStrings " << p1 <<
" and " << p2
302 <<
" duplication of the string " << *
i <<
"\n";
313 vString::const_iterator
end = v.end();
314 bool coutPresent =
false;
315 bool cerrPresent =
false;
316 for (vString::const_iterator
i = v.begin();
i !=
end; ++
i) {
317 if ( *
i ==
"cout" ) coutPresent =
true;
318 if ( *
i ==
"cerr" ) cerrPresent =
true;
320 if (coutPresent && cerrPresent) {
321 flaws << psetName <<
" PSet: \n"
322 <<
"vString " << parameterLabel
323 <<
" has both cout and cerr \n";
332 vString::const_iterator
end = v.end();
333 for (vString::const_iterator
i = v.begin();
i !=
end; ++
i) {
334 if (!keywordCheck(*
i)) {
335 flaws << psetName <<
" PSet: \n"
336 <<
"vString " << parameterLabel
337 <<
" should not contain the keyword " << *
i <<
"\n";
346 if (word ==
"default")
return false;
347 if (word ==
"categories")
return false;
348 if (word ==
"messageIDs")
return false;
349 if (word ==
"fwkJobReports")
return false;
350 if (word ==
"destinations")
return false;
351 if (word ==
"statistics")
return false;
352 if (word ==
"debugModules")
return false;
353 if (word ==
"suppressInfo")
return false;
354 if (word ==
"suppressDebug")
return false;
355 if (word ==
"suppressWarning")
return false;
356 if (word ==
"suppressError")
return false;
357 if (word ==
"threshold")
return false;
358 if (word ==
"ERROR")
return false;
359 if (word ==
"WARNING")
return false;
360 if (word ==
"INFO")
return false;
361 if (word ==
"DEBUG")
return false;
362 if (word ==
"placeholder")
return false;
363 if (word ==
"limit")
return false;
364 if (word ==
"reportEvery")
return false;
365 if (word ==
"timespan")
return false;
366 if (word ==
"noLineBreaks")
return false;
367 if (word ==
"lineLength")
return false;
368 if (word ==
"noTimeStamps")
return false;
369 if (word ==
"output")
return false;
370 if (word ==
"filename")
return false;
371 if (word ==
"extension")
return false;
372 if (word ==
"reset")
return false;
373 if (word ==
"optionalPSet")
return false;
383 disallowedParam <int> (
pset,
v, psetName, parameterLabel,
"int" );
384 disallowedParam <unsigned int> (
pset,
v, psetName, parameterLabel,
"uint" );
385 disallowedParam <bool> (
pset,
v, psetName, parameterLabel,
"bool" );
386 disallowedParam <float> (
pset,
v, psetName, parameterLabel,
"float" );
387 disallowedParam <double> (
pset,
v, psetName, parameterLabel,
"double" );
388 disallowedParam <std::string> (
pset,
v, psetName, parameterLabel,
"string" );
389 disallowedParam <std::vector<std::string> >
390 (
pset,
v, psetName, parameterLabel,
"vstring" );
400 vString::const_iterator end1 = v.end();
401 vString::const_iterator end2 = params.end();
402 for (vString::const_iterator
i = v.begin();
i != end1; ++
i) {
403 for (vString::const_iterator
j = params.begin();
j != end2; ++
j) {
405 flaws << psetName <<
" PSet: \n"
406 << *
i <<
" (listed in vstring " << parameterLabel <<
")\n"
407 <<
"is used as a parameter of type " << type
408 <<
" instead of as a PSet \n";
419 vString::const_iterator
end = v.end();
420 for (vString::const_iterator
i = v.begin();
i !=
end; ++
i) {
421 if ((*
i) ==
"*")
return true;
432 vString::const_iterator
end = psnames.end();
433 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
438 if ( lookForMatch (messageIDs, *
i) )
continue;
439 if ( (*
i) ==
"default" )
continue;
441 bool ok_optionalPSet =
false;
451 if (ok_optionalPSet)
continue;
452 flaws <<
"MessageLogger " <<
" PSet: \n"
453 << *
i <<
" is an unrecognized name for a PSet\n";
459 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
460 flaws <<
"MessageLogger " <<
" PSet: \n"
461 <<
"PSet " << *
i <<
" is tracked - not allowed\n";
470 vString::const_iterator
begin = v.begin();
471 vString::const_iterator
end = v.end();
472 return (
std::find(begin, end, s) != end );
481 for ( std::vector<std::string>::const_iterator
i =
destinations.begin();
484 destinationPSet(d,*
i);
494 categoryPSets (pset, psetName);
498 noNoncategoryPsets (pset, psetName);
502 check <bool> (
pset, psetName,
"placeholder" );
504 if (!thresh.empty()) validateThreshold(thresh, psetName);
505 check <bool> (
pset, psetName,
"noLineBreaks" );
506 check <int> (
pset, psetName,
"lineLength" );
507 check <bool> (
pset, psetName,
"noTimeStamps" );
509 if ( (s ==
"cerr") || (s ==
"cout") ) {
510 flaws << psetName <<
" PSet: \n"
511 << s <<
" is not allowed as a value of filename \n";
513 s = check<std::string> (
pset,
"psetName",
"extension" );
514 if ( (s ==
"cerr") || (s ==
"cout") ) {
515 flaws << psetName <<
" PSet: \n"
516 << s <<
" is not allowed as a value of extension \n";
518 s = check<std::string> (
pset,
"psetName",
"output" );
522 noneExcept <int> (
pset, psetName,
"int",
"lineLength");
525 okbool.push_back (
"placeholder");
526 okbool.push_back (
"optionalPSet");
527 okbool.push_back (
"noLineBreaks");
528 okbool.push_back (
"noTimeStamps");
529 noneExcept <bool> (
pset, psetName,
"bool", okbool);
531 okstring.push_back (
"threshold");
532 okstring.push_back (
"output");
533 okstring.push_back (
"filename");
534 okstring.push_back (
"extension");
535 noneExcept <std::string> (
pset, psetName,
"string", okstring);
545 std::string psetName =
"default (at MessageLogger main level)";
549 categoryPSets (pset, psetName);
553 noNoncategoryPsets (pset, psetName);
557 catInts ( pset, psetName,
"default" );
561 check <bool> (
pset, psetName,
"placeholder" );
563 if (!thresh.empty()) validateThreshold(thresh, psetName);
564 check <bool> (
pset, psetName,
"noLineBreaks" );
565 check <int> (
pset, psetName,
"limit" );
566 check <int> (
pset, psetName,
"reportEvery" );
567 check <int> (
pset, psetName,
"timespan" );
568 check <int> (
pset, psetName,
"lineLength" );
569 check <bool> (
pset, psetName,
"noTimeStamps" );
573 okint.push_back(
"limit");
574 okint.push_back(
"reportEvery");
575 okint.push_back(
"timespan");
576 okint.push_back(
"lineLength");
577 noneExcept <int> (
pset, psetName,
"int", okint);
579 okbool.push_back (
"placeholder");
580 okbool.push_back (
"optionalPSet");
581 okbool.push_back (
"noLineBreaks");
582 okbool.push_back (
"noTimeStamps");
583 noneExcept <bool> (
pset, psetName,
"bool", okbool);
585 okstring.push_back (
"threshold");
586 noneExcept <std::string> (
pset, psetName,
"string", okstring);
595 std::vector<std::string>::const_iterator
end =
statistics.end();
596 for ( std::vector<std::string>::const_iterator
i =
statistics.begin();
600 statisticsPSet(d,*
i);
610 categoryPSets (pset, psetName);
614 noNoncategoryPsets (pset, psetName);
619 if (!thresh.empty()) validateThreshold(thresh, psetName);
620 check <bool> (
pset, psetName,
"placeholder" );
621 check <bool> (
pset, psetName,
"reset" );
623 if ( (s ==
"cerr") || (s ==
"cout") ) {
624 flaws << psetName <<
" PSet: \n"
625 << s <<
" is not allowed as a value of filename \n";
627 s = check<std::string> (
pset,
"psetName",
"extension" );
628 if ( (s ==
"cerr") || (s ==
"cout") ) {
629 flaws << psetName <<
" PSet: \n"
630 << s <<
" is not allowed as a value of extension \n";
632 s = check<std::string> (
pset,
"psetName",
"output" );
636 noneExcept <int> (
pset, psetName,
"int");
639 okbool.push_back (
"placeholder");
640 okbool.push_back (
"optionalPSet");
641 okbool.push_back (
"reset");
642 noneExcept <bool> (
pset, psetName,
"bool", okbool);
644 okstring.push_back (
"output");
645 okstring.push_back (
"filename");
646 okstring.push_back (
"extension");
647 okstring.push_back (
"threshold");
648 noneExcept <std::string> (
pset, psetName,
"string", okstring);
658 for ( std::vector<std::string>::const_iterator
i =
fwkJobReports.begin();
661 fwkJobReportPSet(d,*
i);
671 categoryPSets (pset, psetName);
675 noNoncategoryPsets (pset, psetName);
679 check <bool> (
pset, psetName,
"placeholder" );
681 if ( (s ==
"cerr") || (s ==
"cout") ) {
682 flaws << psetName <<
" PSet: \n"
683 << s <<
" is not allowed as a value of filename \n";
685 s = check<std::string> (
pset,
"psetName",
"extension" );
686 if ( (s ==
"cerr") || (s ==
"cout") ) {
687 flaws << psetName <<
" PSet: \n"
688 << s <<
" is not allowed as a value of extension \n";
690 s = check<std::string> (
pset,
"psetName",
"output" );
694 noneExcept <int> (
pset, psetName,
"int");
697 okbool.push_back (
"placeholder");
698 okbool.push_back (
"optionalPSet");
699 noneExcept <bool> (
pset, psetName,
"bool", okbool);
701 okstring.push_back (
"output");
702 okstring.push_back (
"filename");
703 okstring.push_back (
"extension");
704 noneExcept <std::string> (
pset, psetName,
"string", okstring);
714 vString::const_iterator
end = psnames.end();
715 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
717 if ( lookForMatch (messageIDs, *
i) )
continue;
718 if ( (*
i) ==
"default" )
continue;
719 if ( (*
i) ==
"ERROR" )
continue;
720 if ( (*
i) ==
"WARNING" )
continue;
721 if ( (*
i) ==
"INFO" )
continue;
722 if ( (*
i) ==
"DEBUG" )
continue;
724 bool ok_optionalPSet =
false;
734 if (ok_optionalPSet)
continue;
735 flaws << psetName <<
" PSet: \n"
736 << *
i <<
" is an unrecognized name for a PSet in this context \n";
742 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
743 flaws << psetName <<
" PSet: \n"
744 <<
"PSet " << *
i <<
" is tracked - not allowed\n";
753 categoryPSet (pset, psetName,
"ERROR" );
754 categoryPSet (pset, psetName,
"WARNING");
755 categoryPSet (pset, psetName,
"INFO" ) ;
756 categoryPSet (pset, psetName,
"DEBUG" );
757 if (psetName !=
"MessageLogger") categoryPSet (pset, psetName,
"default");
760 std::vector<std::string>::const_iterator
end =
categories.end();
761 for (std::vector<std::string>::const_iterator
i =
categories.begin();
763 categoryPSet(pset, psetName, *
i);
773 flaws << OuterPsetName <<
" PSet: \n"
774 <<
"Category PSet " << categoryName
775 <<
" is tracked - not allowed\n";
781 catInts ( c, psetName, categoryName );
782 catNone <unsigned int> (
c, psetName, categoryName,
"unsigned int" );
783 catBoolRestriction ( c, psetName, categoryName,
"bool" );
784 catNone <float> (
c, psetName, categoryName,
"float" );
785 catNone <double> (
c, psetName, categoryName,
"double" );
786 catNone <std::string> (
c, psetName, categoryName,
"string" );
787 catNone <vString> (
c, psetName, categoryName,
"vSting" );
788 catNoPSets ( c, psetName, categoryName );
798 vString::const_iterator
end = x.end();
799 for ( vString::const_iterator
i = x.begin();
i !=
end; ++
i ) {
800 if ( *
i ==
"limit" )
continue;
801 if ( *
i ==
"reportEvery" )
continue;
802 if ( *
i ==
"timespan" )
continue;
803 flaws << categoryName <<
" category PSet nested in "
804 << psetName <<
" PSet: \n"
805 << (*i) <<
" is not an allowed parameter within a category PSet \n";
809 for ( vString::const_iterator
i = x.begin();
i !=
end; ++
i ) {
810 flaws << categoryName <<
" category PSet nested in "
811 << psetName <<
" PSet: \n"
812 << (*i) <<
" is used as a tracked int \n"
813 <<
"Tracked parameters not allowed here \n";
825 vString::const_iterator
end = psnames.end();
826 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
827 flaws << categoryName <<
" category PSet nested in "
828 << psetName <<
" PSet: \n"
829 << *
i <<
" is used as a PSet\n"
830 <<
"PSets not allowed within a category PSet\n";
836 for (vString::const_iterator
i = psnames.begin();
i !=
end; ++
i) {
837 flaws << categoryName <<
" category PSet nested in "
838 << psetName <<
" PSet: \n"
839 << *
i <<
" is used as a tracked PSet\n"
840 <<
"tracked parameters not permitted, and "
841 <<
"PSets not allowed within a category PSet\n";
854 vString::const_iterator
end = x.end();
855 for ( vString::const_iterator
i = x.begin();
i !=
end; ++
i ) {
856 if ( ((*
i) ==
"placeholder") || ((*i) ==
"optionalPSet") )
continue;
857 flaws << categoryName <<
" category PSet nested in "
858 << psetName <<
" PSet: \n"
859 << (*i) <<
" is used as a " << type <<
"\n"
860 <<
"Usage of " << type <<
" is not recognized here\n";
864 for ( vString::const_iterator
i = x.begin();
i !=
end; ++
i ) {
865 flaws << categoryName <<
" category PSet nested in "
866 << psetName <<
" PSet: \n"
867 << (*i) <<
" is used as a tracked " << type <<
"\n"
868 <<
"Tracked parameters not allowed here, "
869 <<
" 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)
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)
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)
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
T x() const
Cartesian x coordinate.
void fwkJobReportPSet(ParameterSet const &pset, std::string const &psetName)
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 fwkJobReportPSets(ParameterSet const &pset)
void suppressionLists(ParameterSet const &pset)