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 234 of file MessageServicePSetValidation.cc.

References validateThreshold().

Referenced by vStringsCheck().

235 {
236  if (s == "destinations") return true;
237  if (s == "statistics") return true;
238  if (s == "destinations") return true;
239  if (s == "fwkJobReports") return true;
240  if (s == "categories") return true;
241  if (s == "messageIDs") return true;
242  if (s == "debugModules") return true;
243  if (s == "suppressInfo") return true;
244  if (s == "suppressDebug") return true;
245  if (s == "suppressWarning") return true;
246  if (s == "suppressError") return true;
247  return false;
248 } // 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 850 of file MessageServicePSetValidation.cc.

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

Referenced by catNoPSets().

854 {
855  vString x = pset.getParameterNamesForType <bool> (false);
856  vString::const_iterator end = x.end();
857  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
858  if ( ((*i) == "placeholder") || ((*i) == "optionalPSet") ) continue;
859  flaws << categoryName << " category PSet nested in "
860  << psetName << " PSet: \n"
861  << (*i) << " is used as a " << type << "\n"
862  << "Usage of " << type << " is not recognized here\n";
863  }
864  x = pset.getParameterNamesForType <bool> (true);
865  end = x.end();
866  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
867  flaws << categoryName << " category PSet nested in "
868  << psetName << " PSet: \n"
869  << (*i) << " is used as a tracked " << type << "\n"
870  << "Tracked parameters not allowed here, "
871  <<" and even untracked it would not be recognized\n";
872  }
873 } // 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 771 of file MessageServicePSetValidation.cc.

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

Referenced by categoryPSets().

773  {
774  if (pset.existsAs<ParameterSet> (categoryName, true)) {
775  flaws << OuterPsetName << " PSet: \n"
776  << "Category PSet " << categoryName
777  << " is tracked - not allowed\n";
778  return;
779  }
780  ParameterSet empty_PSet;
781  ParameterSet const& c = pset.getUntrackedParameterSet(categoryName,empty_PSet);
782  std::string const & psetName(OuterPsetName);
783  catInts ( c, psetName, categoryName );
784  catNone <unsigned int> ( c, psetName, categoryName, "unsigned int" );
785  catBoolRestriction ( c, psetName, categoryName, "bool" );
786  catNone <float> ( c, psetName, categoryName, "float" );
787  catNone <double> ( c, psetName, categoryName, "double" );
788  catNone <std::string> ( c, psetName, categoryName, "string" );
789  catNone <vString> ( c, psetName, categoryName, "vSting" );
790  catNoPSets ( c, psetName, categoryName );
791 } // 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 753 of file MessageServicePSetValidation.cc.

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

Referenced by noNoncategoryPsets().

754 {
755  categoryPSet (pset, psetName, "ERROR" );
756  categoryPSet (pset, psetName, "WARNING");
757  categoryPSet (pset, psetName, "INFO" ) ;
758  categoryPSet (pset, psetName, "DEBUG" );
759  if (psetName != "MessageLogger") categoryPSet (pset, psetName, "default");
760  // The above conditional is because default in the main level is treated
761  // as a set of defaults differnt from those of a simple category.
762  std::vector<std::string>::const_iterator end = categories.end();
763  for (std::vector<std::string>::const_iterator i = categories.begin();
764  i != end; ++i) {
765  categoryPSet(pset, psetName, *i);
766  }
767 } // 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 795 of file MessageServicePSetValidation.cc.

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

Referenced by categoryPSet().

798 {
799  vString x = pset.getParameterNamesForType <int> (false);
800  vString::const_iterator end = x.end();
801  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
802  if ( *i == "limit" ) continue;
803  if ( *i == "reportEvery" ) continue;
804  if ( *i == "timespan" ) continue;
805  flaws << categoryName << " category PSet nested in "
806  << psetName << " PSet: \n"
807  << (*i) << " is not an allowed parameter within a category PSet \n";
808  }
809  x = pset.getParameterNamesForType <int> (true);
810  end = x.end();
811  for ( vString::const_iterator i = x.begin(); i != end; ++i ) {
812  flaws << categoryName << " category PSet nested in "
813  << psetName << " PSet: \n"
814  << (*i) << " is used as a tracked int \n"
815  << "Tracked parameters not allowed here \n";
816  }
817 } // 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 821 of file MessageServicePSetValidation.cc.

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

