45 std::set<std::string>& validatedLabels,
57 if (!optional && !exists) {
63 validatedLabels.insert(
label());
73 psetDesc_->validate(*containedPSet);
82 os <<
" (do not write to cfi)";
101 os <<
"Section " << newSection <<
" " <<
label() <<
" PSet description:\n";
111 psetDesc_->print(os, new_dfh);
119 return psetDesc_.operator->();
123 return psetDesc_.operator->();
127 bool startWithComma =
false;
129 psetDesc_->writeCfi(os, startWithComma, indentation);
150 std::vector<ParameterSet>
const& vPset,
155 partOfDefaultOfVPSet_(
false) {}
160 std::vector<ParameterSet>
const& vPset,
165 partOfDefaultOfVPSet_(
false) {}
174 partOfDefaultOfVPSet_(
false) {}
183 partOfDefaultOfVPSet_(
false) {}
188 return psetDesc_.operator->();
192 return psetDesc_.operator->();
196 std::set<std::string>& validatedLabels,
201 validatedLabels.insert(
label());
208 if (!exists && !optional) {
215 validatedLabels.insert(
label());
226 for (
unsigned i = 0;
i < vpsetEntry->
size(); ++
i) {
237 os <<
" (do not write to cfi)";
251 if (!partOfDefaultOfVPSet_) {
253 os <<
"Section " << dfh.
section() <<
"." << dfh.
counter() <<
" " <<
label() <<
" VPSet description:\n";
256 os <<
"All elements will be validated using the PSet description in Section " << dfh.
section() <<
"." 261 <<
" VPSet description for VPSet that is part of the default of a containing VPSet:\n";
266 unsigned subsectionOffset = 2;
267 if (partOfDefaultOfVPSet_)
268 subsectionOffset = 1;
272 os <<
"The default VPSet is empty.\n";
273 else if (vPset_.size() == 1
U)
274 os <<
"The default VPSet has 1 element.\n";
276 os <<
"The default VPSet has " << vPset_.size() <<
" elements.\n";
278 if (!vPset_.empty()) {
279 for (
unsigned i = 0;
i < vPset_.size(); ++
i) {
281 os <<
"[" << (
i) <<
"]: see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"." 282 << (
i + subsectionOffset) <<
"\n";
286 os <<
"Does not have a default VPSet.\n";
292 if (!partOfDefaultOfVPSet_) {
293 std::stringstream
ss;
298 os <<
"Section " << newSection <<
" description of PSet used to validate elements of VPSet:\n";
308 psetDesc_->print(os, new_dfh);
312 for (
unsigned i = 0;
i < vPset_.size(); ++
i) {
313 std::stringstream
ss;
314 ss << dfh.
section() <<
"." << dfh.
counter() <<
"." << (
i + subsectionOffset);
318 os <<
"Section " << newSection <<
" PSet description of " 319 <<
"default VPSet element [" <<
i <<
"]\n";
332 defaultDescription.
print(os, new_dfh);
344 bool& nextOneStartsWithAComma) {
345 if (nextOneStartsWithAComma)
347 nextOneStartsWithAComma =
true;
353 bool startWithComma =
false;
354 int indent = indentation + 4;
358 psetDesc.
writeCfi(os, startWithComma, indent);
364 bool nextOneStartsWithAComma =
false;
368 &writeOneElementToCfi, std::placeholders::_1, std::ref(os), indentation, std::ref(nextOneStartsWithAComma)));
388 namespace writeParameterValue {
390 template <
typename T>
416 std::stringstream
ss;
417 ss << std::setprecision(17) <<
value;
420 if (result.size() > 15 && std::string::npos != result.find(
".")) {
421 std::stringstream
ss;
422 ss << std::setprecision(15) <<
value;
425 if (resultLessPrecision.size() < result.size() - 2) {
426 double test = std::strtod(resultLessPrecision.c_str(),
nullptr);
428 result = resultLessPrecision;
443 value ? os <<
"True" : os <<
"False";
448 os <<
"'" << value <<
"'";
454 os << value.run() <<
", " << value.luminosityBlock() <<
", " << value.event();
456 if (value.luminosityBlock() == 0
U) {
457 os << value.run() <<
":" << value.event();
459 os << value.run() <<
":" << value.luminosityBlock() <<
":" << value.event();
467 os << value.run() <<
", " << value.luminosityBlock();
469 os << value.run() <<
":" << value.luminosityBlock();
474 if (value.startLumi() == 0
U) {
476 os <<
"'" << value.startRun() <<
":" << value.startEvent() <<
"-" << value.endRun() <<
":" << value.endEvent()
479 os << value.startRun() <<
":" << value.startEvent() <<
"-" << value.endRun() <<
":" << value.endEvent();
482 os <<
"'" << value.startRun() <<
":" << value.startLumi() <<
":" << value.startEvent() <<
"-" 483 << value.endRun() <<
":" << value.endLumi() <<
":" << value.endEvent() <<
"'";
485 os << value.startRun() <<
":" << value.startLumi() <<
":" << value.startEvent() <<
"-" << value.endRun()
486 <<
":" << value.endLumi() <<
":" << value.endEvent();
495 os <<
"'" << value.startRun() <<
":" << value.startLumi() <<
"-" << value.endRun() <<
":" << value.endLumi()
498 os << value.startRun() <<
":" << value.startLumi() <<
"-" << value.endRun() <<
":" << value.endLumi();
504 os <<
"'" << value.label() <<
"'";
505 if (!value.instance().empty() || !value.process().empty()) {
506 os <<
", '" << value.instance() <<
"'";
508 if (!value.process().empty()) {
509 os <<
", '" << value.process() <<
"'";
512 os <<
"'" << value.label();
513 if (!value.instance().empty() || !value.process().empty()) {
514 os <<
":" << value.instance();
516 if (!value.process().empty()) {
517 os <<
":" << value.process();
526 os <<
"'" << value.module() <<
"', '" << value.data() <<
"'";
528 os <<
"'" << value.module() <<
":" << value.data() <<
"'";
534 os <<
"'" << value.relativePath() <<
"'";
537 template <
typename T>
545 template <
typename T>
554 if (value.luminosityBlock() == 0
U) {
556 os <<
"'" << value.run() <<
":" << value.event() <<
"'";
558 os << value.run() <<
":" << value.event();
561 os <<
"'" << value.run() <<
":" << value.luminosityBlock() <<
":" << value.event() <<
"'";
563 os << value.run() <<
":" << value.luminosityBlock() <<
":" << value.event();
570 os <<
"'" << value.run() <<
":" << value.luminosityBlock() <<
"'";
572 os << value.run() <<
":" << value.luminosityBlock();
577 os <<
"'" << value.label();
578 if (!value.instance().empty() || !value.process().empty()) {
579 os <<
":" << value.instance();
581 if (!value.process().empty()) {
582 os <<
":" << value.process();
589 os <<
"'" << value.module() <<
":" << value.data() <<
"'";
592 template <
typename T>
595 if (startWithComma && format ==
CFI)
597 startWithComma =
true;
598 os <<
"\n" << std::setw(indentation) <<
"";
600 os <<
"[" << i <<
"]: ";
605 template <
typename T>
608 char oldFill = os.fill();
610 if (value_.empty() && format ==
DOC) {
612 }
else if (value_.size() == 1
U && format ==
CFI) {
613 writeValueInVector<T>(os, value_[0],
format);
614 }
else if (!value_.empty()) {
616 os <<
"(vector size = " << value_.size() <<
")";
617 if (format ==
CFI and value_.size() > 255
U)
620 bool startWithComma =
false;
623 std::bind(&writeValueInVectorWithSpace<T>,
624 std::placeholders::_1,
627 std::ref(startWithComma),
631 os <<
"\n" << std::setw(indentation) <<
"";
632 if (format ==
CFI and value_.size() > 255
U)
669 std::vector<unsigned long long>
const&
value_,
708 std::vector<LuminosityBlockID>
const&
value_,
719 std::vector<LuminosityBlockRange>
const&
value_,
759 bool hasNestedContent(std::vector<unsigned long long>
const& value) {
return value.size() > 5
U; }
768 bool hasNestedContent(std::vector<LuminosityBlockID>
const& value) {
return value.size() > 5
U; }
770 bool hasNestedContent(std::vector<LuminosityBlockRange>
const& value) {
return value.size() > 5
U; }
void writeDoc_(std::ostream &os, int indentation) const override
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
void writeValueInVectorWithSpace(T const &value, std::ostream &os, int indentation, bool &startWithComma, ValueFormat format, int &i)
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void writeSingleValue< ESInputTag >(std::ostream &os, ESInputTag const &value, ValueFormat format)
bool exists_(ParameterSet const &pset) const override
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void writeSingleValue< double >(std::ostream &os, double const &value, ValueFormat)
void writeSingleValue< bool >(std::ostream &os, bool const &value, ValueFormat)
virtual void printDefault_(std::ostream &os, bool writeToCfi, DocFormatHelper &dfh) const
void insert(bool ok_to_replace, char const *, Entry const &)
void writeCfi(std::ostream &os, bool startWithComma, int indentation) const
void fillDescriptionFromPSet(ParameterSet const &pset, ParameterSetDescription &desc)
void writeSingleValue< FileInPath >(std::ostream &os, FileInPath const &value, ValueFormat)
void writeVector(std::ostream &os, int indentation, std::vector< T > const &value_, ValueFormat format)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
void throwMissingRequiredNoDefault() const
void writeValue(std::ostream &os, T const &value_, ValueFormat format)
VParameterSetEntry * getPSetVectorForUpdate(std::string const &name)
void writeCfi_(std::ostream &os, int indentation) const override
void writeSingleValue< EventID >(std::ostream &os, EventID const &value, ValueFormat format)
void addParameter(std::string const &name, T const &value)
void writeSingleValue< EventRange >(std::ostream &os, EventRange const &value, ValueFormat format)
void writeValueInVector< EventID >(std::ostream &os, EventID const &value, ValueFormat format)
void print(std::ostream &os, DocFormatHelper &dfh) const
void throwParameterWrongType() const
void writeSingleValue(std::ostream &os, T const &value, ValueFormat)
~ParameterDescription() override
bool isRegistered() const
void writeValueInVector< InputTag >(std::ostream &os, InputTag const &value, ValueFormat)
void writeValueInVector(std::ostream &os, T const &value, ValueFormat format)
void writeValueInVector< ESInputTag >(std::ostream &os, ESInputTag const &value, ValueFormat)
void invalidateRegistration(std::string const &nameOfTracked)
ParameterDescription(std::string const &iLabel, T const &value, bool isTracked, Comment const &iComment=Comment())
static void printSpaces(std::ostream &os, int n)
bool exists(ParameterSet const &pset) const
void insertDefault_(ParameterSet &pset) const override
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
void writeValueInVector< LuminosityBlockID >(std::ostream &os, LuminosityBlockID const &value, ValueFormat format)
void addUntrackedParameter(std::string const &name, T const &value)
bool hasNestedContent() const
bool hasNestedContent_() const override
void throwParameterWrongTrackiness() const
virtual ParameterSetDescription const * parameterSetDescription() const
void formatDouble(double value, std::string &result)
void writeSingleValue< InputTag >(std::ostream &os, InputTag const &value, ValueFormat format)
std::vector< ParameterSet >::size_type size() const
ParameterSet & psetInVector(int i)
void writeSingleValue< LuminosityBlockID >(std::ostream &os, LuminosityBlockID const &value, ValueFormat format)
void writeSingleValue< LuminosityBlockRange >(std::ostream &os, LuminosityBlockRange const &value, ValueFormat format)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
std::string const & label() const