CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
edm::service::MessageServicePSetValidation Class Reference

#include <MessageServicePSetValidation.h>

Public Member Functions

std::string operator() (ParameterSet const &pset)
 

Private Types

typedef std::string String
 
typedef std::vector< StringvString
 

Private Member Functions

bool allowedVstring (std::string const &s)
 
void catBoolRestriction (ParameterSet const &pset, std::string const &psetName, std::string const &categoryName, std::string const &type)
 
void categoryPSet (ParameterSet const &pset, std::string const &OuterPsetName, std::string const &categoryName)
 
void categoryPSets (ParameterSet const &pset, std::string const &psetName)
 
void catInts (ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
 
template<typename T >
void catNone (ParameterSet const &pset, std::string const &psetName, std::string const &categoryName, std::string const &type)
 
void catNoPSets (ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
 
template<typename T >
T check (ParameterSet const &pset, std::string const &psetName, std::string const &parameterLabel)
 
bool checkThreshold (std::string const &thresh)
 
void defaultPSet (ParameterSet const &main_pset)
 
void destinationPSet (ParameterSet const &pset, std::string const &psetName)
 
void destinationPSets (ParameterSet const &pset)
 
template<typename T >
void disallowedParam (ParameterSet const &pset, vString const &v, std::string const &psetName, std::string const &parameterLabel, std::string const &type)
 
void fwkJobReportPSet (ParameterSet const &pset, std::string const &psetName)
 
void fwkJobReportPSets (ParameterSet const &pset)
 
bool keywordCheck (std::string const &word)
 
bool lookForMatch (vString const &v, std::string const &s)
 
void messageLoggerPSet (ParameterSet const &pset)
 
void noBadParams (vString const &v, vString const &params, std::string const &psetName, std::string const &parameterLabel, std::string const &type)
 
void noCoutCerrClash (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 noDuplicates (vString const &v1, vString const &v2, std::string const &psetName, std::string const &p1, std::string const &p2)
 
void noKeywords (vString const &v, std::string const &psetName, std::string const &parameterLabel)
 
template<typename T >
void noneExcept (ParameterSet const &pset, std::string const &psetName, std::string const &type)
 
template<typename T >
void noneExcept (ParameterSet const &pset, std::string const &psetName, std::string const &type, std::string const &ok)
 
template<typename T >
void noneExcept (ParameterSet const &pset, std::string const &psetName, std::string const &type, T const &ok1, T const &ok2)
 
template<typename T >
void noneExcept (ParameterSet const &pset, std::string const &psetName, std::string const &type, vString const &vok)
 
void noNoncategoryPsets (ParameterSet const &pset, std::string const &psetName)
 
void noNonPSetUsage (ParameterSet const &pset, vString const &v, std::string const &psetName, std::string const &parameterLabel)
 
void noOtherPsets (ParameterSet const &pset)
 
void psetLists (ParameterSet const &pset)
 
void statisticsPSet (ParameterSet const &pset, std::string const &psetName)
 
void statisticsPSets (ParameterSet const &pset)
 
void suppressionLists (ParameterSet const &pset)
 
bool validateThreshold (std::string const &thresh, std::string const &psetName)
 
void vStringsCheck (ParameterSet const &pset, std::string const &psetName)
 
bool wildcard (vString const &v)
 

Private Attributes

std::vector< std::string > categories
 
std::vector< std::string > debugModules
 
std::vector< std::string > destinations
 
std::ostringstream flaws
 
std::vector< std::string > fwkJobReports
 
std::vector< std::string > messageIDs
 
std::vector< std::string > statistics
 
std::vector< std::string > suppressDebug
 
std::vector< std::string > suppressError
 
std::vector< std::string > suppressInfo
 
std::vector< std::string > suppressWarning
 

Detailed Description

Definition at line 43 of file MessageServicePSetValidation.h.

Member Typedef Documentation

Definition at line 48 of file MessageServicePSetValidation.h.

Definition at line 49 of file MessageServicePSetValidation.h.

Member Function Documentation

bool edm::service::MessageServicePSetValidation::allowedVstring ( std::string const &  s)
private

Definition at line 232 of file MessageServicePSetValidation.cc.

References validateThreshold().

Referenced by vStringsCheck().

233 {
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;
245  return false;
246 } // allowedVstring
void edm::service::MessageServicePSetValidation::catBoolRestriction ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  categoryName,
std::string const &  type 
)
private

Definition at line 848 of file MessageServicePSetValidation.cc.

References end, edm::ParameterSet::getParameterNamesForType(), mps_fire::i, and x().

Referenced by catNoPSets().

852 {
853  vString x = pset.getParameterNamesForType <bool> (false);
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";
861  }
862  x = pset.getParameterNamesForType <bool> (true);
863  end = x.end();
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";
870  }
871 } // catBoolRestriction()
type
Definition: HCALResponse.h:21
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::categoryPSet ( ParameterSet const &  pset,
std::string const &  OuterPsetName,
std::string const &  categoryName 
)
private

Definition at line 769 of file MessageServicePSetValidation.cc.

References EnergyCorrector::c, catInts(), edm::ParameterSet::existsAs(), edm::ParameterSet::getUntrackedParameterSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by categoryPSets().