Referenced by catInts().

824 {
825  vString psnames;
826  pset.getParameterSetNames(psnames, false);
827  vString::const_iterator end = psnames.end();
828  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
829  flaws << categoryName << " category PSet nested in "
830  << psetName << " PSet: \n"
831  << *i << " is used as a PSet\n"
832  << "PSets not allowed within a category PSet\n";
833  }
834  psnames.clear();
835  unsigned int n = pset.getParameterSetNames(psnames, true);
836  if ( n > 0 ) {
837  end = psnames.end();
838  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
839  flaws << categoryName << " category PSet nested in "
840  << psetName << " PSet: \n"
841  << *i << " is used as a tracked PSet\n"
842  << "tracked parameters not permitted, and "
843  << "PSets not allowed within a category PSet\n";
844  }
845  }
846 } // 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 265 of file MessageServicePSetValidation.cc.

References noDuplicates().

Referenced by validateThreshold().

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

Definition at line 543 of file MessageServicePSetValidation.cc.

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

Referenced by destinationPSet().

544 {
545  ParameterSet empty_PSet;
546  ParameterSet const& pset = main_pset.getUntrackedParameterSet("default",empty_PSet);
547  std::string psetName = "default (at MessageLogger main level)";
548 
549  // Category PSets
550 
551  categoryPSets (pset, psetName);
552 
553  // No other PSets -- unless they contain optionalPSet or placeholder=True
554 
555  noNoncategoryPsets (pset, psetName);
556 
557  // Parameters applying to the default category
558 
559  catInts ( pset, psetName, "default" );
560 
561  // General parameters
562 
563  check <bool> ( pset, psetName, "placeholder" );
564  std::string thresh = check<std::string> ( pset, "psetName", "threshold" );
565  if (!thresh.empty()) validateThreshold(thresh, psetName);
566  check <bool> ( pset, psetName, "noLineBreaks" );
567  check <int> ( pset, psetName, "limit" );
568  check <int> ( pset, psetName, "reportEvery" );
569  check <int> ( pset, psetName, "timespan" );
570  check <int> ( pset, psetName, "lineLength" );
571  check <bool> ( pset, psetName, "noTimeStamps" );
572 
573  // No other parameters
574  vString okint;
575  okint.push_back("limit");
576  okint.push_back("reportEvery");
577  okint.push_back("timespan");
578  okint.push_back("lineLength");
579  noneExcept <int> (pset, psetName, "int", okint);
580  vString okbool;
581  okbool.push_back ("placeholder");
582  okbool.push_back ("optionalPSet");
583  okbool.push_back ("noLineBreaks");
584  okbool.push_back ("noTimeStamps");
585  noneExcept <bool> (pset, psetName, "bool", okbool);
586  vString okstring;
587  okstring.push_back ("threshold");
588  noneExcept <std::string> (pset, psetName, "string", okstring);
589 
590 } // 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 492 of file MessageServicePSetValidation.cc.

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

Referenced by destinationPSets().

493 {
494  // Category PSets
495 
496  categoryPSets (pset, psetName);
497 
498  // No other PSets -- unless they contain optionalPSet or placeholder=True
499 
500  noNoncategoryPsets (pset, psetName);
501 
502  // General parameters
503 
504  check <bool> ( pset, psetName, "placeholder" );
505  std::string thresh = check<std::string> ( pset, "psetName", "threshold" );
506  if (!thresh.empty()) validateThreshold(thresh, psetName);
507  check <bool> ( pset, psetName, "noLineBreaks" );
508  check <int> ( pset, psetName, "lineLength" );
509  check <bool> ( pset, psetName, "noTimeStamps" );
510  std::string s = check<std::string> ( pset, "psetName", "filename" );
511  if ( (s == "cerr") || (s == "cout") ) {
512  flaws << psetName << " PSet: \n"
513  << s << " is not allowed as a value of filename \n";
514  }
515  s = check<std::string> ( pset, "psetName", "extension" );
516  if ( (s == "cerr") || (s == "cout") ) {
517  flaws << psetName << " PSet: \n"
518  << s << " is not allowed as a value of extension \n";
519  }
520  s = check<std::string> ( pset, "psetName", "output" );
521 
522  // No other parameters
523 
524  noneExcept <int> (pset, psetName, "int", "lineLength");
525 
526  vString okbool;
527  okbool.push_back ("placeholder");
528  okbool.push_back ("optionalPSet");
529  okbool.push_back ("noLineBreaks");
530  okbool.push_back ("noTimeStamps");
531  noneExcept <bool> (pset, psetName, "bool", okbool);
532  vString okstring;
533  okstring.push_back ("threshold");
534  okstring.push_back ("output");
535  okstring.push_back ("filename");
536  okstring.push_back ("extension");
537  noneExcept <std::string> (pset, psetName, "string", okstring);
538 
539 } // 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 479 of file MessageServicePSetValidation.cc.

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

