CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::ParameterWildcardWithSpecifics Class Reference

#include <ParameterWildcardWithSpecifics.h>

Inheritance diagram for edm::ParameterWildcardWithSpecifics:
edm::ParameterWildcardBase edm::ParameterDescriptionNode

Public Member Functions

ParameterDescriptionNodeclone () const override
 
 ParameterWildcardWithSpecifics (std::string_view, WildcardValidationCriteria criteria, bool isTracked, ParameterSetDescription const &desc, std::map< std::string, ParameterSetDescription > exceptions)
 
- Public Member Functions inherited from edm::ParameterWildcardBase
WildcardValidationCriteria criteria () const
 
bool isTracked () const
 
ParameterTypes type () const
 
 ~ParameterWildcardBase () override
 
- Public Member Functions inherited from edm::ParameterDescriptionNode
void checkAndGetLabelsAndTypes (std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const
 
std::string const & comment () const
 
bool exists (ParameterSet const &pset) const
 
bool hasNestedContent () const
 
int howManyXORSubNodesExist (ParameterSet const &pset) const
 
 ParameterDescriptionNode ()
 
 ParameterDescriptionNode (Comment const &iComment)
 
bool partiallyExists (ParameterSet const &pset) const
 
void print (std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const
 
void printNestedContent (std::ostream &os, bool optional, DocFormatHelper &dfh) const
 
void setComment (std::string const &value)
 
void setComment (char const *value)
 
void validate (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const
 
void writeCfi (std::ostream &os, bool optional, bool &startWithComma, int indentation, bool &wroteSomething) const
 
virtual ~ParameterDescriptionNode ()
 

Private Member Functions

bool exists_ (ParameterSet const &pset) const override
 
bool hasNestedContent_ () const override
 
void printNestedContent_ (std::ostream &os, bool optional, DocFormatHelper &dfh) const override
 
void validate_ (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
 
void validateDescription (std::string const &parameterName, ParameterSet &pset) const
 
void validatePSetVector (std::string const &parameterName, ParameterSet &pset) const
 

Private Attributes

std::map< std::string, ParameterSetDescriptionexceptions_
 
ParameterSetDescription wildcardDesc_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::ParameterDescriptionNode
static void printSpaces (std::ostream &os, int n)
 
- Protected Member Functions inherited from edm::ParameterWildcardBase
 ParameterWildcardBase (ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria)
 
void throwIfInvalidPattern (char const *pattern) const
 
void throwIfInvalidPattern (std::string const &pattern) const
 
void validateMatchingNames (std::vector< std::string > const &matchingNames, std::set< std::string > &validatedLabels, bool optional) const
 
- Protected Attributes inherited from edm::ParameterDescriptionNode
std::string comment_
 

Detailed Description

Definition at line 15 of file ParameterWildcardWithSpecifics.h.

Constructor & Destructor Documentation

◆ ParameterWildcardWithSpecifics()

edm::ParameterWildcardWithSpecifics::ParameterWildcardWithSpecifics ( std::string_view  pattern,
WildcardValidationCriteria  criteria,
bool  isTracked,
ParameterSetDescription const &  desc,
std::map< std::string, ParameterSetDescription exceptions 
)

Definition at line 14 of file ParameterWildcardWithSpecifics.cc.

References topSingleLeptonDQM_PU_cfi::pattern, AlCaHLTBitMon_QueryRunRegistry::string, and edm::ParameterWildcardBase::throwIfInvalidPattern().

Referenced by clone().

22  }
void throwIfInvalidPattern(char const *pattern) const
int exceptions(int argc, char *argv[])
Definition: exceptions.h:34
std::map< std::string, ParameterSetDescription > exceptions_
WildcardValidationCriteria criteria() const
def move(src, dest)
Definition: eostools.py:511
ParameterWildcardBase(ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria)

Member Function Documentation

◆ clone()

ParameterDescriptionNode * edm::ParameterWildcardWithSpecifics::clone ( void  ) const
overridevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 24 of file ParameterWildcardWithSpecifics.cc.

References ParameterWildcardWithSpecifics().

24  {
25  return new ParameterWildcardWithSpecifics(*this);
26  }
ParameterWildcardWithSpecifics(std::string_view, WildcardValidationCriteria criteria, bool isTracked, ParameterSetDescription const &desc, std::map< std::string, ParameterSetDescription > exceptions)

◆ exists_()

bool edm::ParameterWildcardWithSpecifics::exists_ ( ParameterSet const &  pset) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 90 of file ParameterWildcardWithSpecifics.cc.

References edm::ParameterWildcardBase::criteria(), edm::ParameterSet::empty(), edm::ParameterWildcardBase::isTracked(), muonDTDigis_cfi::pset, edm::RequireAtLeastOne, edm::RequireZeroOrMore, and mitigatedMETSequence_cff::U.

90  {
91  if (criteria() == RequireZeroOrMore)
92  return true;
93 
94  std::vector<std::string> parameterNames = pset.getParameterNamesForType<ParameterSet>(isTracked());
95 
96  if (criteria() == RequireAtLeastOne)
97  return !parameterNames.empty();
98  return parameterNames.size() == 1U;
99  }
WildcardValidationCriteria criteria() const

◆ hasNestedContent_()

bool edm::ParameterWildcardWithSpecifics::hasNestedContent_ ( ) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 61 of file ParameterWildcardWithSpecifics.cc.

61 { return true; }

◆ printNestedContent_()

void edm::ParameterWildcardWithSpecifics::printNestedContent_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 63 of file ParameterWildcardWithSpecifics.cc.

References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), printContent_cfi::indentation, edm::DocFormatHelper::indentation(), edm::DocFormatHelper::offsetSectionContent(), edm::DocFormatHelper::OTHER, edm::DocFormatHelper::parent(), edm::ParameterSetDescription::print(), edm::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::section(), edm::DocFormatHelper::setIndentation(), edm::DocFormatHelper::setParent(), edm::DocFormatHelper::setSection(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, edm::DocFormatHelper::TOP, and wildcardDesc_.

65  {
66  int indentation = dfh.indentation();
67  if (dfh.parent() != DocFormatHelper::TOP) {
69  }
70 
72  os << "Section " << dfh.section() << "." << dfh.counter() << " description of PSet matching wildcard:";
73  os << "\n";
74  if (!dfh.brief())
75  os << "\n";
76 
77  std::stringstream ss;
78  ss << dfh.section() << "." << dfh.counter();
79  std::string newSection = ss.str();
80 
81  DocFormatHelper new_dfh(dfh);
82  new_dfh.setSection(newSection);
83  new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent());
84  new_dfh.setParent(DocFormatHelper::OTHER);
85 
86  wildcardDesc_.print(os, new_dfh);
87  //NOTE: need to extend to also include the specific cases.
88  }
void print(std::ostream &os, DocFormatHelper &dfh) const
static int offsetSectionContent()
static void printSpaces(std::ostream &os, int n)

◆ validate_()

void edm::ParameterWildcardWithSpecifics::validate_ ( ParameterSet pset,
std::set< std::string > &  validatedLabels,
bool  optional 
) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 28 of file ParameterWildcardWithSpecifics.cc.

References exceptions_, spr::find(), edm::ParameterSet::insert(), edm::ParameterWildcardBase::isTracked(), Skims_PA_cff::name, Types::optional, muonDTDigis_cfi::pset, findQualityFiles::v, validateDescription(), and edm::ParameterWildcardBase::validateMatchingNames().

30  {
31  std::vector<std::string> parameterNames = pset.getParameterNamesForType<ParameterSet>(isTracked());
32  validateMatchingNames(parameterNames, validatedLabels, optional);
33 
34  for (auto const& name : parameterNames) {
36  }
37  //inject exceptions if not already in the pset
38  for (auto const& v : exceptions_) {
39  if (std::find(parameterNames.begin(), parameterNames.end(), v.first) == parameterNames.end()) {
40  if (isTracked()) {
41  pset.addParameter<edm::ParameterSet>(v.first, edm::ParameterSet());
42  } else {
43  pset.addUntrackedParameter<edm::ParameterSet>(v.first, edm::ParameterSet());
44  }
45  validatedLabels.insert(v.first);
46  validateDescription(v.first, pset);
47  }
48  }
49  }
void insert(bool ok_to_replace, char const *, Entry const &)
void validateDescription(std::string const &parameterName, ParameterSet &pset) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::map< std::string, ParameterSetDescription > exceptions_
optional
Definition: Types.py:239
void validateMatchingNames(std::vector< std::string > const &matchingNames, std::set< std::string > &validatedLabels, bool optional) const

◆ validateDescription()

void edm::ParameterWildcardWithSpecifics::validateDescription ( std::string const &  parameterName,
ParameterSet pset 
) const
private

Definition at line 51 of file ParameterWildcardWithSpecifics.cc.

References exceptions_, muonDTDigis_cfi::pset, edm::ParameterSetDescription::validate(), and wildcardDesc_.

Referenced by validate_().

51  {
52  ParameterSet* containedPSet = pset.getPSetForUpdate(parameterName);
53  auto itFound = exceptions_.find(parameterName);
54  if (itFound != exceptions_.end()) {
55  itFound->second.validate(*containedPSet);
56  } else {
57  wildcardDesc_.validate(*containedPSet);
58  }
59  }
std::map< std::string, ParameterSetDescription > exceptions_
void validate(ParameterSet &pset) const

◆ validatePSetVector()

void edm::ParameterWildcardWithSpecifics::validatePSetVector ( std::string const &  parameterName,
ParameterSet pset 
) const
private

Member Data Documentation

◆ exceptions_

std::map<std::string, ParameterSetDescription> edm::ParameterWildcardWithSpecifics::exceptions_
private

Definition at line 39 of file ParameterWildcardWithSpecifics.h.

Referenced by validate_(), and validateDescription().

◆ wildcardDesc_

ParameterSetDescription edm::ParameterWildcardWithSpecifics::wildcardDesc_
private

Definition at line 38 of file ParameterWildcardWithSpecifics.h.

Referenced by printNestedContent_(), and validateDescription().