CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ParameterDescription.cc
Go to the documentation of this file.
1 
3 
17 
18 #include <cassert>
19 #include <cstdlib>
20 #include <iomanip>
21 #include <ostream>
22 #include <sstream>
23 
24 namespace edm {
25 
26  // =================================================================
27 
30  bool isTracked,
31  Comment const& iComment)
32  : ParameterDescriptionBase(iLabel, k_PSet, isTracked, true, iComment),
33  psetDesc_(new ParameterSetDescription(value)) {}
34 
37  bool isTracked,
38  Comment const& iComment)
39  : ParameterDescriptionBase(iLabel, k_PSet, isTracked, true, iComment),
40  psetDesc_(new ParameterSetDescription(value)) {}
41 
43 
45  std::set<std::string>& validatedLabels,
46  bool optional) const {
47  bool exists = pset.existsAs<ParameterSet>(label(), isTracked());
48 
49  if (exists) {
50  validatedLabels.insert(label());
51  } else if (pset.existsAs<ParameterSet>(label(), !isTracked())) {
53  } else if (pset.exists(label())) {
55  }
56 
57  if (!optional && !exists) {
58  if (isTracked()) {
59  pset.addParameter(label(), ParameterSet());
60  } else {
62  }
63  validatedLabels.insert(label());
64  }
65 
66  exists = pset.existsAs<ParameterSet>(label(), isTracked());
67 
68  if (exists) {
69  if (pset.isRegistered()) {
70  pset.invalidateRegistration("");
71  }
72  ParameterSet* containedPSet = pset.getPSetForUpdate(label());
73  psetDesc_->validate(*containedPSet);
74  }
75  }
76 
78  bool writeToCfi,
79  DocFormatHelper& dfh) const {
80  os << "see Section " << dfh.section() << "." << dfh.counter();
81  if (!writeToCfi)
82  os << " (do not write to cfi)";
83  os << "\n";
84  }
85 
87 
89  bool /*optional*/,
90  DocFormatHelper& dfh) const {
91  int indentation = dfh.indentation();
92  if (dfh.parent() != DocFormatHelper::TOP) {
94  }
95 
96  std::stringstream ss;
97  ss << dfh.section() << "." << dfh.counter();
98  std::string newSection = ss.str();
99 
100  printSpaces(os, indentation);
101  os << "Section " << newSection << " " << label() << " PSet description:\n";
102  if (!dfh.brief())
103  os << "\n";
104 
105  DocFormatHelper new_dfh(dfh);
106  new_dfh.init();
107  new_dfh.setSection(newSection);
108  if (dfh.parent() == DocFormatHelper::TOP) {
109  new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent());
110  }
111  psetDesc_->print(os, new_dfh);
112  }
113 
115  return pset.existsAs<ParameterSet>(label(), isTracked());
116  }
117 
119  return psetDesc_.operator->();
120  }
121 
123  return psetDesc_.operator->();
124  }
125 
126  void ParameterDescription<ParameterSetDescription>::writeCfi_(std::ostream& os, int indentation) const {
127  bool startWithComma = false;
128  indentation += 2;
129  psetDesc_->writeCfi(os, startWithComma, indentation);
130  }
131 
132  void ParameterDescription<ParameterSetDescription>::writeDoc_(std::ostream&, int /*indentation*/) const {}
133 
134  // These next two should not be needed for this specialization
137  return true;
138  }
139 
142  return;
143  }
144 
145  // =================================================================
146 
148  ParameterSetDescription const& psetDesc,
149  bool isTracked,
150  std::vector<ParameterSet> const& vPset,
151  Comment const& iComment)
152  : ParameterDescriptionBase(iLabel, k_VPSet, isTracked, true, iComment),
153  psetDesc_(new ParameterSetDescription(psetDesc)),
154  vPset_(vPset),
155  partOfDefaultOfVPSet_(false) {}
156 
158  ParameterSetDescription const& psetDesc,
159  bool isTracked,
160  std::vector<ParameterSet> const& vPset,
161  Comment const& iComment)
162  : ParameterDescriptionBase(iLabel, k_VPSet, isTracked, true, iComment),
163  psetDesc_(new ParameterSetDescription(psetDesc)),
164  vPset_(vPset),
165  partOfDefaultOfVPSet_(false) {}
166 
168  ParameterSetDescription const& psetDesc,
169  bool isTracked,
170  Comment const& iComment)
171  : ParameterDescriptionBase(iLabel, k_VPSet, isTracked, false, iComment),
172  psetDesc_(new ParameterSetDescription(psetDesc)),
173  vPset_(),
174  partOfDefaultOfVPSet_(false) {}
175 
177  ParameterSetDescription const& psetDesc,
178  bool isTracked,
179  Comment const& iComment)
180  : ParameterDescriptionBase(iLabel, k_VPSet, isTracked, false, iComment),
181  psetDesc_(new ParameterSetDescription(psetDesc)),
182  vPset_(),
183  partOfDefaultOfVPSet_(false) {}
184 
186 
188  return psetDesc_.operator->();
189  }
190 
192  return psetDesc_.operator->();
193  }
194 
196  std::set<std::string>& validatedLabels,
197  bool optional) const {
198  bool exists = pset.existsAs<std::vector<ParameterSet> >(label(), isTracked());
199 
200  if (exists) {
201  validatedLabels.insert(label());
202  } else if (pset.existsAs<std::vector<ParameterSet> >(label(), !isTracked())) {
203  throwParameterWrongTrackiness();
204  } else if (pset.exists(label())) {
205  throwParameterWrongType();
206  }
207 
208  if (!exists && !optional) {
209  if (hasDefault()) {
210  if (isTracked()) {
211  pset.addParameter(label(), vPset_);
212  } else {
213  pset.addUntrackedParameter(label(), vPset_);
214  }
215  validatedLabels.insert(label());
216  } else {
217  throwMissingRequiredNoDefault();
218  }
219  }
220 
221  exists = pset.existsAs<std::vector<ParameterSet> >(label(), isTracked());
222  if (exists) {
223  VParameterSetEntry* vpsetEntry = pset.getPSetVectorForUpdate(label());
224  assert(vpsetEntry);
225 
226  for (unsigned i = 0; i < vpsetEntry->size(); ++i) {
227  psetDesc_->validate(vpsetEntry->psetInVector(i));
228  }
229  }
230  }
231 
232  void ParameterDescription<std::vector<ParameterSet> >::printDefault_(std::ostream& os,
233  bool writeToCfi,
234  DocFormatHelper& dfh) const {
235  os << "see Section " << dfh.section() << "." << dfh.counter();
236  if (!writeToCfi)
237  os << " (do not write to cfi)";
238  os << "\n";
239  }
240 
241  bool ParameterDescription<std::vector<ParameterSet> >::hasNestedContent_() const { return true; }
242 
243  void ParameterDescription<std::vector<ParameterSet> >::printNestedContent_(std::ostream& os,
244  bool /*optional*/,
245  DocFormatHelper& dfh) const {
246  int indentation = dfh.indentation();
247  if (dfh.parent() != DocFormatHelper::TOP) {
248  indentation -= DocFormatHelper::offsetSectionContent();
249  }
250 
251  if (!partOfDefaultOfVPSet_) {
252  printSpaces(os, indentation);
253  os << "Section " << dfh.section() << "." << dfh.counter() << " " << label() << " VPSet description:\n";
254 
255  printSpaces(os, indentation + DocFormatHelper::offsetSectionContent());
256  os << "All elements will be validated using the PSet description in Section " << dfh.section() << "."
257  << dfh.counter() << ".1.\n";
258  } else {
259  printSpaces(os, indentation);
260  os << "Section " << dfh.section() << "." << dfh.counter() << " "
261  << " VPSet description for VPSet that is part of the default of a containing VPSet:\n";
262  }
263 
264  printSpaces(os, indentation + DocFormatHelper::offsetSectionContent());
265 
266  unsigned subsectionOffset = 2;
267  if (partOfDefaultOfVPSet_)
268  subsectionOffset = 1;
269 
270  if (hasDefault()) {
271  if (vPset_.empty())
272  os << "The default VPSet is empty.\n";
273  else if (vPset_.size() == 1U)
274  os << "The default VPSet has 1 element.\n";
275  else
276  os << "The default VPSet has " << vPset_.size() << " elements.\n";
277 
278  if (!vPset_.empty()) {
279  for (unsigned i = 0; i < vPset_.size(); ++i) {
280  printSpaces(os, indentation + DocFormatHelper::offsetSectionContent());
281  os << "[" << (i) << "]: see Section " << dfh.section() << "." << dfh.counter() << "."
282  << (i + subsectionOffset) << "\n";
283  }
284  }
285  } else {
286  os << "Does not have a default VPSet.\n";
287  }
288 
289  if (!dfh.brief())
290  os << "\n";
291 
292  if (!partOfDefaultOfVPSet_) {
293  std::stringstream ss;
294  ss << dfh.section() << "." << dfh.counter() << ".1";
295  std::string newSection = ss.str();
296 
297  printSpaces(os, indentation);
298  os << "Section " << newSection << " description of PSet used to validate elements of VPSet:\n";
299  if (!dfh.brief())
300  os << "\n";
301 
302  DocFormatHelper new_dfh(dfh);
303  new_dfh.init();
304  new_dfh.setSection(newSection);
305  if (dfh.parent() == DocFormatHelper::TOP) {
306  new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent());
307  }
308  psetDesc_->print(os, new_dfh);
309  }
310 
311  if (hasDefault()) {
312  for (unsigned i = 0; i < vPset_.size(); ++i) {
313  std::stringstream ss;
314  ss << dfh.section() << "." << dfh.counter() << "." << (i + subsectionOffset);
315  std::string newSection = ss.str();
316 
317  printSpaces(os, indentation);
318  os << "Section " << newSection << " PSet description of "
319  << "default VPSet element [" << i << "]\n";
320  if (!dfh.brief())
321  os << "\n";
322 
323  DocFormatHelper new_dfh(dfh);
324  new_dfh.init();
325  new_dfh.setSection(newSection);
326  if (dfh.parent() == DocFormatHelper::TOP) {
327  new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent());
328  }
329 
330  ParameterSetDescription defaultDescription;
331  fillDescriptionFromPSet(vPset_[i], defaultDescription);
332  defaultDescription.print(os, new_dfh);
333  }
334  }
335  }
336 
338  return pset.existsAs<std::vector<ParameterSet> >(label(), isTracked());
339  }
340 
342  std::ostream& os,
343  int indentation,
344  bool& nextOneStartsWithAComma) {
345  if (nextOneStartsWithAComma)
346  os << ",";
347  nextOneStartsWithAComma = true;
348  os << "\n";
349  printSpaces(os, indentation + 2);
350 
351  os << "cms.PSet(";
352 
353  bool startWithComma = false;
354  int indent = indentation + 4;
355 
356  ParameterSetDescription psetDesc;
357  fillDescriptionFromPSet(pset, psetDesc);
358  psetDesc.writeCfi(os, startWithComma, indent);
359 
360  os << ")";
361  }
362 
363  void ParameterDescription<std::vector<ParameterSet> >::writeCfi_(std::ostream& os, int indentation) const {
364  bool nextOneStartsWithAComma = false;
365  for_all(
366  vPset_,
367  std::bind(
368  &writeOneElementToCfi, std::placeholders::_1, std::ref(os), indentation, std::ref(nextOneStartsWithAComma)));
369  os << "\n";
370  printSpaces(os, indentation);
371  }
372 
373  void ParameterDescription<std::vector<ParameterSet> >::writeDoc_(std::ostream&, int /*indentation*/) const {}
374 
375  // These next two should not be needed for this specialization
376  bool ParameterDescription<std::vector<ParameterSet> >::exists_(ParameterSet const&, bool /*isTracked*/) const {
378  return true;
379  }
380 
383  return;
384  }
385 
386  // =================================================================
387 
388  namespace writeParameterValue {
389 
390  template <typename T>
391  void writeSingleValue(std::ostream& os, T const& value, ValueFormat) {
392  os << value;
393  }
394 
395  // Specialize this for cases where the operator<< does not give
396  // the proper formatting for a configuration file.
397 
398  // Formatting the doubles is a little tricky. It is a requirement
399  // that when a value of ***type double*** is added to a ParameterSetDescription
400  // the EXACT same value of type double will be created and passed to the
401  // ParameterSet after the cfi files have been read. The tricky part
402  // is these values usually appear in the C++ code and cfi file as text
403  // strings (in decimal form). We do our best to force the text
404  // string in the C++ code to be the same as the text string in the
405  // cfi file by judiciously rounding to smaller precision when possible.
406  // But it is not always possible to force the text strings to be the
407  // same. Generally, there are differences when the text string in the
408  // C++ code has many digits (probably more than a human will ever type).
409  // Even in cases where the text strings differ, the values stored in
410  // memory in variables of type double will be exactly the same.
411  // The alternative to the approach here is to store the values as strings,
412  // but that approach was rejected because it would require the
413  // ParameterSetDescription to know how to parse the strings.
415  {
416  std::stringstream ss;
417  ss << std::setprecision(17) << value;
418  result = ss.str();
419  }
420  if (result.size() > 15 && std::string::npos != result.find('.')) {
421  std::stringstream ss;
422  ss << std::setprecision(15) << value;
423  std::string resultLessPrecision = ss.str();
424 
425  if (resultLessPrecision.size() < result.size() - 2) {
426  double test = std::strtod(resultLessPrecision.c_str(), nullptr);
427  if (test == value) {
428  result = resultLessPrecision;
429  }
430  }
431  }
432  }
433 
434  template <>
435  void writeSingleValue<double>(std::ostream& os, double const& value, ValueFormat) {
436  std::string sValue;
437  formatDouble(value, sValue);
438  os << sValue;
439  }
440 
441  template <>
442  void writeSingleValue<bool>(std::ostream& os, bool const& value, ValueFormat) {
443  value ? os << "True" : os << "False";
444  }
445 
446  template <>
447  void writeSingleValue<std::string>(std::ostream& os, std::string const& value, ValueFormat) {
448  os << "'" << value << "'";
449  }
450 
451  template <>
452  void writeSingleValue<EventID>(std::ostream& os, EventID const& value, ValueFormat format) {
453  if (format == CFI) {
454  os << value.run() << ", " << value.luminosityBlock() << ", " << value.event();
455  } else {
456  if (value.luminosityBlock() == 0U) {
457  os << value.run() << ":" << value.event();
458  } else {
459  os << value.run() << ":" << value.luminosityBlock() << ":" << value.event();
460  }
461  }
462  }
463 
464  template <>
466  if (format == CFI)
467  os << value.run() << ", " << value.luminosityBlock();
468  else
469  os << value.run() << ":" << value.luminosityBlock();
470  }
471 
472  template <>
474  if (value.startLumi() == 0U) {
475  if (format == CFI)
476  os << "'" << value.startRun() << ":" << value.startEvent() << "-" << value.endRun() << ":" << value.endEvent()
477  << "'";
478  else
479  os << value.startRun() << ":" << value.startEvent() << "-" << value.endRun() << ":" << value.endEvent();
480  } else {
481  if (format == CFI)
482  os << "'" << value.startRun() << ":" << value.startLumi() << ":" << value.startEvent() << "-"
483  << value.endRun() << ":" << value.endLumi() << ":" << value.endEvent() << "'";
484  else
485  os << value.startRun() << ":" << value.startLumi() << ":" << value.startEvent() << "-" << value.endRun()
486  << ":" << value.endLumi() << ":" << value.endEvent();
487  }
488  }
489 
490  template <>
494  if (format == CFI)
495  os << "'" << value.startRun() << ":" << value.startLumi() << "-" << value.endRun() << ":" << value.endLumi()
496  << "'";
497  else
498  os << value.startRun() << ":" << value.startLumi() << "-" << value.endRun() << ":" << value.endLumi();
499  }
500 
501  template <>
502  void writeSingleValue<InputTag>(std::ostream& os, InputTag const& value, ValueFormat format) {
503  if (format == CFI) {
504  os << "'" << value.label() << "'";
505  if (!value.instance().empty() || !value.process().empty()) {
506  os << ", '" << value.instance() << "'";
507  }
508  if (!value.process().empty()) {
509  os << ", '" << value.process() << "'";
510  }
511  } else {
512  os << "'" << value.label();
513  if (!value.instance().empty() || !value.process().empty()) {
514  os << ":" << value.instance();
515  }
516  if (!value.process().empty()) {
517  os << ":" << value.process();
518  }
519  os << "'";
520  }
521  }
522 
523  template <>
525  if (format == CFI) {
526  os << "'" << value.module() << "', '" << value.data() << "'";
527  } else {
528  os << "'" << value.module() << ":" << value.data() << "'";
529  }
530  }
531 
532  template <>
533  void writeSingleValue<FileInPath>(std::ostream& os, FileInPath const& value, ValueFormat) {
534  os << "'" << value.relativePath() << "'";
535  }
536 
537  template <typename T>
538  void writeValue(std::ostream& os, T const& value_, ValueFormat format) {
539  std::ios_base::fmtflags ff = os.flags(std::ios_base::dec);
540  os.width(0);
541  writeSingleValue<T>(os, value_, format);
542  os.flags(ff);
543  }
544 
545  template <typename T>
546  void writeValueInVector(std::ostream& os, T const& value, ValueFormat format) {
547  writeSingleValue<T>(os, value, format);
548  }
549 
550  // Specializations for cases where we write the single values into
551  // vectors differently than when there is only one not in a vector.
552  template <>
553  void writeValueInVector<EventID>(std::ostream& os, EventID const& value, ValueFormat format) {
554  if (value.luminosityBlock() == 0U) {
555  if (format == CFI)
556  os << "'" << value.run() << ":" << value.event() << "'";
557  else
558  os << value.run() << ":" << value.event();
559  } else {
560  if (format == CFI)
561  os << "'" << value.run() << ":" << value.luminosityBlock() << ":" << value.event() << "'";
562  else
563  os << value.run() << ":" << value.luminosityBlock() << ":" << value.event();
564  }
565  }
566 
567  template <>
569  if (format == CFI)
570  os << "'" << value.run() << ":" << value.luminosityBlock() << "'";
571  else
572  os << value.run() << ":" << value.luminosityBlock();
573  }
574 
575  template <>
576  void writeValueInVector<InputTag>(std::ostream& os, InputTag const& value, ValueFormat) {
577  os << "'" << value.label();
578  if (!value.instance().empty() || !value.process().empty()) {
579  os << ":" << value.instance();
580  }
581  if (!value.process().empty()) {
582  os << ":" << value.process();
583  }
584  os << "'";
585  }
586 
587  template <>
588  void writeValueInVector<ESInputTag>(std::ostream& os, ESInputTag const& value, ValueFormat) {
589  os << "'" << value.module() << ":" << value.data() << "'";
590  }
591 
592  template <typename T>
594  T const& value, std::ostream& os, int indentation, bool& startWithComma, ValueFormat format, int& i) {
595  if (startWithComma && format == CFI)
596  os << ",";
597  startWithComma = true;
598  os << "\n" << std::setw(indentation) << "";
599  if (format == DOC)
600  os << "[" << i << "]: ";
601  writeValueInVector<T>(os, value, format);
602  ++i;
603  }
604 
605  template <typename T>
606  void writeVector(std::ostream& os, int indentation, std::vector<T> const& value_, ValueFormat format) {
607  std::ios_base::fmtflags ff = os.flags(std::ios_base::dec);
608  char oldFill = os.fill();
609  os.width(0);
610  if (value_.empty() && format == DOC) {
611  os << "empty";
612  } else if (value_.size() == 1U && format == CFI) {
613  writeValueInVector<T>(os, value_[0], format);
614  } else if (!value_.empty()) {
615  if (format == DOC)
616  os << "(vector size = " << value_.size() << ")";
617  if (format == CFI and value_.size() > 255U)
618  os << " *(";
619  os.fill(' ');
620  bool startWithComma = false;
621  int i = 0;
622  for_all(value_,
623  std::bind(&writeValueInVectorWithSpace<T>,
624  std::placeholders::_1,
625  std::ref(os),
626  indentation + 2,
627  std::ref(startWithComma),
628  format,
629  std::ref(i)));
630  if (format == CFI)
631  os << "\n" << std::setw(indentation) << "";
632  if (format == CFI and value_.size() > 255U)
633  os << ") ";
634  }
635  os.flags(ff);
636  os.fill(oldFill);
637  }
638 
639  void writeValue(std::ostream& os, int, int const& value_, ValueFormat format) {
640  writeValue<int>(os, value_, format);
641  }
642 
643  void writeValue(std::ostream& os, int indentation, std::vector<int> const& value_, ValueFormat format) {
644  writeVector<int>(os, indentation, value_, format);
645  }
646 
647  void writeValue(std::ostream& os, int, unsigned const& value_, ValueFormat format) {
648  writeValue<unsigned>(os, value_, format);
649  }
650 
651  void writeValue(std::ostream& os, int indentation, std::vector<unsigned> const& value_, ValueFormat format) {
652  writeVector<unsigned>(os, indentation, value_, format);
653  }
654 
655  void writeValue(std::ostream& os, int, long long const& value_, ValueFormat format) {
656  writeValue<long long>(os, value_, format);
657  }
658 
659  void writeValue(std::ostream& os, int indentation, std::vector<long long> const& value_, ValueFormat format) {
660  writeVector<long long>(os, indentation, value_, format);
661  }
662 
663  void writeValue(std::ostream& os, int, unsigned long long const& value_, ValueFormat format) {
664  writeValue<unsigned long long>(os, value_, format);
665  }
666 
667  void writeValue(std::ostream& os,
668  int indentation,
669  std::vector<unsigned long long> const& value_,
671  writeVector<unsigned long long>(os, indentation, value_, format);
672  }
673 
674  void writeValue(std::ostream& os, int, double const& value_, ValueFormat format) {
675  writeValue<double>(os, value_, format);
676  }
677 
678  void writeValue(std::ostream& os, int indentation, std::vector<double> const& value_, ValueFormat format) {
679  writeVector<double>(os, indentation, value_, format);
680  }
681 
682  void writeValue(std::ostream& os, int, bool const& value_, ValueFormat format) {
683  writeValue<bool>(os, value_, format);
684  }
685 
686  void writeValue(std::ostream& os, int, std::string const& value_, ValueFormat format) {
687  writeValue<std::string>(os, value_, format);
688  }
689 
690  void writeValue(std::ostream& os, int indentation, std::vector<std::string> const& value_, ValueFormat format) {
691  writeVector<std::string>(os, indentation, value_, format);
692  }
693 
694  void writeValue(std::ostream& os, int, EventID const& value_, ValueFormat format) {
695  writeValue<EventID>(os, value_, format);
696  }
697 
698  void writeValue(std::ostream& os, int indentation, std::vector<EventID> const& value_, ValueFormat format) {
699  writeVector<EventID>(os, indentation, value_, format);
700  }
701 
702  void writeValue(std::ostream& os, int, LuminosityBlockID const& value_, ValueFormat format) {
703  writeValue<LuminosityBlockID>(os, value_, format);
704  }
705 
706  void writeValue(std::ostream& os,
707  int indentation,
708  std::vector<LuminosityBlockID> const& value_,
710  writeVector<LuminosityBlockID>(os, indentation, value_, format);
711  }
712 
713  void writeValue(std::ostream& os, int, LuminosityBlockRange const& value_, ValueFormat format) {
714  writeValue<LuminosityBlockRange>(os, value_, format);
715  }
716 
717  void writeValue(std::ostream& os,
718  int indentation,
719  std::vector<LuminosityBlockRange> const& value_,
721  writeVector<LuminosityBlockRange>(os, indentation, value_, format);
722  }
723 
724  void writeValue(std::ostream& os, int, EventRange const& value_, ValueFormat format) {
725  writeValue<EventRange>(os, value_, format);
726  }
727 
728  void writeValue(std::ostream& os, int indentation, std::vector<EventRange> const& value_, ValueFormat format) {
729  writeVector<EventRange>(os, indentation, value_, format);
730  }
731 
732  void writeValue(std::ostream& os, int, InputTag const& value_, ValueFormat format) {
733  writeValue<InputTag>(os, value_, format);
734  }
735 
736  void writeValue(std::ostream& os, int indentation, std::vector<InputTag> const& value_, ValueFormat format) {
737  writeVector<InputTag>(os, indentation, value_, format);
738  }
739 
740  void writeValue(std::ostream& os, int, ESInputTag const& value_, ValueFormat format) {
741  writeValue<ESInputTag>(os, value_, format);
742  }
743 
744  void writeValue(std::ostream& os, int indentation, std::vector<ESInputTag> const& value_, ValueFormat format) {
745  writeVector<ESInputTag>(os, indentation, value_, format);
746  }
747 
748  void writeValue(std::ostream& os, int, FileInPath const& value_, ValueFormat format) {
749  writeValue<FileInPath>(os, value_, format);
750  }
751 
752  bool hasNestedContent(int const&) { return false; }
753  bool hasNestedContent(std::vector<int> const& value) { return value.size() > 5U; }
754  bool hasNestedContent(unsigned const&) { return false; }
755  bool hasNestedContent(std::vector<unsigned> const& value) { return value.size() > 5U; }
756  bool hasNestedContent(long long const&) { return false; }
757  bool hasNestedContent(std::vector<long long> const& value) { return value.size() > 5U; }
758  bool hasNestedContent(unsigned long long const&) { return false; }
759  bool hasNestedContent(std::vector<unsigned long long> const& value) { return value.size() > 5U; }
760  bool hasNestedContent(double const&) { return false; }
761  bool hasNestedContent(std::vector<double> const& value) { return value.size() > 5U; }
762  bool hasNestedContent(bool const&) { return false; }
763  bool hasNestedContent(std::string const&) { return false; }
764  bool hasNestedContent(std::vector<std::string> const& value) { return value.size() > 5U; }
765  bool hasNestedContent(EventID const&) { return false; }
766  bool hasNestedContent(std::vector<EventID> const& value) { return value.size() > 5U; }
767  bool hasNestedContent(LuminosityBlockID const&) { return false; }
768  bool hasNestedContent(std::vector<LuminosityBlockID> const& value) { return value.size() > 5U; }
769  bool hasNestedContent(LuminosityBlockRange const&) { return false; }
770  bool hasNestedContent(std::vector<LuminosityBlockRange> const& value) { return value.size() > 5U; }
771  bool hasNestedContent(EventRange const&) { return false; }
772  bool hasNestedContent(std::vector<EventRange> const& value) { return value.size() > 5U; }
773  bool hasNestedContent(InputTag const&) { return false; }
774  bool hasNestedContent(std::vector<InputTag> const& value) { return value.size() > 5U; }
775  bool hasNestedContent(ESInputTag const&) { return false; }
776  bool hasNestedContent(std::vector<ESInputTag> const& value) { return value.size() > 5U; }
777  bool hasNestedContent(FileInPath const&) { return false; }
778  } // namespace writeParameterValue
779 } // namespace edm
tuple optional
Definition: Types.py:198
void writeValueInVectorWithSpace(T const &value, std::ostream &os, int indentation, bool &startWithComma, ValueFormat format, int &i)
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
void writeSingleValue< ESInputTag >(std::ostream &os, ESInputTag const &value, ValueFormat format)
bool exists(std::string const &parameterName) const
checks if a parameter exists
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)
virtual void printDefault_(std::ostream &os, bool writeToCfi, DocFormatHelper &dfh) const
void insert(bool ok_to_replace, char const *, Entry const &)
assert(be >=bs)
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)
DescriptionParent parent() const
void writeVector(std::ostream &os, int indentation, std::vector< T > const &value_, ValueFormat format)
tuple result
Definition: mps_fire.py:311
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
char const * label
int indentation() const
VParameterSetEntry * getPSetVectorForUpdate(std::string const &name)
void writeCfi_(std::ostream &os, int indentation) const override
bool exists_(ParameterSet const &pset) const override
void writeSingleValue< EventID >(std::ostream &os, EventID const &value, ValueFormat format)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
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
static int offsetSectionContent()
void writeSingleValue(std::ostream &os, T const &value, ValueFormat)
bool isRegistered() const
Definition: ParameterSet.h:71
void writeValueInVector< InputTag >(std::ostream &os, InputTag const &value, ValueFormat)
bool hasNestedContent_() const override
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)
Definition: ParameterSet.cc:39
static void printSpaces(std::ostream &os, int n)
bool exists(ParameterSet const &pset) const
void writeValueInVector< LuminosityBlockID >(std::ostream &os, LuminosityBlockID const &value, ValueFormat format)
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:192
virtual ParameterSetDescription const * parameterSetDescription() const
void writeValue(std::ostream &os, int indentation, int const &value_, ValueFormat format)
void writeDoc_(std::ostream &os, int indentation) const override
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)
bool hasNestedContent(int const &value)
void setSection(std::string const &value)
long double T
void insertDefault_(ParameterSet &pset) const override
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)
void setIndentation(int value)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
std::string const & label() const
std::string const & section() const