Referenced by lookForMatch().

480 {
481  ParameterSet empty_PSet;
482  std::vector<std::string>::const_iterator end = destinations.end();
483  for ( std::vector<std::string>::const_iterator i = destinations.begin();
484  i != end; ++i ) {
485  ParameterSet const& d = pset.getUntrackedParameterSet(*i,empty_PSet);
486  destinationPSet(d,*i);
487  }
488 } // 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 669 of file MessageServicePSetValidation.cc.

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

Referenced by fwkJobReportPSets().

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

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

Referenced by statisticsPSet().

657 {
658  ParameterSet empty_PSet;
659  std::vector<std::string>::const_iterator end = fwkJobReports.end();
660  for ( std::vector<std::string>::const_iterator i = fwkJobReports.begin();
661  i != end; ++i ) {
662  ParameterSet const& d = pset.getUntrackedParameterSet(*i, empty_PSet);
663  fwkJobReportPSet(d,*i);
664  }
665 } // 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 346 of file MessageServicePSetValidation.cc.

References noNonPSetUsage().

Referenced by noKeywords().

347 {
348  if (word == "default") return false;
349  if (word == "categories") return false;
350  if (word == "messageIDs") return false;
351  if (word == "fwkJobReports") return false;
352  if (word == "destinations") return false;
353  if (word == "statistics") return false;
354  if (word == "debugModules") return false;
355  if (word == "suppressInfo") return false;
356  if (word == "suppressDebug") return false;
357  if (word == "suppressWarning")return false;
358  if (word == "suppressError") return false;
359  if (word == "threshold") return false;
360  if (word == "ERROR") return false;
361  if (word == "WARNING") return false;
362  if (word == "INFO") return false;
363  if (word == "DEBUG") return false;
364  if (word == "placeholder") return false;
365  if (word == "limit") return false;
366  if (word == "reportEvery") return false;
367  if (word == "timespan") return false;
368  if (word == "noLineBreaks") return false;
369  if (word == "lineLength") return false;
370  if (word == "noTimeStamps") return false;
371  if (word == "output") return false;
372  if (word == "filename") return false;
373  if (word == "extension") return false;
374  if (word == "reset") return false;
375  if (word == "optionalPSet") return false;
376  return true;
377 } // keywordCheck
bool edm::service::MessageServicePSetValidation::lookForMatch ( vString const &  v,
std::string const &  s 
)
private

Definition at line 470 of file MessageServicePSetValidation.cc.

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

Referenced by noOtherPsets().

471 {
472  vString::const_iterator begin = v.begin();
473  vString::const_iterator end = v.end();
474  return ( std::find(begin, end, s) != end );
475 }
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  check<unsigned int>
70  ( pset, "MessageLogger", "waiting_threshold");
71 
72  // Nested PSets
73 
74  destinationPSets(pset);
75  defaultPSet(pset);
76  statisticsPSets(pset);
77  fwkJobReportPSets(pset);
78  categoryPSets(pset, "MessageLogger");
79 
80  // No other PSets -- unless they contain optionalPSet or placeholder=True
81 
82  noOtherPsets (pset);
83 
84  // Nothing else -- look for int, unsigned int, bool, float, double, string
85 
86  noneExcept <int> (pset, "MessageLogger", "int");
87  noneExcept <unsigned int> (pset, "MessageLogger", "unsigned int","waiting_threshold");
88  noneExcept <bool> (pset, "MessageLogger","bool","messageSummaryToJobReport");
89  // Note - at this, the upper MessageLogger PSet level, the use of
90  // optionalPSet makes no sense, so we are OK letting that be a flaw
91  noneExcept <float> (pset, "MessageLogger","float");
92  noneExcept <double> (pset, "MessageLogger","double");
93  noneExcept <std::string> (pset, "MessageLogger","string",
94  "threshold", "generate_preconfiguration_message");
95 
96  // Append explanatory information if flaws were found
97 
98  if (!flaws.str().empty()) {
99  flaws << "\nThe above are from MessageLogger configuration validation.\n"
100  << "In most cases, these involve lines that the logger configuration code\n"
101  << "would not process, but which the cfg creator obviously meant to have "
102  << "effect.\n";
103  }
104 
105 } // 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 397 of file MessageServicePSetValidation.cc.

