45 std::set<std::string>& validatedLabels,
63 validatedLabels.insert(
label());
69 if (
pset.isRegistered()) {
70 pset.invalidateRegistration(
"");
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->();
129 bool startWithComma =
false;
152 std::vector<ParameterSet>
const& vPset,
157 partOfDefaultOfVPSet_(
false) {}
162 std::vector<ParameterSet>
const& vPset,
167 partOfDefaultOfVPSet_(
false) {}
176 partOfDefaultOfVPSet_(
false) {}
185 partOfDefaultOfVPSet_(
false) {}
190 return psetDesc_.operator->();
194 return psetDesc_.operator->();
198 std::set<std::string>& validatedLabels,
200 bool exists =
pset.existsAs<std::vector<ParameterSet> >(
label(), isTracked());
203 validatedLabels.insert(
label());
204 }
else if (
pset.existsAs<std::vector<ParameterSet> >(
label(), !isTracked())) {
205 throwParameterWrongTrackiness();
207 throwParameterWrongType();
215 pset.addUntrackedParameter(
label(), vPset_);
217 validatedLabels.insert(
label());
219 throwMissingRequiredNoDefault();
223 exists =
pset.existsAs<std::vector<ParameterSet> >(
label(), isTracked());
228 for (
unsigned i = 0;
i < vpsetEntry->
size(); ++
i) {
239 os <<
" (do not write to cfi)";
253 if (!partOfDefaultOfVPSet_) {
255 os <<
"Section " << dfh.
section() <<
"." << dfh.
counter() <<
" " <<
label() <<
" VPSet description:\n";
258 os <<
"All elements will be validated using the PSet description in Section " << dfh.
section() <<
"." 263 <<
" VPSet description for VPSet that is part of the default of a containing VPSet:\n";
268 unsigned subsectionOffset = 2;
269 if (partOfDefaultOfVPSet_)
270 subsectionOffset = 1;
274 os <<
"The default VPSet is empty.\n";
275 else if (vPset_.size() == 1
U)
276 os <<
"The default VPSet has 1 element.\n";
278 os <<
"The default VPSet has " << vPset_.size() <<
" elements.\n";
280 if (!vPset_.empty()) {
281 for (
unsigned i = 0;
i < vPset_.size(); ++
i) {
283 os <<
"[" << (
i) <<
"]: see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"." 284 << (
i + subsectionOffset) <<
"\n";
288 os <<
"Does not have a default VPSet.\n";
294 if (!partOfDefaultOfVPSet_) {
295 std::stringstream
ss;
300 os <<
"Section " << newSection <<
" description of PSet used to validate elements of VPSet:\n";
310 psetDesc_->print(
os, new_dfh);
314 for (
unsigned i = 0;
i < vPset_.size(); ++
i) {
315 std::stringstream
ss;
320 os <<
"Section " << newSection <<
" PSet description of " 321 <<
"default VPSet element [" <<
i <<
"]\n";
334 defaultDescription.
print(
os, new_dfh);
340 return pset.existsAs<std::vector<ParameterSet> >(
label(), isTracked());
345 if (nextOneStartsWithAComma)
347 nextOneStartsWithAComma =
true;
353 bool startWithComma =
false;
367 bool nextOneStartsWithAComma =
false;
369 std::bind(&writeOneElementToCfi,
370 std::placeholders::_1,
374 std::ref(nextOneStartsWithAComma)));
394 namespace writeParameterValue {
396 template <
typename T>
422 std::stringstream
ss;
423 ss << std::setprecision(17) <<
value;
426 if (
result.size() > 15 && std::string::npos !=
result.find(
'.')) {
427 std::stringstream
ss;
428 ss << std::setprecision(15) <<
value;
431 if (resultLessPrecision.size() <
result.size() - 2) {
432 double test = std::strtod(resultLessPrecision.c_str(),
nullptr);
434 result = resultLessPrecision;
462 if (
value.luminosityBlock() == 0
U) {
480 if (
value.startLumi() == 0
U) {
482 os <<
"'" <<
value.startRun() <<
":" <<
value.startEvent() <<
"-" <<
value.endRun() <<
":" <<
value.endEvent()
488 os <<
"'" <<
value.startRun() <<
":" <<
value.startLumi() <<
":" <<
value.startEvent() <<
"-" 489 <<
value.endRun() <<
":" <<
value.endLumi() <<
":" <<
value.endEvent() <<
"'";
492 <<
":" <<
value.endLumi() <<
":" <<
value.endEvent();
501 os <<
"'" <<
value.startRun() <<
":" <<
value.startLumi() <<
"-" <<
value.endRun() <<
":" <<
value.endLumi()
510 os <<
"'" <<
value.label() <<
"'";
511 if (!
value.instance().empty() || !
value.process().empty()) {
512 os <<
", '" <<
value.instance() <<
"'";
514 if (!
value.process().empty()) {
515 os <<
", '" <<
value.process() <<
"'";
519 if (!
value.instance().empty() || !
value.process().empty()) {
522 if (!
value.process().empty()) {
532 os <<
"'" <<
value.module() <<
"', '" <<
value.data() <<
"'";
534 os <<
"'" <<
value.module() <<
":" <<
value.data() <<
"'";
540 os <<
"'" <<
value.relativePath() <<
"'";
543 template <
typename T>
547 writeSingleValue<T>(
os, value_,
format);
551 template <
typename T>
560 if (
value.luminosityBlock() == 0
U) {
562 os <<
"'" <<
value.run() <<
":" <<
value.event() <<
"'";
567 os <<
"'" <<
value.run() <<
":" <<
value.luminosityBlock() <<
":" <<
value.event() <<
"'";
576 os <<
"'" <<
value.run() <<
":" <<
value.luminosityBlock() <<
"'";
584 if (!
value.instance().empty() || !
value.process().empty()) {
587 if (!
value.process().empty()) {
595 os <<
"'" <<
value.module() <<
":" <<
value.data() <<
"'";
598 template <
typename T>
603 startWithComma =
true;
606 os <<
"[" <<
i <<
"]: ";
611 template <
typename T>
614 char oldFill =
os.fill();
618 }
else if (value_.size() == 1
U &&
format ==
CFI) {
619 writeValueInVector<T>(
os, value_[0],
format);
620 }
else if (!value_.empty()) {
622 os <<
"(vector size = " << value_.size() <<
")";
626 bool startWithComma =
false;
629 std::bind(&writeValueInVectorWithSpace<T>,
630 std::placeholders::_1,
633 std::ref(startWithComma),
646 writeValue<int>(
os, value_,
format);
654 writeValue<unsigned>(
os, value_,
format);
662 writeValue<long long>(
os, value_,
format);
670 writeValue<unsigned long long>(
os, value_,
format);
675 std::vector<unsigned long long>
const& value_,
681 writeValue<double>(
os, value_,
format);
689 writeValue<bool>(
os, value_,
format);
693 writeValue<std::string>(
os, value_,
format);
701 writeValue<EventID>(
os, value_,
format);
709 writeValue<LuminosityBlockID>(
os, value_,
format);
714 std::vector<LuminosityBlockID>
const& value_,
720 writeValue<LuminosityBlockRange>(
os, value_,
format);
725 std::vector<LuminosityBlockRange>
const& value_,
731 writeValue<EventRange>(
os, value_,
format);
739 writeValue<InputTag>(
os, value_,
format);
747 writeValue<ESInputTag>(
os, value_,
format);
755 writeValue<FileInPath>(
os, value_,
format);
void writeValueInVectorWithSpace(T const &value, std::ostream &os, int indentation, bool &startWithComma, ValueFormat format, int &i)
void print(std::ostream &os, DocFormatHelper &dfh) const
void writeSingleValue< ESInputTag >(std::ostream &os, ESInputTag const &value, ValueFormat format)
std::string const & label() const
virtual ParameterSetDescription const * parameterSetDescription() const
void writeSingleValue< double >(std::ostream &os, double const &value, ValueFormat)
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
void writeSingleValue< bool >(std::ostream &os, bool const &value, ValueFormat)
void insert(bool ok_to_replace, char const *, Entry 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
bool exists_(ParameterSet const &pset) const override
void writeSingleValue< EventID >(std::ostream &os, EventID const &value, ValueFormat format)
void writeSingleValue< EventRange >(std::ostream &os, EventRange const &value, ValueFormat format)
void writeValueInVector< EventID >(std::ostream &os, EventID const &value, ValueFormat format)
void writeSingleValue(std::ostream &os, T const &value, ValueFormat)
~ParameterDescription() override
void writeValueInVector< InputTag >(std::ostream &os, InputTag const &value, ValueFormat)
void throwParameterWrongTrackiness() const
bool hasNestedContent_() const override
void writeValueInVector(std::ostream &os, T const &value, ValueFormat format)
void writeValueInVector< ESInputTag >(std::ostream &os, ESInputTag const &value, ValueFormat)
ParameterDescription(std::string const &iLabel, T const &value, bool isTracked, Comment const &iComment=Comment())
static void printSpaces(std::ostream &os, int n)
void writeValueInVector< LuminosityBlockID >(std::ostream &os, LuminosityBlockID const &value, ValueFormat format)
void writeCfi_(std::ostream &os, int indentation, CfiOptions &) const override
void writeValue(std::ostream &os, int indentation, int const &value_, ValueFormat format)
bool exists(ParameterSet const &pset) const
void throwParameterWrongType() const
void writeDoc_(std::ostream &os, int indentation) const override
virtual void printDefault_(std::ostream &os, bool writeToCfi, DocFormatHelper &dfh) const
void formatDouble(double value, std::string &result)
void writeSingleValue< InputTag >(std::ostream &os, InputTag const &value, ValueFormat format)
ParameterSet & psetInVector(int i)
std::vector< ParameterSet >::size_type size() const
bool hasNestedContent(int const &value)
void insertDefault_(ParameterSet &pset) const override
void writeCfi(std::ostream &os, bool startWithComma, int indentation, CfiOptions &) const
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
void writeSingleValue< LuminosityBlockID >(std::ostream &os, LuminosityBlockID const &value, ValueFormat format)
void writeSingleValue< LuminosityBlockRange >(std::ostream &os, LuminosityBlockRange const &value, ValueFormat format)
cfi::CfiOptions CfiOptions