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 
19 #include "boost/bind.hpp"
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::auto_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::auto_ptr<ParameterSet> pset(new 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::auto_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::auto_ptr<std::vector<ParameterSet> > vpset(new 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  std::vector<std::string> returnValue;
750  std::transform(tbl_.begin(), tbl_.end(), back_inserter(returnValue),
752  std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(returnValue),
754  std::transform(vpsetTable_.begin(), vpsetTable_.end(), back_inserter(returnValue),
756  return returnValue;
757  }
758 
759  bool ParameterSet::exists(std::string const& parameterName) const {
760  return(tbl_.find(parameterName) != tbl_.end() ||
761  psetTable_.find(parameterName) != psetTable_.end() ||
762  vpsetTable_.find(parameterName) != vpsetTable_.end());
763  }
764 
768  for(table::const_iterator tblItr = tbl_.begin(); tblItr != tbl_.end(); ++tblItr) {
769  if(tblItr->second.isTracked()) {
770  result.tbl_.insert(*tblItr);
771  }
772  }
773  for(psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
774  if(psetItr->second.isTracked()) {
775  result.addParameter<ParameterSet>(psetItr->first, psetItr->second.pset().trackedPart());
776  }
777  }
778  for(vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
779  if(vpsetItr->second.isTracked()) {
780  VParameterSet vresult;
781  std::vector<ParameterSet> const& this_vpset = vpsetItr->second.vpset();
782 
783  typedef std::vector<ParameterSet>::const_iterator Iter;
784  for (Iter i = this_vpset.begin(), e = this_vpset.end(); i != e; ++i) {
785  vresult.push_back(i->trackedPart());
786  }
787  result.addParameter<VParameterSet>(vpsetItr->first, vresult);
788  }
789  }
790  return result;
791  }
792 
793 /*
794  // Comment out unneeded function
795  size_t
796  ParameterSet::getAllParameterSetNames(std::vector<std::string>& output) const {
797  std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(output),
798  boost::bind(&std::pair<std::string const, ParameterSetEntry>::first, _1));
799  return output.size();
800  }
801 */
802 
803  size_t
804  ParameterSet::getParameterSetNames(std::vector<std::string>& output,
805  bool trackiness) const {
806  for(psettable::const_iterator psetItr = psetTable_.begin();
807  psetItr != psetTable_.end(); ++psetItr) {
808  if(psetItr->second.isTracked() == trackiness) {
809  output.push_back(psetItr->first);
810  }
811  }
812  return output.size();
813  }
814 
815  size_t
817  bool trackiness) const {
818  for(vpsettable::const_iterator vpsetItr = vpsetTable_.begin();
819  vpsetItr != vpsetTable_.end(); ++vpsetItr) {
820  if(vpsetItr->second.isTracked() == trackiness) {
821  output.push_back(vpsetItr->first);
822  }
823  }
824  return output.size();
825  }
826 
827  size_t
829  bool trackiness,
830  std::vector<std::string>& output) const {
831  size_t count = 0;
832  if(code == 'Q') {
833  return getParameterSetNames(output, trackiness);
834  }
835  if(code == 'q') {
836  return getParameterSetVectorNames(output, trackiness);
837  }
838  table::const_iterator it = tbl_.begin();
839  table::const_iterator end = tbl_.end();
840  while (it != end) {
841  Entry const& e = it->second;
842  if(e.typeCode() == code &&
843  e.isTracked() == trackiness) { // if it is a vector of ParameterSet
844  ++count;
845  output.push_back(it->first); // save the name
846  }
847  ++it;
848  }
849  return count;
850  }
851 
852  template<>
853  std::vector<std::string> ParameterSet::getParameterNamesForType<FileInPath>(bool trackiness) const {
854  std::vector<std::string> result;
855  getNamesByCode_('F', trackiness, result);
856  return result;
857  }
858 
859  bool operator==(ParameterSet const& a, ParameterSet const& b) {
860  if(a.isRegistered() && b.isRegistered()) {
861  return (a.id() == b.id());
862  }
863  return isTransientEqual(a.trackedPart(), b.trackedPart());
864  }
865 
867  if(a.tbl().size() != b.tbl().size()) {
868  return false;
869  }
870  if(a.psetTable().size() != b.psetTable().size()) {
871  return false;
872  }
873  if(a.vpsetTable().size() != b.vpsetTable().size()) {
874  return false;
875  }
876  typedef ParameterSet::table::const_iterator Ti;
877  for (Ti i = a.tbl().begin(), e = a.tbl().end(),
878  j = b.tbl().begin(), f = b.tbl().end();
879  i != e && j != f; ++i, ++j) {
880  if(*i != *j) {
881  return false;
882  }
883  }
884  typedef ParameterSet::psettable::const_iterator Pi;
885  for (Pi i = a.psetTable().begin(), e = a.psetTable().end(),
886  j = b.psetTable().begin(), f = b.psetTable().end();
887  i != e && j != f; ++i, ++j) {
888  if(i->first != j->first) {
889  return false;
890  }
891  if(i->second.isTracked() != j->second.isTracked()) {
892  return false;
893  }
894  if(!isTransientEqual(i->second.pset(), j->second.pset())) {
895  return false;
896  }
897  }
898  typedef ParameterSet::vpsettable::const_iterator PVi;
899  for (PVi i = a.vpsetTable().begin(), e = a.vpsetTable().end(),
900  j = b.vpsetTable().begin(), f = b.vpsetTable().end();
901  i != e && j != f; ++i, ++j) {
902  if(i->first != j->first) {
903  return false;
904  }
905  if(i->second.isTracked() != j->second.isTracked()) {
906  return false;
907  }
908  std::vector<ParameterSet> const& iv = i->second.vpset();
909  std::vector<ParameterSet> const& jv = j->second.vpset();
910  if(iv.size() != jv.size()) {
911  return false;
912  }
913  for (size_t k = 0; k < iv.size(); ++k) {
914  if(!isTransientEqual(iv[k], jv[k])) {
915  return false;
916  }
917  }
918  }
919  return true;
920  }
921 
922  std::string ParameterSet::dump(unsigned int indent) const {
923  std::ostringstream os;
924  // indent a bit
925  std::string indentation(indent, ' ');
926  os << "{" << std::endl;
927  for(table::const_iterator i = tbl_.begin(), e = tbl_.end(); i != e; ++i) {
928  os << indentation << " " << i->first << ": " << i->second << std::endl;
929  }
930  for(psettable::const_iterator i = psetTable_.begin(), e = psetTable_.end(); i != e; ++i) {
931  // indent a bit
932  std::string n = i->first;
933  ParameterSetEntry const& pe = i->second;
934  os << indentation << " " << n << ": " << pe.dump(indent + 2) << std::endl;
935  }
936  for(vpsettable::const_iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
937  // indent a bit
938  std::string n = i->first;
939  VParameterSetEntry const& pe = i->second;
940  os << indentation << " " << n << ": " << pe.dump(indent + 2) << std::endl;
941  }
942  os << indentation << "}";
943  return os.str();
944  }
945 
946  std::ostream& operator<<(std::ostream& os, ParameterSet const& pset) {
947  os << pset.dump();
948  return os;
949  }
950 
951  // Free function to return a parameterSet given its ID.
952  ParameterSet const&
954  ParameterSet const* result = 0;
955  if(0 == (result = pset::Registry::instance()->getMapped(id))) {
956  throw Exception(errors::Configuration, "MissingParameterSet:")
957  << "Parameter Set ID '" << id << "' not found.";
958  }
959  return *result;
960  }
961 
963  std::string const& label) const {
964  LogWarning("Configuration") << "Warning:\n\tstring " << name
965  << " = \"" << label
966  << "\"\nis deprecated, "
967  << "please update your config file to use\n\tInputTag "
968  << name << " = " << label;
969  }
970 
971  // specializations
972  // ----------------------------------------------------------------------
973  // Bool, vBool
974 
975  template<>
976  bool
977  ParameterSet::getParameter<bool>(std::string const& name) const {
978  return retrieve(name).getBool();
979  }
980 
981  // ----------------------------------------------------------------------
982  // Int32, vInt32
983 
984  template<>
985  int
986  ParameterSet::getParameter<int>(std::string const& name) const {
987  return retrieve(name).getInt32();
988  }
989 
990  template<>
991  std::vector<int>
992  ParameterSet::getParameter<std::vector<int> >(std::string const& name) const {
993  return retrieve(name).getVInt32();
994  }
995 
996  // ----------------------------------------------------------------------
997  // Int64, vInt64
998 
999  template<>
1000  long long
1001  ParameterSet::getParameter<long long>(std::string const& name) const {
1002  return retrieve(name).getInt64();
1003  }
1004 
1005  template<>
1006  std::vector<long long>
1007  ParameterSet::getParameter<std::vector<long long> >(std::string const& name) const {
1008  return retrieve(name).getVInt64();
1009  }
1010 
1011  // ----------------------------------------------------------------------
1012  // Uint32, vUint32
1013 
1014  template<>
1015  unsigned int
1016  ParameterSet::getParameter<unsigned int>(std::string const& name) const {
1017  return retrieve(name).getUInt32();
1018  }
1019 
1020  template<>
1021  std::vector<unsigned int>
1022  ParameterSet::getParameter<std::vector<unsigned int> >(std::string const& name) const {
1023  return retrieve(name).getVUInt32();
1024  }
1025 
1026  // ----------------------------------------------------------------------
1027  // Uint64, vUint64
1028 
1029  template<>
1030  unsigned long long
1031  ParameterSet::getParameter<unsigned long long>(std::string const& name) const {
1032  return retrieve(name).getUInt64();
1033  }
1034 
1035  template<>
1036  std::vector<unsigned long long>
1037  ParameterSet::getParameter<std::vector<unsigned long long> >(std::string const& name) const {
1038  return retrieve(name).getVUInt64();
1039  }
1040 
1041  // ----------------------------------------------------------------------
1042  // Double, vDouble
1043 
1044  template<>
1045  double
1046  ParameterSet::getParameter<double>(std::string const& name) const {
1047  return retrieve(name).getDouble();
1048  }
1049 
1050  template<>
1051  std::vector<double>
1052  ParameterSet::getParameter<std::vector<double> >(std::string const& name) const {
1053  return retrieve(name).getVDouble();
1054  }
1055 
1056  // ----------------------------------------------------------------------
1057  // String, vString
1058 
1059  template<>
1060  std::string
1061  ParameterSet::getParameter<std::string>(std::string const& name) const {
1062  return retrieve(name).getString();
1063  }
1064 
1065  template<>
1066  std::vector<std::string>
1067  ParameterSet::getParameter<std::vector<std::string> >(std::string const& name) const {
1068  return retrieve(name).getVString();
1069  }
1070 
1071  // ----------------------------------------------------------------------
1072  // FileInPath
1073 
1074  template<>
1075  FileInPath
1076  ParameterSet::getParameter<FileInPath>(std::string const& name) const {
1077  return retrieve(name).getFileInPath();
1078  }
1079 
1080  // ----------------------------------------------------------------------
1081  // InputTag
1082 
1083  template<>
1084  InputTag
1085  ParameterSet::getParameter<InputTag>(std::string const& name) const {
1086  Entry const& e_input = retrieve(name);
1087  switch (e_input.typeCode()) {
1088  case 't': // InputTag
1089  return e_input.getInputTag();
1090  case 'S': // string
1091  std::string const& label = e_input.getString();
1092  deprecatedInputTagWarning(name, label);
1093  return InputTag(label);
1094  }
1095  throw Exception(errors::Configuration, "ValueError") << "type of "
1096  << name << " is expected to be InputTag or string (deprecated)";
1097 
1098  }
1099 
1100  // ----------------------------------------------------------------------
1101  // VInputTag
1102 
1103  template<>
1104  std::vector<InputTag>
1105  ParameterSet::getParameter<std::vector<InputTag> >(std::string const& name) const {
1106  return retrieve(name).getVInputTag();
1107  }
1108 
1109  // ----------------------------------------------------------------------
1110  // ESInputTag
1111 
1112  template<>
1113  ESInputTag
1114  ParameterSet::getParameter<ESInputTag>(std::string const& name) const {
1115  return retrieve(name).getESInputTag();
1116  }
1117 
1118  // ----------------------------------------------------------------------
1119  // VESInputTag
1120 
1121  template<>
1122  std::vector<ESInputTag>
1123  ParameterSet::getParameter<std::vector<ESInputTag> >(std::string const& name) const {
1124  return retrieve(name).getVESInputTag();
1125  }
1126 
1127  // ----------------------------------------------------------------------
1128  // EventID
1129 
1130  template<>
1131  EventID
1132  ParameterSet::getParameter<EventID>(std::string const& name) const {
1133  return retrieve(name).getEventID();
1134  }
1135 
1136  // ----------------------------------------------------------------------
1137  // VEventID
1138 
1139  template<>
1140  std::vector<EventID>
1141  ParameterSet::getParameter<std::vector<EventID> >(std::string const& name) const {
1142  return retrieve(name).getVEventID();
1143  }
1144 
1145  // ----------------------------------------------------------------------
1146  // LuminosityBlockID
1147 
1148  template<>
1150  ParameterSet::getParameter<LuminosityBlockID>(std::string const& name) const {
1151  return retrieve(name).getLuminosityBlockID();
1152  }
1153 
1154  // ----------------------------------------------------------------------
1155  // VLuminosityBlockID
1156 
1157  template<>
1158  std::vector<LuminosityBlockID>
1159  ParameterSet::getParameter<std::vector<LuminosityBlockID> >(std::string const& name) const {
1160  return retrieve(name).getVLuminosityBlockID();
1161  }
1162 
1163  // ----------------------------------------------------------------------
1164  // EventRange
1165 
1166  template<>
1167  EventRange
1168  ParameterSet::getParameter<EventRange>(std::string const& name) const {
1169  return retrieve(name).getEventRange();
1170  }
1171 
1172  // ----------------------------------------------------------------------
1173  // VEventRange
1174 
1175  template<>
1176  std::vector<EventRange>
1177  ParameterSet::getParameter<std::vector<EventRange> >(std::string const& name) const {
1178  return retrieve(name).getVEventRange();
1179  }
1180 
1181  // ----------------------------------------------------------------------
1182  // LuminosityBlockRange
1183 
1184  template<>
1186  ParameterSet::getParameter<LuminosityBlockRange>(std::string const& name) const {
1187  return retrieve(name).getLuminosityBlockRange();
1188  }
1189 
1190  // ----------------------------------------------------------------------
1191  // VLuminosityBlockRange
1192 
1193  template<>
1194  std::vector<LuminosityBlockRange>
1195  ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(std::string const& name) const {
1196  return retrieve(name).getVLuminosityBlockRange();
1197  }
1198 
1199  // ----------------------------------------------------------------------
1200  // PSet, vPSet
1201 
1202  template<>
1203  ParameterSet
1204  ParameterSet::getParameter<ParameterSet>(std::string const& name) const {
1205  return getParameterSet(name);
1206  }
1207 
1208  template<>
1210  ParameterSet::getParameter<VParameterSet>(std::string const& name) const {
1211  return getParameterSetVector(name);
1212  }
1213 
1214  // untracked parameters
1215 
1216  // ----------------------------------------------------------------------
1217  // Bool, vBool
1218 
1219  template<>
1220  bool
1221  ParameterSet::getUntrackedParameter<bool>(std::string const& name, bool const& defaultValue) const {
1222  Entry const* entryPtr = retrieveUntracked(name);
1223  return entryPtr == 0 ? defaultValue : entryPtr->getBool();
1224  }
1225 
1226  template<>
1227  bool
1228  ParameterSet::getUntrackedParameter<bool>(std::string const& name) const {
1229  return getEntryPointerOrThrow_(name)->getBool();
1230  }
1231 
1232  // ----------------------------------------------------------------------
1233  // Int32, vInt32
1234 
1235  template<>
1236  int
1237  ParameterSet::getUntrackedParameter<int>(std::string const& name, int const& defaultValue) const {
1238  Entry const* entryPtr = retrieveUntracked(name);
1239  return entryPtr == 0 ? defaultValue : entryPtr->getInt32();
1240  }
1241 
1242  template<>
1243  int
1244  ParameterSet::getUntrackedParameter<int>(std::string const& name) const {
1245  return getEntryPointerOrThrow_(name)->getInt32();
1246  }
1247 
1248  template<>
1249  std::vector<int>
1250  ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name, std::vector<int> const& defaultValue) const {
1251  Entry const* entryPtr = retrieveUntracked(name);
1252  return entryPtr == 0 ? defaultValue : entryPtr->getVInt32();
1253  }
1254 
1255  template<>
1256  std::vector<int>
1257  ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name) const {
1258  return getEntryPointerOrThrow_(name)->getVInt32();
1259  }
1260 
1261  // ----------------------------------------------------------------------
1262  // Uint32, vUint32
1263 
1264  template<>
1265  unsigned int
1266  ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name, unsigned int const& defaultValue) const {
1267  Entry const* entryPtr = retrieveUntracked(name);
1268  return entryPtr == 0 ? defaultValue : entryPtr->getUInt32();
1269  }
1270 
1271  template<>
1272  unsigned int
1273  ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name) const {
1274  return getEntryPointerOrThrow_(name)->getUInt32();
1275  }
1276 
1277  template<>
1278  std::vector<unsigned int>
1279  ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(std::string const& name, std::vector<unsigned int> const& defaultValue) const {
1280  Entry const* entryPtr = retrieveUntracked(name);
1281  return entryPtr == 0 ? defaultValue : entryPtr->getVUInt32();
1282  }
1283 
1284  template<>
1285  std::vector<unsigned int>
1286  ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(std::string const& name) const {
1287  return getEntryPointerOrThrow_(name)->getVUInt32();
1288  }
1289 
1290  // ----------------------------------------------------------------------
1291  // Uint64, vUint64
1292 
1293  template<>
1294  unsigned long long
1295  ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name, unsigned long long const& defaultValue) const {
1296  Entry const* entryPtr = retrieveUntracked(name);
1297  return entryPtr == 0 ? defaultValue : entryPtr->getUInt64();
1298  }
1299 
1300  template<>
1301  unsigned long long
1302  ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name) const {
1303  return getEntryPointerOrThrow_(name)->getUInt64();
1304  }
1305 
1306  template<>
1307  std::vector<unsigned long long>
1308  ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(std::string const& name, std::vector<unsigned long long> const& defaultValue) const {
1309  Entry const* entryPtr = retrieveUntracked(name);
1310  return entryPtr == 0 ? defaultValue : entryPtr->getVUInt64();
1311  }
1312 
1313  template<>
1314  std::vector<unsigned long long>
1315  ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(std::string const& name) const {
1316  return getEntryPointerOrThrow_(name)->getVUInt64();
1317  }
1318 
1319  // ----------------------------------------------------------------------
1320  // Int64, Vint64
1321 
1322  template<>
1323  long long
1324  ParameterSet::getUntrackedParameter<long long>(std::string const& name, long long const& defaultValue) const {
1325  Entry const* entryPtr = retrieveUntracked(name);
1326  return entryPtr == 0 ? defaultValue : entryPtr->getInt64();
1327  }
1328 
1329  template<>
1330  long long
1331  ParameterSet::getUntrackedParameter<long long>(std::string const& name) const {
1332  return getEntryPointerOrThrow_(name)->getInt64();
1333  }
1334 
1335  template<>
1336  std::vector<long long>
1337  ParameterSet::getUntrackedParameter<std::vector<long long> >(std::string const& name, std::vector<long long> const& defaultValue) const {
1338  Entry const* entryPtr = retrieveUntracked(name);
1339  return entryPtr == 0 ? defaultValue : entryPtr->getVInt64();
1340  }
1341 
1342  template<>
1343  std::vector<long long>
1344  ParameterSet::getUntrackedParameter<std::vector<long long> >(std::string const& name) const {
1345  return getEntryPointerOrThrow_(name)->getVInt64();
1346  }
1347 
1348  // ----------------------------------------------------------------------
1349  // Double, vDouble
1350 
1351  template<>
1352  double
1353  ParameterSet::getUntrackedParameter<double>(std::string const& name, double const& defaultValue) const {
1354  Entry const* entryPtr = retrieveUntracked(name);
1355  return entryPtr == 0 ? defaultValue : entryPtr->getDouble();
1356  }
1357 
1358  template<>
1359  double
1360  ParameterSet::getUntrackedParameter<double>(std::string const& name) const {
1361  return getEntryPointerOrThrow_(name)->getDouble();
1362  }
1363 
1364  template<>
1365  std::vector<double>
1366  ParameterSet::getUntrackedParameter<std::vector<double> >(std::string const& name, std::vector<double> const& defaultValue) const {
1367  Entry const* entryPtr = retrieveUntracked(name); return entryPtr == 0 ? defaultValue : entryPtr->getVDouble();
1368  }
1369 
1370  template<>
1371  std::vector<double>
1372  ParameterSet::getUntrackedParameter<std::vector<double> >(std::string const& name) const {
1373  return getEntryPointerOrThrow_(name)->getVDouble();
1374  }
1375 
1376  // ----------------------------------------------------------------------
1377  // String, vString
1378 
1379  template<>
1380  std::string
1381  ParameterSet::getUntrackedParameter<std::string>(std::string const& name, std::string const& defaultValue) const {
1382  Entry const* entryPtr = retrieveUntracked(name);
1383  return entryPtr == 0 ? defaultValue : entryPtr->getString();
1384  }
1385 
1386  template<>
1387  std::string
1388  ParameterSet::getUntrackedParameter<std::string>(std::string const& name) const {
1389  return getEntryPointerOrThrow_(name)->getString();
1390  }
1391 
1392  template<>
1393  std::vector<std::string>
1394  ParameterSet::getUntrackedParameter<std::vector<std::string> >(std::string const& name, std::vector<std::string> const& defaultValue) const {
1395  Entry const* entryPtr = retrieveUntracked(name);
1396  return entryPtr == 0 ? defaultValue : entryPtr->getVString();
1397  }
1398 
1399  template<>
1400  std::vector<std::string>
1401  ParameterSet::getUntrackedParameter<std::vector<std::string> >(std::string const& name) const {
1402  return getEntryPointerOrThrow_(name)->getVString();
1403  }
1404 
1405  // ----------------------------------------------------------------------
1406  // FileInPath
1407 
1408  template<>
1409  FileInPath
1410  ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name, FileInPath const& defaultValue) const {
1411  Entry const* entryPtr = retrieveUntracked(name);
1412  return entryPtr == 0 ? defaultValue : entryPtr->getFileInPath();
1413  }
1414 
1415  template<>
1416  FileInPath
1417  ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name) const {
1418  return getEntryPointerOrThrow_(name)->getFileInPath();
1419  }
1420 
1421  // ----------------------------------------------------------------------
1422  // InputTag, VInputTag
1423 
1424  template<>
1425  InputTag
1426  ParameterSet::getUntrackedParameter<InputTag>(std::string const& name, InputTag const& defaultValue) const {
1427  Entry const* entryPtr = retrieveUntracked(name);
1428  return entryPtr == 0 ? defaultValue : entryPtr->getInputTag();
1429  }
1430 
1431  template<>
1432  InputTag
1433  ParameterSet::getUntrackedParameter<InputTag>(std::string const& name) const {
1434  return getEntryPointerOrThrow_(name)->getInputTag();
1435  }
1436 
1437  template<>
1438  std::vector<InputTag>
1439  ParameterSet::getUntrackedParameter<std::vector<InputTag> >(std::string const& name,
1440  std::vector<InputTag> const& defaultValue) const {
1441  Entry const* entryPtr = retrieveUntracked(name);
1442  return entryPtr == 0 ? defaultValue : entryPtr->getVInputTag();
1443  }
1444 
1445  template<>
1446  std::vector<InputTag>
1447  ParameterSet::getUntrackedParameter<std::vector<InputTag> >(std::string const& name) const {
1448  return getEntryPointerOrThrow_(name)->getVInputTag();
1449  }
1450 
1451  // ----------------------------------------------------------------------
1452  // ESInputTag, VESInputTag
1453 
1454  template<>
1455  ESInputTag
1456  ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name, ESInputTag const& defaultValue) const {
1457  Entry const* entryPtr = retrieveUntracked(name);
1458  return entryPtr == 0 ? defaultValue : entryPtr->getESInputTag();
1459  }
1460 
1461  template<>
1462  ESInputTag
1463  ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name) const {
1464  return getEntryPointerOrThrow_(name)->getESInputTag();
1465  }
1466 
1467  template<>
1468  std::vector<ESInputTag>
1469  ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(std::string const& name,
1470  std::vector<ESInputTag> const& defaultValue) const {
1471  Entry const* entryPtr = retrieveUntracked(name);
1472  return entryPtr == 0 ? defaultValue : entryPtr->getVESInputTag();
1473  }
1474 
1475  template<>
1476  std::vector<ESInputTag>
1477  ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(std::string const& name) const {
1478  return getEntryPointerOrThrow_(name)->getVESInputTag();
1479  }
1480 
1481  // ----------------------------------------------------------------------
1482  // EventID, VEventID
1483 
1484  template<>
1485  EventID
1486  ParameterSet::getUntrackedParameter<EventID>(std::string const& name, EventID const& defaultValue) const {
1487  Entry const* entryPtr = retrieveUntracked(name);
1488  return entryPtr == 0 ? defaultValue : entryPtr->getEventID();
1489  }
1490 
1491  template<>
1492  EventID
1493  ParameterSet::getUntrackedParameter<EventID>(std::string const& name) const {
1494  return getEntryPointerOrThrow_(name)->getEventID();
1495  }
1496 
1497  template<>
1498  std::vector<EventID>
1499  ParameterSet::getUntrackedParameter<std::vector<EventID> >(std::string const& name,
1500  std::vector<EventID> const& defaultValue) const {
1501  Entry const* entryPtr = retrieveUntracked(name);
1502  return entryPtr == 0 ? defaultValue : entryPtr->getVEventID();
1503  }
1504 
1505  template<>
1506  std::vector<EventID>
1507  ParameterSet::getUntrackedParameter<std::vector<EventID> >(std::string const& name) const {
1508  return getEntryPointerOrThrow_(name)->getVEventID();
1509  }
1510 
1511  // ----------------------------------------------------------------------
1512  // LuminosityBlockID, VLuminosityBlockID
1513 
1514  template<>
1516  ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name, LuminosityBlockID const& defaultValue) const {
1517  Entry const* entryPtr = retrieveUntracked(name);
1518  return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockID();
1519  }
1520 
1521  template<>
1523  ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name) const {
1524  return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
1525  }
1526 
1527  template<>
1528  std::vector<LuminosityBlockID>
1529  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(std::string const& name,
1530  std::vector<LuminosityBlockID> const& defaultValue) const {
1531  Entry const* entryPtr = retrieveUntracked(name);
1532  return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockID();
1533  }
1534 
1535  template<>
1536  std::vector<LuminosityBlockID>
1537  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(std::string const& name) const {
1538  return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
1539  }
1540 
1541  // ----------------------------------------------------------------------
1542  // EventRange, VEventRange
1543 
1544  template<>
1545  EventRange
1546  ParameterSet::getUntrackedParameter<EventRange>(std::string const& name, EventRange const& defaultValue) const {
1547  Entry const* entryPtr = retrieveUntracked(name);
1548  return entryPtr == 0 ? defaultValue : entryPtr->getEventRange();
1549  }
1550 
1551  template<>
1552  EventRange
1553  ParameterSet::getUntrackedParameter<EventRange>(std::string const& name) const {
1554  return getEntryPointerOrThrow_(name)->getEventRange();
1555  }
1556 
1557  template<>
1558  std::vector<EventRange>
1559  ParameterSet::getUntrackedParameter<std::vector<EventRange> >(std::string const& name,
1560  std::vector<EventRange> const& defaultValue) const {
1561  Entry const* entryPtr = retrieveUntracked(name);
1562  return entryPtr == 0 ? defaultValue : entryPtr->getVEventRange();
1563  }
1564 
1565  template<>
1566  std::vector<EventRange>
1567  ParameterSet::getUntrackedParameter<std::vector<EventRange> >(std::string const& name) const {
1568  return getEntryPointerOrThrow_(name)->getVEventRange();
1569  }
1570 
1571  // ----------------------------------------------------------------------
1572  // LuminosityBlockRange, VLuminosityBlockRange
1573 
1574  template<>
1576  ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name, LuminosityBlockRange const& defaultValue) const {
1577  Entry const* entryPtr = retrieveUntracked(name);
1578  return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockRange();
1579  }
1580 
1581  template<>
1583  ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name) const {
1584  return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
1585  }
1586 
1587  template<>
1588  std::vector<LuminosityBlockRange>
1589  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(std::string const& name,
1590  std::vector<LuminosityBlockRange> const& defaultValue) const {
1591  Entry const* entryPtr = retrieveUntracked(name);
1592  return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockRange();
1593  }
1594 
1595  template<>
1596  std::vector<LuminosityBlockRange>
1597  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(std::string const& name) const {
1598  return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
1599  }
1600 
1601  // specializations
1602  // ----------------------------------------------------------------------
1603  // Bool, vBool
1604 
1605  template<>
1606  bool
1607  ParameterSet::getParameter<bool>(char const* name) const {
1608  return retrieve(name).getBool();
1609  }
1610 
1611  // ----------------------------------------------------------------------
1612  // Int32, vInt32
1613 
1614  template<>
1615  int
1616  ParameterSet::getParameter<int>(char const* name) const {
1617  return retrieve(name).getInt32();
1618  }
1619 
1620  template<>
1621  std::vector<int>
1622  ParameterSet::getParameter<std::vector<int> >(char const* name) const {
1623  return retrieve(name).getVInt32();
1624  }
1625 
1626  // ----------------------------------------------------------------------
1627  // Int64, vInt64
1628 
1629  template<>
1630  long long
1631  ParameterSet::getParameter<long long>(char const* name) const {
1632  return retrieve(name).getInt64();
1633  }
1634 
1635  template<>
1636  std::vector<long long>
1637  ParameterSet::getParameter<std::vector<long long> >(char const* name) const {
1638  return retrieve(name).getVInt64();
1639  }
1640 
1641  // ----------------------------------------------------------------------
1642  // Uint32, vUint32
1643 
1644  template<>
1645  unsigned int
1646  ParameterSet::getParameter<unsigned int>(char const* name) const {
1647  return retrieve(name).getUInt32();
1648  }
1649 
1650  template<>
1651  std::vector<unsigned int>
1652  ParameterSet::getParameter<std::vector<unsigned int> >(char const* name) const {
1653  return retrieve(name).getVUInt32();
1654  }
1655 
1656  // ----------------------------------------------------------------------
1657  // Uint64, vUint64
1658 
1659  template<>
1660  unsigned long long
1661  ParameterSet::getParameter<unsigned long long>(char const* name) const {
1662  return retrieve(name).getUInt64();
1663  }
1664 
1665  template<>
1666  std::vector<unsigned long long>
1667  ParameterSet::getParameter<std::vector<unsigned long long> >(char const* name) const {
1668  return retrieve(name).getVUInt64();
1669  }
1670 
1671  // ----------------------------------------------------------------------
1672  // Double, vDouble
1673 
1674  template<>
1675  double
1676  ParameterSet::getParameter<double>(char const* name) const {
1677  return retrieve(name).getDouble();
1678  }
1679 
1680  template<>
1681  std::vector<double>
1682  ParameterSet::getParameter<std::vector<double> >(char const* name) const {
1683  return retrieve(name).getVDouble();
1684  }
1685 
1686  // ----------------------------------------------------------------------
1687  // String, vString
1688 
1689  template<>
1690  std::string
1691  ParameterSet::getParameter<std::string>(char const* name) const {
1692  return retrieve(name).getString();
1693  }
1694 
1695  template<>
1696  std::vector<std::string>
1697  ParameterSet::getParameter<std::vector<std::string> >(char const* name) const {
1698  return retrieve(name).getVString();
1699  }
1700 
1701  // ----------------------------------------------------------------------
1702  // FileInPath
1703 
1704  template<>
1705  FileInPath
1706  ParameterSet::getParameter<FileInPath>(char const* name) const {
1707  return retrieve(name).getFileInPath();
1708  }
1709 
1710  // ----------------------------------------------------------------------
1711  // InputTag
1712 
1713  template<>
1714  InputTag
1715  ParameterSet::getParameter<InputTag>(char const* name) const {
1716  Entry const& e_input = retrieve(name);
1717  switch (e_input.typeCode()) {
1718  case 't': // InputTag
1719  return e_input.getInputTag();
1720  case 'S': // string
1721  std::string const& label = e_input.getString();
1722  deprecatedInputTagWarning(name, label);
1723  return InputTag(label);
1724  }
1725  throw Exception(errors::Configuration, "ValueError") << "type of "
1726  << name << " is expected to be InputTag or string (deprecated)";
1727  }
1728 
1729  // ----------------------------------------------------------------------
1730  // VInputTag
1731 
1732  template<>
1733  std::vector<InputTag>
1734  ParameterSet::getParameter<std::vector<InputTag> >(char const* name) const {
1735  return retrieve(name).getVInputTag();
1736  }
1737 
1738  // ----------------------------------------------------------------------
1739  // ESInputTag
1740 
1741  template<>
1742  ESInputTag
1743  ParameterSet::getParameter<ESInputTag>(char const* name) const {
1744  return retrieve(name).getESInputTag();
1745  }
1746 
1747  // ----------------------------------------------------------------------
1748  // VESInputTag
1749 
1750  template<>
1751  std::vector<ESInputTag>
1752  ParameterSet::getParameter<std::vector<ESInputTag> >(char const* name) const {
1753  return retrieve(name).getVESInputTag();
1754  }
1755 
1756 
1757  // ----------------------------------------------------------------------
1758  // EventID
1759 
1760  template<>
1761  EventID
1762  ParameterSet::getParameter<EventID>(char const* name) const {
1763  return retrieve(name).getEventID();
1764  }
1765 
1766  // ----------------------------------------------------------------------
1767  // VEventID
1768 
1769  template<>
1770  std::vector<EventID>
1771  ParameterSet::getParameter<std::vector<EventID> >(char const* name) const {
1772  return retrieve(name).getVEventID();
1773  }
1774 
1775  // ----------------------------------------------------------------------
1776  // LuminosityBlockID
1777 
1778  template<>
1780  ParameterSet::getParameter<LuminosityBlockID>(char const* name) const {
1781  return retrieve(name).getLuminosityBlockID();
1782  }
1783 
1784  // ----------------------------------------------------------------------
1785  // VLuminosityBlockID
1786 
1787  template<>
1788  std::vector<LuminosityBlockID>
1789  ParameterSet::getParameter<std::vector<LuminosityBlockID> >(char const* name) const {
1790  return retrieve(name).getVLuminosityBlockID();
1791  }
1792 
1793  // ----------------------------------------------------------------------
1794  // EventRange
1795 
1796  template<>
1797  EventRange
1798  ParameterSet::getParameter<EventRange>(char const* name) const {
1799  return retrieve(name).getEventRange();
1800  }
1801 
1802  // ----------------------------------------------------------------------
1803  // VEventRange
1804 
1805  template<>
1806  std::vector<EventRange>
1807  ParameterSet::getParameter<std::vector<EventRange> >(char const* name) const {
1808  return retrieve(name).getVEventRange();
1809  }
1810 
1811  // ----------------------------------------------------------------------
1812  // LuminosityBlockRange
1813 
1814  template<>
1816  ParameterSet::getParameter<LuminosityBlockRange>(char const* name) const {
1817  return retrieve(name).getLuminosityBlockRange();
1818  }
1819 
1820  // ----------------------------------------------------------------------
1821  // VLuminosityBlockRange
1822 
1823  template<>
1824  std::vector<LuminosityBlockRange>
1825  ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(char const* name) const {
1826  return retrieve(name).getVLuminosityBlockRange();
1827  }
1828 
1829  // ----------------------------------------------------------------------
1830  // PSet, vPSet
1831 
1832  template<>
1833  ParameterSet
1834  ParameterSet::getParameter<ParameterSet>(char const* name) const {
1835  return getParameterSet(name);
1836  }
1837 
1838  template<>
1840  ParameterSet::getParameter<VParameterSet>(char const* name) const {
1841  return getParameterSetVector(name);
1842  }
1843 
1844  // untracked parameters
1845 
1846  // ----------------------------------------------------------------------
1847  // Bool, vBool
1848 
1849  template<>
1850  bool
1851  ParameterSet::getUntrackedParameter<bool>(char const* name, bool const& defaultValue) const {
1852  Entry const* entryPtr = retrieveUntracked(name);
1853  return entryPtr == 0 ? defaultValue : entryPtr->getBool();
1854  }
1855 
1856  template<>
1857  bool
1858  ParameterSet::getUntrackedParameter<bool>(char const* name) const {
1859  return getEntryPointerOrThrow_(name)->getBool();
1860  }
1861 
1862  // ----------------------------------------------------------------------
1863  // Int32, vInt32
1864 
1865  template<>
1866  int
1867  ParameterSet::getUntrackedParameter<int>(char const* name, int const& defaultValue) const {
1868  Entry const* entryPtr = retrieveUntracked(name);
1869  return entryPtr == 0 ? defaultValue : entryPtr->getInt32();
1870  }
1871 
1872  template<>
1873  int
1874  ParameterSet::getUntrackedParameter<int>(char const* name) const {
1875  return getEntryPointerOrThrow_(name)->getInt32();
1876  }
1877 
1878  template<>
1879  std::vector<int>
1880  ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name, std::vector<int> const& defaultValue) const {
1881  Entry const* entryPtr = retrieveUntracked(name);
1882  return entryPtr == 0 ? defaultValue : entryPtr->getVInt32();
1883  }
1884 
1885  template<>
1886  std::vector<int>
1887  ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name) const {
1888  return getEntryPointerOrThrow_(name)->getVInt32();
1889  }
1890 
1891  // ----------------------------------------------------------------------
1892  // Uint32, vUint32
1893 
1894  template<>
1895  unsigned int
1896  ParameterSet::getUntrackedParameter<unsigned int>(char const* name, unsigned int const& defaultValue) const {
1897  Entry const* entryPtr = retrieveUntracked(name);
1898  return entryPtr == 0 ? defaultValue : entryPtr->getUInt32();
1899  }
1900 
1901  template<>
1902  unsigned int
1903  ParameterSet::getUntrackedParameter<unsigned int>(char const* name) const {
1904  return getEntryPointerOrThrow_(name)->getUInt32();
1905  }
1906 
1907  template<>
1908  std::vector<unsigned int>
1909  ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(char const* name, std::vector<unsigned int> const& defaultValue) const {
1910  Entry const* entryPtr = retrieveUntracked(name);
1911  return entryPtr == 0 ? defaultValue : entryPtr->getVUInt32();
1912  }
1913 
1914  template<>
1915  std::vector<unsigned int>
1916  ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(char const* name) const {
1917  return getEntryPointerOrThrow_(name)->getVUInt32();
1918  }
1919 
1920  // ----------------------------------------------------------------------
1921  // Uint64, vUint64
1922 
1923  template<>
1924  unsigned long long
1925  ParameterSet::getUntrackedParameter<unsigned long long>(char const* name, unsigned long long const& defaultValue) const {
1926  Entry const* entryPtr = retrieveUntracked(name);
1927  return entryPtr == 0 ? defaultValue : entryPtr->getUInt64();
1928  }
1929 
1930  template<>
1931  unsigned long long
1932  ParameterSet::getUntrackedParameter<unsigned long long>(char const* name) const {
1933  return getEntryPointerOrThrow_(name)->getUInt64();
1934  }
1935 
1936  template<>
1937  std::vector<unsigned long long>
1938  ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(char const* name, std::vector<unsigned long long> const& defaultValue) const {
1939  Entry const* entryPtr = retrieveUntracked(name);
1940  return entryPtr == 0 ? defaultValue : entryPtr->getVUInt64();
1941  }
1942 
1943  template<>
1944  std::vector<unsigned long long>
1945  ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(char const* name) const {
1946  return getEntryPointerOrThrow_(name)->getVUInt64();
1947  }
1948 
1949  // ----------------------------------------------------------------------
1950  // Int64, Vint64
1951 
1952  template<>
1953  long long
1954  ParameterSet::getUntrackedParameter<long long>(char const* name, long long const& defaultValue) const {
1955  Entry const* entryPtr = retrieveUntracked(name);
1956  return entryPtr == 0 ? defaultValue : entryPtr->getInt64();
1957  }
1958 
1959  template<>
1960  long long
1961  ParameterSet::getUntrackedParameter<long long>(char const* name) const {
1962  return getEntryPointerOrThrow_(name)->getInt64();
1963  }
1964 
1965  template<>
1966  std::vector<long long>
1967  ParameterSet::getUntrackedParameter<std::vector<long long> >(char const* name, std::vector<long long> const& defaultValue) const {
1968  Entry const* entryPtr = retrieveUntracked(name);
1969  return entryPtr == 0 ? defaultValue : entryPtr->getVInt64();
1970  }
1971 
1972  template<>
1973  std::vector<long long>
1974  ParameterSet::getUntrackedParameter<std::vector<long long> >(char const* name) const {
1975  return getEntryPointerOrThrow_(name)->getVInt64();
1976  }
1977 
1978  // ----------------------------------------------------------------------
1979  // Double, vDouble
1980 
1981  template<>
1982  double
1983  ParameterSet::getUntrackedParameter<double>(char const* name, double const& defaultValue) const {
1984  Entry const* entryPtr = retrieveUntracked(name);
1985  return entryPtr == 0 ? defaultValue : entryPtr->getDouble();
1986  }
1987 
1988  template<>
1989  double
1990  ParameterSet::getUntrackedParameter<double>(char const* name) const {
1991  return getEntryPointerOrThrow_(name)->getDouble();
1992  }
1993 
1994  template<>
1995  std::vector<double>
1996  ParameterSet::getUntrackedParameter<std::vector<double> >(char const* name, std::vector<double> const& defaultValue) const {
1997  Entry const* entryPtr = retrieveUntracked(name); return entryPtr == 0 ? defaultValue : entryPtr->getVDouble();
1998  }
1999 
2000  template<>
2001  std::vector<double>
2002  ParameterSet::getUntrackedParameter<std::vector<double> >(char const* name) const {
2003  return getEntryPointerOrThrow_(name)->getVDouble();
2004  }
2005 
2006  // ----------------------------------------------------------------------
2007  // String, vString
2008 
2009  template<>
2010  std::string
2011  ParameterSet::getUntrackedParameter<std::string>(char const* name, std::string const& defaultValue) const {
2012  Entry const* entryPtr = retrieveUntracked(name);
2013  return entryPtr == 0 ? defaultValue : entryPtr->getString();
2014  }
2015 
2016  template<>
2017  std::string
2018  ParameterSet::getUntrackedParameter<std::string>(char const* name) const {
2019  return getEntryPointerOrThrow_(name)->getString();
2020  }
2021 
2022  template<>
2023  std::vector<std::string>
2024  ParameterSet::getUntrackedParameter<std::vector<std::string> >(char const* name, std::vector<std::string> const& defaultValue) const {
2025  Entry const* entryPtr = retrieveUntracked(name);
2026  return entryPtr == 0 ? defaultValue : entryPtr->getVString();
2027  }
2028 
2029  template<>
2030  std::vector<std::string>
2031  ParameterSet::getUntrackedParameter<std::vector<std::string> >(char const* name) const {
2032  return getEntryPointerOrThrow_(name)->getVString();
2033  }
2034 
2035  // ----------------------------------------------------------------------
2036  // FileInPath
2037 
2038  template<>
2039  FileInPath
2040  ParameterSet::getUntrackedParameter<FileInPath>(char const* name, FileInPath const& defaultValue) const {
2041  Entry const* entryPtr = retrieveUntracked(name);
2042  return entryPtr == 0 ? defaultValue : entryPtr->getFileInPath();
2043  }
2044 
2045  template<>
2046  FileInPath
2047  ParameterSet::getUntrackedParameter<FileInPath>(char const* name) const {
2048  return getEntryPointerOrThrow_(name)->getFileInPath();
2049  }
2050 
2051  // ----------------------------------------------------------------------
2052  // InputTag, VInputTag
2053 
2054  template<>
2055  InputTag
2056  ParameterSet::getUntrackedParameter<InputTag>(char const* name, InputTag const& defaultValue) const {
2057  Entry const* entryPtr = retrieveUntracked(name);
2058  return entryPtr == 0 ? defaultValue : entryPtr->getInputTag();
2059  }
2060 
2061  template<>
2062  InputTag
2063  ParameterSet::getUntrackedParameter<InputTag>(char const* name) const {
2064  return getEntryPointerOrThrow_(name)->getInputTag();
2065  }
2066 
2067  template<>
2068  std::vector<InputTag>
2069  ParameterSet::getUntrackedParameter<std::vector<InputTag> >(char const* name,
2070  std::vector<InputTag> const& defaultValue) const {
2071  Entry const* entryPtr = retrieveUntracked(name);
2072  return entryPtr == 0 ? defaultValue : entryPtr->getVInputTag();
2073  }
2074 
2075  template<>
2076  std::vector<InputTag>
2077  ParameterSet::getUntrackedParameter<std::vector<InputTag> >(char const* name) const {
2078  return getEntryPointerOrThrow_(name)->getVInputTag();
2079  }
2080 
2081  // ----------------------------------------------------------------------
2082  // ESInputTag, VESInputTag
2083 
2084  template<>
2085  ESInputTag
2086  ParameterSet::getUntrackedParameter<ESInputTag>(char const* name, ESInputTag const& defaultValue) const {
2087  Entry const* entryPtr = retrieveUntracked(name);
2088  return entryPtr == 0 ? defaultValue : entryPtr->getESInputTag();
2089  }
2090 
2091  template<>
2092  ESInputTag
2093  ParameterSet::getUntrackedParameter<ESInputTag>(char const* name) const {
2094  return getEntryPointerOrThrow_(name)->getESInputTag();
2095  }
2096 
2097  template<>
2098  std::vector<ESInputTag>
2099  ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(char const* name,
2100  std::vector<ESInputTag> const& defaultValue) const {
2101  Entry const* entryPtr = retrieveUntracked(name);
2102  return entryPtr == 0 ? defaultValue : entryPtr->getVESInputTag();
2103  }
2104 
2105  template<>
2106  std::vector<ESInputTag>
2107  ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(char const* name) const {
2108  return getEntryPointerOrThrow_(name)->getVESInputTag();
2109  }
2110 
2111  // ----------------------------------------------------------------------
2112  // EventID, VEventID
2113 
2114  template<>
2115  EventID
2116  ParameterSet::getUntrackedParameter<EventID>(char const* name, EventID const& defaultValue) const {
2117  Entry const* entryPtr = retrieveUntracked(name);
2118  return entryPtr == 0 ? defaultValue : entryPtr->getEventID();
2119  }
2120 
2121  template<>
2122  EventID
2123  ParameterSet::getUntrackedParameter<EventID>(char const* name) const {
2124  return getEntryPointerOrThrow_(name)->getEventID();
2125  }
2126 
2127  template<>
2128  std::vector<EventID>
2129  ParameterSet::getUntrackedParameter<std::vector<EventID> >(char const* name,
2130  std::vector<EventID> const& defaultValue) const {
2131  Entry const* entryPtr = retrieveUntracked(name);
2132  return entryPtr == 0 ? defaultValue : entryPtr->getVEventID();
2133  }
2134 
2135  template<>
2136  std::vector<EventID>
2137  ParameterSet::getUntrackedParameter<std::vector<EventID> >(char const* name) const {
2138  return getEntryPointerOrThrow_(name)->getVEventID();
2139  }
2140 
2141  // ----------------------------------------------------------------------
2142  // LuminosityBlockID, VLuminosityBlockID
2143 
2144  template<>
2146  ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name, LuminosityBlockID const& defaultValue) const {
2147  Entry const* entryPtr = retrieveUntracked(name);
2148  return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockID();
2149  }
2150 
2151  template<>
2153  ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name) const {
2154  return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
2155  }
2156 
2157  template<>
2158  std::vector<LuminosityBlockID>
2159  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(char const* name,
2160  std::vector<LuminosityBlockID> const& defaultValue) const {
2161  Entry const* entryPtr = retrieveUntracked(name);
2162  return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockID();
2163  }
2164 
2165  template<>
2166  std::vector<LuminosityBlockID>
2167  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(char const* name) const {
2168  return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
2169  }
2170 
2171  // ----------------------------------------------------------------------
2172  // EventRange, VEventRange
2173 
2174  template<>
2175  EventRange
2176  ParameterSet::getUntrackedParameter<EventRange>(char const* name, EventRange const& defaultValue) const {
2177  Entry const* entryPtr = retrieveUntracked(name);
2178  return entryPtr == 0 ? defaultValue : entryPtr->getEventRange();
2179  }
2180 
2181  template<>
2182  EventRange
2183  ParameterSet::getUntrackedParameter<EventRange>(char const* name) const {
2184  return getEntryPointerOrThrow_(name)->getEventRange();
2185  }
2186 
2187  template<>
2188  std::vector<EventRange>
2189  ParameterSet::getUntrackedParameter<std::vector<EventRange> >(char const* name,
2190  std::vector<EventRange> const& defaultValue) const {
2191  Entry const* entryPtr = retrieveUntracked(name);
2192  return entryPtr == 0 ? defaultValue : entryPtr->getVEventRange();
2193  }
2194 
2195  template<>
2196  std::vector<EventRange>
2197  ParameterSet::getUntrackedParameter<std::vector<EventRange> >(char const* name) const {
2198  return getEntryPointerOrThrow_(name)->getVEventRange();
2199  }
2200 
2201  // ----------------------------------------------------------------------
2202  // LuminosityBlockRange, VLuminosityBlockRange
2203 
2204  template<>
2206  ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name, LuminosityBlockRange const& defaultValue) const {
2207  Entry const* entryPtr = retrieveUntracked(name);
2208  return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockRange();
2209  }
2210 
2211  template<>
2213  ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name) const {
2214  return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
2215  }
2216 
2217  template<>
2218  std::vector<LuminosityBlockRange>
2219  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(char const* name,
2220  std::vector<LuminosityBlockRange> const& defaultValue) const {
2221  Entry const* entryPtr = retrieveUntracked(name);
2222  return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockRange();
2223  }
2224 
2225  template<>
2226  std::vector<LuminosityBlockRange>
2227  ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(char const* name) const {
2228  return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
2229  }
2230 
2231  // ----------------------------------------------------------------------
2232  // PSet, vPSet
2233 
2234  template<>
2235  ParameterSet
2236  ParameterSet::getUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& defaultValue) const {
2237  return getUntrackedParameterSet(name, defaultValue);
2238  }
2239 
2240  template<>
2242  ParameterSet::getUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& defaultValue) const {
2243  return getUntrackedParameterSetVector(name, defaultValue);
2244  }
2245 
2246  template<>
2247  ParameterSet
2248  ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& defaultValue) const {
2249  return getUntrackedParameterSet(name, defaultValue);
2250  }
2251 
2252  template<>
2254  ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& defaultValue) const {
2255  return getUntrackedParameterSetVector(name, defaultValue);
2256  }
2257 
2258  template<>
2259  ParameterSet
2260  ParameterSet::getUntrackedParameter<ParameterSet>(char const* name) const {
2261  return getUntrackedParameterSet(name);
2262  }
2263 
2264  template<>
2266  ParameterSet::getUntrackedParameter<VParameterSet>(char const* name) const {
2267  return getUntrackedParameterSetVector(name);
2268  }
2269 
2270  template<>
2271  ParameterSet
2272  ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name) const {
2273  return getUntrackedParameterSet(name);
2274  }
2275 
2276  template<>
2278  ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name) const {
2279  return getUntrackedParameterSetVector(name);
2280  }
2281 
2282 //----------------------------------------------------------------------------------
2283 // specializations for addParameter and addUntrackedParameter
2284 
2285  template<>
2286  void
2287  ParameterSet::addParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
2288  invalidateRegistration(name);
2289  insertParameterSet(true, name, ParameterSetEntry(value, true));
2290  }
2291 
2292  template<>
2293  void
2294  ParameterSet::addParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
2295  invalidateRegistration(name);
2296  insertVParameterSet(true, name, VParameterSetEntry(value, true));
2297  }
2298 
2299  template<>
2300  void
2301  ParameterSet::addParameter<ParameterSet>(char const* name, ParameterSet const& value) {
2302  invalidateRegistration(name);
2303  insertParameterSet(true, name, ParameterSetEntry(value, true));
2304  }
2305 
2306  template<>
2307  void
2308  ParameterSet::addParameter<VParameterSet>(char const* name, VParameterSet const& value) {
2309  invalidateRegistration(name);
2310  insertVParameterSet(true, name, VParameterSetEntry(value, true));
2311  }
2312 
2313  template<>
2314  void
2315  ParameterSet::addUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
2316  insertParameterSet(true, name, ParameterSetEntry(value, false));
2317  }
2318 
2319  template<>
2320  void
2321  ParameterSet::addUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
2322  insertVParameterSet(true, name, VParameterSetEntry(value, false));
2323  }
2324 
2325  template<>
2326  void
2327  ParameterSet::addUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& value) {
2328  insertParameterSet(true, name, ParameterSetEntry(value, false));
2329  }
2330 
2331  template<>
2332  void
2333  ParameterSet::addUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& value) {
2334  insertVParameterSet(true, name, VParameterSetEntry(value, false));
2335  }
2336 
2337 //----------------------------------------------------------------------------------
2338 // specializations for getParameterNamesForType
2339 
2340  template<>
2341  std::vector<std::string>
2342  ParameterSet::getParameterNamesForType<ParameterSet>(bool trackiness) const {
2343  std::vector<std::string> output;
2344  getParameterSetNames(output, trackiness);
2345  return output;
2346  }
2347 
2348  template<>
2349  std::vector<std::string>
2350  ParameterSet::getParameterNamesForType<VParameterSet>(bool trackiness) const {
2351  std::vector<std::string> output;
2352  getParameterSetVectorNames(output, trackiness);
2353  return output;
2354  }
2355 
2356  ParameterSet const&
2358  return retrieveParameterSet(name).pset();
2359  }
2360 
2361  ParameterSet const&
2363  return retrieveParameterSet(name).pset();
2364  }
2365 
2366  ParameterSet
2368  return getUntrackedParameterSet(name.c_str(), defaultValue);
2369  }
2370 
2371  ParameterSet
2372  ParameterSet::getUntrackedParameterSet(char const* name, ParameterSet const& defaultValue) const {
2373  ParameterSetEntry const* entryPtr = retrieveUntrackedParameterSet(name);
2374  if(entryPtr == 0) {
2375  return defaultValue;
2376  }
2377  return entryPtr->pset();
2378  }
2379 
2380  ParameterSet const&
2382  return getUntrackedParameterSet(name.c_str());
2383  }
2384 
2385  ParameterSet const&
2388  if(result == 0)
2389  throw Exception(errors::Configuration, "MissingParameter:")
2390  << "The required ParameterSet '" << name << "' was not specified.\n";
2391  return result->pset();
2392  }
2393 
2394  VParameterSet const&
2396  return retrieveVParameterSet(name).vpset();
2397  }
2398 
2399  VParameterSet const&
2401  return retrieveVParameterSet(name).vpset();
2402  }
2403 
2406  return getUntrackedParameterSetVector(name.c_str(), defaultValue);
2407  }
2408 
2410  ParameterSet::getUntrackedParameterSetVector(char const* name, VParameterSet const& defaultValue) const {
2411  VParameterSetEntry const* entryPtr = retrieveUntrackedVParameterSet(name);
2412  return entryPtr == 0 ? defaultValue : entryPtr->vpset();
2413  }
2414 
2415  VParameterSet const&
2417  return getUntrackedParameterSetVector(name.c_str());
2418  }
2419 
2420  VParameterSet const&
2423  if(result == 0)
2424  throw Exception(errors::Configuration, "MissingParameter:")
2425  << "The required ParameterSetVector '" << name << "' was not specified.\n";
2426  return result->vpset();
2427  }
2428 
2429 //----------------------------------------------------------------------------------
2432  if(a == ParameterSet::False || b == ParameterSet::False) {
2433  return ParameterSet::False;
2434  } else if(a == ParameterSet::Unknown || b == ParameterSet::Unknown) {
2435  return ParameterSet::Unknown;
2436  }
2437  return ParameterSet::True;
2438  }
2439 
2440 
2441 } // namespace edm
std::vector< unsigned > getVUInt32() const
Definition: Entry.cc:708
const double Pi
void setID(ParameterSetID const &id)
Entry const & retrieve(char const *) const
bool empty() const
Definition: ParameterSet.h:216
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
ParameterSetID id_
Definition: ParameterSet.h:298
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
std::auto_ptr< std::vector< ParameterSet > > popVParameterSet(std::string const &name)
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
ParameterSet getPSet() const
Definition: Entry.cc:934
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
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 trackedPart() const
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:142
tuple result
Definition: query.py:137
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
std::auto_ptr< ParameterSet > popParameterSet(std::string const &name)
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:63
std::vector< EventRange > getVEventRange() const
Definition: Entry.cc:922
bool first
Definition: L1TdeRCT.cc:79
Hash< ParameterSetType > ParameterSetID
void invalidateRegistration(std::string const &nameOfTracked)
Definition: ParameterSet.cc:33
int k[5][pyjets_maxn]
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:255
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:258
double a
Definition: hdecay.h:121
psettable psetTable_
Definition: ParameterSet.h:292
EventRange getEventRange() const
Definition: Entry.cc:911
VParameterSet getUntrackedParameterSetVector(std::string const &name, VParameterSet const &defaultValue) const
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:37
Entry const * retrieveUnknown(char const *) const
T first(std::pair< T, U > const &p)
table const & tbl() const
Definition: ParameterSet.h:252
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:14
vpsettable vpsetTable_
Definition: ParameterSet.h:293
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