771  {
772  if (pset.existsAs<ParameterSet> (categoryName, true)) {
773  flaws << OuterPsetName << " PSet: \n"
774  << "Category PSet " << categoryName
775  << " is tracked - not allowed\n";
776  return;
777  }
778  ParameterSet empty_PSet;
779  ParameterSet const& c = pset.getUntrackedParameterSet(categoryName,empty_PSet);
780  std::string const & psetName(OuterPsetName);
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 );
789 } // categoryPSet
void catNoPSets(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
void catBoolRestriction(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName, std::string const &type)
void catInts(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
void edm::service::MessageServicePSetValidation::categoryPSets ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 751 of file MessageServicePSetValidation.cc.

References myMessageLogger_cff::categories, categoryPSet(), end, and mps_fire::i.

Referenced by noNoncategoryPsets().

752 {
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");
758  // The above conditional is because default in the main level is treated
759  // as a set of defaults differnt from those of a simple category.
760  std::vector<std::string>::const_iterator end = categories.end();
761  for (std::vector<std::string>::const_iterator i = categories.begin();
762  i != end; ++i) {
763  categoryPSet(pset, psetName, *i);
764  }
765 } // categoryPSets
#define end
Definition: vmac.h:37
void categoryPSet(ParameterSet const &pset, std::string const &OuterPsetName, std::string const &categoryName)
void edm::service::MessageServicePSetValidation::catInts ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  categoryName 
)
private

Definition at line 793 of file MessageServicePSetValidation.cc.

References catNoPSets(), end, edm::ParameterSet::getParameterNamesForType(), mps_fire::i, and x().

Referenced by categoryPSet().

796 {
797  vString x = pset.getParameterNamesForType <int> (false);
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";
806  }
807  x = pset.getParameterNamesForType <int> (true);
808  end = x.end();
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";
814  }
815 } // catInts()
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
template<typename T >
void edm::service::MessageServicePSetValidation::catNone ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  categoryName,
std::string const &  type 
)
inlineprivate

Definition at line 252 of file MessageServicePSetValidation.h.

References end, flaws, mps_fire::i, and x().

256  {
257  vString x = pset.template getParameterNamesForType <T> (false);
258  vString::const_iterator end = x.end();
259  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
260  flaws << categoryName << " category PSet nested in "
261  << psetName << " PSet: \n"
262  << (*i) << " is used as a " << type << "\n"
263  << "Usage of " << type << " is not recognized here\n";
264  }
265  x = pset.template getParameterNamesForType <T> (true);
266  end = x.end();
267  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
268  flaws << categoryName << " category PSet nested in "
269  << psetName << " PSet: \n"
270  << (*i) << " is used as a tracked " << type << "\n"
271  << "Tracked parameters not allowed here, "
272  <<" and even untracked it would not be recognized\n";
273  }
274  } // catNone()
type
Definition: HCALResponse.h:21
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::catNoPSets ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  categoryName 
)
private

Definition at line 819 of file MessageServicePSetValidation.cc.

References catBoolRestriction(), end, edm::ParameterSet::getParameterSetNames(), mps_fire::i, and gen::n.

Referenced by catInts().

822 {
823  vString psnames;
824  pset.getParameterSetNames(psnames, false);
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";
831  }
832  psnames.clear();
833  unsigned int n = pset.getParameterSetNames(psnames, true);
834  if ( n > 0 ) {
835  end = psnames.end();
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";
842  }
843  }
844 } // catNoPSets
#define end
Definition: vmac.h:37
template<typename T >
T edm::service::MessageServicePSetValidation::check ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  parameterLabel 
)
inlineprivate

Definition at line 105 of file MessageServicePSetValidation.h.

References disallowedParam(), MillePedeFileConverter_cfg::e, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), flaws, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), heppy_batch::val, and cms::Exception::what().

108  {
109  T val = T();
110  try {
111  if (!pset.exists(parameterLabel)) return val;
112  if ( pset.existsAs<T> (parameterLabel, false) ) {
113  val = pset.getUntrackedParameter<T>(parameterLabel, val);
114  return val;
115  }
116  if ( pset.existsAs<T> (parameterLabel, true) ) {
117  flaws << psetName << " PSet: \n"
118  << parameterLabel
119  << " is declared as tracked - needs to be untracked \n";
120  val = pset.getParameter<T>(parameterLabel);
121  } else {
122  flaws << psetName << " PSet: \n"
123  << parameterLabel
124  << " is declared with incorrect type \n";
125  }
126  return val;
127  } catch (cms::Exception& e) {
128  flaws << psetName << " PSet: \n"
129  << parameterLabel
130  << " is declared but causes an exception when processed: \n"
131  << e.what() << "\n";
132  return val;
133  }
134  } // check()
virtual char const * what() const
Definition: Exception.cc:141
long double T
bool edm::service::MessageServicePSetValidation::checkThreshold ( std::string const &  thresh)
private

Definition at line 263 of file MessageServicePSetValidation.cc.

References noDuplicates().

Referenced by validateThreshold().

