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->();
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,
198 bool exists =
pset.existsAs<std::vector<ParameterSet> >(
label(), isTracked());
201 validatedLabels.insert(
label());
202 }
else if (
pset.existsAs<std::vector<ParameterSet> >(
label(), !isTracked())) {
203 throwParameterWrongTrackiness();
205 throwParameterWrongType();
213 pset.addUntrackedParameter(
label(), vPset_);
215 validatedLabels.insert(
label());
217 throwMissingRequiredNoDefault();
221 exists =
pset.existsAs<std::vector<ParameterSet> >(
label(), isTracked());
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;
318 os <<
"Section " << newSection <<
" PSet description of "
319 <<
"default VPSet element [" <<
i <<
"]\n";
332 defaultDescription.
print(os, new_dfh);
338 return pset.existsAs<std::vector<ParameterSet> >(
label(), isTracked());
344 bool& nextOneStartsWithAComma) {
345 if (nextOneStartsWithAComma)
347 nextOneStartsWithAComma =
true;
353 bool startWithComma =
false;
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) {
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>
541 writeSingleValue<T>(os, value_,
format);
545 template <
typename T>
554 if (
value.luminosityBlock() == 0
U) {
556 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>
597 startWithComma =
true;
600 os <<
"[" <<
i <<
"]: ";
605 template <
typename T>
608 char oldFill = os.fill();
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() <<
")";
620 bool startWithComma =
false;
623 std::bind(&writeValueInVectorWithSpace<T>,
624 std::placeholders::_1,
627 std::ref(startWithComma),
640 writeValue<int>(os, value_,
format);
648 writeValue<unsigned>(os, value_,
format);
656 writeValue<long long>(os, value_,
format);
664 writeValue<unsigned long long>(os, value_,
format);
669 std::vector<unsigned long long>
const& value_,
675 writeValue<double>(os, value_,
format);
683 writeValue<bool>(os, value_,
format);
687 writeValue<std::string>(os, value_,
format);
695 writeValue<EventID>(os, value_,
format);
703 writeValue<LuminosityBlockID>(os, value_,
format);
708 std::vector<LuminosityBlockID>
const& value_,
714 writeValue<LuminosityBlockRange>(os, value_,
format);
719 std::vector<LuminosityBlockRange>
const& value_,
725 writeValue<EventRange>(os, value_,
format);
733 writeValue<InputTag>(os, value_,
format);
741 writeValue<ESInputTag>(os, value_,
format);
749 writeValue<FileInPath>(os, value_,
format);