CMS 3D CMS Logo

ParameterSet.cc
Go to the documentation of this file.
1 // ----------------------------------------------------------------------
2 //
3 // definition of ParameterSet's function members
4 // ----------------------------------------------------------------------
5 
6 // ----------------------------------------------------------------------
7 // prerequisite source files and headers
8 // ----------------------------------------------------------------------
9 
11 
18 
20 
21 #include <algorithm>
22 #include <iostream>
23 #include <sstream>
24 #include <cassert>
25 
26 // ----------------------------------------------------------------------
27 // class invariant checker
28 // ----------------------------------------------------------------------
29 
30 namespace edm {
31 
32  namespace pset::exceptions {
33  void throwWrongNumberOfElements(std::string const& iName, size_t iExpected, size_t iGot) {
34  throw Exception(errors::Configuration) << "The parameter '" << iName << "' should have " << iExpected
35  << " elements, but has " << iGot << " elements in the configuration.\n";
36  }
37  } // namespace pset::exceptions
38 
40  // We have added a new parameter. Invalidate the ID.
41  if (isRegistered()) {
42  id_ = ParameterSetID();
43  if (!nameOfTracked.empty()) {
44  // Give a warning (informational for now).
45  LogInfo("ParameterSet") << "Warning: You have added a new tracked parameter\n"
46  << "'" << nameOfTracked << "' to a previously registered parameter set.\n"
47  << "This is a bad idea because the new parameter(s) will not be recorded.\n"
48  << "Use the forthcoming ParameterSetDescription facility instead.\n"
49  << "A warning is given only for the first such parameter in a pset.\n";
50  }
51  }
52  assert(!isRegistered());
53  }
54 
55  // ----------------------------------------------------------------------
56  // constructors
57  // ----------------------------------------------------------------------
58 
59  ParameterSet::ParameterSet() : tbl_(), psetTable_(), vpsetTable_(), id_() {}
60 
61  // ----------------------------------------------------------------------
62  // from coded string
63 
64  ParameterSet::ParameterSet(std::string_view code) : tbl_(), psetTable_(), vpsetTable_(), id_() {
65  if (!fromString(code)) {
66  throw Exception(errors::Configuration, "InvalidInput")
67  << "The encoded configuration string "
68  << "passed to a ParameterSet during construction is invalid:\n"
69  << code;
70  }
71  }
72 
73  // ----------------------------------------------------------------------
74  // from coded string and ID.
75 
76  ParameterSet::ParameterSet(std::string_view code, ParameterSetID const& id)
77  : tbl_(), psetTable_(), vpsetTable_(), id_(id) {
78  if (!fromString(code)) {
79  throw Exception(errors::Configuration, "InvalidInput")
80  << "The encoded configuration string "
81  << "passed to a ParameterSet during construction is invalid:\n"
82  << code;
83  }
84  }
85 
87  // from coded string. Will cause registration
88  cms::Digest dg(rep);
89  edm::ParameterSetID psID(dg.digest().toString());
90  edm::ParameterSet ps(rep, psID);
92  }
93 
95  cms::Digest newDigest;
96  ParameterSet().toDigest(newDigest);
97  return ParameterSetID(newDigest.digest().toString());
98  }
99 
102  swap(temp);
103  id_ = ParameterSetID();
104  }
105 
107  tbl_.swap(other.tbl_);
108  psetTable_.swap(other.psetTable_);
109  vpsetTable_.swap(other.vpsetTable_);
110  id_.swap(other.id_);
111  }
112 
114  if (!isRegistered()) {
115  calculateID();
117  }
118  return *this;
119  }
120 
121  std::unique_ptr<ParameterSet> ParameterSet::popParameterSet(std::string const& name) {
122  assert(!isRegistered());
123  psettable::iterator it = psetTable_.find(name);
124  assert(it != psetTable_.end());
125  auto pset = std::make_unique<ParameterSet>();
126  std::swap(*pset, it->second.psetForUpdate());
127  psetTable_.erase(it);
128  return pset;
129  }
130 
132  assert(!isRegistered());
133  table::iterator it = tbl_.find(name);
134  assert(it != tbl_.end());
135  tbl_.erase(it);
136  }
137 
139  assert(!isRegistered());
140  psettable::iterator it = psetTable_.find(name);
141  assert(it != psetTable_.end());
142  ParameterSet& pset = it->second.psetForUpdate();
143  if (pset.isRegistered()) {
144  it->second.setIsTracked(false);
145  } else {
146  psetTable_.erase(it);
147  }
148  }
149 
150  std::vector<ParameterSet> ParameterSet::popVParameterSet(std::string const& name) {
151  assert(!isRegistered());
152  vpsettable::iterator it = vpsetTable_.find(name);
153  assert(it != vpsetTable_.end());
154  std::vector<ParameterSet> vpset;
155  std::swap(vpset, it->second.vpsetForUpdate());
156  vpsetTable_.erase(it);
157  return vpset;
158  }
159 
161  // make sure contained tracked psets are updated
162  for (auto& item : psetTable_) {
163  ParameterSet& pset = item.second.psetForUpdate();
164  if (!pset.isRegistered()) {
165  pset.registerIt();
166  }
167  item.second.updateID();
168  }
169 
170  // make sure contained tracked vpsets are updated
171  for (vpsettable::iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
172  i->second.registerPsetsAndUpdateIDs();
173  }
174  // The old, string base code is found below. Uncomment this and the assert to check whether
175  // there are discrepancies between old and new implementation.
176  // std::string stringrep;
177  // toString(stringrep);
178  // cms::Digest md5alg(stringrep);
179  // id_ = ParameterSetID(md5alg.digest().toString());
180  cms::Digest newDigest;
181  toDigest(newDigest);
182  id_ = ParameterSetID(newDigest.digest().toString());
183  // assert(md5alg.digest().toString() == newDigest.digest().toString());
184  assert(isRegistered());
185  }
186 
187  // ----------------------------------------------------------------------
188  // identification
190  // checks if valid
191  if (!isRegistered()) {
192  throw Exception(errors::LogicError) << "ParameterSet::id() called prematurely\n"
193  << "before ParameterSet::registerIt() has been called.\n";
194  }
195  return id_;
196  }
197 
198  void ParameterSet::setID(ParameterSetID const& id) { id_ = id; }
199 
200  // ----------------------------------------------------------------------
201  // Entry-handling
202  // ----------------------------------------------------------------------
203 
206  }
207 
210  if (result == nullptr)
211  throw Exception(errors::Configuration, "MissingParameter:")
212  << "The required parameter '" << name << "' was not specified.\n";
213  return result;
214  }
215 
216  template <typename T, typename U>
217  T first(std::pair<T, U> const& p) {
218  return p.first;
219  }
220 
221  template <typename T, typename U>
222  U second(std::pair<T, U> const& p) {
223  return p.second;
224  }
225 
226  Entry const& ParameterSet::retrieve(char const* name) const { return retrieve(std::string(name)); }
227 
229  table::const_iterator it = tbl_.find(name);
230  if (it == tbl_.end()) {
231  throw Exception(errors::Configuration, "MissingParameter:") << "Parameter '" << name << "' not found.";
232  }
233  if (it->second.isTracked() == false) {
234  if (name[0] == '@') {
235  throw Exception(errors::Configuration, "StatusMismatch:")
236  << "Framework Error: Parameter '" << name << "' is incorrectly designated as tracked in the framework.";
237  } else {
238  throw Exception(errors::Configuration, "StatusMismatch:")
239  << "Parameter '" << name << "' is designated as tracked in the code,\n"
240  << "but is designated as untracked in the configuration file.\n"
241  << "Please remove 'untracked' from the configuration file for parameter '" << name << "'.";
242  }
243  }
244  return it->second;
245  } // retrieve()
246 
248 
250  table::const_iterator it = tbl_.find(name);
251 
252  if (it == tbl_.end())
253  return nullptr;
254  if (it->second.isTracked()) {
255  if (name[0] == '@') {
256  throw Exception(errors::Configuration, "StatusMismatch:")
257  << "Framework Error: Parameter '" << name << "' is incorrectly designated as untracked in the framework.";
258  } else {
259  throw Exception(errors::Configuration, "StatusMismatch:")
260  << "Parameter '" << name << "' is designated as untracked in the code,\n"
261  << "but is not designated as untracked in the configuration file.\n"
262  << "Please change the configuration file to 'untracked <type> " << name << "'.";
263  }
264  }
265  return &it->second;
266  } // retrieve()
267 
269  psettable::const_iterator it = psetTable_.find(name);
270  if (it == psetTable_.end()) {
271  throw Exception(errors::Configuration, "MissingParameter:") << "ParameterSet '" << name << "' not found.";
272  }
273  if (it->second.isTracked() == false) {
274  if (name[0] == '@') {
275  throw Exception(errors::Configuration, "StatusMismatch:")
276  << "Framework Error: ParameterSet '" << name << "' is incorrectly designated as tracked in the framework.";
277  } else {
278  throw Exception(errors::Configuration, "StatusMismatch:")
279  << "ParameterSet '" << name << "' is designated as tracked in the code,\n"
280  << "but is designated as untracked in the configuration file.\n"
281  << "Please remove 'untracked' from the configuration file for parameter '" << name << "'.";
282  }
283  }
284  return it->second;
285  } // retrieve()
286 
288  psettable::const_iterator it = psetTable_.find(name);
289 
290  if (it == psetTable_.end())
291  return nullptr;
292  if (it->second.isTracked()) {
293  if (name[0] == '@') {
294  throw Exception(errors::Configuration, "StatusMismatch:")
295  << "Framework Error: ParameterSet '" << name
296  << "' is incorrectly designated as untracked in the framework.";
297  } else {
298  throw Exception(errors::Configuration, "StatusMismatch:")
299  << "ParameterSet '" << name << "' is designated as untracked in the code,\n"
300  << "but is not designated as untracked in the configuration file.\n"
301  << "Please change the configuration file to 'untracked <type> " << name << "'.";
302  }
303  }
304  return &it->second;
305  } // retrieve()
306 
308  vpsettable::const_iterator it = vpsetTable_.find(name);
309  if (it == vpsetTable_.end()) {
310  throw Exception(errors::Configuration, "MissingParameter:") << "VParameterSet '" << name << "' not found.";
311  }
312  if (it->second.isTracked() == false) {
313  throw Exception(errors::Configuration, "StatusMismatch:")
314  << "VParameterSet '" << name << "' is designated as tracked in the code,\n"
315  << "but is designated as untracked in the configuration file.\n"
316  << "Please remove 'untracked' from the configuration file for parameter '" << name << "'.";
317  }
318  return it->second;
319  } // retrieve()
320 
322  vpsettable::const_iterator it = vpsetTable_.find(name);
323 
324  if (it == vpsetTable_.end())
325  return nullptr;
326  if (it->second.isTracked()) {
327  throw Exception(errors::Configuration, "StatusMismatch:")
328  << "VParameterSet '" << name << "' is designated as untracked in the code,\n"
329  << "but is not designated as untracked in the configuration file.\n"
330  << "Please change the configuration file to 'untracked <type> " << name << "'.";
331  }
332  return &it->second;
333  } // retrieve()
334 
335  Entry const* ParameterSet::retrieveUnknown(char const* name) const { return retrieveUnknown(std::string(name)); }
336 
338  table::const_iterator it = tbl_.find(name);
339  if (it == tbl_.end()) {
340  return nullptr;
341  }
342  return &it->second;
343  }
344 
346  psettable::const_iterator it = psetTable_.find(name);
347  if (it == psetTable_.end()) {
348  return nullptr;
349  }
350  return &it->second;
351  }
352 
354  vpsettable::const_iterator it = vpsetTable_.find(name);
355  if (it == vpsetTable_.end()) {
356  return nullptr;
357  }
358  return &it->second;
359  }
360 
361  // ----------------------------------------------------------------------
362  // ----------------------------------------------------------------------
363 
365  if (existsAs<ParameterSet>(name)) {
367  } else if (existsAs<std::vector<ParameterSet> >(name)) {
369  } else if (exists(name)) {
370  return retrieveUnknown(name)->toString();
371  } else {
372  throw Exception(errors::Configuration, "getParameterAsString")
373  << "Cannot find parameter " << name << " in " << *this;
374  }
375  }
376 
377  // ----------------------------------------------------------------------
378  // ----------------------------------------------------------------------
379 
380  void ParameterSet::insert(bool okay_to_replace, char const* name, Entry const& value) {
381  insert(okay_to_replace, std::string(name), value);
382  }
383 
384  void ParameterSet::insert(bool okay_to_replace, std::string const& name, Entry const& value) {
385  // We should probably get rid of 'okay_to_replace', which will
386  // simplify the logic in this function.
387  table::iterator it = tbl_.find(name);
388 
389  if (it == tbl_.end()) {
390  if (!tbl_.insert(std::make_pair(name, value)).second)
391  throw Exception(errors::Configuration, "InsertFailure") << "cannot insert " << name << " into a ParameterSet\n";
392  } else if (okay_to_replace) {
393  it->second = value;
394  }
395  } // insert()
396 
397  void ParameterSet::insertParameterSet(bool okay_to_replace, std::string const& name, ParameterSetEntry const& entry) {
398  // We should probably get rid of 'okay_to_replace', which will
399  // simplify the logic in this function.
400  psettable::iterator it = psetTable_.find(name);
401 
402  if (it == psetTable_.end()) {
403  if (!psetTable_.insert(std::make_pair(name, entry)).second)
404  throw Exception(errors::Configuration, "InsertFailure") << "cannot insert " << name << " into a ParameterSet\n";
405  } else if (okay_to_replace) {
406  it->second = entry;
407  }
408  } // insert()
409 
410  void ParameterSet::insertVParameterSet(bool okay_to_replace,
411  std::string const& name,
412  VParameterSetEntry const& entry) {
413  // We should probably get rid of 'okay_to_replace', which will
414  // simplify the logic in this function.
415  vpsettable::iterator it = vpsetTable_.find(name);
416 
417  if (it == vpsetTable_.end()) {
418  if (!vpsetTable_.insert(std::make_pair(name, entry)).second)
419  throw Exception(errors::Configuration, "InsertFailure")
420  << "cannot insert " << name << " into a VParameterSet\n";
421  } else if (okay_to_replace) {
422  it->second = entry;
423  }
424  } // insert()
425 
427  // This preemptive invalidation may be more agressive than necessary.
429  if (&from == this) {
430  return;
431  }
432 
433  for (table::const_iterator b = from.tbl_.begin(), e = from.tbl_.end(); b != e; ++b) {
434  this->insert(false, b->first, b->second);
435  }
436  for (psettable::const_iterator b = from.psetTable_.begin(), e = from.psetTable_.end(); b != e; ++b) {
437  this->insertParameterSet(false, b->first, b->second);
438  }
439  for (vpsettable::const_iterator b = from.vpsetTable_.begin(), e = from.vpsetTable_.end(); b != e; ++b) {
440  this->insertVParameterSet(false, b->first, b->second);
441  }
442  } // augment()
443 
446  if (from.existsAs<ParameterSet>(name)) {
447  this->insertParameterSet(false, name, *(from.retrieveUnknownParameterSet(name)));
448  } else if (from.existsAs<std::vector<ParameterSet> >(name)) {
449  this->insertVParameterSet(false, name, *(from.retrieveUnknownVParameterSet(name)));
450  } else if (from.exists(name)) {
451  this->insert(false, name, *(from.retrieveUnknown(name)));
452  } else {
453  throw Exception(errors::Configuration, "copyFrom") << "Cannot find parameter " << name << " in " << from;
454  }
455  }
456 
458  assert(!isRegistered());
459  isTracked = false;
460  psettable::iterator it = psetTable_.find(name);
461  if (it == psetTable_.end())
462  return nullptr;
463  isTracked = it->second.isTracked();
464  return &it->second.psetForUpdate();
465  }
466 
468  assert(!isRegistered());
469  vpsettable::iterator it = vpsetTable_.find(name);
470  if (it == vpsetTable_.end())
471  return nullptr;
472  return &it->second;
473  }
474 
475  // ----------------------------------------------------------------------
476  // coding
477  // ----------------------------------------------------------------------
478 
480 
482 
483  void ParameterSet::toStringImp(std::string& rep, bool useAll) const {
484  // make sure the PSets get filled
485  if (empty()) {
486  rep += "<>";
487  return;
488  }
489  size_t size = 1;
490  for (table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
491  if (useAll || b->second.isTracked()) {
492  size += 2;
493  size += b->first.size();
494  size += b->second.sizeOfString();
495  }
496  }
497  for (psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
498  if (useAll || b->second.isTracked()) {
499  size += 2;
500  size += b->first.size();
501  size += b->first.size();
502  size += b->first.size();
503  size += sizeof(ParameterSetID);
504  }
505  }
506  for (vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
507  if (useAll || b->second.isTracked()) {
508  size += 2;
509  size += b->first.size();
510  size += sizeof(ParameterSetID) * b->second.vpset().size();
511  }
512  }
513 
514  rep.reserve(rep.size() + size);
515  rep += '<';
517  std::string const between(";");
518  for (table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
519  if (useAll || b->second.isTracked()) {
520  rep += start;
521  rep += b->first;
522  rep += '=';
523  b->second.toString(rep);
524  start = between;
525  }
526  }
527  for (psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
528  if (useAll || b->second.isTracked()) {
529  rep += start;
530  rep += b->first;
531  rep += '=';
532  b->second.toString(rep);
533  start = between;
534  }
535  }
536  for (vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
537  if (useAll || b->second.isTracked()) {
538  rep += start;
539  rep += b->first;
540  rep += '=';
541  b->second.toString(rep);
542  start = between;
543  }
544  }
545 
546  rep += '>';
547  } // to_string()
548 
549  void ParameterSet::toDigest(cms::Digest& digest) const {
550  digest.append("<", 1);
551  bool started = false;
552  for (table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
553  if (b->second.isTracked()) {
554  if (started)
555  digest.append(";", 1);
556  digest.append(b->first);
557  digest.append("=", 1);
558  b->second.toDigest(digest);
559  started = true;
560  }
561  }
562  for (psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
563  if (b->second.isTracked()) {
564  if (started)
565  digest.append(";", 1);
566  digest.append(b->first);
567  digest.append("=", 1);
568  b->second.toDigest(digest);
569  started = true;
570  }
571  }
572  for (vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
573  if (b->second.isTracked()) {
574  if (started)
575  digest.append(";", 1);
576  digest.append(b->first);
577  digest.append("=", 1);
578  b->second.toDigest(digest);
579  }
580  }
581 
582  digest.append(">", 1);
583  }
584 
587  toString(result);
588  return result;
589  }
590 
591  // ----------------------------------------------------------------------
592 
593  bool ParameterSet::fromString(std::string_view from) {
594  if (from.size() < 2 or from.front() != '<' or from.back() != '>') {
595  return false;
596  }
597 
598  std::string_view remaining = from;
599  remaining = remaining.substr(1, from.size() - 2);
600 
601  tbl_.clear(); // precaution
602  while (not remaining.empty()) {
603  // locate required name/value separator
604  auto q = remaining.find_first_of('=');
605  if (q == remaining.npos)
606  return false;
607  // form name unique to this ParameterSet
608  auto name = remaining.substr(0, q);
609  if (tbl_.find(name) != tbl_.end())
610  return false;
611 
612  remaining = remaining.substr(q + 1);
613  std::string_view rep = remaining.substr(0, remaining.find_first_of(';'));
614  // entries are generically of the form tracked-type-rep
615  if (rep[1] == 'Q') {
616  ParameterSetEntry psetEntry(rep);
617  if (!psetTable_.emplace(name, psetEntry).second) {
618  return false;
619  }
620  } else if (rep[1] == 'q') {
621  VParameterSetEntry vpsetEntry(rep);
622  if (!vpsetTable_.emplace(name, vpsetEntry).second) {
623  return false;
624  }
625  } else {
626  // form value and insert name/value pair
627  auto bounds = Entry::bounds(remaining, rep.size());
628  if (bounds.empty()) {
629  return false;
630  }
631  remaining = remaining.substr(bounds.size());
632  if (not remaining.empty() and remaining.front() != ';') {
633  return false;
634  }
636  if (rep[1] == 'P') {
637  ParameterSetEntry psetEntry(value.getPSet(), value.isTracked());
638  if (!psetTable_.emplace(name, psetEntry).second) {
639  return false;
640  }
641  } else if (rep[1] == 'p') {
642  VParameterSetEntry vpsetEntry(value.getVPSet(), value.isTracked());
643  if (!vpsetTable_.emplace(name, vpsetEntry).second) {
644  return false;
645  }
646  } else {
647  if (!tbl_.emplace(name, value).second) {
648  return false;
649  }
650  }
651  }
652  auto newStart = remaining.find_first_of(';');
653  if (newStart == remaining.npos)
654  break;
655  remaining = remaining.substr(newStart + 1);
656  }
657 
658  return true;
659  } // from_string()
660 
661  // ----------------------------------------------------------------------
662  std::string_view ParameterSet::extent(std::string_view from) {
663  if (from.size() < 2 or from.front() != '<') {
664  return {};
665  }
666 
667  std::string_view remaining = from;
668  remaining.remove_prefix(1);
669  while (not remaining.empty() and remaining[0] != '>') {
670  auto start_index = remaining.find_first_of('=');
671  if (remaining.npos == start_index) {
672  return {};
673  }
674  remaining.remove_prefix(start_index + 1);
675  auto end_index = remaining.find_first_of(";>");
676  if (remaining.npos == end_index) {
677  return {};
678  }
679  auto bounds = edm::Entry::bounds(remaining, end_index);
680  if (bounds.empty()) {
681  return {};
682  }
683  remaining.remove_prefix(bounds.size());
684  if (not remaining.empty() and remaining[0] == ';') {
685  remaining.remove_prefix(1);
686  }
687  }
688  if (remaining.empty()) {
689  return {};
690  }
691  from.remove_suffix(remaining.size() - 1);
692  return from;
693  }
694 
695  // ----------------------------------------------------------------------
696 
699  table::const_iterator it = tbl_.begin();
700  table::const_iterator end = tbl_.end();
701  while (it != end) {
702  Entry const& e = it->second;
703  if (e.typeCode() == 'F') {
704  ++count;
705  output.push_back(e.getFileInPath());
706  }
707  ++it;
708  }
709  return count;
710  }
711 
712  std::vector<std::string> ParameterSet::getParameterNames() const {
713  using std::placeholders::_1;
714  std::vector<std::string> returnValue;
715  std::transform(tbl_.begin(),
716  tbl_.end(),
717  back_inserter(returnValue),
719  std::transform(psetTable_.begin(),
720  psetTable_.end(),
721  back_inserter(returnValue),
723  std::transform(vpsetTable_.begin(),
724  vpsetTable_.end(),
725  back_inserter(returnValue),
727  return returnValue;
728  }
729 
730  bool ParameterSet::exists(std::string const& parameterName) const {
731  return (tbl_.find(parameterName) != tbl_.end() || psetTable_.find(parameterName) != psetTable_.end() ||
732  vpsetTable_.find(parameterName) != vpsetTable_.end());
733  }
734 
737  for (table::const_iterator tblItr = tbl_.begin(); tblItr != tbl_.end(); ++tblItr) {
738  if (tblItr->second.isTracked()) {
739  result.tbl_.insert(*tblItr);
740  }
741  }
742  for (psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
743  if (psetItr->second.isTracked()) {
744  result.addParameter<ParameterSet>(psetItr->first, psetItr->second.pset().trackedPart());
745  }
746  }
747  for (vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
748  if (vpsetItr->second.isTracked()) {
749  VParameterSet vresult;
750  std::vector<ParameterSet> const& this_vpset = vpsetItr->second.vpset();
751 
752  typedef std::vector<ParameterSet>::const_iterator Iter;
753  for (Iter i = this_vpset.begin(), e = this_vpset.end(); i != e; ++i) {
754  vresult.push_back(i->trackedPart());
755  }
756  result.addParameter<VParameterSet>(vpsetItr->first, vresult);
757  }
758  }
759  return result;
760  }
761 
762  /*
763  // Comment out unneeded function
764  size_t
765  ParameterSet::getAllParameterSetNames(std::vector<std::string>& output) const {
766  using std::placeholders::_1;
767  std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(output),
768  std::bind(&std::pair<std::string const, ParameterSetEntry>::first, _1));
769  return output.size();
770  }
771 */
772 
773  size_t ParameterSet::getParameterSetNames(std::vector<std::string>& output, bool trackiness) const {
774  for (psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
775  if (psetItr->second.isTracked() == trackiness) {
776  output.push_back(psetItr->first);
777  }
778  }
779  return output.size();
780  }
781 
782  size_t ParameterSet::getParameterSetVectorNames(std::vector<std::string>& output, bool trackiness) const {
783  for (vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
784  if (vpsetItr->second.isTracked() == trackiness) {
785  output.push_back(vpsetItr->first);
786  }
787  }
788  return output.size();
789  }
790 
791  size_t ParameterSet::getNamesByCode_(char code, bool trackiness, std::vector<std::string>& output) const {
792  size_t count = 0;
793  if (code == 'Q') {
794  return getParameterSetNames(output, trackiness);
795  }
796  if (code == 'q') {
797  return getParameterSetVectorNames(output, trackiness);
798  }
799  //deal with string encoding change by also looking for old code values
800  if (code == 'z') {
801  count += getNamesByCode_('s', trackiness, output);
802  }
803  if (code == 'Z') {
804  count += getNamesByCode_('S', trackiness, output);
805  }
806  table::const_iterator it = tbl_.begin();
807  table::const_iterator end = tbl_.end();
808  while (it != end) {
809  Entry const& e = it->second;
810  if (e.typeCode() == code && e.isTracked() == trackiness) { // if it is a vector of ParameterSet
811  ++count;
812  output.push_back(it->first); // save the name
813  }
814  ++it;
815  }
816  return count;
817  }
818 
819  template <>
820  std::vector<std::string> ParameterSet::getParameterNamesForType<FileInPath>(bool trackiness) const {
821  std::vector<std::string> result;
822  getNamesByCode_('F', trackiness, result);
823  return result;
824  }
825 
826  bool operator==(ParameterSet const& a, ParameterSet const& b) {
827  if (a.isRegistered() && b.isRegistered()) {
828  return (a.id() == b.id());
829  }
830  return isTransientEqual(a.trackedPart(), b.trackedPart());
831  }
832 
834  if (a.tbl().size() != b.tbl().size()) {
835  return false;
836  }
837  if (a.psetTable().size() != b.psetTable().size()) {
838  return false;
839  }
840  if (a.vpsetTable().size() != b.vpsetTable().size()) {
841  return false;
842  }
843  typedef ParameterSet::table::const_iterator Ti;
844  for (Ti i = a.tbl().begin(), e = a.tbl().end(), j = b.tbl().begin(), f = b.tbl().end(); i != e && j != f;
845  ++i, ++j) {
846  if (*i != *j) {
847  return false;
848  }
849  }
850  typedef ParameterSet::psettable::const_iterator Pi;
851  for (Pi i = a.psetTable().begin(), e = a.psetTable().end(), j = b.psetTable().begin(), f = b.psetTable().end();
852  i != e && j != f;
853  ++i, ++j) {
854  if (i->first != j->first) {
855  return false;
856  }
857  if (i->second.isTracked() != j->second.isTracked()) {
858  return false;
859  }
860  if (!isTransientEqual(i->second.pset(), j->second.pset())) {
861  return false;
862  }
863  }
864  typedef ParameterSet::vpsettable::const_iterator PVi;
865  for (PVi i = a.vpsetTable().begin(), e = a.vpsetTable().end(), j = b.vpsetTable().begin(), f = b.vpsetTable().end();
866  i != e && j != f;
867  ++i, ++j) {
868  if (i->first != j->first) {
869  return false;
870  }
871  if (i->second.isTracked() != j->second.isTracked()) {
872  return false;
873  }
874  std::vector<ParameterSet> const& iv = i->second.vpset();
875  std::vector<ParameterSet> const& jv = j->second.vpset();
876  if (iv.size() != jv.size()) {
877  return false;
878  }
879  for (size_t k = 0; k < iv.size(); ++k) {
880  if (!isTransientEqual(iv[k], jv[k])) {
881  return false;
882  }
883  }
884  }
885  return true;
886  }
887 
888  std::string ParameterSet::dump(unsigned int indent) const {
889  std::ostringstream os;
890  // indent a bit
892  os << "{" << std::endl;
893  for (table::const_iterator i = tbl_.begin(), e = tbl_.end(); i != e; ++i) {
894  os << indentation << " " << i->first << ": " << i->second << std::endl;
895  }
896  for (psettable::const_iterator i = psetTable_.begin(), e = psetTable_.end(); i != e; ++i) {
897  // indent a bit
898  std::string n = i->first;
899  ParameterSetEntry const& pe = i->second;
900  os << indentation << " " << n << ": " << pe.dump(indent + 2) << std::endl;
901  }
902  for (vpsettable::const_iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
903  // indent a bit
904  std::string n = i->first;
905  VParameterSetEntry const& pe = i->second;
906  os << indentation << " " << n << ": " << pe.dump(indent + 2) << std::endl;
907  }
908  os << indentation << "}";
909  return os.str();
910  }
911 
912  std::ostream& operator<<(std::ostream& os, ParameterSet const& pset) {
913  os << pset.dump();
914  return os;
915  }
916 
917  // Free function to return a parameterSet given its ID.
919  ParameterSet const* result = nullptr;
920  if (nullptr == (result = pset::Registry::instance()->getMapped(id))) {
921  throw Exception(errors::LogicError, "MissingParameterSet:") << "Parameter Set ID '" << id << "' not found.";
922  }
923  return *result;
924  }
925 
927  return getParameterSet(moduleDescription.mainParameterSetID());
928  }
929 
931  LogWarning("Configuration") << "Warning:\n\tstring " << name << " = \"" << label << "\"\nis deprecated, "
932  << "please update your config file to use\n\tInputTag " << name << " = " << label;
933  }
934 
935  // specializations
936  // ----------------------------------------------------------------------
937  // Bool, vBool
938 
939  template <>
940  bool ParameterSet::getParameter<bool>(std::string const& name) const {
941  return retrieve(name).getBool();
942  }
943 
944  // ----------------------------------------------------------------------
945  // Int32, vInt32
946 
947  template <>
948  int ParameterSet::getParameter<int>(std::string const& name) const {
949  return retrieve(name).getInt32();
950  }
951 
952  template <>
953  std::vector<int> ParameterSet::getParameter<std::vector<int> >(std::string const& name) const {
954  return retrieve(name).getVInt32();
955  }
956 
957  // ----------------------------------------------------------------------
958  // Int64, vInt64
959 
960  template <>
961  long long ParameterSet::getParameter<long long>(std::string const& name) const {
962  return retrieve(name).getInt64();
963  }
964 
965  template <>
966  std::vector<long long> ParameterSet::getParameter<std::vector<long long> >(std::string const& name) const {
967  return retrieve(name).getVInt64();
968  }
969 
970  // ----------------------------------------------------------------------
971  // Uint32, vUint32
972 
973  template <>
974  unsigned int ParameterSet::getParameter<unsigned int>(std::string const& name) const {
975  return retrieve(name).getUInt32();
976  }
977 
978  template <>
979  std::vector<unsigned int> ParameterSet::getParameter<std::vector<unsigned int> >(std::string const& name) const {
980  return retrieve(name).getVUInt32();
981  }
982 
983  // ----------------------------------------------------------------------
984  // Uint64, vUint64
985 
986  template <>
987  unsigned long long ParameterSet::getParameter<unsigned long long>(std::string const& name) const {
988  return retrieve(name).getUInt64();
989  }
990 
991  template <>
992  std::vector<unsigned long long> ParameterSet::getParameter<std::vector<unsigned long long> >(
993  std::string const& name) const {
994  return retrieve(name).getVUInt64();
995  }
996 
997  // ----------------------------------------------------------------------
998  // Double, vDouble
999 
1000  template <>
1001  double ParameterSet::getParameter<double>(std::string const& name) const {
1002  return retrieve(name).getDouble();
1003  }
1004 
1005  template <>
1006  std::vector<double> ParameterSet::getParameter<std::vector<double> >(std::string const& name) const {
1007  return retrieve(name).getVDouble();
1008  }
1009 
1010  // ----------------------------------------------------------------------
1011  // String, vString
1012 
1013  template <>
1014  std::string ParameterSet::getParameter<std::string>(std::string const& name) const {
1015  return retrieve(name).getString();
1016  }
1017 
1018  template <>
1019  std::vector<std::string> ParameterSet::getParameter<std::vector<std::string> >(std::string const& name) const {
1020  return retrieve(name).getVString();
1021  }
1022 
1023  // ----------------------------------------------------------------------
1024  // FileInPath
1025 
1026  template <>
1027  FileInPath ParameterSet::getParameter<FileInPath>(std::string const& name) const {
1028  return retrieve(name).getFileInPath();
1029  }
1030 
1031  // ----------------------------------------------------------------------
1032  // InputTag
1033 
1034  template <>
1035  InputTag ParameterSet::getParameter<InputTag>(std::string const& name) const {
1036  Entry const& e_input = retrieve(name);
1037  switch (e_input.typeCode()) {
1038  case 't': // InputTag
1039  {
1040  return e_input.getInputTag();
1041  }
1042  case 'S': // string Hex
1043  {
1044  std::string const& label = e_input.getString();
1045  deprecatedInputTagWarning(name, label);
1046  return InputTag(label);
1047  }
1048  case 'Z': // string Raw
1049  {
1050  std::string const& label = e_input.getString();
1051  deprecatedInputTagWarning(name, label);
1052  return InputTag(label);
1053  }
1054  }
1055  throw Exception(errors::Configuration, "ValueError")
1056  << "type of " << name << " is expected to be InputTag or string (deprecated)";
1057  }
1058 
1059  // ----------------------------------------------------------------------
1060  // VInputTag
1061 
1062  template <>
1063  std::vector<InputTag> ParameterSet::getParameter<std::vector<InputTag> >(std::string const& name) const {
1064  return retrieve(name).getVInputTag();
1065  }
1066 
1067  // ----------------------------------------------------------------------
1068  // ESInputTag
1069 
1070  template <>
1071  ESInputTag ParameterSet::getParameter<ESInputTag>(std::string const& name) const {
1072  return retrieve(name).getESInputTag();
1073  }
1074 
1075  // ----------------------------------------------------------------------
1076  // VESInputTag
1077 
1078  template <>
1079  std::vector<ESInputTag> ParameterSet::getParameter<std::vector<ESInputTag> >(std::string const& name) const {
1080  return retrieve(name).getVESInputTag();
1081  }
1082 
1083  // ----------------------------------------------------------------------
1084  // EventID
1085 
1086  template <>
1087  EventID ParameterSet::getParameter<EventID>(std::string const& name) const {
1088  return retrieve(name).getEventID();
1089  }
1090 
1091  // ----------------------------------------------------------------------
1092  // VEventID
1093 
1094  template <>
1095  std::vector<EventID> ParameterSet::getParameter<std::vector<EventID> >(std::string const& name) const {
1096  return retrieve(name).getVEventID();
1097  }
1098 
1099  // ----------------------------------------------------------------------
1100  // LuminosityBlockID
1101 
1102  template <>
1103  LuminosityBlockID ParameterSet::getParameter<LuminosityBlockID>(std::string const& name) const {
1104  return retrieve(name).getLuminosityBlockID();
1105  }
1106 
1107  // ----------------------------------------------------------------------
1108  // VLuminosityBlockID
1109 
1110  template <>
1111  std::vector<LuminosityBlockID> ParameterSet::getParameter<std::vector<LuminosityBlockID> >(
1112  std::string const& name) const {
1113  return retrieve(name).getVLuminosityBlockID();
1114  }
1115 
1116  // ----------------------------------------------------------------------
1117  // EventRange
1118 
1119  template <>
1120  EventRange ParameterSet::getParameter<EventRange>(std::string const& name) const {
1121  return retrieve(name).getEventRange();
1122  }
1123 
1124  // ----------------------------------------------------------------------
1125  // VEventRange
1126 
1127  template <>
1128  std::vector<EventRange> ParameterSet::getParameter<std::vector<EventRange> >(std::string const& name) const {
1129  return retrieve(name).getVEventRange();
1130  }
1131 
1132  // ----------------------------------------------------------------------
1133  // LuminosityBlockRange
1134 
1135  template <>
1136  LuminosityBlockRange ParameterSet::getParameter<LuminosityBlockRange>(std::string const& name) const {
1137  return retrieve(name).getLuminosityBlockRange();
1138  }
1139 
1140  // ----------------------------------------------------------------------
1141  // VLuminosityBlockRange
1142 
1143  template <>
1144  std::vector<LuminosityBlockRange> ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(
1145  std::string const& name) const {
1146  return retrieve(name).getVLuminosityBlockRange();
1147  }
1148 
1149  // ----------------------------------------------------------------------
1150  // PSet, vPSet
1151 
1152  template <>
1153  ParameterSet ParameterSet::getParameter<ParameterSet>(std::string const& name) const {
1154  return getParameterSet(name);
1155  }
1156 
1157  template <>
1158  VParameterSet ParameterSet::getParameter<VParameterSet>(std::string const& name) const {
1159  return getParameterSetVector(name);
1160  }
1161 
1162  // untracked parameters
1163 
1164  // ----------------------------------------------------------------------
1165  // Bool, vBool
1166 
1167  template <>
1168  bool ParameterSet::getUntrackedParameter<bool>(std::string const& name, bool const& defaultValue) const {
1169  Entry const* entryPtr = retrieveUntracked(name);
1170  return entryPtr == nullptr ? defaultValue : entryPtr->getBool();
1171  }
1172 
1173  template <>
1174  bool ParameterSet::getUntrackedParameter<bool>(std::string const& name) const {
1175  return getEntryPointerOrThrow_(name)->getBool();
1176  }
1177 
1178  // ----------------------------------------------------------------------
1179  // Int32, vInt32
1180 
1181  template <>
1182  int ParameterSet::getUntrackedParameter<int>(std::string const& name, int const& defaultValue) const {
1183  Entry const* entryPtr = retrieveUntracked(name);
1184  return entryPtr == nullptr ? defaultValue : entryPtr->getInt32();
1185  }
1186 
1187  template <>
1188  int ParameterSet::getUntrackedParameter<int>(std::string const& name) const {
1189  return getEntryPointerOrThrow_(name)->getInt32();
1190  }
1191 
1192  template <>
1193  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name,
1194  std::vector<int> const& defaultValue) const {
1195  Entry const* entryPtr = retrieveUntracked(name);
1196  return entryPtr == nullptr ? defaultValue : entryPtr->getVInt32();
1197  }
1198 
1199  template <>
1200  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name) const {
1201  return getEntryPointerOrThrow_(name)->getVInt32();
1202  }
1203 
1204  // ----------------------------------------------------------------------
1205  // Uint32, vUint32
1206 
1207  template <>
1208  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name,
1209  unsigned int const& defaultValue) const {
1210  Entry const* entryPtr = retrieveUntracked(name);
1211  return entryPtr == nullptr ? defaultValue : entryPtr->getUInt32();
1212  }
1213 
1214  template <>
1215  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name) const {
1216  return getEntryPointerOrThrow_(name)->getUInt32();
1217  }
1218 
1219  template <>
1220  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(
1221  std::string const& name, std::vector<unsigned int> const& defaultValue) const {
1222  Entry const* entryPtr = retrieveUntracked(name);
1223  return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt32();
1224  }
1225 
1226  template <>
1227  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(
1228  std::string const& name) const {
1229  return getEntryPointerOrThrow_(name)->getVUInt32();
1230  }
1231 
1232  // ----------------------------------------------------------------------
1233  // Uint64, vUint64
1234 
1235  template <>
1236  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(
1237  std::string const& name, unsigned long long const& defaultValue) const {
1238  Entry const* entryPtr = retrieveUntracked(name);
1239  return entryPtr == nullptr ? defaultValue : entryPtr->getUInt64();
1240  }
1241 
1242  template <>
1243  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name) const {
1244  return getEntryPointerOrThrow_(name)->getUInt64();
1245  }
1246 
1247  template <>
1248  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1249  std::string const& name, std::vector<unsigned long long> const& defaultValue) const {
1250  Entry const* entryPtr = retrieveUntracked(name);
1251  return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt64();
1252  }
1253 
1254  template <>
1255  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1256  std::string const& name) const {
1257  return getEntryPointerOrThrow_(name)->getVUInt64();
1258  }
1259 
1260  // ----------------------------------------------------------------------
1261  // Int64, Vint64
1262 
1263  template <>
1264  long long ParameterSet::getUntrackedParameter<long long>(std::string const& name,
1265  long long const& defaultValue) const {
1266  Entry const* entryPtr = retrieveUntracked(name);
1267  return entryPtr == nullptr ? defaultValue : entryPtr->getInt64();
1268  }
1269 
1270  template <>
1271  long long ParameterSet::getUntrackedParameter<long long>(std::string const& name) const {
1272  return getEntryPointerOrThrow_(name)->getInt64();
1273  }
1274 
1275  template <>
1276  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(
1277  std::string const& name, std::vector<long long> const& defaultValue) const {
1278  Entry const* entryPtr = retrieveUntracked(name);
1279  return entryPtr == nullptr ? defaultValue : entryPtr->getVInt64();
1280  }
1281 
1282  template <>
1283  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(std::string const& name) const {
1284  return getEntryPointerOrThrow_(name)->getVInt64();
1285  }
1286 
1287  // ----------------------------------------------------------------------
1288  // Double, vDouble
1289 
1290  template <>
1291  double ParameterSet::getUntrackedParameter<double>(std::string const& name, double const& defaultValue) const {
1292  Entry const* entryPtr = retrieveUntracked(name);
1293  return entryPtr == nullptr ? defaultValue : entryPtr->getDouble();
1294  }
1295 
1296  template <>
1297  double ParameterSet::getUntrackedParameter<double>(std::string const& name) const {
1298  return getEntryPointerOrThrow_(name)->getDouble();
1299  }
1300 
1301  template <>
1302  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(
1303  std::string const& name, std::vector<double> const& defaultValue) const {
1304  Entry const* entryPtr = retrieveUntracked(name);
1305  return entryPtr == nullptr ? defaultValue : entryPtr->getVDouble();
1306  }
1307 
1308  template <>
1309  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(std::string const& name) const {
1310  return getEntryPointerOrThrow_(name)->getVDouble();
1311  }
1312 
1313  // ----------------------------------------------------------------------
1314  // String, vString
1315 
1316  template <>
1317  std::string ParameterSet::getUntrackedParameter<std::string>(std::string const& name,
1318  std::string const& defaultValue) const {
1319  Entry const* entryPtr = retrieveUntracked(name);
1320  return entryPtr == nullptr ? defaultValue : entryPtr->getString();
1321  }
1322 
1323  template <>
1324  std::string ParameterSet::getUntrackedParameter<std::string>(std::string const& name) const {
1325  return getEntryPointerOrThrow_(name)->getString();
1326  }
1327 
1328  template <>
1329  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(
1330  std::string const& name, std::vector<std::string> const& defaultValue) const {
1331  Entry const* entryPtr = retrieveUntracked(name);
1332  return entryPtr == nullptr ? defaultValue : entryPtr->getVString();
1333  }
1334 
1335  template <>
1336  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(
1337  std::string const& name) const {
1338  return getEntryPointerOrThrow_(name)->getVString();
1339  }
1340 
1341  // ----------------------------------------------------------------------
1342  // FileInPath
1343 
1344  template <>
1345  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name,
1346  FileInPath const& defaultValue) const {
1347  Entry const* entryPtr = retrieveUntracked(name);
1348  return entryPtr == nullptr ? defaultValue : entryPtr->getFileInPath();
1349  }
1350 
1351  template <>
1352  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name) const {
1353  return getEntryPointerOrThrow_(name)->getFileInPath();
1354  }
1355 
1356  // ----------------------------------------------------------------------
1357  // InputTag, VInputTag
1358 
1359  template <>
1360  InputTag ParameterSet::getUntrackedParameter<InputTag>(std::string const& name, InputTag const& defaultValue) const {
1361  Entry const* entryPtr = retrieveUntracked(name);
1362  return entryPtr == nullptr ? defaultValue : entryPtr->getInputTag();
1363  }
1364 
1365  template <>
1366  InputTag ParameterSet::getUntrackedParameter<InputTag>(std::string const& name) const {
1367  return getEntryPointerOrThrow_(name)->getInputTag();
1368  }
1369 
1370  template <>
1371  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(
1372  std::string const& name, std::vector<InputTag> const& defaultValue) const {
1373  Entry const* entryPtr = retrieveUntracked(name);
1374  return entryPtr == nullptr ? defaultValue : entryPtr->getVInputTag();
1375  }
1376 
1377  template <>
1378  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(std::string const& name) const {
1379  return getEntryPointerOrThrow_(name)->getVInputTag();
1380  }
1381 
1382  // ----------------------------------------------------------------------
1383  // ESInputTag, VESInputTag
1384 
1385  template <>
1386  ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name,
1387  ESInputTag const& defaultValue) const {
1388  Entry const* entryPtr = retrieveUntracked(name);
1389  return entryPtr == nullptr ? defaultValue : entryPtr->getESInputTag();
1390  }
1391 
1392  template <>
1393  ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name) const {
1394  return getEntryPointerOrThrow_(name)->getESInputTag();
1395  }
1396 
1397  template <>
1398  std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(
1399  std::string const& name, std::vector<ESInputTag> const& defaultValue) const {
1400  Entry const* entryPtr = retrieveUntracked(name);
1401  return entryPtr == nullptr ? defaultValue : entryPtr->getVESInputTag();
1402  }
1403 
1404  template <>
1405  std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(std::string const& name) const {
1406  return getEntryPointerOrThrow_(name)->getVESInputTag();
1407  }
1408 
1409  // ----------------------------------------------------------------------
1410  // EventID, VEventID
1411 
1412  template <>
1413  EventID ParameterSet::getUntrackedParameter<EventID>(std::string const& name, EventID const& defaultValue) const {
1414  Entry const* entryPtr = retrieveUntracked(name);
1415  return entryPtr == nullptr ? defaultValue : entryPtr->getEventID();
1416  }
1417 
1418  template <>
1419  EventID ParameterSet::getUntrackedParameter<EventID>(std::string const& name) const {
1420  return getEntryPointerOrThrow_(name)->getEventID();
1421  }
1422 
1423  template <>
1424  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(
1425  std::string const& name, std::vector<EventID> const& defaultValue) const {
1426  Entry const* entryPtr = retrieveUntracked(name);
1427  return entryPtr == nullptr ? defaultValue : entryPtr->getVEventID();
1428  }
1429 
1430  template <>
1431  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(std::string const& name) const {
1432  return getEntryPointerOrThrow_(name)->getVEventID();
1433  }
1434 
1435  // ----------------------------------------------------------------------
1436  // LuminosityBlockID, VLuminosityBlockID
1437 
1438  template <>
1439  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(
1440  std::string const& name, LuminosityBlockID const& defaultValue) const {
1441  Entry const* entryPtr = retrieveUntracked(name);
1442  return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockID();
1443  }
1444 
1445  template <>
1446  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name) const {
1447  return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
1448  }
1449 
1450  template <>
1451  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
1452  std::string const& name, std::vector<LuminosityBlockID> const& defaultValue) const {
1453  Entry const* entryPtr = retrieveUntracked(name);
1454  return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockID();
1455  }
1456 
1457  template <>
1458  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
1459  std::string const& name) const {
1460  return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
1461  }
1462 
1463  // ----------------------------------------------------------------------
1464  // EventRange, VEventRange
1465 
1466  template <>
1467  EventRange ParameterSet::getUntrackedParameter<EventRange>(std::string const& name,
1468  EventRange const& defaultValue) const {
1469  Entry const* entryPtr = retrieveUntracked(name);
1470  return entryPtr == nullptr ? defaultValue : entryPtr->getEventRange();
1471  }
1472 
1473  template <>
1474  EventRange ParameterSet::getUntrackedParameter<EventRange>(std::string const& name) const {
1475  return getEntryPointerOrThrow_(name)->getEventRange();
1476  }
1477 
1478  template <>
1479  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(
1480  std::string const& name, std::vector<EventRange> const& defaultValue) const {
1481  Entry const* entryPtr = retrieveUntracked(name);
1482  return entryPtr == nullptr ? defaultValue : entryPtr->getVEventRange();
1483  }
1484 
1485  template <>
1486  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(std::string const& name) const {
1487  return getEntryPointerOrThrow_(name)->getVEventRange();
1488  }
1489 
1490  // ----------------------------------------------------------------------
1491  // LuminosityBlockRange, VLuminosityBlockRange
1492 
1493  template <>
1494  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(
1495  std::string const& name, LuminosityBlockRange const& defaultValue) const {
1496  Entry const* entryPtr = retrieveUntracked(name);
1497  return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockRange();
1498  }
1499 
1500  template <>
1501  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name) const {
1502  return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
1503  }
1504 
1505  template <>
1506  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
1507  std::string const& name, std::vector<LuminosityBlockRange> const& defaultValue) const {
1508  Entry const* entryPtr = retrieveUntracked(name);
1509  return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockRange();
1510  }
1511 
1512  template <>
1513  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
1514  std::string const& name) const {
1515  return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
1516  }
1517 
1518  // specializations
1519  // ----------------------------------------------------------------------
1520  // Bool, vBool
1521 
1522  template <>
1523  bool ParameterSet::getParameter<bool>(char const* name) const {
1524  return retrieve(name).getBool();
1525  }
1526 
1527  // ----------------------------------------------------------------------
1528  // Int32, vInt32
1529 
1530  template <>
1531  int ParameterSet::getParameter<int>(char const* name) const {
1532  return retrieve(name).getInt32();
1533  }
1534 
1535  template <>
1536  std::vector<int> ParameterSet::getParameter<std::vector<int> >(char const* name) const {
1537  return retrieve(name).getVInt32();
1538  }
1539 
1540  // ----------------------------------------------------------------------
1541  // Int64, vInt64
1542 
1543  template <>
1544  long long ParameterSet::getParameter<long long>(char const* name) const {
1545  return retrieve(name).getInt64();
1546  }
1547 
1548  template <>
1549  std::vector<long long> ParameterSet::getParameter<std::vector<long long> >(char const* name) const {
1550  return retrieve(name).getVInt64();
1551  }
1552 
1553  // ----------------------------------------------------------------------
1554  // Uint32, vUint32
1555 
1556  template <>
1557  unsigned int ParameterSet::getParameter<unsigned int>(char const* name) const {
1558  return retrieve(name).getUInt32();
1559  }
1560 
1561  template <>
1562  std::vector<unsigned int> ParameterSet::getParameter<std::vector<unsigned int> >(char const* name) const {
1563  return retrieve(name).getVUInt32();
1564  }
1565 
1566  // ----------------------------------------------------------------------
1567  // Uint64, vUint64
1568 
1569  template <>
1570  unsigned long long ParameterSet::getParameter<unsigned long long>(char const* name) const {
1571  return retrieve(name).getUInt64();
1572  }
1573 
1574  template <>
1575  std::vector<unsigned long long> ParameterSet::getParameter<std::vector<unsigned long long> >(char const* name) const {
1576  return retrieve(name).getVUInt64();
1577  }
1578 
1579  // ----------------------------------------------------------------------
1580  // Double, vDouble
1581 
1582  template <>
1583  double ParameterSet::getParameter<double>(char const* name) const {
1584  return retrieve(name).getDouble();
1585  }
1586 
1587  template <>
1588  std::vector<double> ParameterSet::getParameter<std::vector<double> >(char const* name) const {
1589  return retrieve(name).getVDouble();
1590  }
1591 
1592  // ----------------------------------------------------------------------
1593  // String, vString
1594 
1595  template <>
1596  std::string ParameterSet::getParameter<std::string>(char const* name) const {
1597  return retrieve(name).getString();
1598  }
1599 
1600  template <>
1601  std::vector<std::string> ParameterSet::getParameter<std::vector<std::string> >(char const* name) const {
1602  return retrieve(name).getVString();
1603  }
1604 
1605  // ----------------------------------------------------------------------
1606  // FileInPath
1607 
1608  template <>
1609  FileInPath ParameterSet::getParameter<FileInPath>(char const* name) const {
1610  return retrieve(name).getFileInPath();
1611  }
1612 
1613  // ----------------------------------------------------------------------
1614  // InputTag
1615 
1616  template <>
1617  InputTag ParameterSet::getParameter<InputTag>(char const* name) const {
1618  Entry const& e_input = retrieve(name);
1619  switch (e_input.typeCode()) {
1620  case 't': // InputTag
1621  {
1622  return e_input.getInputTag();
1623  }
1624  case 'S': // string Hex
1625  {
1626  std::string const& label = e_input.getString();
1627  deprecatedInputTagWarning(name, label);
1628  return InputTag(label);
1629  }
1630  case 'Z': // string Raw
1631  {
1632  std::string const& label = e_input.getString();
1633  deprecatedInputTagWarning(name, label);
1634  return InputTag(label);
1635  }
1636  }
1637  throw Exception(errors::Configuration, "ValueError")
1638  << "type of " << name << " is expected to be InputTag or string (deprecated)";
1639  }
1640 
1641  // ----------------------------------------------------------------------
1642  // VInputTag
1643 
1644  template <>
1645  std::vector<InputTag> ParameterSet::getParameter<std::vector<InputTag> >(char const* name) const {
1646  return retrieve(name).getVInputTag();
1647  }
1648 
1649  // ----------------------------------------------------------------------
1650  // ESInputTag
1651 
1652  template <>
1653  ESInputTag ParameterSet::getParameter<ESInputTag>(char const* name) const {
1654  return retrieve(name).getESInputTag();
1655  }
1656 
1657  // ----------------------------------------------------------------------
1658  // VESInputTag
1659 
1660  template <>
1661  std::vector<ESInputTag> ParameterSet::getParameter<std::vector<ESInputTag> >(char const* name) const {
1662  return retrieve(name).getVESInputTag();
1663  }
1664 
1665  // ----------------------------------------------------------------------
1666  // EventID
1667 
1668  template <>
1669  EventID ParameterSet::getParameter<EventID>(char const* name) const {
1670  return retrieve(name).getEventID();
1671  }
1672 
1673  // ----------------------------------------------------------------------
1674  // VEventID
1675 
1676  template <>
1677  std::vector<EventID> ParameterSet::getParameter<std::vector<EventID> >(char const* name) const {
1678  return retrieve(name).getVEventID();
1679  }
1680 
1681  // ----------------------------------------------------------------------
1682  // LuminosityBlockID
1683 
1684  template <>
1685  LuminosityBlockID ParameterSet::getParameter<LuminosityBlockID>(char const* name) const {
1686  return retrieve(name).getLuminosityBlockID();
1687  }
1688 
1689  // ----------------------------------------------------------------------
1690  // VLuminosityBlockID
1691 
1692  template <>
1693  std::vector<LuminosityBlockID> ParameterSet::getParameter<std::vector<LuminosityBlockID> >(char const* name) const {
1694  return retrieve(name).getVLuminosityBlockID();
1695  }
1696 
1697  // ----------------------------------------------------------------------
1698  // EventRange
1699 
1700  template <>
1701  EventRange ParameterSet::getParameter<EventRange>(char const* name) const {
1702  return retrieve(name).getEventRange();
1703  }
1704 
1705  // ----------------------------------------------------------------------
1706  // VEventRange
1707 
1708  template <>
1709  std::vector<EventRange> ParameterSet::getParameter<std::vector<EventRange> >(char const* name) const {
1710  return retrieve(name).getVEventRange();
1711  }
1712 
1713  // ----------------------------------------------------------------------
1714  // LuminosityBlockRange
1715 
1716  template <>
1717  LuminosityBlockRange ParameterSet::getParameter<LuminosityBlockRange>(char const* name) const {
1718  return retrieve(name).getLuminosityBlockRange();
1719  }
1720 
1721  // ----------------------------------------------------------------------
1722  // VLuminosityBlockRange
1723 
1724  template <>
1725  std::vector<LuminosityBlockRange> ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(
1726  char const* name) const {
1727  return retrieve(name).getVLuminosityBlockRange();
1728  }
1729 
1730  // ----------------------------------------------------------------------
1731  // PSet, vPSet
1732 
1733  template <>
1734  ParameterSet ParameterSet::getParameter<ParameterSet>(char const* name) const {
1735  return getParameterSet(name);
1736  }
1737 
1738  template <>
1739  VParameterSet ParameterSet::getParameter<VParameterSet>(char const* name) const {
1740  return getParameterSetVector(name);
1741  }
1742 
1743  // untracked parameters
1744 
1745  // ----------------------------------------------------------------------
1746  // Bool, vBool
1747 
1748  template <>
1749  bool ParameterSet::getUntrackedParameter<bool>(char const* name, bool const& defaultValue) const {
1750  Entry const* entryPtr = retrieveUntracked(name);
1751  return entryPtr == nullptr ? defaultValue : entryPtr->getBool();
1752  }
1753 
1754  template <>
1755  bool ParameterSet::getUntrackedParameter<bool>(char const* name) const {
1756  return getEntryPointerOrThrow_(name)->getBool();
1757  }
1758 
1759  // ----------------------------------------------------------------------
1760  // Int32, vInt32
1761 
1762  template <>
1763  int ParameterSet::getUntrackedParameter<int>(char const* name, int const& defaultValue) const {
1764  Entry const* entryPtr = retrieveUntracked(name);
1765  return entryPtr == nullptr ? defaultValue : entryPtr->getInt32();
1766  }
1767 
1768  template <>
1769  int ParameterSet::getUntrackedParameter<int>(char const* name) const {
1770  return getEntryPointerOrThrow_(name)->getInt32();
1771  }
1772 
1773  template <>
1774  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name,
1775  std::vector<int> const& defaultValue) const {
1776  Entry const* entryPtr = retrieveUntracked(name);
1777  return entryPtr == nullptr ? defaultValue : entryPtr->getVInt32();
1778  }
1779 
1780  template <>
1781  std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name) const {
1782  return getEntryPointerOrThrow_(name)->getVInt32();
1783  }
1784 
1785  // ----------------------------------------------------------------------
1786  // Uint32, vUint32
1787 
1788  template <>
1789  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(char const* name,
1790  unsigned int const& defaultValue) const {
1791  Entry const* entryPtr = retrieveUntracked(name);
1792  return entryPtr == nullptr ? defaultValue : entryPtr->getUInt32();
1793  }
1794 
1795  template <>
1796  unsigned int ParameterSet::getUntrackedParameter<unsigned int>(char const* name) const {
1797  return getEntryPointerOrThrow_(name)->getUInt32();
1798  }
1799 
1800  template <>
1801  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(
1802  char const* name, std::vector<unsigned int> const& defaultValue) const {
1803  Entry const* entryPtr = retrieveUntracked(name);
1804  return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt32();
1805  }
1806 
1807  template <>
1808  std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(char const* name) const {
1809  return getEntryPointerOrThrow_(name)->getVUInt32();
1810  }
1811 
1812  // ----------------------------------------------------------------------
1813  // Uint64, vUint64
1814 
1815  template <>
1816  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(
1817  char const* name, unsigned long long const& defaultValue) const {
1818  Entry const* entryPtr = retrieveUntracked(name);
1819  return entryPtr == nullptr ? defaultValue : entryPtr->getUInt64();
1820  }
1821 
1822  template <>
1823  unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(char const* name) const {
1824  return getEntryPointerOrThrow_(name)->getUInt64();
1825  }
1826 
1827  template <>
1828  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1829  char const* name, std::vector<unsigned long long> const& defaultValue) const {
1830  Entry const* entryPtr = retrieveUntracked(name);
1831  return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt64();
1832  }
1833 
1834  template <>
1835  std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1836  char const* name) const {
1837  return getEntryPointerOrThrow_(name)->getVUInt64();
1838  }
1839 
1840  // ----------------------------------------------------------------------
1841  // Int64, Vint64
1842 
1843  template <>
1844  long long ParameterSet::getUntrackedParameter<long long>(char const* name, long long const& defaultValue) const {
1845  Entry const* entryPtr = retrieveUntracked(name);
1846  return entryPtr == nullptr ? defaultValue : entryPtr->getInt64();
1847  }
1848 
1849  template <>
1850  long long ParameterSet::getUntrackedParameter<long long>(char const* name) const {
1851  return getEntryPointerOrThrow_(name)->getInt64();
1852  }
1853 
1854  template <>
1855  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(
1856  char const* name, std::vector<long long> const& defaultValue) const {
1857  Entry const* entryPtr = retrieveUntracked(name);
1858  return entryPtr == nullptr ? defaultValue : entryPtr->getVInt64();
1859  }
1860 
1861  template <>
1862  std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(char const* name) const {
1863  return getEntryPointerOrThrow_(name)->getVInt64();
1864  }
1865 
1866  // ----------------------------------------------------------------------
1867  // Double, vDouble
1868 
1869  template <>
1870  double ParameterSet::getUntrackedParameter<double>(char const* name, double const& defaultValue) const {
1871  Entry const* entryPtr = retrieveUntracked(name);
1872  return entryPtr == nullptr ? defaultValue : entryPtr->getDouble();
1873  }
1874 
1875  template <>
1876  double ParameterSet::getUntrackedParameter<double>(char const* name) const {
1877  return getEntryPointerOrThrow_(name)->getDouble();
1878  }
1879 
1880  template <>
1881  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(
1882  char const* name, std::vector<double> const& defaultValue) const {
1883  Entry const* entryPtr = retrieveUntracked(name);
1884  return entryPtr == nullptr ? defaultValue : entryPtr->getVDouble();
1885  }
1886 
1887  template <>
1888  std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(char const* name) const {
1889  return getEntryPointerOrThrow_(name)->getVDouble();
1890  }
1891 
1892  // ----------------------------------------------------------------------
1893  // String, vString
1894 
1895  template <>
1896  std::string ParameterSet::getUntrackedParameter<std::string>(char const* name,
1897  std::string const& defaultValue) const {
1898  Entry const* entryPtr = retrieveUntracked(name);
1899  return entryPtr == nullptr ? defaultValue : entryPtr->getString();
1900  }
1901 
1902  template <>
1903  std::string ParameterSet::getUntrackedParameter<std::string>(char const* name) const {
1904  return getEntryPointerOrThrow_(name)->getString();
1905  }
1906 
1907  template <>
1908  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(
1909  char const* name, std::vector<std::string> const& defaultValue) const {
1910  Entry const* entryPtr = retrieveUntracked(name);
1911  return entryPtr == nullptr ? defaultValue : entryPtr->getVString();
1912  }
1913 
1914  template <>
1915  std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(char const* name) const {
1916  return getEntryPointerOrThrow_(name)->getVString();
1917  }
1918 
1919  // ----------------------------------------------------------------------
1920  // FileInPath
1921 
1922  template <>
1923  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(char const* name, FileInPath const& defaultValue) const {
1924  Entry const* entryPtr = retrieveUntracked(name);
1925  return entryPtr == nullptr ? defaultValue : entryPtr->getFileInPath();
1926  }
1927 
1928  template <>
1929  FileInPath ParameterSet::getUntrackedParameter<FileInPath>(char const* name) const {
1930  return getEntryPointerOrThrow_(name)->getFileInPath();
1931  }
1932 
1933  // ----------------------------------------------------------------------
1934  // InputTag, VInputTag
1935 
1936  template <>
1937  InputTag ParameterSet::getUntrackedParameter<InputTag>(char const* name, InputTag const& defaultValue) const {
1938  Entry const* entryPtr = retrieveUntracked(name);
1939  return entryPtr == nullptr ? defaultValue : entryPtr->getInputTag();
1940  }
1941 
1942  template <>
1943  InputTag ParameterSet::getUntrackedParameter<InputTag>(char const* name) const {
1944  return getEntryPointerOrThrow_(name)->getInputTag();
1945  }
1946 
1947  template <>
1948  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(
1949  char const* name, std::vector<InputTag> const& defaultValue) const {
1950  Entry const* entryPtr = retrieveUntracked(name);
1951  return entryPtr == nullptr ? defaultValue : entryPtr->getVInputTag();
1952  }
1953 
1954  template <>
1955  std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(char const* name) const {
1956  return getEntryPointerOrThrow_(name)->getVInputTag();
1957  }
1958 
1959  // ----------------------------------------------------------------------
1960  // ESInputTag, VESInputTag
1961 
1962  template <>
1963  ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(char const* name, ESInputTag const& defaultValue) const {
1964  Entry const* entryPtr = retrieveUntracked(name);
1965  return entryPtr == nullptr ? defaultValue : entryPtr->getESInputTag();
1966  }
1967 
1968  template <>
1969  ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(char const* name) const {
1970  return getEntryPointerOrThrow_(name)->getESInputTag();
1971  }
1972 
1973  template <>
1974  std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(
1975  char const* name, std::vector<ESInputTag> const& defaultValue) const {
1976  Entry const* entryPtr = retrieveUntracked(name);
1977  return entryPtr == nullptr ? defaultValue : entryPtr->getVESInputTag();
1978  }
1979 
1980  template <>
1981  std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(char const* name) const {
1982  return getEntryPointerOrThrow_(name)->getVESInputTag();
1983  }
1984 
1985  // ----------------------------------------------------------------------
1986  // EventID, VEventID
1987 
1988  template <>
1989  EventID ParameterSet::getUntrackedParameter<EventID>(char const* name, EventID const& defaultValue) const {
1990  Entry const* entryPtr = retrieveUntracked(name);
1991  return entryPtr == nullptr ? defaultValue : entryPtr->getEventID();
1992  }
1993 
1994  template <>
1995  EventID ParameterSet::getUntrackedParameter<EventID>(char const* name) const {
1996  return getEntryPointerOrThrow_(name)->getEventID();
1997  }
1998 
1999  template <>
2000  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(
2001  char const* name, std::vector<EventID> const& defaultValue) const {
2002  Entry const* entryPtr = retrieveUntracked(name);
2003  return entryPtr == nullptr ? defaultValue : entryPtr->getVEventID();
2004  }
2005 
2006  template <>
2007  std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(char const* name) const {
2008  return getEntryPointerOrThrow_(name)->getVEventID();
2009  }
2010 
2011  // ----------------------------------------------------------------------
2012  // LuminosityBlockID, VLuminosityBlockID
2013 
2014  template <>
2015  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(
2016  char const* name, LuminosityBlockID const& defaultValue) const {
2017  Entry const* entryPtr = retrieveUntracked(name);
2018  return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockID();
2019  }
2020 
2021  template <>
2022  LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name) const {
2023  return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
2024  }
2025 
2026  template <>
2027  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
2028  char const* name, std::vector<LuminosityBlockID> const& defaultValue) const {
2029  Entry const* entryPtr = retrieveUntracked(name);
2030  return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockID();
2031  }
2032 
2033  template <>
2034  std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
2035  char const* name) const {
2036  return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
2037  }
2038 
2039  // ----------------------------------------------------------------------
2040  // EventRange, VEventRange
2041 
2042  template <>
2043  EventRange ParameterSet::getUntrackedParameter<EventRange>(char const* name, EventRange const& defaultValue) const {
2044  Entry const* entryPtr = retrieveUntracked(name);
2045  return entryPtr == nullptr ? defaultValue : entryPtr->getEventRange();
2046  }
2047 
2048  template <>
2049  EventRange ParameterSet::getUntrackedParameter<EventRange>(char const* name) const {
2050  return getEntryPointerOrThrow_(name)->getEventRange();
2051  }
2052 
2053  template <>
2054  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(
2055  char const* name, std::vector<EventRange> const& defaultValue) const {
2056  Entry const* entryPtr = retrieveUntracked(name);
2057  return entryPtr == nullptr ? defaultValue : entryPtr->getVEventRange();
2058  }
2059 
2060  template <>
2061  std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(char const* name) const {
2062  return getEntryPointerOrThrow_(name)->getVEventRange();
2063  }
2064 
2065  // ----------------------------------------------------------------------
2066  // LuminosityBlockRange, VLuminosityBlockRange
2067 
2068  template <>
2069  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(
2070  char const* name, LuminosityBlockRange const& defaultValue) const {
2071  Entry const* entryPtr = retrieveUntracked(name);
2072  return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockRange();
2073  }
2074 
2075  template <>
2076  LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name) const {
2077  return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
2078  }
2079 
2080  template <>
2081  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
2082  char const* name, std::vector<LuminosityBlockRange> const& defaultValue) const {
2083  Entry const* entryPtr = retrieveUntracked(name);
2084  return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockRange();
2085  }
2086 
2087  template <>
2088  std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
2089  char const* name) const {
2090  return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
2091  }
2092 
2093  // ----------------------------------------------------------------------
2094  // PSet, vPSet
2095 
2096  template <>
2097  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(char const* name,
2098  ParameterSet const& defaultValue) const {
2099  return getUntrackedParameterSet(name, defaultValue);
2100  }
2101 
2102  template <>
2103  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(char const* name,
2104  VParameterSet const& defaultValue) const {
2105  return getUntrackedParameterSetVector(name, defaultValue);
2106  }
2107 
2108  template <>
2109  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name,
2110  ParameterSet const& defaultValue) const {
2111  return getUntrackedParameterSet(name, defaultValue);
2112  }
2113 
2114  template <>
2115  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name,
2116  VParameterSet const& defaultValue) const {
2117  return getUntrackedParameterSetVector(name, defaultValue);
2118  }
2119 
2120  template <>
2121  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(char const* name) const {
2122  return getUntrackedParameterSet(name);
2123  }
2124 
2125  template <>
2126  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(char const* name) const {
2127  return getUntrackedParameterSetVector(name);
2128  }
2129 
2130  template <>
2131  ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name) const {
2132  return getUntrackedParameterSet(name);
2133  }
2134 
2135  template <>
2136  VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name) const {
2137  return getUntrackedParameterSetVector(name);
2138  }
2139 
2140  //----------------------------------------------------------------------------------
2141  // specializations for addParameter and addUntrackedParameter
2142 
2143  template <>
2144  void ParameterSet::addParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
2145  invalidateRegistration(name);
2146  insertParameterSet(true, name, ParameterSetEntry(value, true));
2147  }
2148 
2149  template <>
2150  void ParameterSet::addParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
2151  invalidateRegistration(name);
2152  insertVParameterSet(true, name, VParameterSetEntry(value, true));
2153  }
2154 
2155  template <>
2156  void ParameterSet::addParameter<ParameterSet>(char const* name, ParameterSet const& value) {
2157  invalidateRegistration(name);
2158  insertParameterSet(true, name, ParameterSetEntry(value, true));
2159  }
2160 
2161  template <>
2162  void ParameterSet::addParameter<VParameterSet>(char const* name, VParameterSet const& value) {
2163  invalidateRegistration(name);
2164  insertVParameterSet(true, name, VParameterSetEntry(value, true));
2165  }
2166 
2167  template <>
2168  void ParameterSet::addUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
2169  insertParameterSet(true, name, ParameterSetEntry(value, false));
2170  }
2171 
2172  template <>
2173  void ParameterSet::addUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
2174  insertVParameterSet(true, name, VParameterSetEntry(value, false));
2175  }
2176 
2177  template <>
2178  void ParameterSet::addUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& value) {
2179  insertParameterSet(true, name, ParameterSetEntry(value, false));
2180  }
2181 
2182  template <>
2183  void ParameterSet::addUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& value) {
2184  insertVParameterSet(true, name, VParameterSetEntry(value, false));
2185  }
2186 
2187  //----------------------------------------------------------------------------------
2188  // specializations for getParameterNamesForType
2189 
2190  template <>
2191  std::vector<std::string> ParameterSet::getParameterNamesForType<ParameterSet>(bool trackiness) const {
2192  std::vector<std::string> output;
2193  getParameterSetNames(output, trackiness);
2194  return output;
2195  }
2196 
2197  template <>
2198  std::vector<std::string> ParameterSet::getParameterNamesForType<VParameterSet>(bool trackiness) const {
2199  std::vector<std::string> output;
2200  getParameterSetVectorNames(output, trackiness);
2201  return output;
2202  }
2203 
2205  return retrieveParameterSet(name).pset();
2206  }
2207 
2209  return retrieveParameterSet(name).pset();
2210  }
2211 
2213  return getUntrackedParameterSet(name.c_str(), defaultValue);
2214  }
2215 
2218  if (entryPtr == nullptr) {
2219  return defaultValue;
2220  }
2221  return entryPtr->pset();
2222  }
2223 
2225  return getUntrackedParameterSet(name.c_str());
2226  }
2227 
2230  if (result == nullptr)
2231  throw Exception(errors::Configuration, "MissingParameter:")
2232  << "The required ParameterSet '" << name << "' was not specified.\n";
2233  return result->pset();
2234  }
2235 
2237  return retrieveVParameterSet(name).vpset();
2238  }
2239 
2241  return retrieveVParameterSet(name).vpset();
2242  }
2243 
2245  VParameterSet const& defaultValue) const {
2247  }
2248 
2250  VParameterSet const& defaultValue) const {
2252  return entryPtr == nullptr ? defaultValue : entryPtr->vpset();
2253  }
2254 
2256  return getUntrackedParameterSetVector(name.c_str());
2257  }
2258 
2261  if (result == nullptr)
2262  throw Exception(errors::Configuration, "MissingParameter:")
2263  << "The required ParameterSetVector '" << name << "' was not specified.\n";
2264  return result->vpset();
2265  }
2266 } // namespace edm
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
Definition: start.py:1
const double Pi
std::vector< unsigned > getVUInt32() const
Definition: Entry.cc:918
void setID(ParameterSetID const &id)
std::vector< std::string > getVString() const
Definition: Entry.cc:995
ParameterSetID id_
Definition: ParameterSet.h:276
int32_t *__restrict__ iv
std::unique_ptr< ParameterSet > popParameterSet(std::string const &name)
std::vector< InputTag > getVInputTag() const
Definition: Entry.cc:1035
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:35
std::string toString() const
void toStringImp(std::string &, bool useAll) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
int exceptions(int argc, char *argv[])
Definition: exceptions.h:34
ParameterSet const & getParameterSet(std::string const &) const
size_t getParameterSetVectorNames(std::vector< std::string > &output, bool trackiness=true) const
ParameterSet trackedPart() const
VParameterSetEntry const * retrieveUntrackedVParameterSet(std::string const &) const
VParameterSetEntry const & retrieveVParameterSet(std::string const &) const
void insert(bool ok_to_replace, char const *, Entry const &)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
std::vector< ParameterSet > const & vpset() const
returns the VPSet
void swap(Hash< I > &other)
Definition: Hash.h:181
std::string toString() const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
ParameterSetID const & mainParameterSetID() const
ParameterSet const & pset() const
returns the PSet
assert(be >=bs)
uint16_t size_type
std::string toString() const
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
static std::string_view extent(std::string_view)
unsigned long long getUInt64() const
Definition: Entry.cc:930
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
std::vector< EventRange > getVEventRange() const
Definition: Entry.cc:1154
Entry const * retrieveUntracked(char const *) const
void augment(ParameterSet const &from)
void eraseOrSetUntrackedParameterSet(std::string const &name)
void swap(ParameterSet &other)
void allToString(std::string &result) const
U second(std::pair< T, U > const &p)
char const * label
std::vector< EventID > getVEventID() const
Definition: Entry.cc:1083
ParameterSetID id() const
VParameterSet getUntrackedParameterSetVector(std::string const &name, VParameterSet const &defaultValue) const
void copyFrom(ParameterSet const &from, std::string const &name)
ParameterSet const & registerIt()
std::vector< int > getVInt32() const
Definition: Entry.cc:870
LuminosityBlockID getLuminosityBlockID() const
Definition: Entry.cc:1095
int getInt32() const
Definition: Entry.cc:858
std::vector< FileInPath >::size_type getAllFileInPaths(std::vector< FileInPath > &output) const
std::string dump(unsigned int indent=0) const
MD5Result digest()
Definition: Digest.cc:171
VParameterSetEntry * getPSetVectorForUpdate(std::string const &name)
Entry const & retrieve(char const *) const
std::vector< ESInputTag > getVESInputTag() const
Definition: Entry.cc:1059
bool empty() const
Definition: ParameterSet.h:202
std::string toString() const
Definition: Entry.cc:819
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool fromString(std::string_view)
bool getBool() const
Definition: Entry.cc:846
void insertVParameterSet(bool okay_to_replace, std::string const &name, VParameterSetEntry const &entry)
VParameterSetEntry const * retrieveUnknownVParameterSet(std::string const &) const
double f[11][100]
ParameterSetEntry const * retrieveUntrackedParameterSet(std::string const &) const
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
static std::string_view bounds(std::string_view, std::size_t iEndHint)
Definition: Entry.cc:759
unsigned getUInt32() const
Definition: Entry.cc:906
Definition: value.py:1
void eraseSimpleParameter(std::string const &name)
void copyForModify(ParameterSet const &other)
rep
Definition: cuy.py:1189
Hash< ParameterSetType > ParameterSetID
void invalidateRegistration(std::string const &nameOfTracked)
Definition: ParameterSet.cc:39
size_t getNamesByCode_(char code, bool trackiness, std::vector< std::string > &output) const
ParameterSet const & getProcessParameterSetContainingModule(ModuleDescription const &moduleDescription)
InputTag getInputTag() const
Definition: Entry.cc:1023
Log< level::Info, false > LogInfo
static void registerFromString(std::string const &rep)
Definition: ParameterSet.cc:86
ESInputTag getESInputTag() const
Definition: Entry.cc:1047
std::vector< LuminosityBlockID > getVLuminosityBlockID() const
Definition: Entry.cc:1107
Entry const * retrieveUnknown(char const *) const
std::string getString() const
Definition: Entry.cc:978
void insertParameterSet(bool okay_to_replace, std::string const &name, ParameterSetEntry const &entry)
void deprecatedInputTagWarning(std::string const &name, std::string const &label) const
double b
Definition: hdecay.h:120
ParameterSetEntry const * retrieveUnknownParameterSet(std::string const &) const
FileInPath getFileInPath() const
Definition: Entry.cc:1011
ParameterSet const & getParameterSet(ParameterSetID const &id)
std::string dump(unsigned int indent=0) const
EventID getEventID() const
Definition: Entry.cc:1071
std::vector< ParameterSet > popVParameterSet(std::string const &name)
HLT enums.
VParameterSet const & getParameterSetVector(std::string const &name) const
double a
Definition: hdecay.h:121
EventRange getEventRange() const
Definition: Entry.cc:1142
psettable psetTable_
Definition: ParameterSet.h:270
std::vector< unsigned long long > getVUInt64() const
Definition: Entry.cc:942
std::string dump(unsigned int indent=0) const
std::string getParameterAsString(std::string const &name) const
bool isRegistered() const
Definition: ParameterSet.h:72
Entry const * getEntryPointerOrThrow_(std::string const &name) const
double getDouble() const
Definition: Entry.cc:954
Definition: output.py:1
long long getInt64() const
Definition: Entry.cc:882
Log< level::Warning, false > LogWarning
void throwWrongNumberOfElements(std::string const &iParameterName, size_t iExpected, size_t iGot)
Definition: ParameterSet.cc:33
T first(std::pair< T, U > const &p)
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.
long double T
static ParameterSetID emptyParameterSetID()
Definition: ParameterSet.cc:94
ParameterSetEntry const & retrieveParameterSet(std::string const &) const
void toDigest(cms::Digest &digest) const
std::vector< std::string > getParameterNames() const
std::string toString() const
Definition: Digest.cc:95
bool isTransientEqual(ParameterSet const &a, ParameterSet const &b)
LuminosityBlockRange getLuminosityBlockRange() const
Definition: Entry.cc:1118
std::vector< LuminosityBlockRange > getVLuminosityBlockRange() const
Definition: Entry.cc:1130
static Registry * instance()
Definition: Registry.cc:12
char typeCode() const
Definition: Entry.h:176
vpsettable vpsetTable_
Definition: ParameterSet.h:271
std::vector< long long > getVInt64() const
Definition: Entry.cc:894
void append(std::string const &s)
Definition: Digest.cc:161
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
std::vector< double > getVDouble() const
Definition: Entry.cc:966
unsigned transform(const HcalDetId &id, unsigned transformCode)