264 {
265  if (thresh == "WARNING") return true;
266  if (thresh == "INFO") return true;
267  if (thresh == "ERROR") return true;
268  if (thresh == "DEBUG") return true;
269  return false;
270 }
void edm::service::MessageServicePSetValidation::defaultPSet ( ParameterSet const &  main_pset)
private

Definition at line 541 of file MessageServicePSetValidation.cc.

References edm::ParameterSet::getUntrackedParameterSet(), muonDTDigis_cfi::pset, statisticsPSets(), AlCaHLTBitMon_QueryRunRegistry::string, and scrapingFilter_cfi::thresh.

Referenced by destinationPSet().

542 {
543  ParameterSet empty_PSet;
544  ParameterSet const& pset = main_pset.getUntrackedParameterSet("default",empty_PSet);
545  std::string psetName = "default (at MessageLogger main level)";
546 
547  // Category PSets
548 
549  categoryPSets (pset, psetName);
550 
551  // No other PSets -- unless they contain optionalPSet or placeholder=True
552 
553  noNoncategoryPsets (pset, psetName);
554 
555  // Parameters applying to the default category
556 
557  catInts ( pset, psetName, "default" );
558 
559  // General parameters
560 
561  check <bool> ( pset, psetName, "placeholder" );
562  std::string thresh = check<std::string> ( pset, "psetName", "threshold" );
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" );
570 
571  // No other parameters
572  vString okint;
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);
578  vString okbool;
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);
584  vString okstring;
585  okstring.push_back ("threshold");
586  noneExcept <std::string> (pset, psetName, "string", okstring);
587 
588 } // defaultPSet
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
bool validateThreshold(std::string const &thresh, std::string const &psetName)
void noNoncategoryPsets(ParameterSet const &pset, std::string const &psetName)
void catInts(ParameterSet const &pset, std::string const &psetName, std::string const &categoryName)
void edm::service::MessageServicePSetValidation::destinationPSet ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 490 of file MessageServicePSetValidation.cc.

References defaultPSet(), muonDTDigis_cfi::pset, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and scrapingFilter_cfi::thresh.

Referenced by destinationPSets().

491 {
492  // Category PSets
493 
494  categoryPSets (pset, psetName);
495 
496  // No other PSets -- unless they contain optionalPSet or placeholder=True
497 
498  noNoncategoryPsets (pset, psetName);
499 
500  // General parameters
501 
502  check <bool> ( pset, psetName, "placeholder" );
503  std::string thresh = check<std::string> ( pset, "psetName", "threshold" );
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" );
508  std::string s = check<std::string> ( pset, "psetName", "filename" );
509  if ( (s == "cerr") || (s == "cout") ) {
510  flaws << psetName << " PSet: \n"
511  << s << " is not allowed as a value of filename \n";
512  }
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";
517  }
518  s = check<std::string> ( pset, "psetName", "output" );
519 
520  // No other parameters
521 
522  noneExcept <int> (pset, psetName, "int", "lineLength");
523 
524  vString okbool;
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);
530  vString okstring;
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);
536 
537 } // destinationPSet
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
bool validateThreshold(std::string const &thresh, std::string const &psetName)
void noNoncategoryPsets(ParameterSet const &pset, std::string const &psetName)
void edm::service::MessageServicePSetValidation::destinationPSets ( ParameterSet const &  pset)
private

Definition at line 477 of file MessageServicePSetValidation.cc.

References edmIntegrityCheck::d, destinationPSet(), myMessageLogger_cff::destinations, end, edm::ParameterSet::getUntrackedParameterSet(), and mps_fire::i.

Referenced by lookForMatch().

478 {
479  ParameterSet empty_PSet;
480  std::vector<std::string>::const_iterator end = destinations.end();
481  for ( std::vector<std::string>::const_iterator i = destinations.begin();
482  i != end; ++i ) {
483  ParameterSet const& d = pset.getUntrackedParameterSet(*i,empty_PSet);
484  destinationPSet(d,*i);
485  }
486 } // destinationPSets
void destinationPSet(ParameterSet const &pset, std::string const &psetName)
#define end
Definition: vmac.h:37
template<typename T >
void edm::service::MessageServicePSetValidation::disallowedParam ( ParameterSet const &  pset,
vString const &  v,
std::string const &  psetName,
std::string const &  parameterLabel,
std::string const &  type 
)
inlineprivate

Definition at line 138 of file MessageServicePSetValidation.h.

References edm::ParameterSet::getParameterNamesForType(), and noBadParams().

Referenced by check().

143  {
144  vString params = pset.getParameterNamesForType <T> (true);
145  noBadParams(v, params, psetName, parameterLabel, type);
146  params = pset.getParameterNamesForType <T> (false);
147  noBadParams(v, params, psetName, parameterLabel, type);
148  } // disallowedParam()
type
Definition: HCALResponse.h:21
void noBadParams(vString const &v, vString const &params, std::string const &psetName, std::string const &parameterLabel, std::string const &type)
long double T
void edm::service::MessageServicePSetValidation::fwkJobReportPSet ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 667 of file MessageServicePSetValidation.cc.

References noNoncategoryPsets(), muonDTDigis_cfi::pset, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fwkJobReportPSets().

