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