References mps_fire::i, and wildcard().

Referenced by disallowedParam(), and noNonPSetUsage().

401 {
402  vString::const_iterator end1 = v.end();
403  vString::const_iterator end2 = params.end();
404  for (vString::const_iterator i = v.begin(); i != end1; ++i) {
405  for (vString::const_iterator j = params.begin(); j != end2; ++j) {
406  if ( *i == *j ) {
407  flaws << psetName << " PSet: \n"
408  << *i << " (listed in vstring " << parameterLabel << ")\n"
409  << "is used as a parameter of type " << type
410  << " instead of as a PSet \n";
411  }
412  }
413  }
414 
415 } // 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 312 of file MessageServicePSetValidation.cc.

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

Referenced by noDuplicates().

314 {
315  vString::const_iterator end = v.end();
316  bool coutPresent = false;
317  bool cerrPresent = false;
318  for (vString::const_iterator i = v.begin(); i != end; ++i) {
319  if ( *i == "cout" ) coutPresent = true;
320  if ( *i == "cerr" ) cerrPresent = true;
321  }
322  if (coutPresent && cerrPresent) {
323  flaws << psetName << " PSet: \n"
324  << "vString " << parameterLabel
325  << " has both cout and cerr \n";
326  }
327 } // 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 276 of file MessageServicePSetValidation.cc.

References end, and mps_fire::i.

Referenced by checkThreshold().

278 {
279  vString::const_iterator end = v.end();
280  for (vString::const_iterator i = v.begin(); i != end; ++i) {
281  for (vString::const_iterator j = i+1; j != end; ++j) {
282  if ( *i == *j ) {
283  flaws << psetName << " PSet: \n"
284  << "in vString " << parameterLabel
285  << " duplication of the string " << *i << "\n";
286  }
287  }
288  }
289 } // 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 293 of file MessageServicePSetValidation.cc.

References mps_fire::i, and noCoutCerrClash().

296 {
297  vString::const_iterator end1 = v1.end();
298  vString::const_iterator end2 = v2.end();
299  for (vString::const_iterator i = v1.begin(); i != end1; ++i) {
300  for (vString::const_iterator j = v2.begin(); j != end2; ++j) {
301  if ( *i == *j ) {
302  flaws << psetName << " PSet: \n"
303  << "in vStrings " << p1 << " and " << p2
304  << " duplication of the string " << *i << "\n";
305  }
306  }
307  }
308 } // 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 331 of file MessageServicePSetValidation.cc.

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

Referenced by noCoutCerrClash().

333 {
334  vString::const_iterator end = v.end();
335  for (vString::const_iterator i = v.begin(); i != end; ++i) {
336  if (!keywordCheck(*i)) {
337  flaws << psetName << " PSet: \n"
338  << "vString " << parameterLabel
339  << " should not contain the keyword " << *i << "\n";
340  }
341  }
342 } // 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 712 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().