668 {
669  // Category PSets
670 
671  categoryPSets (pset, psetName);
672 
673  // No other PSets -- unless they contain optionalPSet or placeholder=True
674 
675  noNoncategoryPsets (pset, psetName);
676 
677  // General parameters
678 
679  check <bool> ( pset, psetName, "placeholder" );
680  std::string s = check<std::string> ( pset, "psetName", "filename" );
681  if ( (s == "cerr") || (s == "cout") ) {
682  flaws << psetName << " PSet: \n"
683  << s << " is not allowed as a value of filename \n";
684  }
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";
689  }
690  s = check<std::string> ( pset, "psetName", "output" );
691 
692  // No other parameters
693 
694  noneExcept <int> (pset, psetName, "int");
695 
696  vString okbool;
697  okbool.push_back ("placeholder");
698  okbool.push_back ("optionalPSet");
699  noneExcept <bool> (pset, psetName, "bool", okbool);
700  vString okstring;
701  okstring.push_back ("output");
702  okstring.push_back ("filename");
703  okstring.push_back ("extension");
704  noneExcept <std::string> (pset, psetName, "string", okstring);
705 
706 } // fwkJobReportPSet
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
void noNoncategoryPsets(ParameterSet const &pset, std::string const &psetName)
void edm::service::MessageServicePSetValidation::fwkJobReportPSets ( ParameterSet const &  pset)
private

Definition at line 654 of file MessageServicePSetValidation.cc.

References edmIntegrityCheck::d, end, fwkJobReportPSet(), MessageLogger_cfi::fwkJobReports, edm::ParameterSet::getUntrackedParameterSet(), and mps_fire::i.

Referenced by statisticsPSet().

655 {
656  ParameterSet empty_PSet;
657  std::vector<std::string>::const_iterator end = fwkJobReports.end();
658  for ( std::vector<std::string>::const_iterator i = fwkJobReports.begin();
659  i != end; ++i ) {
660  ParameterSet const& d = pset.getUntrackedParameterSet(*i, empty_PSet);
661  fwkJobReportPSet(d,*i);
662  }
663 } // fwkJobReportPSets
void fwkJobReportPSet(ParameterSet const &pset, std::string const &psetName)
#define end
Definition: vmac.h:37
bool edm::service::MessageServicePSetValidation::keywordCheck ( std::string const &  word)
private

Definition at line 344 of file MessageServicePSetValidation.cc.

References noNonPSetUsage().

Referenced by noKeywords().

345 {
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;
374  return true;
375 } // keywordCheck
bool edm::service::MessageServicePSetValidation::lookForMatch ( vString const &  v,
std::string const &  s 
)
private

Definition at line 468 of file MessageServicePSetValidation.cc.

References begin, destinationPSets(), end, and spr::find().

Referenced by noOtherPsets().

469 {
470  vString::const_iterator begin = v.begin();
471  vString::const_iterator end = v.end();
472  return ( std::find(begin, end, s) != end );
473 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
void edm::service::MessageServicePSetValidation::messageLoggerPSet ( ParameterSet const &  pset)
private

Definition at line 40 of file MessageServicePSetValidation.cc.

References muonDTDigis_cfi::pset, psetLists(), AlCaHLTBitMon_QueryRunRegistry::string, and scrapingFilter_cfi::thresh.

Referenced by operator()().

41 {
42  // Four types of material are allowed at the MessageLogger level:
43  // PSet lists (such as destinations or categories
44  // Suppression lists, such as SuppressInfo or debugModules
45  // General parameters, such as threshold or messageSummaryToJobReport
46  // Nested PSets, such as those for each destination
47 
48  // PSet lists
49 
50  psetLists(pset);
51 
52  // Suppression lists
53 
55 
56  // No other vstrings
57 
58  vStringsCheck(pset, "MessageLogger");
59 
60  // General Parameters
61 
62  check<bool>
63  ( pset, "MessageLogger", "messageSummaryToJobReport" );
64  std::string dumps = check<std::string>
65  ( pset, "MessageLogger", "generate_preconfiguration_message" );
66  std::string thresh = check<std::string>
67  ( pset, "MessageLogger", "threshold" );
68  if (!thresh.empty()) validateThreshold(thresh, "MessageLogger");
69 
70  // Nested PSets
71 
72  destinationPSets(pset);
73  defaultPSet(pset);
74  statisticsPSets(pset);
75  fwkJobReportPSets(pset);
76  categoryPSets(pset, "MessageLogger");
77 
78  // No other PSets -- unless they contain optionalPSet or placeholder=True
79 
80  noOtherPsets (pset);
81 
82  // Nothing else -- look for int, unsigned int, bool, float, double, string
83 
84  noneExcept <int> (pset, "MessageLogger", "int");
85  noneExcept <unsigned int> (pset, "MessageLogger", "unsigned int");
86  noneExcept <bool> (pset, "MessageLogger","bool","messageSummaryToJobReport");
87  // Note - at this, the upper MessageLogger PSet level, the use of
88  // optionalPSet makes no sense, so we are OK letting that be a flaw
89  noneExcept <float> (pset, "MessageLogger","float");
90  noneExcept <double> (pset, "MessageLogger","double");
91  noneExcept <std::string> (pset, "MessageLogger","string",
92  "threshold", "generate_preconfiguration_message");
93 
94  // Append explanatory information if flaws were found
95 
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 "
100  << "effect.\n";
101  }
102 
103 } // messageLoggerPSet
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
void vStringsCheck(ParameterSet const &pset, std::string const &psetName)
bool validateThreshold(std::string const &thresh, std::string const &psetName)
void edm::service::MessageServicePSetValidation::noBadParams ( vString const &  v,
vString const &  params,
std::string const &  psetName,
std::string const &  parameterLabel,
std::string const &  type 
)
private

