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 <algorithm>
20 #include <iostream>
21 #include <sstream>
22 #include <cassert>
23 
24 // ----------------------------------------------------------------------
25 // class invariant checker
26 // ----------------------------------------------------------------------
27 
28 namespace edm {
29 
30  void
32  // We have added a new parameter. Invalidate the ID.
33  if(isRegistered()) {
34  id_ = ParameterSetID();
35  if(!nameOfTracked.empty()) {
36  // Give a warning (informational for now).
37  LogInfo("ParameterSet") << "Warning: You have added a new tracked parameter\n"
38  << "'" << nameOfTracked << "' to a previously registered parameter set.\n"
39  << "This is a bad idea because the new parameter(s) will not be recorded.\n"
40  << "Use the forthcoming ParameterSetDescription facility instead.\n"
41  << "A warning is given only for the first such parameter in a pset.\n";
42  }
43  }
44  assert(!isRegistered());
45  }
46 
47  // ----------------------------------------------------------------------
48  // constructors
49  // ----------------------------------------------------------------------
50 
52  tbl_(),
53  psetTable_(),
54  vpsetTable_(),
55  id_() {
56  }
57 
58  // ----------------------------------------------------------------------
59  // from coded string
60 
62  tbl_(),
63  psetTable_(),
64  vpsetTable_(),
65  id_() {
66  if(!fromString(code)) {
67  throw Exception(errors::Configuration, "InvalidInput")
68  << "The encoded configuration string "
69  << "passed to a ParameterSet during construction is invalid:\n"
70  << code;
71  }
72  }
73 
74  // ----------------------------------------------------------------------
75  // from coded string and ID.
76 
78  tbl_(),
79  psetTable_(),
80  vpsetTable_(),
81  id_(id) {
82  if(!fromString(code)) {
83  throw Exception(errors::Configuration, "InvalidInput")
84  << "The encoded configuration string "
85  << "passed to a ParameterSet during construction is invalid:\n"
86  << code;
87  }
88  }
89 
91 
92  void
94  // from coded string. Will cause registration
95  cms::Digest dg(rep);
96  edm::ParameterSetID psID(dg.digest().toString());
97  edm::ParameterSet ps(rep, psID);
99  }
100 
103  cms::Digest newDigest;
104  ParameterSet().toDigest(newDigest);
105  return ParameterSetID(newDigest.digest().toString());
106  }
107 
109  : tbl_(other.tbl_),
110  psetTable_(other.psetTable_),
111  vpsetTable_(other.vpsetTable_),
112  id_(other.id_) {
113  }
114 
116  ParameterSet temp(other);
117  swap(temp);
118  return *this;
119  }
120 
122  ParameterSet temp(other);
123  swap(temp);
124  id_ = ParameterSetID();
125  }
126 
128  tbl_.swap(other.tbl_);
129  psetTable_.swap(other.psetTable_);
130  vpsetTable_.swap(other.vpsetTable_);
131  id_.swap(other.id_);
132  }
133 
135  if(!isRegistered()) {
136  calculateID();
138  }
139  return *this;
140  }
141 
142  std::auto_ptr<ParameterSet> ParameterSet::popParameterSet(std::string const& name) {
143  assert(!isRegistered());
144  psettable::iterator it = psetTable_.find(name);
145  assert(it != psetTable_.end());
146  std::auto_ptr<ParameterSet> pset(new ParameterSet);
147  std::swap(*pset, it->second.psetForUpdate());
148  psetTable_.erase(it);
149  return pset;
150  }
151 
153  assert(!isRegistered());
154  table::iterator it = tbl_.find(name);
155  assert(it != tbl_.end());
156  tbl_.erase(it);
157  }
158 
160  assert(!isRegistered());
161  psettable::iterator it = psetTable_.find(name);
162  assert(it != psetTable_.end());
163  ParameterSet& pset = it->second.psetForUpdate();
164  if (pset.isRegistered()) {
165  it->second.setIsTracked(false);
166  } else {
167  psetTable_.erase(it);
168  }
169  }
170 
171  std::auto_ptr<std::vector<ParameterSet> > ParameterSet::popVParameterSet(std::string const& name) {
172  assert(!isRegistered());
173  vpsettable::iterator it = vpsetTable_.find(name);
174  assert(it != vpsetTable_.end());
175  std::auto_ptr<std::vector<ParameterSet> > vpset(new std::vector<ParameterSet>);
176  std::swap(*vpset, it->second.vpsetForUpdate());
177  vpsetTable_.erase(it);
178  return vpset;
179  }
180 
182  // make sure contained tracked psets are updated
183  for(auto& item : psetTable_) {
184  ParameterSet& pset = item.second.psetForUpdate();
185  if(!pset.isRegistered()) {
186  pset.registerIt();
187  }
188  item.second.updateID();
189  }
190 
191  // make sure contained tracked vpsets are updated
192  for(vpsettable::iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
193  i->second.registerPsetsAndUpdateIDs();
194  }
195 // The old, string base code is found below. Uncomment this and the assert to check whether
196 // there are discrepancies between old and new implementation.
197 // std::string stringrep;
198 // toString(stringrep);
199 // cms::Digest md5alg(stringrep);
200 // id_ = ParameterSetID(md5alg.digest().toString());
201  cms::Digest newDigest;
202  toDigest(newDigest);
203  id_ = ParameterSetID(newDigest.digest().toString());
204 // assert(md5alg.digest().toString() == newDigest.digest().toString());
205  assert(isRegistered());
206  }
207 
208  // ----------------------------------------------------------------------
209  // identification
212  // checks if valid
213  if(!isRegistered()) {
215  << "ParameterSet::id() called prematurely\n"
216  << "before ParameterSet::registerIt() has been called.\n";
217  }
218  return id_;
219  }
220 
222  id_ = id;
223  }
224 
225  // ----------------------------------------------------------------------
226  // Entry-handling
227  // ----------------------------------------------------------------------
228 
229  Entry const*
231  return getEntryPointerOrThrow_(std::string(name));
232  }
233 
234  Entry const*
236  Entry const* result = retrieveUntracked(name);
237  if(result == 0)
238  throw Exception(errors::Configuration, "MissingParameter:")
239  << "The required parameter '" << name
240  << "' was not specified.\n";
241  return result;
242  }
243 
244  template<typename T, typename U> T first(std::pair<T, U> const& p) {
245  return p.first;
246  }
247 
248  template<typename T, typename U> U second(std::pair<T, U> const& p) {
249  return p.second;
250  }
251 
252  Entry const&
253  ParameterSet::retrieve(char const* name) const {
254  return retrieve(std::string(name));
255  }
256 
257  Entry const&
259  table::const_iterator it = tbl_.find(name);
260  if(it == tbl_.end()) {
261  throw Exception(errors::Configuration, "MissingParameter:")
262  << "Parameter '" << name
263  << "' not found.";
264  }
265  if(it->second.isTracked() == false) {
266  if(name[0] == '@') {
267  throw Exception(errors::Configuration, "StatusMismatch:")
268  << "Framework Error: Parameter '" << name
269  << "' is incorrectly designated as tracked in the framework.";
270  } else {
271  throw Exception(errors::Configuration, "StatusMismatch:")
272  << "Parameter '" << name
273  << "' is designated as tracked in the code,\n"
274  << "but is designated as untracked in the configuration file.\n"
275  << "Please remove 'untracked' from the configuration file for parameter '"<< name << "'.";
276  }
277  }
278  return it->second;
279  } // retrieve()
280 
281  Entry const*
283  return retrieveUntracked(std::string(name));
284  }
285 
286  Entry const*
288  table::const_iterator it = tbl_.find(name);
289 
290  if(it == tbl_.end()) return 0;
291  if(it->second.isTracked()) {
292  if(name[0] == '@') {
293  throw Exception(errors::Configuration, "StatusMismatch:")
294  << "Framework Error: Parameter '" << name
295  << "' is incorrectly designated as untracked in the framework.";
296  } else {
297  throw Exception(errors::Configuration, "StatusMismatch:")
298  << "Parameter '" << name
299  << "' is designated as untracked in the code,\n"
300  << "but is not designated as untracked in the configuration file.\n"
301  << "Please change the configuration file to 'untracked <type> " << name << "'.";
302  }
303  }
304  return &it->second;
305  } // retrieve()
306 
307  ParameterSetEntry const&
309  psettable::const_iterator it = psetTable_.find(name);
310  if(it == psetTable_.end()) {
311  throw Exception(errors::Configuration, "MissingParameter:")
312  << "ParameterSet '" << name
313  << "' not found.";
314  }
315  if(it->second.isTracked() == false) {
316  if(name[0] == '@') {
317  throw Exception(errors::Configuration, "StatusMismatch:")
318  << "Framework Error: ParameterSet '" << name
319  << "' is incorrectly designated as tracked in the framework.";
320  } else {
321  throw Exception(errors::Configuration, "StatusMismatch:")
322  << "ParameterSet '" << name
323  << "' is designated as tracked in the code,\n"
324  << "but is designated as untracked in the configuration file.\n"
325  << "Please remove 'untracked' from the configuration file for parameter '"<< name << "'.";
326  }
327  }
328  return it->second;
329  } // retrieve()
330 
331  ParameterSetEntry const*
333  psettable::const_iterator it = psetTable_.find(name);
334 
335  if(it == psetTable_.end()) return 0;
336  if(it->second.isTracked()) {
337  if(name[0] == '@') {
338  throw Exception(errors::Configuration, "StatusMismatch:")
339  << "Framework Error: ParameterSet '" << name
340  << "' is incorrectly designated as untracked in the framework.";
341  } else {
342  throw Exception(errors::Configuration, "StatusMismatch:")
343  << "ParameterSet '" << name
344  << "' is designated as untracked in the code,\n"
345  << "but is not designated as untracked in the configuration file.\n"
346  << "Please change the configuration file to 'untracked <type> " << name << "'.";
347  }
348  }
349  return &it->second;
350  } // retrieve()
351 
352  VParameterSetEntry const&
354  vpsettable::const_iterator it = vpsetTable_.find(name);
355  if(it == vpsetTable_.end()) {
356  throw Exception(errors::Configuration, "MissingParameter:")
357  << "VParameterSet '" << name
358  << "' not found.";
359  }
360  if(it->second.isTracked() == false) {
361  throw Exception(errors::Configuration, "StatusMismatch:")
362  << "VParameterSet '" << name
363  << "' is designated as tracked in the code,\n"
364  << "but is designated as untracked in the configuration file.\n"
365  << "Please remove 'untracked' from the configuration file for parameter '"<< name << "'.";
366  }
367  return it->second;
368  } // retrieve()
369 
370  VParameterSetEntry const*
372  vpsettable::const_iterator it = vpsetTable_.find(name);
373 
374  if(it == vpsetTable_.end()) return 0;
375  if(it->second.isTracked()) {
376  throw Exception(errors::Configuration, "StatusMismatch:")
377  << "VParameterSet '" << name
378  << "' is designated as untracked in the code,\n"
379  << "but is not designated as untracked in the configuration file.\n"
380  << "Please change the configuration file to 'untracked <type> " << name << "'.";
381  }
382  return &it->second;
383  } // retrieve()
384 
385  Entry const*
386  ParameterSet::retrieveUnknown(char const* name) const {
387  return retrieveUnknown(std::string(name));
388  }
389 
390  Entry const*
392  table::const_iterator it = tbl_.find(name);
393  if(it == tbl_.end()) {
394  return 0;
395  }
396  return &it->second;
397  }
398 
399  ParameterSetEntry const*
401  psettable::const_iterator it = psetTable_.find(name);
402  if(it == psetTable_.end()) {
403  return 0;
404  }
405  return &it->second;
406  }
407 
408  VParameterSetEntry const*
410  vpsettable::const_iterator it = vpsetTable_.find(name);
411  if(it == vpsetTable_.end()) {
412  return 0;
413  }
414  return &it->second;
415  }
416 
417  // ----------------------------------------------------------------------
418  // ----------------------------------------------------------------------
419 
422  if(existsAs<ParameterSet>(name)) {
423  return retrieveUnknownParameterSet(name)->toString();
424  }
425  else if(existsAs<std::vector<ParameterSet> >(name)) {
426  return retrieveUnknownVParameterSet(name)->toString();
427  }
428  else if(exists(name)) {
429  return retrieveUnknown(name)->toString();
430  }
431  else {
432  throw Exception(errors::Configuration, "getParameterAsString")
433  << "Cannot find parameter " << name << " in " << *this;
434  }
435  }
436 
437  // ----------------------------------------------------------------------
438  // ----------------------------------------------------------------------
439 
440  void
441  ParameterSet::insert(bool okay_to_replace, char const* name, Entry const& value) {
442  insert(okay_to_replace, std::string(name), value);
443  }
444 
445  void
446  ParameterSet::insert(bool okay_to_replace, std::string const& name, Entry const& value) {
447  // We should probably get rid of 'okay_to_replace', which will
448  // simplify the logic in this function.
449  table::iterator it = tbl_.find(name);
450 
451  if(it == tbl_.end()) {
452  if(!tbl_.insert(std::make_pair(name, value)).second)
453  throw Exception(errors::Configuration, "InsertFailure")
454  << "cannot insert " << name
455  << " into a ParameterSet\n";
456  }
457  else if(okay_to_replace) {
458  it->second = value;
459  }
460  } // insert()
461 
462  void ParameterSet::insertParameterSet(bool okay_to_replace, std::string const& name, ParameterSetEntry const& entry) {
463  // We should probably get rid of 'okay_to_replace', which will
464  // simplify the logic in this function.
465  psettable::iterator it = psetTable_.find(name);
466 
467  if(it == psetTable_.end()) {
468  if(!psetTable_.insert(std::make_pair(name, entry)).second)
469  throw Exception(errors::Configuration, "InsertFailure")
470  << "cannot insert " << name
471  << " into a ParameterSet\n";
472  } else if(okay_to_replace) {
473  it->second = entry;
474  }
475  } // insert()
476 
477  void ParameterSet::insertVParameterSet(bool okay_to_replace, std::string const& name, VParameterSetEntry const& entry) {
478  // We should probably get rid of 'okay_to_replace', which will
479  // simplify the logic in this function.
480  vpsettable::iterator it = vpsetTable_.find(name);
481 
482  if(it == vpsetTable_.end()) {
483  if(!vpsetTable_.insert(std::make_pair(name, entry)).second)
484  throw Exception(errors::Configuration, "InsertFailure")
485  << "cannot insert " << name
486  << " into a VParameterSet\n";
487  } else if(okay_to_replace) {
488  it->second = entry;
489  }
490  } // insert()
491 
492  void
494  // This preemptive invalidation may be more agressive than necessary.
496  if(&from == this) {
497  return;
498  }
499 
500  for(table::const_iterator b = from.tbl_.begin(), e = from.tbl_.end(); b != e; ++b) {
501  this->insert(false, b->first, b->second);
502  }
503  for(psettable::const_iterator b = from.psetTable_.begin(), e = from.psetTable_.end(); b != e; ++b) {
504  this->insertParameterSet(false, b->first, b->second);
505  }
506  for(vpsettable::const_iterator b = from.vpsetTable_.begin(), e = from.vpsetTable_.end(); b != e; ++b) {
507  this->insertVParameterSet(false, b->first, b->second);
508  }
509  } // augment()
510 
513  if(from.existsAs<ParameterSet>(name)) {
514  this->insertParameterSet(false, name, *(from.retrieveUnknownParameterSet(name)));
515  }
516  else if(from.existsAs<std::vector<ParameterSet> >(name)) {
517  this->insertVParameterSet(false, name, *(from.retrieveUnknownVParameterSet(name)));
518  }
519  else if(from.exists(name)) {
520  this->insert(false, name, *(from.retrieveUnknown(name)));
521  }
522  else {
523  throw Exception(errors::Configuration, "copyFrom")
524  << "Cannot find parameter " << name << " in " << from;
525  }
526  }
527 
528  ParameterSet*
530  assert(!isRegistered());
531  isTracked = false;
532  psettable::iterator it = psetTable_.find(name);
533  if(it == psetTable_.end()) return 0;
534  isTracked = it->second.isTracked();
535  return &it->second.psetForUpdate();
536  }
537 
540  assert(!isRegistered());
541  vpsettable::iterator it = vpsetTable_.find(name);
542  if(it == vpsetTable_.end()) return 0;
543  return &it->second;
544  }
545 
546  // ----------------------------------------------------------------------
547  // coding
548  // ----------------------------------------------------------------------
549 
550  void
552  toStringImp(rep, false);
553  }
554 
555  void
557  toStringImp(rep, true);
558  }
559 
560  void
562  // make sure the PSets get filled
563  if(empty()) {
564  rep += "<>";
565  return;
566  }
567  size_t size = 1;
568  for(table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
569  if(useAll || b->second.isTracked()) {
570  size += 2;
571  size += b->first.size();
572  size += b->second.sizeOfString();
573  }
574  }
575  for(psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
576  if(useAll || b->second.isTracked()) {
577  size += 2;
578  size += b->first.size();
579  size += b->first.size();
580  size += b->first.size();
581  size += sizeof(ParameterSetID);
582  }
583  }
584  for(vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
585  if(useAll || b->second.isTracked()) {
586  size += 2;
587  size += b->first.size();
588  size += sizeof(ParameterSetID) * b->second.vpset().size();
589  }
590  }
591 
592  rep.reserve(rep.size()+size);
593  rep += '<';
595  std::string const between(";");
596  for(table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
597  if(useAll || b->second.isTracked()) {
598  rep += start;
599  rep += b->first;
600  rep += '=';
601  b->second.toString(rep);
602  start = between;
603  }
604  }
605  for(psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
606  if(useAll || b->second.isTracked()) {
607  rep += start;
608  rep += b->first;
609  rep += '=';
610  b->second.toString(rep);
611  start = between;
612  }
613  }
614  for(vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
615  if(useAll || b->second.isTracked()) {
616  rep += start;
617  rep += b->first;
618  rep += '=';
619  b->second.toString(rep);
620  start = between;
621  }
622  }
623 
624  rep += '>';
625  } // to_string()
626 
627  void
629  digest.append("<", 1);
630  bool started = false;
631  for(table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
632  if(b->second.isTracked()) {
633  if (started)
634  digest.append(";", 1);
635  digest.append(b->first);
636  digest.append("=", 1);
637  b->second.toDigest(digest);
638  started = true;
639  }
640  }
641  for(psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
642  if(b->second.isTracked()) {
643  if (started)
644  digest.append(";", 1);
645  digest.append(b->first);
646  digest.append("=", 1);
647  b->second.toDigest(digest);
648  started = true;
649  }
650  }
651  for(vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
652  if(b->second.isTracked()) {
653  if (started)
654  digest.append(";", 1);
655  digest.append(b->first);
656  digest.append("=", 1);
657  b->second.toDigest(digest);
658  }
659  }
660 
661  digest.append(">",1);
662  }
663 
667  toString(result);
668  return result;
669  }
670 
671  // ----------------------------------------------------------------------
672 
673  bool
675  std::vector<std::string> temp;
676  if(!split(std::back_inserter(temp), from, '<', ';', '>'))
677  return false;
678 
679  tbl_.clear(); // precaution
680  for(std::vector<std::string>::const_iterator b = temp.begin(), e = temp.end(); b != e; ++b) {
681  // locate required name/value separator
682  std::string::const_iterator q = find_in_all(*b, '=');
683  if(q == b->end())
684  return false;
685 
686  // form name unique to this ParameterSet
687  std::string name = std::string(b->begin(), q);
688  if(tbl_.find(name) != tbl_.end())
689  return false;
690 
691  std::string rep(q+1, b->end());
692  // entries are generically of the form tracked-type-rep
693  if(rep[0] == '-') {
694  }
695  if(rep[1] == 'Q') {
696  ParameterSetEntry psetEntry(rep);
697  if(!psetTable_.insert(std::make_pair(name, psetEntry)).second) {
698  return false;
699  }
700  } else if(rep[1] == 'q') {
701  VParameterSetEntry vpsetEntry(rep);
702  if(!vpsetTable_.insert(std::make_pair(name, vpsetEntry)).second) {
703  return false;
704  }
705  } else if(rep[1] == 'P') {
706  Entry value(name, rep);
707  ParameterSetEntry psetEntry(value.getPSet(), value.isTracked());
708  if(!psetTable_.insert(std::make_pair(name, psetEntry)).second) {
709  return false;
710  }
711  } else if(rep[1] == 'p') {
712  Entry value(name, rep);
713  VParameterSetEntry vpsetEntry(value.getVPSet(), value.isTracked());
714  if(!vpsetTable_.insert(std::make_pair(name, vpsetEntry)).second) {
715  return false;
716  }
717  } else {
718  // form value and insert name/value pair
719  Entry value(name, rep);
720  if(!tbl_.insert(std::make_pair(name, value)).second) {
721  return false;
722  }
723  }
724  }
725 
726  return true;
727  } // from_string()
728 
730  ParameterSet::getAllFileInPaths(std::vector<FileInPath>& output) const {
732  table::const_iterator it = tbl_.begin();
733  table::const_iterator end = tbl_.end();
734  while (it != end) {
735  Entry const& e = it->second;
736  if(e.typeCode() == 'F') {
737  ++count;
738  output.push_back(e.getFileInPath());
739  }
740  ++it;
741  }
742  return count;
743  }
744 
745  std::vector<std::string>
747  using std::placeholders::_1;
748  std::vector<std::string> returnValue;
749  std::transform(tbl_.begin(), tbl_.end(), back_inserter(returnValue),
751  std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(returnValue),
753  std::transform(vpsetTable_.begin(), vpsetTable_.end(), back_inserter(returnValue),
755  return returnValue;
756  }
757 
758  bool ParameterSet::exists(std::string const& parameterName) const {
759  return(tbl_.find(parameterName) != tbl_.end() ||
760  psetTable_.find(parameterName) != psetTable_.end() ||
761  vpsetTable_.find(parameterName) != vpsetTable_.end());
762  }
763 
767  for(table::const_iterator tblItr = tbl_.begin(); tblItr != tbl_.end(); ++tblItr) {
768  if(tblItr->second.isTracked()) {
769  result.tbl_.insert(*tblItr);
770  }
771  }
772  for(psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
773  if(psetItr->second.isTracked()) {
774  result.addParameter<ParameterSet>(psetItr->first, psetItr->second.pset().trackedPart());
775  }
776  }
777  for(vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
778  if(vpsetItr->second.isTracked()) {
779  VParameterSet vresult;
780  std::vector<ParameterSet> const& this_vpset = vpsetItr->second.vpset();
781 
782  typedef std::vector<ParameterSet>::const_iterator Iter;
783  for (Iter i = this_vpset.begin(), e = this_vpset.end(); i != e; ++i) {
784  vresult.push_back(i->trackedPart());
785  }
786  result.addParameter<VParameterSet>(vpsetItr->first, vresult);
787  }
788  }
789  return result;
790  }
791 
792 /*
793  // Comment out unneeded function
794  size_t
795  ParameterSet::getAllParameterSetNames(std::vector<std::string>& output) const {
796  using std::placeholders::_1;
797  std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(output),
798  std::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:75
Hash< ParameterSetType > ParameterSetID
void invalidateRegistration(std::string const &nameOfTracked)
Definition: ParameterSet.cc:31
std::string toString() const
static void registerFromString(std::string const &rep)
Definition: ParameterSet.cc:93
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:39
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:16
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