713 {
714  vString psnames;
715  pset.getParameterSetNames(psnames, false);
716  vString::const_iterator end = psnames.end();
717  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
718  if ( lookForMatch (categories, *i) ) continue;
719  if ( lookForMatch (messageIDs, *i) ) continue;
720  if ( (*i) == "default" ) continue;
721  if ( (*i) == "ERROR" ) continue;
722  if ( (*i) == "WARNING" ) continue;
723  if ( (*i) == "INFO" ) continue;
724  if ( (*i) == "DEBUG" ) continue;
725  ParameterSet empty_PSet;
726  bool ok_optionalPSet = false;
727  try {
728  ParameterSet const& culprit =
729  pset.getUntrackedParameterSet((*i),empty_PSet);
730  ok_optionalPSet =
731  culprit.getUntrackedParameter<bool>("placeholder", ok_optionalPSet);
732  ok_optionalPSet =
733  culprit.getUntrackedParameter<bool>("optionalPSet", ok_optionalPSet);
734  } catch (cms::Exception& e) {
735  }
736  if (ok_optionalPSet) continue;
737  flaws << psetName << " PSet: \n"
738  << *i << " is an unrecognized name for a PSet in this context \n";
739  }
740  psnames.clear();
741  unsigned int n = pset.getParameterSetNames(psnames, true);
742  if ( n > 0 ) {
743  end = psnames.end();
744  for (vString::const_iterator i = psnames.begin(); i != end; ++i) {
745  flaws << psetName << " PSet: \n"
746  << "PSet " << *i << " is tracked - not allowed\n";
747  }
748  }
749 } // 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 381 of file MessageServicePSetValidation.cc.

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

Referenced by keywordCheck().

384 {
385  disallowedParam <int> ( pset, v, psetName, parameterLabel, "int" );
386  disallowedParam <unsigned int> ( pset, v, psetName, parameterLabel, "uint" );
387  disallowedParam <bool> ( pset, v, psetName, parameterLabel, "bool" );
388  disallowedParam <float> ( pset, v, psetName, parameterLabel, "float" );
389  disallowedParam <double> ( pset, v, psetName, parameterLabel, "double" );
390  disallowedParam <std::string> ( pset, v, psetName, parameterLabel, "string" );
391  disallowedParam <std::vector<std::string> >
392  ( pset, v, psetName, parameterLabel, "vstring" );
393 } // noNonPSetUsage
void edm::service::MessageServicePSetValidation::noOtherPsets ( ParameterSet const &  pset)
private

Definition at line 430 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().

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

110 {
111  destinations = check<vString>
112  (pset, "MessageLogger", "destinations");
113  noDuplicates(destinations,"MessageLogger", "destinations");
114  noKeywords(destinations,"MessageLogger", "destinations");
115  noNonPSetUsage(pset, destinations,"MessageLogger", "destinations");
116  // REMOVED: noCoutCerrClash(destinations,"MessageLogger", "destinations");
117 
118  statistics = check<vString>
119  (pset, "MessageLogger", "statistics");
120  noDuplicates(statistics,"MessageLogger", "statistics");
121  noKeywords(statistics,"MessageLogger", "statistics");
122  noNonPSetUsage(pset, statistics,"MessageLogger", "statistics");
123 
124  fwkJobReports = check<vString>
125  (pset, "MessageLogger", "fwkJobReports");
126  noDuplicates(fwkJobReports,"MessageLogger", "fwkJobReports");
127  noKeywords(fwkJobReports,"MessageLogger", "fwkJobReports");
128  noNonPSetUsage(pset, fwkJobReports,"MessageLogger", "fwkJobReports");
130  "MessageLogger", "fwkJobReports","destinations");
132  "MessageLogger", "fwkJobReports","statistics");
133 
134  categories = check<vString>
135  (pset, "MessageLogger", "categories");
136  noDuplicates(categories,"MessageLogger", "categories");
137  noKeywords(categories,"MessageLogger", "categories");
138  noNonPSetUsage(pset, categories,"MessageLogger", "categories");
140  "MessageLogger", "categories","destinations");
142  "MessageLogger", "categories","statistics");
144  "MessageLogger", "categories","fwkJobReports");
145 
146  messageIDs = check<vString>
147  (pset, "MessageLogger", "messageIDs");
148  noDuplicates(messageIDs,"MessageLogger", "messageIDs");
149  noKeywords(messageIDs,"MessageLogger", "messageIDs");
150  noNonPSetUsage(pset, messageIDs,"MessageLogger", "messageIDs");
152  "MessageLogger", "messageIDs","destinations");
154  "MessageLogger", "messageIDs","statistics");
156  "MessageLogger", "messageIDs","fwkJobReports");
158  "MessageLogger", "messageIDs","categories");
159 
160 } // 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 608 of file MessageServicePSetValidation.cc.

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

Referenced by statisticsPSets().

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

595 {
596  ParameterSet empty_PSet;
597  std::vector<std::string>::const_iterator end = statistics.end();
598  for ( std::vector<std::string>::const_iterator i = statistics.begin();
599  i != end; ++i ) {
600  if (lookForMatch(destinations, *i)) continue;
601  ParameterSet const& d = pset.getUntrackedParameterSet(*i, empty_PSet);
602  statisticsPSet(d,*i);
603  }
604 } // 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 164 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().

165 {
166  debugModules = check<vString>
167  (pset, "MessageLogger", "debugModules");
168  bool dmStar = wildcard(debugModules);
169  if ( dmStar && debugModules.size() != 1) {
170  flaws << "MessageLogger" << " PSet: \n"
171  << "debugModules contains wildcard character *"
172  << " and also " << debugModules.size()-1
173  << " other entries - * must be alone\n";
174  }
175  suppressDebug = check<vString>
176  (pset, "MessageLogger", "suppressDebug");
177  if ( (suppressDebug.size() > 0) && (!dmStar) ) {
178  flaws << "MessageLogger" << " PSet: \n"
179  << "suppressDebug contains modules, but debugModules is not *\n"
180  << "Unless all the debugModules are enabled,\n"
181  << "suppressing specific modules is meaningless\n";
182  }
183  if (wildcard(suppressDebug)) {
184  flaws << "MessageLogger" << " PSet: \n"
185  << "Use of wildcard (*) in suppressDebug is not supported\n"
186  << "By default, LogDebug is suppressed for all modules\n";
187  }
188  suppressInfo = check<vString>
189  (pset, "MessageLogger", "suppressInfo");
190  if (wildcard(suppressInfo)) {
191  flaws << "MessageLogger" << " PSet: \n"
192  << "Use of wildcard (*) in suppressInfo is not supported\n";
193  }
194  suppressWarning = check<vString>
195  (pset, "MessageLogger", "suppressWarning");
196  if (wildcard(suppressWarning)) {
197  flaws << "MessageLogger" << " PSet: \n"
198  << "Use of wildcard (*) in suppressWarning is not supported\n";
199  }
200  suppressError = check<vString>
201  (pset, "MessageLogger", "suppressError");
202  if (wildcard(suppressError)) {
203  flaws << "MessageLogger" << " PSet: \n"
204  << "Use of wildcard (*) in suppressError is not supported\n";
205  }
206 
207 } // suppressionLists
bool edm::service::MessageServicePSetValidation::validateThreshold ( std::string const &  thresh,
std::string const &  psetName 
)
private

Definition at line 254 of file MessageServicePSetValidation.cc.

References checkThreshold().

Referenced by allowedVstring().

255 {
256  if (checkThreshold(thresh)) return true;
257  flaws << psetName << " PSet: \n"
258  << "threshold has value " << thresh
259  << " which is not among {DEBUG, INFO, WARNING, ERROR}\n";
260  return false;
261 } // validateThreshold
void edm::service::MessageServicePSetValidation::vStringsCheck ( ParameterSet const &  pset,
std::string const &  psetName 
)
private

Definition at line 212 of file MessageServicePSetValidation.cc.

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

Referenced by suppressionLists().

213 {
214  vString vStrings = pset.getParameterNamesForType <vString> (false);
215  vString::const_iterator end = vStrings.end();
216  for ( vString::const_iterator i = vStrings.begin(); i != end; ++i ) {
217  if ( !allowedVstring(*i) ) {
218  flaws << "MessageLogger" << " PSet: \n"
219  << (*i) << " is used as a vstring, "
220  << "but no such vstring is recognized\n";
221  }
222  }
223  vStrings = pset.getParameterNamesForType <vString> (true);
224  end = vStrings.end();
225  for ( vString::const_iterator i = vStrings.begin(); i != end; ++i ) {
226  flaws << "MessageLogger" << " PSet: \n"
227  << (*i) << " is used as a tracked vstring: "
228  << "tracked parameters not allowed here\n";
229  }
230 } // vStringsCheck
#define end
Definition: vmac.h:37
bool edm::service::MessageServicePSetValidation::wildcard ( vString const &  v)
private

Definition at line 419 of file MessageServicePSetValidation.cc.

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

Referenced by noBadParams().

420 {
421  vString::const_iterator end = v.end();
422  for (vString::const_iterator i = v.begin(); i != end; ++i) {
423  if ((*i) == "*") return true;
424  }
425  return false;
426 }
#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.