Definition at line 395 of file MessageServicePSetValidation.cc.

References mps_fire::i, and wildcard().

Referenced by disallowedParam(), and noNonPSetUsage().

399 {
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) {
404  if ( *i == *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";
409  }
410  }
411  }
412 
413 } // noBadParams
type
Definition: HCALResponse.h:21
void edm::service::MessageServicePSetValidation::noCoutCerrClash ( vString const &  v,
std::string const &  psetName,
std::string const &  parameterLabel 
)
private

Definition at line 310 of file MessageServicePSetValidation.cc.

References end, mps_fire::i, and noKeywords().

Referenced by noDuplicates().

312 {
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;
319  }
320  if (coutPresent && cerrPresent) {
321  flaws << psetName << " PSet: \n"
322  << "vString " << parameterLabel
323  << " has both cout and cerr \n";
324  }
325 } // noCoutCerrClash(v)
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::noDuplicates ( vString const &  v,
std::string const &  psetName,
std::string const &  parameterLabel 
)
private

Definition at line 274 of file MessageServicePSetValidation.cc.

References end, and mps_fire::i.

Referenced by checkThreshold().

276 {
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) {
280  if ( *i == *j ) {
281  flaws << psetName << " PSet: \n"
282  << "in vString " << parameterLabel
283  << " duplication of the string " << *i << "\n";
284  }
285  }
286  }
287 } // noDuplicates(v)
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::noDuplicates ( vString const &  v1,
vString const &  v2,
std::string const &  psetName,
std::string const &  p1,
std::string const &  p2 
)
private

Definition at line 291 of file MessageServicePSetValidation.cc.

References mps_fire::i, and noCoutCerrClash().

294 {
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) {
299  if ( *i == *j ) {
300  flaws << psetName << " PSet: \n"
301  << "in vStrings " << p1 << " and " << p2
302  << " duplication of the string " << *i << "\n";
303  }
304  }
305  }
306 } // noDuplicates(v1,v2)
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
void edm::service::MessageServicePSetValidation::noKeywords ( vString const &  v,
std::string const &  psetName,
std::string const &  parameterLabel 
)
private

Definition at line 329 of file MessageServicePSetValidation.cc.

References end, mps_fire::i, and keywordCheck().

Referenced by noCoutCerrClash().

331 {
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";
338  }
339  }
340 } // noKeywords(v)
#define end
Definition: vmac.h:37
template<typename T >
void edm::service::MessageServicePSetValidation::noneExcept ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  type 
)
inlineprivate

Definition at line 151 of file MessageServicePSetValidation.h.

References end, flaws, mps_fire::i, and x().

153  {
154  vString x = pset.template getParameterNamesForType <T> (false);
155  vString::const_iterator end = x.end();
156  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
157  flaws << psetName << " PSet: \n"
158  << (*i) << " is used as a " << type << "\n"
159  << "Usage of " << type << " is not recognized here\n";
160  }
161  x = pset.template getParameterNamesForType <T> (true);
162  end = x.end();
163  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
164  if ( (*i) == "@service_type" ) continue;
165  flaws << psetName << " PSet: \n"
166  << (*i) << " is used as a tracked " << type << "\n"
167  << "Tracked parameters not allowed here, "
168  <<" and even untracked it would not be recognized\n";
169  }
170  } // noneExcept()
type
Definition: HCALResponse.h:21
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
template<typename T >
void edm::service::MessageServicePSetValidation::noneExcept ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  type,
std::string const &  ok 
)
inlineprivate

Definition at line 173 of file MessageServicePSetValidation.h.

References end, flaws, mps_fire::i, AlCaHLTBitMon_QueryRunRegistry::string, heppy_batch::val, and x().

176  {
177  vString x = pset.template getParameterNamesForType <T> (false);
178  vString::const_iterator end = x.end();
179  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
180  std::string val = (*i);
181  if ( val != ok ) {
182  flaws << psetName << " PSet: \n"
183  << val << " is used as a " << type << "\n"
184  << "This usage is not recognized in this type of PSet\n";
185  }
186  }
187  x = pset.template getParameterNamesForType <T> (true);
188  end = x.end();
189  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
190  if ( (*i) == "@service_type" ) continue;
191  flaws << psetName << " PSet: \n"
192  << (*i) << " is used as a tracked " << type << "\n"
193  << "Tracked parameters not allowed here\n";
194  }
195  } // noneExcept(okValue)
type
Definition: HCALResponse.h:21
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
template<typename T >
void edm::service::MessageServicePSetValidation::noneExcept ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  type,
T const &  ok1,
T const &  ok2 
)
inlineprivate

