CMSSW/ FWCore/ ParameterSet/ src/ ParameterSet.cc

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

-- DavidCockerill - 24-Aug-2010

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2010-08-24 - DavidCockerill
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback