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 (char const *value)
 
void setComment (std::string 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 
)

Member Function Documentation

◆ clone()

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

Implements edm::ParameterDescriptionNode.

Definition at line 24 of file ParameterWildcardWithSpecifics.cc.

24  {
25  return new ParameterWildcardWithSpecifics(*this);
26  }

References ParameterWildcardWithSpecifics().

◆ exists_()

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

Implements edm::ParameterDescriptionNode.

Definition at line 90 of file ParameterWildcardWithSpecifics.cc.

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  }

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

◆ 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.

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  }

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_.

◆ 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.

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  }

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().

◆ validateDescription()

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

Definition at line 51 of file ParameterWildcardWithSpecifics.cc.

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  }

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

Referenced by validate_().

◆ 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().

edm::DocFormatHelper::TOP
Definition: DocFormatHelper.h:17
edm::ParameterWildcardBase::throwIfInvalidPattern
void throwIfInvalidPattern(char const *pattern) const
Definition: ParameterWildcardBase.cc:20
edm::ParameterWildcardWithSpecifics::validateDescription
void validateDescription(std::string const &parameterName, ParameterSet &pset) const
Definition: ParameterWildcardWithSpecifics.cc:51
edm::ParameterSetDescription::validate
void validate(ParameterSet &pset) const
Definition: ParameterSetDescription.cc:78
Types.optional
optional
Definition: Types.py:199
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::ParameterWildcardWithSpecifics::exceptions_
std::map< std::string, ParameterSetDescription > exceptions_
Definition: ParameterWildcardWithSpecifics.h:39
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::ParameterWildcardWithSpecifics::ParameterWildcardWithSpecifics
ParameterWildcardWithSpecifics(std::string_view, WildcardValidationCriteria criteria, bool isTracked, ParameterSetDescription const &desc, std::map< std::string, ParameterSetDescription > exceptions)
Definition: ParameterWildcardWithSpecifics.cc:14
edm::ParameterSet::insert
void insert(bool ok_to_replace, char const *, Entry const &)
Definition: ParameterSet.cc:380
edm::RequireAtLeastOne
Definition: ParameterWildcardBase.h:17
edm::ParameterWildcardBase::isTracked
bool isTracked() const
Definition: ParameterWildcardBase.h:24
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterWildcardWithSpecifics::wildcardDesc_
ParameterSetDescription wildcardDesc_
Definition: ParameterWildcardWithSpecifics.h:38
ParameterSet
Definition: Functions.h:16
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
edm::ParameterSetDescription::print
void print(std::ostream &os, DocFormatHelper &dfh) const
Definition: ParameterSetDescription.cc:146
edm::ParameterWildcardBase::validateMatchingNames
void validateMatchingNames(std::vector< std::string > const &matchingNames, std::set< std::string > &validatedLabels, bool optional) const
Definition: ParameterWildcardBase.cc:36
edm::k_PSet
Definition: ParameterDescriptionNode.h:60
edm::ParameterDescriptionNode::printSpaces
static void printSpaces(std::ostream &os, int n)
Definition: ParameterDescriptionNode.cc:124
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::DocFormatHelper::offsetSectionContent
static int offsetSectionContent()
Definition: DocFormatHelper.h:83
edm::ParameterWildcardBase::ParameterWildcardBase
ParameterWildcardBase(ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria)
Definition: ParameterWildcardBase.cc:15
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
printContent_cfi.indentation
indentation
Definition: printContent_cfi.py:10
edm::ParameterWildcardBase::criteria
WildcardValidationCriteria criteria() const
Definition: ParameterWildcardBase.h:25
edm::DocFormatHelper::OTHER
Definition: DocFormatHelper.h:17
edm::RequireZeroOrMore
Definition: ParameterWildcardBase.h:17
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27