Definition at line 198 of file MessageServicePSetValidation.h.

References end, flaws, mps_fire::i, AlCaHLTBitMon_QueryRunRegistry::string, heppy_batch::val, and x().

201  {
202  vString x = pset.template getParameterNamesForType <T> (false);
203  vString::const_iterator end = x.end();
204  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
205  std::string val = (*i);
206  if ( (val != ok1) && (val != ok2) ) {
207  flaws << psetName << " PSet: \n"
208  << val << " is used as a " << type << "\n"
209  << "This usage is not recognized in this type of PSet\n";
210  }
211  }
212  x = pset.template getParameterNamesForType <T> (true);
213  end = x.end();
214  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
215  if ( (*i) == "@service_type" ) continue;
216  flaws << psetName << " PSet: \n"
217  << (*i) << " is used as a tracked " << type << "\n"
218  << "Tracked parameters not allowed here\n";
219  }
220  } // noneExcept(okValue1, okValue2)
type
Definition: HCALResponse.h:21
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
template<typename T >
void edm::service::MessageServicePSetValidation::noneExcept ( ParameterSet const &  pset,
std::string const &  psetName,
std::string const &  type,
vString const &  vok 
)
inlineprivate

Definition at line 223 of file MessageServicePSetValidation.h.

References end, flaws, runEdmFileComparison::found, mps_fire::i, vend, and x().

226  {
227  vString x = pset.template getParameterNamesForType <T> (false);
228  vString::const_iterator end = x.end();
229  vString::const_iterator vend = vok.end();
230  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
231  bool found = false;
232  for (vString::const_iterator vit = vok.begin(); vit!=vend; ++vit) {
233  if ( *i == *vit ) found = true;
234  }
235  if ( !found ) {
236  flaws << psetName << " PSet: \n"
237  << *i << " is used as a " << type << "\n"
238  << "This usage is not recognized in this type of PSet\n";
239  }
240  }
241  x = pset.template getParameterNamesForType <T> (true);
242  end = x.end();
243  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
244  if ( (*i) == "@service_type" ) continue;
245  flaws << psetName << " PSet: \n"
246  << (*i) << " is used as a tracked " << type << "\n"
247  << "Tracked parameters not allowed here\n";
248  }
249  } // noneExcept(vok)
type
Definition: HCALResponse.h:21
#define vend()
Definition: vmac.h:41
T x() const
Cartesian x coordinate.
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::noNoncategoryPsets ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 710 of file MessageServicePSetValidation.cc.

References myMessageLogger_cff::categories, categoryPSets(), MillePedeFileConverter_cfg::e, end, edm::ParameterSet::getParameterSetNames(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), mps_fire::i, and gen::n.

Referenced by fwkJobReportPSet().

711 {
712  vString psnames;
713  pset.getParameterSetNames(psnames, false);
714  vString::const_iterator end = psnames.end();
715  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
716  if ( lookForMatch (categories, *i) ) continue;
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;
723  ParameterSet empty_PSet;
724  bool ok_optionalPSet = false;
725  try {
726  ParameterSet const& culprit =
727  pset.getUntrackedParameterSet((*i),empty_PSet);
728  ok_optionalPSet =
729  culprit.getUntrackedParameter<bool>("placeholder", ok_optionalPSet);
730  ok_optionalPSet =
731  culprit.getUntrackedParameter<bool>("optionalPSet", ok_optionalPSet);
732  } catch (cms::Exception& e) {
733  }
734  if (ok_optionalPSet) continue;
735  flaws << psetName << " PSet: \n"
736  << *i << " is an unrecognized name for a PSet in this context \n";
737  }
738  psnames.clear();
739  unsigned int n = pset.getParameterSetNames(psnames, true);
740  if ( n > 0 ) {
741  end = psnames.end();
742  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
743  flaws << psetName << " PSet: \n"
744  << "PSet " << *i << " is tracked - not allowed\n";
745  }
746  }
747 } // noNoncategoryPsets
T getUntrackedParameter(std::string const &, T const &) const
bool lookForMatch(vString const &v, std::string const &s)
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::noNonPSetUsage ( ParameterSet const &  pset,
vString const &  v,
std::string const &  psetName,
std::string const &  parameterLabel 
)
private

Definition at line 379 of file MessageServicePSetValidation.cc.

References noBadParams(), muonDTDigis_cfi::pset, and findQualityFiles::v.

Referenced by keywordCheck().

382 {
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" );
391 } // noNonPSetUsage
void edm::service::MessageServicePSetValidation::noOtherPsets ( ParameterSet const &  pset)
private

Definition at line 428 of file MessageServicePSetValidation.cc.

References myMessageLogger_cff::categories, myMessageLogger_cff::destinations, MillePedeFileConverter_cfg::e, end, MessageLogger_cfi::fwkJobReports, edm::ParameterSet::getParameterSetNames(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), mps_fire::i, lookForMatch(), gen::n, and myMessageLogger_cff::statistics.

Referenced by wildcard().

