CMS 3D CMS Logo

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