Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:58

0001 // ----------------------------------------------------------------------
0002 //
0003 // definition of ParameterSet's function members
0004 // ----------------------------------------------------------------------
0005 
0006 // ----------------------------------------------------------------------
0007 // prerequisite source files and headers
0008 // ----------------------------------------------------------------------
0009 
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "FWCore/ParameterSet/interface/Registry.h"
0014 #include "FWCore/ParameterSet/src/split.h"
0015 #include "FWCore/Utilities/interface/Algorithms.h"
0016 #include "FWCore/Utilities/interface/Digest.h"
0017 #include "FWCore/Utilities/interface/EDMException.h"
0018 
0019 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0020 
0021 #include <algorithm>
0022 #include <iostream>
0023 #include <sstream>
0024 #include <cassert>
0025 
0026 // ----------------------------------------------------------------------
0027 // class invariant checker
0028 // ----------------------------------------------------------------------
0029 
0030 namespace edm {
0031 
0032   namespace pset::exceptions {
0033     void throwWrongNumberOfElements(std::string const& iName, size_t iExpected, size_t iGot) {
0034       throw Exception(errors::Configuration) << "The parameter '" << iName << "' should have " << iExpected
0035                                              << " elements, but has " << iGot << " elements in the configuration.\n";
0036     }
0037   }  // namespace pset::exceptions
0038 
0039   void ParameterSet::invalidateRegistration(std::string const& nameOfTracked) {
0040     // We have added a new parameter.  Invalidate the ID.
0041     if (isRegistered()) {
0042       id_ = ParameterSetID();
0043       if (!nameOfTracked.empty()) {
0044         // Give a warning (informational for now).
0045         LogInfo("ParameterSet") << "Warning: You have added a new tracked parameter\n"
0046                                 << "'" << nameOfTracked << "' to a previously registered parameter set.\n"
0047                                 << "This is a bad idea because the new parameter(s) will not be recorded.\n"
0048                                 << "Use the forthcoming ParameterSetDescription facility instead.\n"
0049                                 << "A warning is given only for the first such parameter in a pset.\n";
0050       }
0051     }
0052     assert(!isRegistered());
0053   }
0054 
0055   // ----------------------------------------------------------------------
0056   // constructors
0057   // ----------------------------------------------------------------------
0058 
0059   ParameterSet::ParameterSet() : tbl_(), psetTable_(), vpsetTable_(), id_() {}
0060 
0061   // ----------------------------------------------------------------------
0062   // from coded string
0063 
0064   ParameterSet::ParameterSet(std::string const& code) : tbl_(), psetTable_(), vpsetTable_(), id_() {
0065     if (!fromString(code)) {
0066       throw Exception(errors::Configuration, "InvalidInput")
0067           << "The encoded configuration string "
0068           << "passed to a ParameterSet during construction is invalid:\n"
0069           << code;
0070     }
0071   }
0072 
0073   // ----------------------------------------------------------------------
0074   // from coded string and ID.
0075 
0076   ParameterSet::ParameterSet(std::string const& code, ParameterSetID const& id)
0077       : tbl_(), psetTable_(), vpsetTable_(), id_(id) {
0078     if (!fromString(code)) {
0079       throw Exception(errors::Configuration, "InvalidInput")
0080           << "The encoded configuration string "
0081           << "passed to a ParameterSet during construction is invalid:\n"
0082           << code;
0083     }
0084   }
0085 
0086   void ParameterSet::registerFromString(std::string const& rep) {
0087     // from coded string.  Will cause registration
0088     cms::Digest dg(rep);
0089     edm::ParameterSetID psID(dg.digest().toString());
0090     edm::ParameterSet ps(rep, psID);
0091     pset::Registry::instance()->insertMapped(ps);
0092   }
0093 
0094   ParameterSetID ParameterSet::emptyParameterSetID() {  // const
0095     cms::Digest newDigest;
0096     ParameterSet().toDigest(newDigest);
0097     return ParameterSetID(newDigest.digest().toString());
0098   }
0099 
0100   void ParameterSet::copyForModify(ParameterSet const& other) {
0101     ParameterSet temp(other);
0102     swap(temp);
0103     id_ = ParameterSetID();
0104   }
0105 
0106   void ParameterSet::swap(ParameterSet& other) {
0107     tbl_.swap(other.tbl_);
0108     psetTable_.swap(other.psetTable_);
0109     vpsetTable_.swap(other.vpsetTable_);
0110     id_.swap(other.id_);
0111   }
0112 
0113   ParameterSet const& ParameterSet::registerIt() {
0114     if (!isRegistered()) {
0115       calculateID();
0116       pset::Registry::instance()->insertMapped(*this);
0117     }
0118     return *this;
0119   }
0120 
0121   std::unique_ptr<ParameterSet> ParameterSet::popParameterSet(std::string const& name) {
0122     assert(!isRegistered());
0123     psettable::iterator it = psetTable_.find(name);
0124     assert(it != psetTable_.end());
0125     auto pset = std::make_unique<ParameterSet>();
0126     std::swap(*pset, it->second.psetForUpdate());
0127     psetTable_.erase(it);
0128     return pset;
0129   }
0130 
0131   void ParameterSet::eraseSimpleParameter(std::string const& name) {
0132     assert(!isRegistered());
0133     table::iterator it = tbl_.find(name);
0134     assert(it != tbl_.end());
0135     tbl_.erase(it);
0136   }
0137 
0138   void ParameterSet::eraseOrSetUntrackedParameterSet(std::string const& name) {
0139     assert(!isRegistered());
0140     psettable::iterator it = psetTable_.find(name);
0141     assert(it != psetTable_.end());
0142     ParameterSet& pset = it->second.psetForUpdate();
0143     if (pset.isRegistered()) {
0144       it->second.setIsTracked(false);
0145     } else {
0146       psetTable_.erase(it);
0147     }
0148   }
0149 
0150   std::vector<ParameterSet> ParameterSet::popVParameterSet(std::string const& name) {
0151     assert(!isRegistered());
0152     vpsettable::iterator it = vpsetTable_.find(name);
0153     assert(it != vpsetTable_.end());
0154     std::vector<ParameterSet> vpset;
0155     std::swap(vpset, it->second.vpsetForUpdate());
0156     vpsetTable_.erase(it);
0157     return vpset;
0158   }
0159 
0160   void ParameterSet::calculateID() {
0161     // make sure contained tracked psets are updated
0162     for (auto& item : psetTable_) {
0163       ParameterSet& pset = item.second.psetForUpdate();
0164       if (!pset.isRegistered()) {
0165         pset.registerIt();
0166       }
0167       item.second.updateID();
0168     }
0169 
0170     // make sure contained tracked vpsets are updated
0171     for (vpsettable::iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
0172       i->second.registerPsetsAndUpdateIDs();
0173     }
0174     //  The old, string base code is found below. Uncomment this and the assert to check whether
0175     //  there are discrepancies between old and new implementation.
0176     //    std::string stringrep;
0177     //    toString(stringrep);
0178     //    cms::Digest md5alg(stringrep);
0179     //    id_ = ParameterSetID(md5alg.digest().toString());
0180     cms::Digest newDigest;
0181     toDigest(newDigest);
0182     id_ = ParameterSetID(newDigest.digest().toString());
0183     //    assert(md5alg.digest().toString() == newDigest.digest().toString());
0184     assert(isRegistered());
0185   }
0186 
0187   // ----------------------------------------------------------------------
0188   // identification
0189   ParameterSetID ParameterSet::id() const {
0190     // checks if valid
0191     if (!isRegistered()) {
0192       throw Exception(errors::LogicError) << "ParameterSet::id() called prematurely\n"
0193                                           << "before ParameterSet::registerIt() has been called.\n";
0194     }
0195     return id_;
0196   }
0197 
0198   void ParameterSet::setID(ParameterSetID const& id) { id_ = id; }
0199 
0200   // ----------------------------------------------------------------------
0201   // Entry-handling
0202   // ----------------------------------------------------------------------
0203 
0204   Entry const* ParameterSet::getEntryPointerOrThrow_(char const* name) const {
0205     return getEntryPointerOrThrow_(std::string(name));
0206   }
0207 
0208   Entry const* ParameterSet::getEntryPointerOrThrow_(std::string const& name) const {
0209     Entry const* result = retrieveUntracked(name);
0210     if (result == nullptr)
0211       throw Exception(errors::Configuration, "MissingParameter:")
0212           << "The required parameter '" << name << "' was not specified.\n";
0213     return result;
0214   }
0215 
0216   template <typename T, typename U>
0217   T first(std::pair<T, U> const& p) {
0218     return p.first;
0219   }
0220 
0221   template <typename T, typename U>
0222   U second(std::pair<T, U> const& p) {
0223     return p.second;
0224   }
0225 
0226   Entry const& ParameterSet::retrieve(char const* name) const { return retrieve(std::string(name)); }
0227 
0228   Entry const& ParameterSet::retrieve(std::string const& name) const {
0229     table::const_iterator it = tbl_.find(name);
0230     if (it == tbl_.end()) {
0231       throw Exception(errors::Configuration, "MissingParameter:") << "Parameter '" << name << "' not found.";
0232     }
0233     if (it->second.isTracked() == false) {
0234       if (name[0] == '@') {
0235         throw Exception(errors::Configuration, "StatusMismatch:")
0236             << "Framework Error:  Parameter '" << name << "' is incorrectly designated as tracked in the framework.";
0237       } else {
0238         throw Exception(errors::Configuration, "StatusMismatch:")
0239             << "Parameter '" << name << "' is designated as tracked in the code,\n"
0240             << "but is designated as untracked in the configuration file.\n"
0241             << "Please remove 'untracked' from the configuration file for parameter '" << name << "'.";
0242       }
0243     }
0244     return it->second;
0245   }  // retrieve()
0246 
0247   Entry const* ParameterSet::retrieveUntracked(char const* name) const { return retrieveUntracked(std::string(name)); }
0248 
0249   Entry const* ParameterSet::retrieveUntracked(std::string const& name) const {
0250     table::const_iterator it = tbl_.find(name);
0251 
0252     if (it == tbl_.end())
0253       return nullptr;
0254     if (it->second.isTracked()) {
0255       if (name[0] == '@') {
0256         throw Exception(errors::Configuration, "StatusMismatch:")
0257             << "Framework Error:  Parameter '" << name << "' is incorrectly designated as untracked in the framework.";
0258       } else {
0259         throw Exception(errors::Configuration, "StatusMismatch:")
0260             << "Parameter '" << name << "' is designated as untracked in the code,\n"
0261             << "but is not designated as untracked in the configuration file.\n"
0262             << "Please change the configuration file to 'untracked <type> " << name << "'.";
0263       }
0264     }
0265     return &it->second;
0266   }  // retrieve()
0267 
0268   ParameterSetEntry const& ParameterSet::retrieveParameterSet(std::string const& name) const {
0269     psettable::const_iterator it = psetTable_.find(name);
0270     if (it == psetTable_.end()) {
0271       throw Exception(errors::Configuration, "MissingParameter:") << "ParameterSet '" << name << "' not found.";
0272     }
0273     if (it->second.isTracked() == false) {
0274       if (name[0] == '@') {
0275         throw Exception(errors::Configuration, "StatusMismatch:")
0276             << "Framework Error:  ParameterSet '" << name << "' is incorrectly designated as tracked in the framework.";
0277       } else {
0278         throw Exception(errors::Configuration, "StatusMismatch:")
0279             << "ParameterSet '" << name << "' is designated as tracked in the code,\n"
0280             << "but is designated as untracked in the configuration file.\n"
0281             << "Please remove 'untracked' from the configuration file for parameter '" << name << "'.";
0282       }
0283     }
0284     return it->second;
0285   }  // retrieve()
0286 
0287   ParameterSetEntry const* ParameterSet::retrieveUntrackedParameterSet(std::string const& name) const {
0288     psettable::const_iterator it = psetTable_.find(name);
0289 
0290     if (it == psetTable_.end())
0291       return nullptr;
0292     if (it->second.isTracked()) {
0293       if (name[0] == '@') {
0294         throw Exception(errors::Configuration, "StatusMismatch:")
0295             << "Framework Error:  ParameterSet '" << name
0296             << "' is incorrectly designated as untracked in the framework.";
0297       } else {
0298         throw Exception(errors::Configuration, "StatusMismatch:")
0299             << "ParameterSet '" << name << "' is designated as untracked in the code,\n"
0300             << "but is not designated as untracked in the configuration file.\n"
0301             << "Please change the configuration file to 'untracked <type> " << name << "'.";
0302       }
0303     }
0304     return &it->second;
0305   }  // retrieve()
0306 
0307   VParameterSetEntry const& ParameterSet::retrieveVParameterSet(std::string const& name) const {
0308     vpsettable::const_iterator it = vpsetTable_.find(name);
0309     if (it == vpsetTable_.end()) {
0310       throw Exception(errors::Configuration, "MissingParameter:") << "VParameterSet '" << name << "' not found.";
0311     }
0312     if (it->second.isTracked() == false) {
0313       throw Exception(errors::Configuration, "StatusMismatch:")
0314           << "VParameterSet '" << name << "' is designated as tracked in the code,\n"
0315           << "but is designated as untracked in the configuration file.\n"
0316           << "Please remove 'untracked' from the configuration file for parameter '" << name << "'.";
0317     }
0318     return it->second;
0319   }  // retrieve()
0320 
0321   VParameterSetEntry const* ParameterSet::retrieveUntrackedVParameterSet(std::string const& name) const {
0322     vpsettable::const_iterator it = vpsetTable_.find(name);
0323 
0324     if (it == vpsetTable_.end())
0325       return nullptr;
0326     if (it->second.isTracked()) {
0327       throw Exception(errors::Configuration, "StatusMismatch:")
0328           << "VParameterSet '" << name << "' is designated as untracked in the code,\n"
0329           << "but is not designated as untracked in the configuration file.\n"
0330           << "Please change the configuration file to 'untracked <type> " << name << "'.";
0331     }
0332     return &it->second;
0333   }  // retrieve()
0334 
0335   Entry const* ParameterSet::retrieveUnknown(char const* name) const { return retrieveUnknown(std::string(name)); }
0336 
0337   Entry const* ParameterSet::retrieveUnknown(std::string const& name) const {
0338     table::const_iterator it = tbl_.find(name);
0339     if (it == tbl_.end()) {
0340       return nullptr;
0341     }
0342     return &it->second;
0343   }
0344 
0345   ParameterSetEntry const* ParameterSet::retrieveUnknownParameterSet(std::string const& name) const {
0346     psettable::const_iterator it = psetTable_.find(name);
0347     if (it == psetTable_.end()) {
0348       return nullptr;
0349     }
0350     return &it->second;
0351   }
0352 
0353   VParameterSetEntry const* ParameterSet::retrieveUnknownVParameterSet(std::string const& name) const {
0354     vpsettable::const_iterator it = vpsetTable_.find(name);
0355     if (it == vpsetTable_.end()) {
0356       return nullptr;
0357     }
0358     return &it->second;
0359   }
0360 
0361   // ----------------------------------------------------------------------
0362   // ----------------------------------------------------------------------
0363 
0364   std::string ParameterSet::getParameterAsString(std::string const& name) const {
0365     if (existsAs<ParameterSet>(name)) {
0366       return retrieveUnknownParameterSet(name)->toString();
0367     } else if (existsAs<std::vector<ParameterSet> >(name)) {
0368       return retrieveUnknownVParameterSet(name)->toString();
0369     } else if (exists(name)) {
0370       return retrieveUnknown(name)->toString();
0371     } else {
0372       throw Exception(errors::Configuration, "getParameterAsString")
0373           << "Cannot find parameter " << name << " in " << *this;
0374     }
0375   }
0376 
0377   // ----------------------------------------------------------------------
0378   // ----------------------------------------------------------------------
0379 
0380   void ParameterSet::insert(bool okay_to_replace, char const* name, Entry const& value) {
0381     insert(okay_to_replace, std::string(name), value);
0382   }
0383 
0384   void ParameterSet::insert(bool okay_to_replace, std::string const& name, Entry const& value) {
0385     // We should probably get rid of 'okay_to_replace', which will
0386     // simplify the logic in this function.
0387     table::iterator it = tbl_.find(name);
0388 
0389     if (it == tbl_.end()) {
0390       if (!tbl_.insert(std::make_pair(name, value)).second)
0391         throw Exception(errors::Configuration, "InsertFailure") << "cannot insert " << name << " into a ParameterSet\n";
0392     } else if (okay_to_replace) {
0393       it->second = value;
0394     }
0395   }  // insert()
0396 
0397   void ParameterSet::insertParameterSet(bool okay_to_replace, std::string const& name, ParameterSetEntry const& entry) {
0398     // We should probably get rid of 'okay_to_replace', which will
0399     // simplify the logic in this function.
0400     psettable::iterator it = psetTable_.find(name);
0401 
0402     if (it == psetTable_.end()) {
0403       if (!psetTable_.insert(std::make_pair(name, entry)).second)
0404         throw Exception(errors::Configuration, "InsertFailure") << "cannot insert " << name << " into a ParameterSet\n";
0405     } else if (okay_to_replace) {
0406       it->second = entry;
0407     }
0408   }  // insert()
0409 
0410   void ParameterSet::insertVParameterSet(bool okay_to_replace,
0411                                          std::string const& name,
0412                                          VParameterSetEntry const& entry) {
0413     // We should probably get rid of 'okay_to_replace', which will
0414     // simplify the logic in this function.
0415     vpsettable::iterator it = vpsetTable_.find(name);
0416 
0417     if (it == vpsetTable_.end()) {
0418       if (!vpsetTable_.insert(std::make_pair(name, entry)).second)
0419         throw Exception(errors::Configuration, "InsertFailure")
0420             << "cannot insert " << name << " into a VParameterSet\n";
0421     } else if (okay_to_replace) {
0422       it->second = entry;
0423     }
0424   }  // insert()
0425 
0426   void ParameterSet::augment(ParameterSet const& from) {
0427     // This preemptive invalidation may be more agressive than necessary.
0428     invalidateRegistration(std::string());
0429     if (&from == this) {
0430       return;
0431     }
0432 
0433     for (table::const_iterator b = from.tbl_.begin(), e = from.tbl_.end(); b != e; ++b) {
0434       this->insert(false, b->first, b->second);
0435     }
0436     for (psettable::const_iterator b = from.psetTable_.begin(), e = from.psetTable_.end(); b != e; ++b) {
0437       this->insertParameterSet(false, b->first, b->second);
0438     }
0439     for (vpsettable::const_iterator b = from.vpsetTable_.begin(), e = from.vpsetTable_.end(); b != e; ++b) {
0440       this->insertVParameterSet(false, b->first, b->second);
0441     }
0442   }  // augment()
0443 
0444   void ParameterSet::copyFrom(ParameterSet const& from, std::string const& name) {
0445     invalidateRegistration(std::string());
0446     if (from.existsAs<ParameterSet>(name)) {
0447       this->insertParameterSet(false, name, *(from.retrieveUnknownParameterSet(name)));
0448     } else if (from.existsAs<std::vector<ParameterSet> >(name)) {
0449       this->insertVParameterSet(false, name, *(from.retrieveUnknownVParameterSet(name)));
0450     } else if (from.exists(name)) {
0451       this->insert(false, name, *(from.retrieveUnknown(name)));
0452     } else {
0453       throw Exception(errors::Configuration, "copyFrom") << "Cannot find parameter " << name << " in " << from;
0454     }
0455   }
0456 
0457   ParameterSet* ParameterSet::getPSetForUpdate(std::string const& name, bool& isTracked) {
0458     assert(!isRegistered());
0459     isTracked = false;
0460     psettable::iterator it = psetTable_.find(name);
0461     if (it == psetTable_.end())
0462       return nullptr;
0463     isTracked = it->second.isTracked();
0464     return &it->second.psetForUpdate();
0465   }
0466 
0467   VParameterSetEntry* ParameterSet::getPSetVectorForUpdate(std::string const& name) {
0468     assert(!isRegistered());
0469     vpsettable::iterator it = vpsetTable_.find(name);
0470     if (it == vpsetTable_.end())
0471       return nullptr;
0472     return &it->second;
0473   }
0474 
0475   // ----------------------------------------------------------------------
0476   // coding
0477   // ----------------------------------------------------------------------
0478 
0479   void ParameterSet::toString(std::string& rep) const { toStringImp(rep, false); }
0480 
0481   void ParameterSet::allToString(std::string& rep) const { toStringImp(rep, true); }
0482 
0483   void ParameterSet::toStringImp(std::string& rep, bool useAll) const {
0484     // make sure the PSets get filled
0485     if (empty()) {
0486       rep += "<>";
0487       return;
0488     }
0489     size_t size = 1;
0490     for (table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
0491       if (useAll || b->second.isTracked()) {
0492         size += 2;
0493         size += b->first.size();
0494         size += b->second.sizeOfString();
0495       }
0496     }
0497     for (psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
0498       if (useAll || b->second.isTracked()) {
0499         size += 2;
0500         size += b->first.size();
0501         size += b->first.size();
0502         size += b->first.size();
0503         size += sizeof(ParameterSetID);
0504       }
0505     }
0506     for (vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
0507       if (useAll || b->second.isTracked()) {
0508         size += 2;
0509         size += b->first.size();
0510         size += sizeof(ParameterSetID) * b->second.vpset().size();
0511       }
0512     }
0513 
0514     rep.reserve(rep.size() + size);
0515     rep += '<';
0516     std::string start;
0517     std::string const between(";");
0518     for (table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
0519       if (useAll || b->second.isTracked()) {
0520         rep += start;
0521         rep += b->first;
0522         rep += '=';
0523         b->second.toString(rep);
0524         start = between;
0525       }
0526     }
0527     for (psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
0528       if (useAll || b->second.isTracked()) {
0529         rep += start;
0530         rep += b->first;
0531         rep += '=';
0532         b->second.toString(rep);
0533         start = between;
0534       }
0535     }
0536     for (vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
0537       if (useAll || b->second.isTracked()) {
0538         rep += start;
0539         rep += b->first;
0540         rep += '=';
0541         b->second.toString(rep);
0542         start = between;
0543       }
0544     }
0545 
0546     rep += '>';
0547   }  // to_string()
0548 
0549   void ParameterSet::toDigest(cms::Digest& digest) const {
0550     digest.append("<", 1);
0551     bool started = false;
0552     for (table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
0553       if (b->second.isTracked()) {
0554         if (started)
0555           digest.append(";", 1);
0556         digest.append(b->first);
0557         digest.append("=", 1);
0558         b->second.toDigest(digest);
0559         started = true;
0560       }
0561     }
0562     for (psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
0563       if (b->second.isTracked()) {
0564         if (started)
0565           digest.append(";", 1);
0566         digest.append(b->first);
0567         digest.append("=", 1);
0568         b->second.toDigest(digest);
0569         started = true;
0570       }
0571     }
0572     for (vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
0573       if (b->second.isTracked()) {
0574         if (started)
0575           digest.append(";", 1);
0576         digest.append(b->first);
0577         digest.append("=", 1);
0578         b->second.toDigest(digest);
0579       }
0580     }
0581 
0582     digest.append(">", 1);
0583   }
0584 
0585   std::string ParameterSet::toString() const {
0586     std::string result;
0587     toString(result);
0588     return result;
0589   }
0590 
0591   // ----------------------------------------------------------------------
0592 
0593   bool ParameterSet::fromString(std::string const& from) {
0594     std::vector<std::string> temp;
0595     if (!split(std::back_inserter(temp), from, '<', ';', '>'))
0596       return false;
0597 
0598     tbl_.clear();  // precaution
0599     for (std::vector<std::string>::const_iterator b = temp.begin(), e = temp.end(); b != e; ++b) {
0600       // locate required name/value separator
0601       std::string::const_iterator q = find_in_all(*b, '=');
0602       if (q == b->end())
0603         return false;
0604 
0605       // form name unique to this ParameterSet
0606       std::string name = std::string(b->begin(), q);
0607       if (tbl_.find(name) != tbl_.end())
0608         return false;
0609 
0610       std::string rep(q + 1, b->end());
0611       // entries are generically of the form tracked-type-rep
0612       if (rep[0] == '-') {
0613       }
0614       if (rep[1] == 'Q') {
0615         ParameterSetEntry psetEntry(rep);
0616         if (!psetTable_.insert(std::make_pair(name, psetEntry)).second) {
0617           return false;
0618         }
0619       } else if (rep[1] == 'q') {
0620         VParameterSetEntry vpsetEntry(rep);
0621         if (!vpsetTable_.insert(std::make_pair(name, vpsetEntry)).second) {
0622           return false;
0623         }
0624       } else if (rep[1] == 'P') {
0625         Entry value(name, rep);
0626         ParameterSetEntry psetEntry(value.getPSet(), value.isTracked());
0627         if (!psetTable_.insert(std::make_pair(name, psetEntry)).second) {
0628           return false;
0629         }
0630       } else if (rep[1] == 'p') {
0631         Entry value(name, rep);
0632         VParameterSetEntry vpsetEntry(value.getVPSet(), value.isTracked());
0633         if (!vpsetTable_.insert(std::make_pair(name, vpsetEntry)).second) {
0634           return false;
0635         }
0636       } else {
0637         // form value and insert name/value pair
0638         Entry value(name, rep);
0639         if (!tbl_.insert(std::make_pair(name, value)).second) {
0640           return false;
0641         }
0642       }
0643     }
0644 
0645     return true;
0646   }  // from_string()
0647 
0648   std::vector<FileInPath>::size_type ParameterSet::getAllFileInPaths(std::vector<FileInPath>& output) const {
0649     std::vector<FileInPath>::size_type count = 0;
0650     table::const_iterator it = tbl_.begin();
0651     table::const_iterator end = tbl_.end();
0652     while (it != end) {
0653       Entry const& e = it->second;
0654       if (e.typeCode() == 'F') {
0655         ++count;
0656         output.push_back(e.getFileInPath());
0657       }
0658       ++it;
0659     }
0660     return count;
0661   }
0662 
0663   std::vector<std::string> ParameterSet::getParameterNames() const {
0664     using std::placeholders::_1;
0665     std::vector<std::string> returnValue;
0666     std::transform(tbl_.begin(),
0667                    tbl_.end(),
0668                    back_inserter(returnValue),
0669                    std::bind(&std::pair<std::string const, Entry>::first, _1));
0670     std::transform(psetTable_.begin(),
0671                    psetTable_.end(),
0672                    back_inserter(returnValue),
0673                    std::bind(&std::pair<std::string const, ParameterSetEntry>::first, _1));
0674     std::transform(vpsetTable_.begin(),
0675                    vpsetTable_.end(),
0676                    back_inserter(returnValue),
0677                    std::bind(&std::pair<std::string const, VParameterSetEntry>::first, _1));
0678     return returnValue;
0679   }
0680 
0681   bool ParameterSet::exists(std::string const& parameterName) const {
0682     return (tbl_.find(parameterName) != tbl_.end() || psetTable_.find(parameterName) != psetTable_.end() ||
0683             vpsetTable_.find(parameterName) != vpsetTable_.end());
0684   }
0685 
0686   ParameterSet ParameterSet::trackedPart() const {
0687     ParameterSet result;
0688     for (table::const_iterator tblItr = tbl_.begin(); tblItr != tbl_.end(); ++tblItr) {
0689       if (tblItr->second.isTracked()) {
0690         result.tbl_.insert(*tblItr);
0691       }
0692     }
0693     for (psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
0694       if (psetItr->second.isTracked()) {
0695         result.addParameter<ParameterSet>(psetItr->first, psetItr->second.pset().trackedPart());
0696       }
0697     }
0698     for (vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
0699       if (vpsetItr->second.isTracked()) {
0700         VParameterSet vresult;
0701         std::vector<ParameterSet> const& this_vpset = vpsetItr->second.vpset();
0702 
0703         typedef std::vector<ParameterSet>::const_iterator Iter;
0704         for (Iter i = this_vpset.begin(), e = this_vpset.end(); i != e; ++i) {
0705           vresult.push_back(i->trackedPart());
0706         }
0707         result.addParameter<VParameterSet>(vpsetItr->first, vresult);
0708       }
0709     }
0710     return result;
0711   }
0712 
0713   /*
0714   // Comment out unneeded function
0715   size_t
0716   ParameterSet::getAllParameterSetNames(std::vector<std::string>& output) const {
0717     using std::placeholders::_1;
0718     std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(output),
0719                    std::bind(&std::pair<std::string const, ParameterSetEntry>::first, _1));
0720     return output.size();
0721   }
0722 */
0723 
0724   size_t ParameterSet::getParameterSetNames(std::vector<std::string>& output, bool trackiness) const {
0725     for (psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
0726       if (psetItr->second.isTracked() == trackiness) {
0727         output.push_back(psetItr->first);
0728       }
0729     }
0730     return output.size();
0731   }
0732 
0733   size_t ParameterSet::getParameterSetVectorNames(std::vector<std::string>& output, bool trackiness) const {
0734     for (vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
0735       if (vpsetItr->second.isTracked() == trackiness) {
0736         output.push_back(vpsetItr->first);
0737       }
0738     }
0739     return output.size();
0740   }
0741 
0742   size_t ParameterSet::getNamesByCode_(char code, bool trackiness, std::vector<std::string>& output) const {
0743     size_t count = 0;
0744     if (code == 'Q') {
0745       return getParameterSetNames(output, trackiness);
0746     }
0747     if (code == 'q') {
0748       return getParameterSetVectorNames(output, trackiness);
0749     }
0750     table::const_iterator it = tbl_.begin();
0751     table::const_iterator end = tbl_.end();
0752     while (it != end) {
0753       Entry const& e = it->second;
0754       if (e.typeCode() == code && e.isTracked() == trackiness) {  // if it is a vector of ParameterSet
0755         ++count;
0756         output.push_back(it->first);  // save the name
0757       }
0758       ++it;
0759     }
0760     return count;
0761   }
0762 
0763   template <>
0764   std::vector<std::string> ParameterSet::getParameterNamesForType<FileInPath>(bool trackiness) const {
0765     std::vector<std::string> result;
0766     getNamesByCode_('F', trackiness, result);
0767     return result;
0768   }
0769 
0770   bool operator==(ParameterSet const& a, ParameterSet const& b) {
0771     if (a.isRegistered() && b.isRegistered()) {
0772       return (a.id() == b.id());
0773     }
0774     return isTransientEqual(a.trackedPart(), b.trackedPart());
0775   }
0776 
0777   bool isTransientEqual(ParameterSet const& a, ParameterSet const& b) {
0778     if (a.tbl().size() != b.tbl().size()) {
0779       return false;
0780     }
0781     if (a.psetTable().size() != b.psetTable().size()) {
0782       return false;
0783     }
0784     if (a.vpsetTable().size() != b.vpsetTable().size()) {
0785       return false;
0786     }
0787     typedef ParameterSet::table::const_iterator Ti;
0788     for (Ti i = a.tbl().begin(), e = a.tbl().end(), j = b.tbl().begin(), f = b.tbl().end(); i != e && j != f;
0789          ++i, ++j) {
0790       if (*i != *j) {
0791         return false;
0792       }
0793     }
0794     typedef ParameterSet::psettable::const_iterator Pi;
0795     for (Pi i = a.psetTable().begin(), e = a.psetTable().end(), j = b.psetTable().begin(), f = b.psetTable().end();
0796          i != e && j != f;
0797          ++i, ++j) {
0798       if (i->first != j->first) {
0799         return false;
0800       }
0801       if (i->second.isTracked() != j->second.isTracked()) {
0802         return false;
0803       }
0804       if (!isTransientEqual(i->second.pset(), j->second.pset())) {
0805         return false;
0806       }
0807     }
0808     typedef ParameterSet::vpsettable::const_iterator PVi;
0809     for (PVi i = a.vpsetTable().begin(), e = a.vpsetTable().end(), j = b.vpsetTable().begin(), f = b.vpsetTable().end();
0810          i != e && j != f;
0811          ++i, ++j) {
0812       if (i->first != j->first) {
0813         return false;
0814       }
0815       if (i->second.isTracked() != j->second.isTracked()) {
0816         return false;
0817       }
0818       std::vector<ParameterSet> const& iv = i->second.vpset();
0819       std::vector<ParameterSet> const& jv = j->second.vpset();
0820       if (iv.size() != jv.size()) {
0821         return false;
0822       }
0823       for (size_t k = 0; k < iv.size(); ++k) {
0824         if (!isTransientEqual(iv[k], jv[k])) {
0825           return false;
0826         }
0827       }
0828     }
0829     return true;
0830   }
0831 
0832   std::string ParameterSet::dump(unsigned int indent) const {
0833     std::ostringstream os;
0834     // indent a bit
0835     std::string indentation(indent, ' ');
0836     os << "{" << std::endl;
0837     for (table::const_iterator i = tbl_.begin(), e = tbl_.end(); i != e; ++i) {
0838       os << indentation << "  " << i->first << ": " << i->second << std::endl;
0839     }
0840     for (psettable::const_iterator i = psetTable_.begin(), e = psetTable_.end(); i != e; ++i) {
0841       // indent a bit
0842       std::string n = i->first;
0843       ParameterSetEntry const& pe = i->second;
0844       os << indentation << "  " << n << ": " << pe.dump(indent + 2) << std::endl;
0845     }
0846     for (vpsettable::const_iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
0847       // indent a bit
0848       std::string n = i->first;
0849       VParameterSetEntry const& pe = i->second;
0850       os << indentation << "  " << n << ": " << pe.dump(indent + 2) << std::endl;
0851     }
0852     os << indentation << "}";
0853     return os.str();
0854   }
0855 
0856   std::ostream& operator<<(std::ostream& os, ParameterSet const& pset) {
0857     os << pset.dump();
0858     return os;
0859   }
0860 
0861   // Free function to return a parameterSet given its ID.
0862   ParameterSet const& getParameterSet(ParameterSetID const& id) {
0863     ParameterSet const* result = nullptr;
0864     if (nullptr == (result = pset::Registry::instance()->getMapped(id))) {
0865       throw Exception(errors::LogicError, "MissingParameterSet:") << "Parameter Set ID '" << id << "' not found.";
0866     }
0867     return *result;
0868   }
0869 
0870   ParameterSet const& getProcessParameterSetContainingModule(ModuleDescription const& moduleDescription) {
0871     return getParameterSet(moduleDescription.mainParameterSetID());
0872   }
0873 
0874   void ParameterSet::deprecatedInputTagWarning(std::string const& name, std::string const& label) const {
0875     LogWarning("Configuration") << "Warning:\n\tstring " << name << " = \"" << label << "\"\nis deprecated, "
0876                                 << "please update your config file to use\n\tInputTag " << name << " = " << label;
0877   }
0878 
0879   // specializations
0880   // ----------------------------------------------------------------------
0881   // Bool, vBool
0882 
0883   template <>
0884   bool ParameterSet::getParameter<bool>(std::string const& name) const {
0885     return retrieve(name).getBool();
0886   }
0887 
0888   // ----------------------------------------------------------------------
0889   // Int32, vInt32
0890 
0891   template <>
0892   int ParameterSet::getParameter<int>(std::string const& name) const {
0893     return retrieve(name).getInt32();
0894   }
0895 
0896   template <>
0897   std::vector<int> ParameterSet::getParameter<std::vector<int> >(std::string const& name) const {
0898     return retrieve(name).getVInt32();
0899   }
0900 
0901   // ----------------------------------------------------------------------
0902   // Int64, vInt64
0903 
0904   template <>
0905   long long ParameterSet::getParameter<long long>(std::string const& name) const {
0906     return retrieve(name).getInt64();
0907   }
0908 
0909   template <>
0910   std::vector<long long> ParameterSet::getParameter<std::vector<long long> >(std::string const& name) const {
0911     return retrieve(name).getVInt64();
0912   }
0913 
0914   // ----------------------------------------------------------------------
0915   // Uint32, vUint32
0916 
0917   template <>
0918   unsigned int ParameterSet::getParameter<unsigned int>(std::string const& name) const {
0919     return retrieve(name).getUInt32();
0920   }
0921 
0922   template <>
0923   std::vector<unsigned int> ParameterSet::getParameter<std::vector<unsigned int> >(std::string const& name) const {
0924     return retrieve(name).getVUInt32();
0925   }
0926 
0927   // ----------------------------------------------------------------------
0928   // Uint64, vUint64
0929 
0930   template <>
0931   unsigned long long ParameterSet::getParameter<unsigned long long>(std::string const& name) const {
0932     return retrieve(name).getUInt64();
0933   }
0934 
0935   template <>
0936   std::vector<unsigned long long> ParameterSet::getParameter<std::vector<unsigned long long> >(
0937       std::string const& name) const {
0938     return retrieve(name).getVUInt64();
0939   }
0940 
0941   // ----------------------------------------------------------------------
0942   // Double, vDouble
0943 
0944   template <>
0945   double ParameterSet::getParameter<double>(std::string const& name) const {
0946     return retrieve(name).getDouble();
0947   }
0948 
0949   template <>
0950   std::vector<double> ParameterSet::getParameter<std::vector<double> >(std::string const& name) const {
0951     return retrieve(name).getVDouble();
0952   }
0953 
0954   // ----------------------------------------------------------------------
0955   // String, vString
0956 
0957   template <>
0958   std::string ParameterSet::getParameter<std::string>(std::string const& name) const {
0959     return retrieve(name).getString();
0960   }
0961 
0962   template <>
0963   std::vector<std::string> ParameterSet::getParameter<std::vector<std::string> >(std::string const& name) const {
0964     return retrieve(name).getVString();
0965   }
0966 
0967   // ----------------------------------------------------------------------
0968   // FileInPath
0969 
0970   template <>
0971   FileInPath ParameterSet::getParameter<FileInPath>(std::string const& name) const {
0972     return retrieve(name).getFileInPath();
0973   }
0974 
0975   // ----------------------------------------------------------------------
0976   // InputTag
0977 
0978   template <>
0979   InputTag ParameterSet::getParameter<InputTag>(std::string const& name) const {
0980     Entry const& e_input = retrieve(name);
0981     switch (e_input.typeCode()) {
0982       case 't':  // InputTag
0983         return e_input.getInputTag();
0984       case 'S':  // string
0985         std::string const& label = e_input.getString();
0986         deprecatedInputTagWarning(name, label);
0987         return InputTag(label);
0988     }
0989     throw Exception(errors::Configuration, "ValueError")
0990         << "type of " << name << " is expected to be InputTag or string (deprecated)";
0991   }
0992 
0993   // ----------------------------------------------------------------------
0994   // VInputTag
0995 
0996   template <>
0997   std::vector<InputTag> ParameterSet::getParameter<std::vector<InputTag> >(std::string const& name) const {
0998     return retrieve(name).getVInputTag();
0999   }
1000 
1001   // ----------------------------------------------------------------------
1002   // ESInputTag
1003 
1004   template <>
1005   ESInputTag ParameterSet::getParameter<ESInputTag>(std::string const& name) const {
1006     return retrieve(name).getESInputTag();
1007   }
1008 
1009   // ----------------------------------------------------------------------
1010   // VESInputTag
1011 
1012   template <>
1013   std::vector<ESInputTag> ParameterSet::getParameter<std::vector<ESInputTag> >(std::string const& name) const {
1014     return retrieve(name).getVESInputTag();
1015   }
1016 
1017   // ----------------------------------------------------------------------
1018   // EventID
1019 
1020   template <>
1021   EventID ParameterSet::getParameter<EventID>(std::string const& name) const {
1022     return retrieve(name).getEventID();
1023   }
1024 
1025   // ----------------------------------------------------------------------
1026   // VEventID
1027 
1028   template <>
1029   std::vector<EventID> ParameterSet::getParameter<std::vector<EventID> >(std::string const& name) const {
1030     return retrieve(name).getVEventID();
1031   }
1032 
1033   // ----------------------------------------------------------------------
1034   // LuminosityBlockID
1035 
1036   template <>
1037   LuminosityBlockID 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> ParameterSet::getParameter<std::vector<LuminosityBlockID> >(
1046       std::string const& name) const {
1047     return retrieve(name).getVLuminosityBlockID();
1048   }
1049 
1050   // ----------------------------------------------------------------------
1051   // EventRange
1052 
1053   template <>
1054   EventRange ParameterSet::getParameter<EventRange>(std::string const& name) const {
1055     return retrieve(name).getEventRange();
1056   }
1057 
1058   // ----------------------------------------------------------------------
1059   // VEventRange
1060 
1061   template <>
1062   std::vector<EventRange> ParameterSet::getParameter<std::vector<EventRange> >(std::string const& name) const {
1063     return retrieve(name).getVEventRange();
1064   }
1065 
1066   // ----------------------------------------------------------------------
1067   // LuminosityBlockRange
1068 
1069   template <>
1070   LuminosityBlockRange ParameterSet::getParameter<LuminosityBlockRange>(std::string const& name) const {
1071     return retrieve(name).getLuminosityBlockRange();
1072   }
1073 
1074   // ----------------------------------------------------------------------
1075   // VLuminosityBlockRange
1076 
1077   template <>
1078   std::vector<LuminosityBlockRange> ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(
1079       std::string const& name) const {
1080     return retrieve(name).getVLuminosityBlockRange();
1081   }
1082 
1083   // ----------------------------------------------------------------------
1084   // PSet, vPSet
1085 
1086   template <>
1087   ParameterSet ParameterSet::getParameter<ParameterSet>(std::string const& name) const {
1088     return getParameterSet(name);
1089   }
1090 
1091   template <>
1092   VParameterSet ParameterSet::getParameter<VParameterSet>(std::string const& name) const {
1093     return getParameterSetVector(name);
1094   }
1095 
1096   // untracked parameters
1097 
1098   // ----------------------------------------------------------------------
1099   // Bool, vBool
1100 
1101   template <>
1102   bool ParameterSet::getUntrackedParameter<bool>(std::string const& name, bool const& defaultValue) const {
1103     Entry const* entryPtr = retrieveUntracked(name);
1104     return entryPtr == nullptr ? defaultValue : entryPtr->getBool();
1105   }
1106 
1107   template <>
1108   bool ParameterSet::getUntrackedParameter<bool>(std::string const& name) const {
1109     return getEntryPointerOrThrow_(name)->getBool();
1110   }
1111 
1112   // ----------------------------------------------------------------------
1113   // Int32, vInt32
1114 
1115   template <>
1116   int ParameterSet::getUntrackedParameter<int>(std::string const& name, int const& defaultValue) const {
1117     Entry const* entryPtr = retrieveUntracked(name);
1118     return entryPtr == nullptr ? defaultValue : entryPtr->getInt32();
1119   }
1120 
1121   template <>
1122   int ParameterSet::getUntrackedParameter<int>(std::string const& name) const {
1123     return getEntryPointerOrThrow_(name)->getInt32();
1124   }
1125 
1126   template <>
1127   std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name,
1128                                                                           std::vector<int> const& defaultValue) const {
1129     Entry const* entryPtr = retrieveUntracked(name);
1130     return entryPtr == nullptr ? defaultValue : entryPtr->getVInt32();
1131   }
1132 
1133   template <>
1134   std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name) const {
1135     return getEntryPointerOrThrow_(name)->getVInt32();
1136   }
1137 
1138   // ----------------------------------------------------------------------
1139   // Uint32, vUint32
1140 
1141   template <>
1142   unsigned int ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name,
1143                                                                  unsigned int const& defaultValue) const {
1144     Entry const* entryPtr = retrieveUntracked(name);
1145     return entryPtr == nullptr ? defaultValue : entryPtr->getUInt32();
1146   }
1147 
1148   template <>
1149   unsigned int ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name) const {
1150     return getEntryPointerOrThrow_(name)->getUInt32();
1151   }
1152 
1153   template <>
1154   std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(
1155       std::string const& name, std::vector<unsigned int> const& defaultValue) const {
1156     Entry const* entryPtr = retrieveUntracked(name);
1157     return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt32();
1158   }
1159 
1160   template <>
1161   std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(
1162       std::string const& name) const {
1163     return getEntryPointerOrThrow_(name)->getVUInt32();
1164   }
1165 
1166   // ----------------------------------------------------------------------
1167   // Uint64, vUint64
1168 
1169   template <>
1170   unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(
1171       std::string const& name, unsigned long long const& defaultValue) const {
1172     Entry const* entryPtr = retrieveUntracked(name);
1173     return entryPtr == nullptr ? defaultValue : entryPtr->getUInt64();
1174   }
1175 
1176   template <>
1177   unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name) const {
1178     return getEntryPointerOrThrow_(name)->getUInt64();
1179   }
1180 
1181   template <>
1182   std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1183       std::string const& name, std::vector<unsigned long long> const& defaultValue) const {
1184     Entry const* entryPtr = retrieveUntracked(name);
1185     return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt64();
1186   }
1187 
1188   template <>
1189   std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1190       std::string const& name) const {
1191     return getEntryPointerOrThrow_(name)->getVUInt64();
1192   }
1193 
1194   // ----------------------------------------------------------------------
1195   // Int64, Vint64
1196 
1197   template <>
1198   long long ParameterSet::getUntrackedParameter<long long>(std::string const& name,
1199                                                            long long const& defaultValue) const {
1200     Entry const* entryPtr = retrieveUntracked(name);
1201     return entryPtr == nullptr ? defaultValue : entryPtr->getInt64();
1202   }
1203 
1204   template <>
1205   long long ParameterSet::getUntrackedParameter<long long>(std::string const& name) const {
1206     return getEntryPointerOrThrow_(name)->getInt64();
1207   }
1208 
1209   template <>
1210   std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(
1211       std::string const& name, std::vector<long long> const& defaultValue) const {
1212     Entry const* entryPtr = retrieveUntracked(name);
1213     return entryPtr == nullptr ? defaultValue : entryPtr->getVInt64();
1214   }
1215 
1216   template <>
1217   std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(std::string const& name) const {
1218     return getEntryPointerOrThrow_(name)->getVInt64();
1219   }
1220 
1221   // ----------------------------------------------------------------------
1222   // Double, vDouble
1223 
1224   template <>
1225   double ParameterSet::getUntrackedParameter<double>(std::string const& name, double const& defaultValue) const {
1226     Entry const* entryPtr = retrieveUntracked(name);
1227     return entryPtr == nullptr ? defaultValue : entryPtr->getDouble();
1228   }
1229 
1230   template <>
1231   double ParameterSet::getUntrackedParameter<double>(std::string const& name) const {
1232     return getEntryPointerOrThrow_(name)->getDouble();
1233   }
1234 
1235   template <>
1236   std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(
1237       std::string const& name, std::vector<double> const& defaultValue) const {
1238     Entry const* entryPtr = retrieveUntracked(name);
1239     return entryPtr == nullptr ? defaultValue : entryPtr->getVDouble();
1240   }
1241 
1242   template <>
1243   std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(std::string const& name) const {
1244     return getEntryPointerOrThrow_(name)->getVDouble();
1245   }
1246 
1247   // ----------------------------------------------------------------------
1248   // String, vString
1249 
1250   template <>
1251   std::string ParameterSet::getUntrackedParameter<std::string>(std::string const& name,
1252                                                                std::string const& defaultValue) const {
1253     Entry const* entryPtr = retrieveUntracked(name);
1254     return entryPtr == nullptr ? defaultValue : entryPtr->getString();
1255   }
1256 
1257   template <>
1258   std::string ParameterSet::getUntrackedParameter<std::string>(std::string const& name) const {
1259     return getEntryPointerOrThrow_(name)->getString();
1260   }
1261 
1262   template <>
1263   std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(
1264       std::string const& name, std::vector<std::string> const& defaultValue) const {
1265     Entry const* entryPtr = retrieveUntracked(name);
1266     return entryPtr == nullptr ? defaultValue : entryPtr->getVString();
1267   }
1268 
1269   template <>
1270   std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(
1271       std::string const& name) const {
1272     return getEntryPointerOrThrow_(name)->getVString();
1273   }
1274 
1275   // ----------------------------------------------------------------------
1276   //  FileInPath
1277 
1278   template <>
1279   FileInPath ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name,
1280                                                              FileInPath const& defaultValue) const {
1281     Entry const* entryPtr = retrieveUntracked(name);
1282     return entryPtr == nullptr ? defaultValue : entryPtr->getFileInPath();
1283   }
1284 
1285   template <>
1286   FileInPath ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name) const {
1287     return getEntryPointerOrThrow_(name)->getFileInPath();
1288   }
1289 
1290   // ----------------------------------------------------------------------
1291   // InputTag, VInputTag
1292 
1293   template <>
1294   InputTag ParameterSet::getUntrackedParameter<InputTag>(std::string const& name, InputTag const& defaultValue) const {
1295     Entry const* entryPtr = retrieveUntracked(name);
1296     return entryPtr == nullptr ? defaultValue : entryPtr->getInputTag();
1297   }
1298 
1299   template <>
1300   InputTag ParameterSet::getUntrackedParameter<InputTag>(std::string const& name) const {
1301     return getEntryPointerOrThrow_(name)->getInputTag();
1302   }
1303 
1304   template <>
1305   std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(
1306       std::string const& name, std::vector<InputTag> const& defaultValue) const {
1307     Entry const* entryPtr = retrieveUntracked(name);
1308     return entryPtr == nullptr ? defaultValue : entryPtr->getVInputTag();
1309   }
1310 
1311   template <>
1312   std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(std::string const& name) const {
1313     return getEntryPointerOrThrow_(name)->getVInputTag();
1314   }
1315 
1316   // ----------------------------------------------------------------------
1317   // ESInputTag, VESInputTag
1318 
1319   template <>
1320   ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name,
1321                                                              ESInputTag const& defaultValue) const {
1322     Entry const* entryPtr = retrieveUntracked(name);
1323     return entryPtr == nullptr ? defaultValue : entryPtr->getESInputTag();
1324   }
1325 
1326   template <>
1327   ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name) const {
1328     return getEntryPointerOrThrow_(name)->getESInputTag();
1329   }
1330 
1331   template <>
1332   std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(
1333       std::string const& name, std::vector<ESInputTag> const& defaultValue) const {
1334     Entry const* entryPtr = retrieveUntracked(name);
1335     return entryPtr == nullptr ? defaultValue : entryPtr->getVESInputTag();
1336   }
1337 
1338   template <>
1339   std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(std::string const& name) const {
1340     return getEntryPointerOrThrow_(name)->getVESInputTag();
1341   }
1342 
1343   // ----------------------------------------------------------------------
1344   // EventID, VEventID
1345 
1346   template <>
1347   EventID ParameterSet::getUntrackedParameter<EventID>(std::string const& name, EventID const& defaultValue) const {
1348     Entry const* entryPtr = retrieveUntracked(name);
1349     return entryPtr == nullptr ? defaultValue : entryPtr->getEventID();
1350   }
1351 
1352   template <>
1353   EventID ParameterSet::getUntrackedParameter<EventID>(std::string const& name) const {
1354     return getEntryPointerOrThrow_(name)->getEventID();
1355   }
1356 
1357   template <>
1358   std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(
1359       std::string const& name, std::vector<EventID> const& defaultValue) const {
1360     Entry const* entryPtr = retrieveUntracked(name);
1361     return entryPtr == nullptr ? defaultValue : entryPtr->getVEventID();
1362   }
1363 
1364   template <>
1365   std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(std::string const& name) const {
1366     return getEntryPointerOrThrow_(name)->getVEventID();
1367   }
1368 
1369   // ----------------------------------------------------------------------
1370   // LuminosityBlockID, VLuminosityBlockID
1371 
1372   template <>
1373   LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(
1374       std::string const& name, LuminosityBlockID const& defaultValue) const {
1375     Entry const* entryPtr = retrieveUntracked(name);
1376     return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockID();
1377   }
1378 
1379   template <>
1380   LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name) const {
1381     return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
1382   }
1383 
1384   template <>
1385   std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
1386       std::string const& name, std::vector<LuminosityBlockID> const& defaultValue) const {
1387     Entry const* entryPtr = retrieveUntracked(name);
1388     return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockID();
1389   }
1390 
1391   template <>
1392   std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
1393       std::string const& name) const {
1394     return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
1395   }
1396 
1397   // ----------------------------------------------------------------------
1398   // EventRange, VEventRange
1399 
1400   template <>
1401   EventRange ParameterSet::getUntrackedParameter<EventRange>(std::string const& name,
1402                                                              EventRange const& defaultValue) const {
1403     Entry const* entryPtr = retrieveUntracked(name);
1404     return entryPtr == nullptr ? defaultValue : entryPtr->getEventRange();
1405   }
1406 
1407   template <>
1408   EventRange ParameterSet::getUntrackedParameter<EventRange>(std::string const& name) const {
1409     return getEntryPointerOrThrow_(name)->getEventRange();
1410   }
1411 
1412   template <>
1413   std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(
1414       std::string const& name, std::vector<EventRange> const& defaultValue) const {
1415     Entry const* entryPtr = retrieveUntracked(name);
1416     return entryPtr == nullptr ? defaultValue : entryPtr->getVEventRange();
1417   }
1418 
1419   template <>
1420   std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(std::string const& name) const {
1421     return getEntryPointerOrThrow_(name)->getVEventRange();
1422   }
1423 
1424   // ----------------------------------------------------------------------
1425   // LuminosityBlockRange, VLuminosityBlockRange
1426 
1427   template <>
1428   LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(
1429       std::string const& name, LuminosityBlockRange const& defaultValue) const {
1430     Entry const* entryPtr = retrieveUntracked(name);
1431     return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockRange();
1432   }
1433 
1434   template <>
1435   LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name) const {
1436     return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
1437   }
1438 
1439   template <>
1440   std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
1441       std::string const& name, std::vector<LuminosityBlockRange> const& defaultValue) const {
1442     Entry const* entryPtr = retrieveUntracked(name);
1443     return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockRange();
1444   }
1445 
1446   template <>
1447   std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
1448       std::string const& name) const {
1449     return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
1450   }
1451 
1452   // specializations
1453   // ----------------------------------------------------------------------
1454   // Bool, vBool
1455 
1456   template <>
1457   bool ParameterSet::getParameter<bool>(char const* name) const {
1458     return retrieve(name).getBool();
1459   }
1460 
1461   // ----------------------------------------------------------------------
1462   // Int32, vInt32
1463 
1464   template <>
1465   int ParameterSet::getParameter<int>(char const* name) const {
1466     return retrieve(name).getInt32();
1467   }
1468 
1469   template <>
1470   std::vector<int> ParameterSet::getParameter<std::vector<int> >(char const* name) const {
1471     return retrieve(name).getVInt32();
1472   }
1473 
1474   // ----------------------------------------------------------------------
1475   // Int64, vInt64
1476 
1477   template <>
1478   long long ParameterSet::getParameter<long long>(char const* name) const {
1479     return retrieve(name).getInt64();
1480   }
1481 
1482   template <>
1483   std::vector<long long> ParameterSet::getParameter<std::vector<long long> >(char const* name) const {
1484     return retrieve(name).getVInt64();
1485   }
1486 
1487   // ----------------------------------------------------------------------
1488   // Uint32, vUint32
1489 
1490   template <>
1491   unsigned int ParameterSet::getParameter<unsigned int>(char const* name) const {
1492     return retrieve(name).getUInt32();
1493   }
1494 
1495   template <>
1496   std::vector<unsigned int> ParameterSet::getParameter<std::vector<unsigned int> >(char const* name) const {
1497     return retrieve(name).getVUInt32();
1498   }
1499 
1500   // ----------------------------------------------------------------------
1501   // Uint64, vUint64
1502 
1503   template <>
1504   unsigned long long ParameterSet::getParameter<unsigned long long>(char const* name) const {
1505     return retrieve(name).getUInt64();
1506   }
1507 
1508   template <>
1509   std::vector<unsigned long long> ParameterSet::getParameter<std::vector<unsigned long long> >(char const* name) const {
1510     return retrieve(name).getVUInt64();
1511   }
1512 
1513   // ----------------------------------------------------------------------
1514   // Double, vDouble
1515 
1516   template <>
1517   double ParameterSet::getParameter<double>(char const* name) const {
1518     return retrieve(name).getDouble();
1519   }
1520 
1521   template <>
1522   std::vector<double> ParameterSet::getParameter<std::vector<double> >(char const* name) const {
1523     return retrieve(name).getVDouble();
1524   }
1525 
1526   // ----------------------------------------------------------------------
1527   // String, vString
1528 
1529   template <>
1530   std::string ParameterSet::getParameter<std::string>(char const* name) const {
1531     return retrieve(name).getString();
1532   }
1533 
1534   template <>
1535   std::vector<std::string> ParameterSet::getParameter<std::vector<std::string> >(char const* name) const {
1536     return retrieve(name).getVString();
1537   }
1538 
1539   // ----------------------------------------------------------------------
1540   // FileInPath
1541 
1542   template <>
1543   FileInPath ParameterSet::getParameter<FileInPath>(char const* name) const {
1544     return retrieve(name).getFileInPath();
1545   }
1546 
1547   // ----------------------------------------------------------------------
1548   // InputTag
1549 
1550   template <>
1551   InputTag ParameterSet::getParameter<InputTag>(char const* name) const {
1552     Entry const& e_input = retrieve(name);
1553     switch (e_input.typeCode()) {
1554       case 't':  // InputTag
1555         return e_input.getInputTag();
1556       case 'S':  // string
1557         std::string const& label = e_input.getString();
1558         deprecatedInputTagWarning(name, label);
1559         return InputTag(label);
1560     }
1561     throw Exception(errors::Configuration, "ValueError")
1562         << "type of " << name << " is expected to be InputTag or string (deprecated)";
1563   }
1564 
1565   // ----------------------------------------------------------------------
1566   // VInputTag
1567 
1568   template <>
1569   std::vector<InputTag> ParameterSet::getParameter<std::vector<InputTag> >(char const* name) const {
1570     return retrieve(name).getVInputTag();
1571   }
1572 
1573   // ----------------------------------------------------------------------
1574   // ESInputTag
1575 
1576   template <>
1577   ESInputTag ParameterSet::getParameter<ESInputTag>(char const* name) const {
1578     return retrieve(name).getESInputTag();
1579   }
1580 
1581   // ----------------------------------------------------------------------
1582   // VESInputTag
1583 
1584   template <>
1585   std::vector<ESInputTag> ParameterSet::getParameter<std::vector<ESInputTag> >(char const* name) const {
1586     return retrieve(name).getVESInputTag();
1587   }
1588 
1589   // ----------------------------------------------------------------------
1590   // EventID
1591 
1592   template <>
1593   EventID ParameterSet::getParameter<EventID>(char const* name) const {
1594     return retrieve(name).getEventID();
1595   }
1596 
1597   // ----------------------------------------------------------------------
1598   // VEventID
1599 
1600   template <>
1601   std::vector<EventID> ParameterSet::getParameter<std::vector<EventID> >(char const* name) const {
1602     return retrieve(name).getVEventID();
1603   }
1604 
1605   // ----------------------------------------------------------------------
1606   // LuminosityBlockID
1607 
1608   template <>
1609   LuminosityBlockID ParameterSet::getParameter<LuminosityBlockID>(char const* name) const {
1610     return retrieve(name).getLuminosityBlockID();
1611   }
1612 
1613   // ----------------------------------------------------------------------
1614   // VLuminosityBlockID
1615 
1616   template <>
1617   std::vector<LuminosityBlockID> ParameterSet::getParameter<std::vector<LuminosityBlockID> >(char const* name) const {
1618     return retrieve(name).getVLuminosityBlockID();
1619   }
1620 
1621   // ----------------------------------------------------------------------
1622   // EventRange
1623 
1624   template <>
1625   EventRange ParameterSet::getParameter<EventRange>(char const* name) const {
1626     return retrieve(name).getEventRange();
1627   }
1628 
1629   // ----------------------------------------------------------------------
1630   // VEventRange
1631 
1632   template <>
1633   std::vector<EventRange> ParameterSet::getParameter<std::vector<EventRange> >(char const* name) const {
1634     return retrieve(name).getVEventRange();
1635   }
1636 
1637   // ----------------------------------------------------------------------
1638   // LuminosityBlockRange
1639 
1640   template <>
1641   LuminosityBlockRange ParameterSet::getParameter<LuminosityBlockRange>(char const* name) const {
1642     return retrieve(name).getLuminosityBlockRange();
1643   }
1644 
1645   // ----------------------------------------------------------------------
1646   // VLuminosityBlockRange
1647 
1648   template <>
1649   std::vector<LuminosityBlockRange> ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(
1650       char const* name) const {
1651     return retrieve(name).getVLuminosityBlockRange();
1652   }
1653 
1654   // ----------------------------------------------------------------------
1655   // PSet, vPSet
1656 
1657   template <>
1658   ParameterSet ParameterSet::getParameter<ParameterSet>(char const* name) const {
1659     return getParameterSet(name);
1660   }
1661 
1662   template <>
1663   VParameterSet ParameterSet::getParameter<VParameterSet>(char const* name) const {
1664     return getParameterSetVector(name);
1665   }
1666 
1667   // untracked parameters
1668 
1669   // ----------------------------------------------------------------------
1670   // Bool, vBool
1671 
1672   template <>
1673   bool ParameterSet::getUntrackedParameter<bool>(char const* name, bool const& defaultValue) const {
1674     Entry const* entryPtr = retrieveUntracked(name);
1675     return entryPtr == nullptr ? defaultValue : entryPtr->getBool();
1676   }
1677 
1678   template <>
1679   bool ParameterSet::getUntrackedParameter<bool>(char const* name) const {
1680     return getEntryPointerOrThrow_(name)->getBool();
1681   }
1682 
1683   // ----------------------------------------------------------------------
1684   // Int32, vInt32
1685 
1686   template <>
1687   int ParameterSet::getUntrackedParameter<int>(char const* name, int const& defaultValue) const {
1688     Entry const* entryPtr = retrieveUntracked(name);
1689     return entryPtr == nullptr ? defaultValue : entryPtr->getInt32();
1690   }
1691 
1692   template <>
1693   int ParameterSet::getUntrackedParameter<int>(char const* name) const {
1694     return getEntryPointerOrThrow_(name)->getInt32();
1695   }
1696 
1697   template <>
1698   std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name,
1699                                                                           std::vector<int> const& defaultValue) const {
1700     Entry const* entryPtr = retrieveUntracked(name);
1701     return entryPtr == nullptr ? defaultValue : entryPtr->getVInt32();
1702   }
1703 
1704   template <>
1705   std::vector<int> ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name) const {
1706     return getEntryPointerOrThrow_(name)->getVInt32();
1707   }
1708 
1709   // ----------------------------------------------------------------------
1710   // Uint32, vUint32
1711 
1712   template <>
1713   unsigned int ParameterSet::getUntrackedParameter<unsigned int>(char const* name,
1714                                                                  unsigned int const& defaultValue) const {
1715     Entry const* entryPtr = retrieveUntracked(name);
1716     return entryPtr == nullptr ? defaultValue : entryPtr->getUInt32();
1717   }
1718 
1719   template <>
1720   unsigned int ParameterSet::getUntrackedParameter<unsigned int>(char const* name) const {
1721     return getEntryPointerOrThrow_(name)->getUInt32();
1722   }
1723 
1724   template <>
1725   std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(
1726       char const* name, std::vector<unsigned int> const& defaultValue) const {
1727     Entry const* entryPtr = retrieveUntracked(name);
1728     return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt32();
1729   }
1730 
1731   template <>
1732   std::vector<unsigned int> ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(char const* name) const {
1733     return getEntryPointerOrThrow_(name)->getVUInt32();
1734   }
1735 
1736   // ----------------------------------------------------------------------
1737   // Uint64, vUint64
1738 
1739   template <>
1740   unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(
1741       char const* name, unsigned long long const& defaultValue) const {
1742     Entry const* entryPtr = retrieveUntracked(name);
1743     return entryPtr == nullptr ? defaultValue : entryPtr->getUInt64();
1744   }
1745 
1746   template <>
1747   unsigned long long ParameterSet::getUntrackedParameter<unsigned long long>(char const* name) const {
1748     return getEntryPointerOrThrow_(name)->getUInt64();
1749   }
1750 
1751   template <>
1752   std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1753       char const* name, std::vector<unsigned long long> const& defaultValue) const {
1754     Entry const* entryPtr = retrieveUntracked(name);
1755     return entryPtr == nullptr ? defaultValue : entryPtr->getVUInt64();
1756   }
1757 
1758   template <>
1759   std::vector<unsigned long long> ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(
1760       char const* name) const {
1761     return getEntryPointerOrThrow_(name)->getVUInt64();
1762   }
1763 
1764   // ----------------------------------------------------------------------
1765   // Int64, Vint64
1766 
1767   template <>
1768   long long ParameterSet::getUntrackedParameter<long long>(char const* name, long long const& defaultValue) const {
1769     Entry const* entryPtr = retrieveUntracked(name);
1770     return entryPtr == nullptr ? defaultValue : entryPtr->getInt64();
1771   }
1772 
1773   template <>
1774   long long ParameterSet::getUntrackedParameter<long long>(char const* name) const {
1775     return getEntryPointerOrThrow_(name)->getInt64();
1776   }
1777 
1778   template <>
1779   std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(
1780       char const* name, std::vector<long long> const& defaultValue) const {
1781     Entry const* entryPtr = retrieveUntracked(name);
1782     return entryPtr == nullptr ? defaultValue : entryPtr->getVInt64();
1783   }
1784 
1785   template <>
1786   std::vector<long long> ParameterSet::getUntrackedParameter<std::vector<long long> >(char const* name) const {
1787     return getEntryPointerOrThrow_(name)->getVInt64();
1788   }
1789 
1790   // ----------------------------------------------------------------------
1791   // Double, vDouble
1792 
1793   template <>
1794   double ParameterSet::getUntrackedParameter<double>(char const* name, double const& defaultValue) const {
1795     Entry const* entryPtr = retrieveUntracked(name);
1796     return entryPtr == nullptr ? defaultValue : entryPtr->getDouble();
1797   }
1798 
1799   template <>
1800   double ParameterSet::getUntrackedParameter<double>(char const* name) const {
1801     return getEntryPointerOrThrow_(name)->getDouble();
1802   }
1803 
1804   template <>
1805   std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(
1806       char const* name, std::vector<double> const& defaultValue) const {
1807     Entry const* entryPtr = retrieveUntracked(name);
1808     return entryPtr == nullptr ? defaultValue : entryPtr->getVDouble();
1809   }
1810 
1811   template <>
1812   std::vector<double> ParameterSet::getUntrackedParameter<std::vector<double> >(char const* name) const {
1813     return getEntryPointerOrThrow_(name)->getVDouble();
1814   }
1815 
1816   // ----------------------------------------------------------------------
1817   // String, vString
1818 
1819   template <>
1820   std::string ParameterSet::getUntrackedParameter<std::string>(char const* name,
1821                                                                std::string const& defaultValue) const {
1822     Entry const* entryPtr = retrieveUntracked(name);
1823     return entryPtr == nullptr ? defaultValue : entryPtr->getString();
1824   }
1825 
1826   template <>
1827   std::string ParameterSet::getUntrackedParameter<std::string>(char const* name) const {
1828     return getEntryPointerOrThrow_(name)->getString();
1829   }
1830 
1831   template <>
1832   std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(
1833       char const* name, std::vector<std::string> const& defaultValue) const {
1834     Entry const* entryPtr = retrieveUntracked(name);
1835     return entryPtr == nullptr ? defaultValue : entryPtr->getVString();
1836   }
1837 
1838   template <>
1839   std::vector<std::string> ParameterSet::getUntrackedParameter<std::vector<std::string> >(char const* name) const {
1840     return getEntryPointerOrThrow_(name)->getVString();
1841   }
1842 
1843   // ----------------------------------------------------------------------
1844   //  FileInPath
1845 
1846   template <>
1847   FileInPath ParameterSet::getUntrackedParameter<FileInPath>(char const* name, FileInPath const& defaultValue) const {
1848     Entry const* entryPtr = retrieveUntracked(name);
1849     return entryPtr == nullptr ? defaultValue : entryPtr->getFileInPath();
1850   }
1851 
1852   template <>
1853   FileInPath ParameterSet::getUntrackedParameter<FileInPath>(char const* name) const {
1854     return getEntryPointerOrThrow_(name)->getFileInPath();
1855   }
1856 
1857   // ----------------------------------------------------------------------
1858   // InputTag, VInputTag
1859 
1860   template <>
1861   InputTag ParameterSet::getUntrackedParameter<InputTag>(char const* name, InputTag const& defaultValue) const {
1862     Entry const* entryPtr = retrieveUntracked(name);
1863     return entryPtr == nullptr ? defaultValue : entryPtr->getInputTag();
1864   }
1865 
1866   template <>
1867   InputTag ParameterSet::getUntrackedParameter<InputTag>(char const* name) const {
1868     return getEntryPointerOrThrow_(name)->getInputTag();
1869   }
1870 
1871   template <>
1872   std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(
1873       char const* name, std::vector<InputTag> const& defaultValue) const {
1874     Entry const* entryPtr = retrieveUntracked(name);
1875     return entryPtr == nullptr ? defaultValue : entryPtr->getVInputTag();
1876   }
1877 
1878   template <>
1879   std::vector<InputTag> ParameterSet::getUntrackedParameter<std::vector<InputTag> >(char const* name) const {
1880     return getEntryPointerOrThrow_(name)->getVInputTag();
1881   }
1882 
1883   // ----------------------------------------------------------------------
1884   // ESInputTag, VESInputTag
1885 
1886   template <>
1887   ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(char const* name, ESInputTag const& defaultValue) const {
1888     Entry const* entryPtr = retrieveUntracked(name);
1889     return entryPtr == nullptr ? defaultValue : entryPtr->getESInputTag();
1890   }
1891 
1892   template <>
1893   ESInputTag ParameterSet::getUntrackedParameter<ESInputTag>(char const* name) const {
1894     return getEntryPointerOrThrow_(name)->getESInputTag();
1895   }
1896 
1897   template <>
1898   std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(
1899       char const* name, std::vector<ESInputTag> const& defaultValue) const {
1900     Entry const* entryPtr = retrieveUntracked(name);
1901     return entryPtr == nullptr ? defaultValue : entryPtr->getVESInputTag();
1902   }
1903 
1904   template <>
1905   std::vector<ESInputTag> ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(char const* name) const {
1906     return getEntryPointerOrThrow_(name)->getVESInputTag();
1907   }
1908 
1909   // ----------------------------------------------------------------------
1910   // EventID, VEventID
1911 
1912   template <>
1913   EventID ParameterSet::getUntrackedParameter<EventID>(char const* name, EventID const& defaultValue) const {
1914     Entry const* entryPtr = retrieveUntracked(name);
1915     return entryPtr == nullptr ? defaultValue : entryPtr->getEventID();
1916   }
1917 
1918   template <>
1919   EventID ParameterSet::getUntrackedParameter<EventID>(char const* name) const {
1920     return getEntryPointerOrThrow_(name)->getEventID();
1921   }
1922 
1923   template <>
1924   std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(
1925       char const* name, std::vector<EventID> const& defaultValue) const {
1926     Entry const* entryPtr = retrieveUntracked(name);
1927     return entryPtr == nullptr ? defaultValue : entryPtr->getVEventID();
1928   }
1929 
1930   template <>
1931   std::vector<EventID> ParameterSet::getUntrackedParameter<std::vector<EventID> >(char const* name) const {
1932     return getEntryPointerOrThrow_(name)->getVEventID();
1933   }
1934 
1935   // ----------------------------------------------------------------------
1936   // LuminosityBlockID, VLuminosityBlockID
1937 
1938   template <>
1939   LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(
1940       char const* name, LuminosityBlockID const& defaultValue) const {
1941     Entry const* entryPtr = retrieveUntracked(name);
1942     return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockID();
1943   }
1944 
1945   template <>
1946   LuminosityBlockID ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name) const {
1947     return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
1948   }
1949 
1950   template <>
1951   std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
1952       char const* name, std::vector<LuminosityBlockID> const& defaultValue) const {
1953     Entry const* entryPtr = retrieveUntracked(name);
1954     return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockID();
1955   }
1956 
1957   template <>
1958   std::vector<LuminosityBlockID> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(
1959       char const* name) const {
1960     return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
1961   }
1962 
1963   // ----------------------------------------------------------------------
1964   // EventRange, VEventRange
1965 
1966   template <>
1967   EventRange ParameterSet::getUntrackedParameter<EventRange>(char const* name, EventRange const& defaultValue) const {
1968     Entry const* entryPtr = retrieveUntracked(name);
1969     return entryPtr == nullptr ? defaultValue : entryPtr->getEventRange();
1970   }
1971 
1972   template <>
1973   EventRange ParameterSet::getUntrackedParameter<EventRange>(char const* name) const {
1974     return getEntryPointerOrThrow_(name)->getEventRange();
1975   }
1976 
1977   template <>
1978   std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(
1979       char const* name, std::vector<EventRange> const& defaultValue) const {
1980     Entry const* entryPtr = retrieveUntracked(name);
1981     return entryPtr == nullptr ? defaultValue : entryPtr->getVEventRange();
1982   }
1983 
1984   template <>
1985   std::vector<EventRange> ParameterSet::getUntrackedParameter<std::vector<EventRange> >(char const* name) const {
1986     return getEntryPointerOrThrow_(name)->getVEventRange();
1987   }
1988 
1989   // ----------------------------------------------------------------------
1990   // LuminosityBlockRange, VLuminosityBlockRange
1991 
1992   template <>
1993   LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(
1994       char const* name, LuminosityBlockRange const& defaultValue) const {
1995     Entry const* entryPtr = retrieveUntracked(name);
1996     return entryPtr == nullptr ? defaultValue : entryPtr->getLuminosityBlockRange();
1997   }
1998 
1999   template <>
2000   LuminosityBlockRange ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name) const {
2001     return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
2002   }
2003 
2004   template <>
2005   std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
2006       char const* name, std::vector<LuminosityBlockRange> const& defaultValue) const {
2007     Entry const* entryPtr = retrieveUntracked(name);
2008     return entryPtr == nullptr ? defaultValue : entryPtr->getVLuminosityBlockRange();
2009   }
2010 
2011   template <>
2012   std::vector<LuminosityBlockRange> ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(
2013       char const* name) const {
2014     return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
2015   }
2016 
2017   // ----------------------------------------------------------------------
2018   // PSet, vPSet
2019 
2020   template <>
2021   ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(char const* name,
2022                                                                  ParameterSet const& defaultValue) const {
2023     return getUntrackedParameterSet(name, defaultValue);
2024   }
2025 
2026   template <>
2027   VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(char const* name,
2028                                                                    VParameterSet const& defaultValue) const {
2029     return getUntrackedParameterSetVector(name, defaultValue);
2030   }
2031 
2032   template <>
2033   ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name,
2034                                                                  ParameterSet const& defaultValue) const {
2035     return getUntrackedParameterSet(name, defaultValue);
2036   }
2037 
2038   template <>
2039   VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name,
2040                                                                    VParameterSet const& defaultValue) const {
2041     return getUntrackedParameterSetVector(name, defaultValue);
2042   }
2043 
2044   template <>
2045   ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(char const* name) const {
2046     return getUntrackedParameterSet(name);
2047   }
2048 
2049   template <>
2050   VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(char const* name) const {
2051     return getUntrackedParameterSetVector(name);
2052   }
2053 
2054   template <>
2055   ParameterSet ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name) const {
2056     return getUntrackedParameterSet(name);
2057   }
2058 
2059   template <>
2060   VParameterSet ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name) const {
2061     return getUntrackedParameterSetVector(name);
2062   }
2063 
2064   //----------------------------------------------------------------------------------
2065   // specializations for addParameter and addUntrackedParameter
2066 
2067   template <>
2068   void ParameterSet::addParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
2069     invalidateRegistration(name);
2070     insertParameterSet(true, name, ParameterSetEntry(value, true));
2071   }
2072 
2073   template <>
2074   void ParameterSet::addParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
2075     invalidateRegistration(name);
2076     insertVParameterSet(true, name, VParameterSetEntry(value, true));
2077   }
2078 
2079   template <>
2080   void ParameterSet::addParameter<ParameterSet>(char const* name, ParameterSet const& value) {
2081     invalidateRegistration(name);
2082     insertParameterSet(true, name, ParameterSetEntry(value, true));
2083   }
2084 
2085   template <>
2086   void ParameterSet::addParameter<VParameterSet>(char const* name, VParameterSet const& value) {
2087     invalidateRegistration(name);
2088     insertVParameterSet(true, name, VParameterSetEntry(value, true));
2089   }
2090 
2091   template <>
2092   void ParameterSet::addUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
2093     insertParameterSet(true, name, ParameterSetEntry(value, false));
2094   }
2095 
2096   template <>
2097   void ParameterSet::addUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
2098     insertVParameterSet(true, name, VParameterSetEntry(value, false));
2099   }
2100 
2101   template <>
2102   void ParameterSet::addUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& value) {
2103     insertParameterSet(true, name, ParameterSetEntry(value, false));
2104   }
2105 
2106   template <>
2107   void ParameterSet::addUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& value) {
2108     insertVParameterSet(true, name, VParameterSetEntry(value, false));
2109   }
2110 
2111   //----------------------------------------------------------------------------------
2112   // specializations for getParameterNamesForType
2113 
2114   template <>
2115   std::vector<std::string> ParameterSet::getParameterNamesForType<ParameterSet>(bool trackiness) const {
2116     std::vector<std::string> output;
2117     getParameterSetNames(output, trackiness);
2118     return output;
2119   }
2120 
2121   template <>
2122   std::vector<std::string> ParameterSet::getParameterNamesForType<VParameterSet>(bool trackiness) const {
2123     std::vector<std::string> output;
2124     getParameterSetVectorNames(output, trackiness);
2125     return output;
2126   }
2127 
2128   ParameterSet const& ParameterSet::getParameterSet(std::string const& name) const {
2129     return retrieveParameterSet(name).pset();
2130   }
2131 
2132   ParameterSet const& ParameterSet::getParameterSet(char const* name) const {
2133     return retrieveParameterSet(name).pset();
2134   }
2135 
2136   ParameterSet ParameterSet::getUntrackedParameterSet(std::string const& name, ParameterSet const& defaultValue) const {
2137     return getUntrackedParameterSet(name.c_str(), defaultValue);
2138   }
2139 
2140   ParameterSet ParameterSet::getUntrackedParameterSet(char const* name, ParameterSet const& defaultValue) const {
2141     ParameterSetEntry const* entryPtr = retrieveUntrackedParameterSet(name);
2142     if (entryPtr == nullptr) {
2143       return defaultValue;
2144     }
2145     return entryPtr->pset();
2146   }
2147 
2148   ParameterSet const& ParameterSet::getUntrackedParameterSet(std::string const& name) const {
2149     return getUntrackedParameterSet(name.c_str());
2150   }
2151 
2152   ParameterSet const& ParameterSet::getUntrackedParameterSet(char const* name) const {
2153     ParameterSetEntry const* result = retrieveUntrackedParameterSet(name);
2154     if (result == nullptr)
2155       throw Exception(errors::Configuration, "MissingParameter:")
2156           << "The required ParameterSet '" << name << "' was not specified.\n";
2157     return result->pset();
2158   }
2159 
2160   VParameterSet const& ParameterSet::getParameterSetVector(std::string const& name) const {
2161     return retrieveVParameterSet(name).vpset();
2162   }
2163 
2164   VParameterSet const& ParameterSet::getParameterSetVector(char const* name) const {
2165     return retrieveVParameterSet(name).vpset();
2166   }
2167 
2168   VParameterSet ParameterSet::getUntrackedParameterSetVector(std::string const& name,
2169                                                              VParameterSet const& defaultValue) const {
2170     return getUntrackedParameterSetVector(name.c_str(), defaultValue);
2171   }
2172 
2173   VParameterSet ParameterSet::getUntrackedParameterSetVector(char const* name,
2174                                                              VParameterSet const& defaultValue) const {
2175     VParameterSetEntry const* entryPtr = retrieveUntrackedVParameterSet(name);
2176     return entryPtr == nullptr ? defaultValue : entryPtr->vpset();
2177   }
2178 
2179   VParameterSet const& ParameterSet::getUntrackedParameterSetVector(std::string const& name) const {
2180     return getUntrackedParameterSetVector(name.c_str());
2181   }
2182 
2183   VParameterSet const& ParameterSet::getUntrackedParameterSetVector(char const* name) const {
2184     VParameterSetEntry const* result = retrieveUntrackedVParameterSet(name);
2185     if (result == nullptr)
2186       throw Exception(errors::Configuration, "MissingParameter:")
2187           << "The required ParameterSetVector '" << name << "' was not specified.\n";
2188     return result->vpset();
2189   }
2190 }  // namespace edm