429 {
430  vString psnames;
431  pset.getParameterSetNames(psnames, false);
432  vString::const_iterator end = psnames.end();
433  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
434  if ( lookForMatch (destinations, *i) ) continue;
435  if ( lookForMatch (statistics, *i) ) continue;
436  if ( lookForMatch (fwkJobReports, *i) ) continue;
437  if ( lookForMatch (categories, *i) ) continue;
438  if ( lookForMatch (messageIDs, *i) ) continue;
439  if ( (*i) == "default" ) continue;
440  ParameterSet empty_PSet;
441  bool ok_optionalPSet = false;
442  try {
443  ParameterSet const& culprit =
444  pset.getUntrackedParameterSet((*i),empty_PSet);
445  ok_optionalPSet =
446  culprit.getUntrackedParameter<bool>("placeholder", ok_optionalPSet);
447  ok_optionalPSet =
448  culprit.getUntrackedParameter<bool>("optionalPSet", ok_optionalPSet);
449  } catch (cms::Exception& e) {
450  }
451  if (ok_optionalPSet) continue;
452  flaws << "MessageLogger " << " PSet: \n"
453  << *i << " is an unrecognized name for a PSet\n";
454  }
455  psnames.clear();
456  unsigned int n = pset.getParameterSetNames(psnames, true);
457  if ( n > 0 ) {
458  end = psnames.end();
459  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
460  flaws << "MessageLogger " << " PSet: \n"
461  << "PSet " << *i << " is tracked - not allowed\n";
462  }
463  }
464 }
T getUntrackedParameter(std::string const &, T const &) const
bool lookForMatch(vString const &v, std::string const &s)
#define end
Definition: vmac.h:37
std::string edm::service::MessageServicePSetValidation::operator() ( ParameterSet const &  pset)

Definition at line 32 of file MessageServicePSetValidation.cc.

References messageLoggerPSet().

33 {
35  return flaws.str();
36 } // operator() to validate the PSet passed in
void edm::service::MessageServicePSetValidation::psetLists ( ParameterSet const &  pset)
private

Definition at line 107 of file MessageServicePSetValidation.cc.

References myMessageLogger_cff::categories, myMessageLogger_cff::destinations, MessageLogger_cfi::fwkJobReports, muonDTDigis_cfi::pset, myMessageLogger_cff::statistics, and suppressionLists().

Referenced by messageLoggerPSet().

108 {
109  destinations = check<vString>
110  (pset, "MessageLogger", "destinations");
111  noDuplicates(destinations,"MessageLogger", "destinations");
112  noKeywords(destinations,"MessageLogger", "destinations");
113  noNonPSetUsage(pset, destinations,"MessageLogger", "destinations");
114  // REMOVED: noCoutCerrClash(destinations,"MessageLogger", "destinations");
115 
116  statistics = check<vString>
117  (pset, "MessageLogger", "statistics");
118  noDuplicates(statistics,"MessageLogger", "statistics");
119  noKeywords(statistics,"MessageLogger", "statistics");
120  noNonPSetUsage(pset, statistics,"MessageLogger", "statistics");
121 
122  fwkJobReports = check<vString>
123  (pset, "MessageLogger", "fwkJobReports");
124  noDuplicates(fwkJobReports,"MessageLogger", "fwkJobReports");
125  noKeywords(fwkJobReports,"MessageLogger", "fwkJobReports");
126  noNonPSetUsage(pset, fwkJobReports,"MessageLogger", "fwkJobReports");
128  "MessageLogger", "fwkJobReports","destinations");
130  "MessageLogger", "fwkJobReports","statistics");
131 
132  categories = check<vString>
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");
143 
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");
157 
158 } // psetLists
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 noNonPSetUsage(ParameterSet const &pset, vString const &v, std::string const &psetName, std::string const &parameterLabel)
void edm::service::MessageServicePSetValidation::statisticsPSet ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 606 of file MessageServicePSetValidation.cc.

References fwkJobReportPSets(), muonDTDigis_cfi::pset, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and scrapingFilter_cfi::thresh.

Referenced by statisticsPSets().

607 {
608  // Category PSets
609 
610  categoryPSets (pset, psetName);
611 
612  // No other PSets -- unless they contain optionalPSet or placeholder=True
613 
614  noNoncategoryPsets (pset, psetName);
615 
616  // General parameters
617 
618  std::string thresh = check<std::string> ( pset, "psetName", "threshold" );
619  if (!thresh.empty()) validateThreshold(thresh, psetName);
620  check <bool> ( pset, psetName, "placeholder" );
621  check <bool> ( pset, psetName, "reset" );
622  std::string s = check<std::string> ( pset, "psetName", "filename" );
623  if ( (s == "cerr") || (s == "cout") ) {
624  flaws << psetName << " PSet: \n"
625  << s << " is not allowed as a value of filename \n";
626  }
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";
631  }
632  s = check<std::string> ( pset, "psetName", "output" );
633 
634  // No other parameters
635 
636  noneExcept <int> (pset, psetName, "int");
637 
638  vString okbool;
639  okbool.push_back ("placeholder");
640  okbool.push_back ("optionalPSet");
641  okbool.push_back ("reset");
642  noneExcept <bool> (pset, psetName, "bool", okbool);
643  vString okstring;
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);
649 
650 } // statisticsPSet
void categoryPSets(ParameterSet const &pset, std::string const &psetName)
bool validateThreshold(std::string const &thresh, std::string const &psetName)
void noNoncategoryPsets(ParameterSet const &pset, std::string const &psetName)
void edm::service::MessageServicePSetValidation::statisticsPSets ( ParameterSet const &  pset)
private

