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