Definition at line 592 of file MessageServicePSetValidation.cc.

References edmIntegrityCheck::d, myMessageLogger_cff::destinations, end, edm::ParameterSet::getUntrackedParameterSet(), mps_fire::i, myMessageLogger_cff::statistics, and statisticsPSet().

Referenced by defaultPSet().

593 {
594  ParameterSet empty_PSet;
595  std::vector<std::string>::const_iterator end = statistics.end();
596  for ( std::vector<std::string>::const_iterator i = statistics.begin();
597  i != end; ++i ) {
598  if (lookForMatch(destinations, *i)) continue;
599  ParameterSet const& d = pset.getUntrackedParameterSet(*i, empty_PSet);
600  statisticsPSet(d,*i);
601  }
602 } // statisticsPSets
void statisticsPSet(ParameterSet const &pset, std::string const &psetName)
bool lookForMatch(vString const &v, std::string const &s)
#define end
Definition: vmac.h:37
void edm::service::MessageServicePSetValidation::suppressionLists ( ParameterSet const &  pset)
private

Definition at line 162 of file MessageServicePSetValidation.cc.

References MessageLogger_cfi::debugModules, muonDTDigis_cfi::pset, benchmark_cfg::suppressDebug, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::suppressInfo, benchmark_cfg::suppressWarning, and vStringsCheck().

Referenced by psetLists().

163 {
164  debugModules = check<vString>
165  (pset, "MessageLogger", "debugModules");
166  bool dmStar = wildcard(debugModules);
167  if ( dmStar && debugModules.size() != 1) {
168  flaws << "MessageLogger" << " PSet: \n"
169  << "debugModules contains wildcard character *"
170  << " and also " << debugModules.size()-1
171  << " other entries - * must be alone\n";
172  }
173  suppressDebug = check<vString>
174  (pset, "MessageLogger", "suppressDebug");
175  if ( (suppressDebug.size() > 0) && (!dmStar) ) {
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";
180  }
181  if (wildcard(suppressDebug)) {
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";
185  }
186  suppressInfo = check<vString>
187  (pset, "MessageLogger", "suppressInfo");
188  if (wildcard(suppressInfo)) {
189  flaws << "MessageLogger" << " PSet: \n"
190  << "Use of wildcard (*) in suppressInfo is not supported\n";
191  }
192  suppressWarning = check<vString>
193  (pset, "MessageLogger", "suppressWarning");
194  if (wildcard(suppressWarning)) {
195  flaws << "MessageLogger" << " PSet: \n"
196  << "Use of wildcard (*) in suppressWarning is not supported\n";
197  }
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";
203  }
204 
205 } // suppressionLists
bool edm::service::MessageServicePSetValidation::validateThreshold ( std::string const &  thresh,
std::string const &  psetName 
)
private

Definition at line 252 of file MessageServicePSetValidation.cc.

References checkThreshold().

Referenced by allowedVstring().

253 {
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";
258  return false;
259 } // validateThreshold
void edm::service::MessageServicePSetValidation::vStringsCheck ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 210 of file MessageServicePSetValidation.cc.

References allowedVstring(), end, edm::ParameterSet::getParameterNamesForType(), and mps_fire::i.

Referenced by suppressionLists().

211 {
212  vString vStrings = pset.getParameterNamesForType <vString> (false);
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";
219  }
220  }
221  vStrings = pset.getParameterNamesForType <vString> (true);
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";
227  }
228 } // vStringsCheck
#define end
Definition: vmac.h:37
bool edm::service::MessageServicePSetValidation::wildcard ( vString const &  v)
private

Definition at line 417 of file MessageServicePSetValidation.cc.

References end, mps_fire::i, and noOtherPsets().

Referenced by noBadParams().

418 {
419  vString::const_iterator end = v.end();
420  for (vString::const_iterator i = v.begin(); i != end; ++i) {
421  if ((*i) == "*") return true;
422  }
423  return false;
424 }
#define end
Definition: vmac.h:37

Member Data Documentation

std::vector<std::string> edm::service::MessageServicePSetValidation::categories
private

Definition at line 283 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::debugModules
private

Definition at line 285 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::destinations
private

Definition at line 280 of file MessageServicePSetValidation.h.

std::ostringstream edm::service::MessageServicePSetValidation::flaws
private

Definition at line 279 of file MessageServicePSetValidation.h.

Referenced by catNone(), check(), and noneExcept().

std::vector<std::string> edm::service::MessageServicePSetValidation::fwkJobReports
private

Definition at line 282 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::messageIDs
private

Definition at line 284 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::statistics
private

Definition at line 281 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::suppressDebug
private

Definition at line 287 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::suppressError
private

Definition at line 289 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::suppressInfo
private

Definition at line 286 of file MessageServicePSetValidation.h.

std::vector<std::string> edm::service::MessageServicePSetValidation::suppressWarning
private

Definition at line 288 of file MessageServicePSetValidation.h.