CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/FWCore/ParameterSet/src/ParameterSet.cc

Go to the documentation of this file.
00001  // ----------------------------------------------------------------------
00002 //
00003 // definition of ParameterSet's function members
00004 // ----------------------------------------------------------------------
00005 
00006 // ----------------------------------------------------------------------
00007 // prerequisite source files and headers
00008 // ----------------------------------------------------------------------
00009 
00010 #include "FWCore/Utilities/interface/Digest.h"
00011 
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "FWCore/ParameterSet/interface/Registry.h"
00014 
00015 #include "FWCore/ParameterSet/interface/split.h"
00016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00017 #include "FWCore/Utilities/interface/EDMException.h"
00018 #include "FWCore/Utilities/interface/Algorithms.h"
00019 
00020 #include "boost/bind.hpp"
00021 
00022 #include <algorithm>
00023 #include <iostream>
00024 
00025 #include <sstream>
00026 
00027 // ----------------------------------------------------------------------
00028 // class invariant checker
00029 // ----------------------------------------------------------------------
00030 
00031 namespace edm {
00032 
00033   void
00034   ParameterSet::invalidateRegistration(std::string const& nameOfTracked) const {
00035     // We have added a new parameter.  Invalidate the ID.
00036     if(isRegistered()) {
00037       id_ = ParameterSetID();
00038       if (!nameOfTracked.empty()) {
00039         // Give a warning (informational for now).
00040         LogInfo("ParameterSet")  << "Warning: You have added a new tracked parameter\n"
00041                                  <<  "'" << nameOfTracked << "' to a previously registered parameter set.\n"
00042                                  << "This is a bad idea because the new parameter(s) will not be recorded.\n"
00043                                  << "Use the forthcoming ParameterSetDescription facility instead.\n"
00044                                  << "A warning is given only for the first such parameter in a pset.\n";
00045       }
00046     }
00047     assert(!isRegistered());
00048   }
00049 
00050   // ----------------------------------------------------------------------
00051   // constructors
00052   // ----------------------------------------------------------------------
00053 
00054   ParameterSet::ParameterSet() :
00055     tbl_(),
00056     psetTable_(),
00057     vpsetTable_(),
00058     id_() {
00059   }
00060 
00061   // ----------------------------------------------------------------------
00062   // from coded string
00063 
00064   ParameterSet::ParameterSet(std::string const& code) :
00065     tbl_(),
00066     psetTable_(),
00067     vpsetTable_(),
00068     id_() {
00069     if(!fromString(code)) {
00070       throw edm::Exception(errors::Configuration,"InvalidInput")
00071         << "The encoded configuration string "
00072         << "passed to a ParameterSet during construction is invalid:\n"
00073         << code;
00074     }
00075   }
00076 
00077   // ----------------------------------------------------------------------
00078   // from coded string and ID.  Will cause registration
00079 
00080   ParameterSet::ParameterSet(std::string const& code, ParameterSetID const& id) :
00081     tbl_(),
00082     psetTable_(),
00083     vpsetTable_(),
00084     id_(id) {
00085     if(!fromString(code)) {
00086       throw edm::Exception(errors::Configuration,"InvalidInput")
00087         << "The encoded configuration string "
00088         << "passed to a ParameterSet during construction is invalid:\n"
00089         << code;
00090     }
00091     pset::Registry::instance()->insertMapped(*this);
00092   }
00093 
00094   ParameterSet::~ParameterSet() {}
00095 
00096   ParameterSet::ParameterSet(ParameterSet const& other)
00097   : tbl_(other.tbl_),
00098     psetTable_(other.psetTable_),
00099     vpsetTable_(other.vpsetTable_),
00100     id_(other.id_) {
00101   }
00102 
00103   ParameterSet const& ParameterSet::operator=(ParameterSet const& other) {
00104     ParameterSet temp(other);
00105     swap(temp);
00106     return *this;
00107   }
00108 
00109   void ParameterSet::swap(ParameterSet& other) {
00110     tbl_.swap(other.tbl_);
00111     psetTable_.swap(other.psetTable_);
00112     vpsetTable_.swap(other.vpsetTable_);
00113     id_.swap(other.id_);
00114   }
00115 
00116   ParameterSet const& ParameterSet::registerIt() {
00117     if(!isRegistered()) {
00118       calculateID();
00119       pset::Registry::instance()->insertMapped(*this);
00120     }
00121     return *this;
00122   }
00123 
00124   void ParameterSet::calculateID() {
00125     // make sure contained tracked psets are updated
00126     for(psettable::iterator i = psetTable_.begin(), e = psetTable_.end(); i != e; ++i) {
00127       if (!i->second.pset().isRegistered()) {
00128         i->second.pset().registerIt();
00129       }
00130       i->second.updateID();
00131     }
00132 
00133     // make sure contained tracked vpsets are updated
00134     for(vpsettable::iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
00135       i->second.registerPsetsAndUpdateIDs();
00136     }
00137 
00138     std::string stringrep;
00139     toString(stringrep);
00140     cms::Digest md5alg(stringrep);
00141     id_ = ParameterSetID(md5alg.digest().toString());
00142     assert(isRegistered());
00143   }
00144 
00145   // ----------------------------------------------------------------------
00146   // identification
00147   ParameterSetID
00148   ParameterSet::id() const {
00149     // checks if valid
00150     if (!isRegistered()) {
00151       throw edm::Exception(edm::errors::LogicError)
00152         << "ParameterSet::id() called prematurely\n"
00153         << "before ParameterSet::registerIt() has been called.\n";
00154     }
00155     return id_;
00156   }
00157 
00158   void ParameterSet::setID(ParameterSetID const& id) const {
00159     id_ = id;
00160   }
00161 
00162   // ----------------------------------------------------------------------
00163   // Entry-handling
00164   // ----------------------------------------------------------------------
00165 
00166   Entry const*
00167   ParameterSet::getEntryPointerOrThrow_(char const* name) const {
00168     return getEntryPointerOrThrow_(std::string(name));
00169   }
00170 
00171   Entry const*
00172   ParameterSet::getEntryPointerOrThrow_(std::string const& name) const {
00173     Entry const* result = retrieveUntracked(name);
00174     if (result == 0)
00175       throw edm::Exception(errors::Configuration, "MissingParameter:")
00176         << "The required parameter '" << name
00177         << "' was not specified.\n";
00178     return result;
00179   }
00180 
00181   template<typename T, typename U> T first(std::pair<T,U> const& p) {
00182     return p.first;
00183   }
00184 
00185   template<typename T, typename U> U second(std::pair<T,U> const& p) {
00186     return p.second;
00187   }
00188 
00189   Entry const&
00190   ParameterSet::retrieve(char const* name) const {
00191     return retrieve(std::string(name));
00192   }
00193 
00194   Entry const&
00195   ParameterSet::retrieve(std::string const& name) const {
00196     table::const_iterator  it = tbl_.find(name);
00197     if (it == tbl_.end()) {
00198         throw edm::Exception(errors::Configuration,"MissingParameter:")
00199           << "Parameter '" << name
00200           << "' not found.";
00201     }
00202     if (it->second.isTracked() == false) {
00203       if (name[0] == '@') {
00204         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00205           << "Framework Error:  Parameter '" << name
00206           << "' is incorrectly designated as tracked in the framework.";
00207       } else {
00208         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00209           << "Parameter '" << name
00210           << "' is designated as tracked in the code,\n"
00211           << "but is designated as untracked in the configuration file.\n"
00212           << "Please remove 'untracked' from the configuration file for parameter '"<< name << "'.";
00213       }
00214     }
00215     return it->second;
00216   }  // retrieve()
00217 
00218   Entry const* const
00219   ParameterSet::retrieveUntracked(char const* name) const {
00220     return retrieveUntracked(std::string(name));
00221   }
00222 
00223   Entry const* const
00224   ParameterSet::retrieveUntracked(std::string const& name) const {
00225     table::const_iterator  it = tbl_.find(name);
00226 
00227     if (it == tbl_.end()) return 0;
00228     if (it->second.isTracked()) {
00229       if (name[0] == '@') {
00230         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00231           << "Framework Error:  Parameter '" << name
00232           << "' is incorrectly designated as untracked in the framework.";
00233       } else {
00234         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00235           << "Parameter '" << name
00236           << "' is designated as untracked in the code,\n"
00237           << "but is not designated as untracked in the configuration file.\n"
00238           << "Please change the configuration file to 'untracked <type> " << name << "'.";
00239       }
00240     }
00241     return &it->second;
00242   }  // retrieve()
00243 
00244   ParameterSetEntry const&
00245   ParameterSet::retrieveParameterSet(std::string const& name) const {
00246     psettable::const_iterator it = psetTable_.find(name);
00247     if (it == psetTable_.end()) {
00248         throw edm::Exception(errors::Configuration,"MissingParameter:")
00249           << "ParameterSet '" << name
00250           << "' not found.";
00251     }
00252     if (it->second.isTracked() == false) {
00253       if (name[0] == '@') {
00254         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00255           << "Framework Error:  ParameterSet '" << name
00256           << "' is incorrectly designated as tracked in the framework.";
00257       } else {
00258         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00259           << "ParameterSet '" << name
00260           << "' is designated as tracked in the code,\n"
00261           << "but is designated as untracked in the configuration file.\n"
00262           << "Please remove 'untracked' from the configuration file for parameter '"<< name << "'.";
00263       }
00264     }
00265     return it->second;
00266   }  // retrieve()
00267 
00268   ParameterSetEntry const* const
00269   ParameterSet::retrieveUntrackedParameterSet(std::string const& name) const {
00270     psettable::const_iterator  it = psetTable_.find(name);
00271 
00272     if (it == psetTable_.end()) return 0;
00273     if (it->second.isTracked()) {
00274       if (name[0] == '@') {
00275         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00276           << "Framework Error:  ParameterSet '" << name
00277           << "' is incorrectly designated as untracked in the framework.";
00278       } else {
00279         throw edm::Exception(errors::Configuration,"StatusMismatch:")
00280           << "ParameterSet '" << name
00281           << "' is designated as untracked in the code,\n"
00282           << "but is not designated as untracked in the configuration file.\n"
00283           << "Please change the configuration file to 'untracked <type> " << name << "'.";
00284       }
00285     }
00286     return &it->second;
00287   }  // retrieve()
00288 
00289   VParameterSetEntry const&
00290   ParameterSet::retrieveVParameterSet(std::string const& name) const {
00291     vpsettable::const_iterator it = vpsetTable_.find(name);
00292     if (it == vpsetTable_.end()) {
00293         throw edm::Exception(errors::Configuration,"MissingParameter:")
00294           << "VParameterSet '" << name
00295           << "' not found.";
00296     }
00297     if (it->second.isTracked() == false) {
00298       throw edm::Exception(errors::Configuration,"StatusMismatch:")
00299         << "VParameterSet '" << name
00300         << "' is designated as tracked in the code,\n"
00301         << "but is designated as untracked in the configuration file.\n"
00302         << "Please remove 'untracked' from the configuration file for parameter '"<< name << "'.";
00303     }
00304     return it->second;
00305   }  // retrieve()
00306 
00307   VParameterSetEntry const* const
00308   ParameterSet::retrieveUntrackedVParameterSet(std::string const& name) const {
00309     vpsettable::const_iterator it = vpsetTable_.find(name);
00310 
00311     if (it == vpsetTable_.end()) return 0;
00312     if (it->second.isTracked()) {
00313       throw edm::Exception(errors::Configuration,"StatusMismatch:")
00314         << "VParameterSet '" << name
00315         << "' is designated as untracked in the code,\n"
00316         << "but is not designated as untracked in the configuration file.\n"
00317         << "Please change the configuration file to 'untracked <type> " << name << "'.";
00318     }
00319     return &it->second;
00320   }  // retrieve()
00321 
00322   Entry const* const
00323   ParameterSet::retrieveUnknown(char const* name) const {
00324     return retrieveUnknown(std::string(name));
00325   }
00326 
00327   Entry const* const
00328   ParameterSet::retrieveUnknown(std::string const& name) const {
00329     table::const_iterator it = tbl_.find(name);
00330     if (it == tbl_.end()) {
00331       return 0;
00332     }
00333     return &it->second;
00334   }
00335 
00336   ParameterSetEntry const* const
00337   ParameterSet::retrieveUnknownParameterSet(std::string const& name) const {
00338     psettable::const_iterator  it = psetTable_.find(name);
00339     if (it == psetTable_.end()) {
00340       return 0;
00341     }
00342     return &it->second;
00343   }
00344 
00345   VParameterSetEntry const* const
00346   ParameterSet::retrieveUnknownVParameterSet(std::string const& name) const {
00347     vpsettable::const_iterator  it = vpsetTable_.find(name);
00348     if (it == vpsetTable_.end()) {
00349       return 0;
00350     }
00351     return &it->second;
00352   }
00353 
00354   // ----------------------------------------------------------------------
00355   // ----------------------------------------------------------------------
00356 
00357   std::string
00358   ParameterSet::getParameterAsString(std::string const& name) const {
00359     if(existsAs<ParameterSet>(name)) {
00360       return retrieveUnknownParameterSet(name)->toString();
00361     }
00362     else if(existsAs<std::vector<ParameterSet> >(name)) {
00363       return retrieveUnknownVParameterSet(name)->toString();
00364     }
00365     else if(exists(name)) {
00366       return retrieveUnknown(name)->toString();
00367     }
00368     else {
00369       throw edm::Exception(errors::Configuration,"getParameterAsString")
00370        << "Cannot find parameter " << name  << " in " << *this;
00371     }
00372   }
00373 
00374   // ----------------------------------------------------------------------
00375   // ----------------------------------------------------------------------
00376 
00377   void
00378   ParameterSet::insert(bool okay_to_replace, char const* name, Entry const& value) {
00379     insert(okay_to_replace, std::string(name), value);
00380   }
00381 
00382   void
00383   ParameterSet::insert(bool okay_to_replace, std::string const& name, Entry const& value) {
00384     // We should probably get rid of 'okay_to_replace', which will
00385     // simplify the logic in this function.
00386     table::iterator  it = tbl_.find(name);
00387 
00388     if(it == tbl_.end())  {
00389       if(!tbl_.insert(std::make_pair(name, value)).second)
00390         throw edm::Exception(errors::Configuration,"InsertFailure")
00391           << "cannot insert " << name
00392           << " into a ParameterSet\n";
00393     }
00394     else if(okay_to_replace)  {
00395       it->second = value;
00396     }
00397   }  // insert()
00398 
00399   void ParameterSet::insertParameterSet(bool okay_to_replace, std::string const& name, ParameterSetEntry const& entry) {
00400     // We should probably get rid of 'okay_to_replace', which will
00401     // simplify the logic in this function.
00402     psettable::iterator it = psetTable_.find(name);
00403 
00404     if(it == psetTable_.end()) {
00405       if(!psetTable_.insert(std::make_pair(name, entry)).second)
00406         throw edm::Exception(errors::Configuration,"InsertFailure")
00407           << "cannot insert " << name
00408           << " into a ParameterSet\n";
00409     } else if(okay_to_replace) {
00410       it->second = entry;
00411     }
00412   }  // insert()
00413 
00414   void ParameterSet::insertVParameterSet(bool okay_to_replace, std::string const& name, VParameterSetEntry const& entry) {
00415     // We should probably get rid of 'okay_to_replace', which will
00416     // simplify the logic in this function.
00417     vpsettable::iterator it = vpsetTable_.find(name);
00418 
00419     if(it == vpsetTable_.end()) {
00420       if(!vpsetTable_.insert(std::make_pair(name, entry)).second)
00421         throw edm::Exception(errors::Configuration,"InsertFailure")
00422           << "cannot insert " << name
00423           << " into a VParameterSet\n";
00424     } else if(okay_to_replace) {
00425       it->second = entry;
00426     }
00427   }  // insert()
00428 
00429   void
00430   ParameterSet::augment(ParameterSet const& from) {
00431     // This preemptive invalidation may be more agressive than necessary.
00432     invalidateRegistration(std::string());
00433     if(&from == this) {
00434       return;
00435     }
00436 
00437     for(table::const_iterator b = from.tbl_.begin(), e = from.tbl_.end(); b != e; ++b) {
00438       this->insert(false, b->first, b->second);
00439     }
00440     for(psettable::const_iterator b = from.psetTable_.begin(), e = from.psetTable_.end(); b != e; ++b) {
00441       this->insertParameterSet(false, b->first, b->second);
00442     }
00443     for(vpsettable::const_iterator b = from.vpsetTable_.begin(), e = from.vpsetTable_.end(); b != e; ++b) {
00444       this->insertVParameterSet(false, b->first, b->second);
00445     }
00446   }  // augment()
00447 
00448   void ParameterSet::copyFrom(ParameterSet const& from, std::string const& name) {
00449     invalidateRegistration(std::string());
00450     if(from.existsAs<ParameterSet>(name)) {
00451       this->insertParameterSet(false, name, *(from.retrieveUnknownParameterSet(name)));
00452     }
00453     else if(from.existsAs<std::vector<ParameterSet> >(name)) {
00454       this->insertVParameterSet(false, name, *(from.retrieveUnknownVParameterSet(name)));
00455     }
00456     else if(from.exists(name)) {
00457       this->insert(false, name, *(from.retrieveUnknown(name)));
00458     }
00459     else {
00460       throw edm::Exception(errors::Configuration, "copyFrom")
00461        << "Cannot find parameter " << name  << " in " << from;
00462     }
00463   }
00464 
00465   ParameterSet *
00466   ParameterSet::getPSetForUpdate(std::string const& name, bool& isTracked) {
00467     assert(!isRegistered());
00468     isTracked = false;
00469     psettable::iterator it = psetTable_.find(name);
00470     if (it == psetTable_.end()) return 0;
00471     isTracked = it->second.isTracked();
00472     return &it->second.pset();
00473   }
00474 
00475   VParameterSetEntry *
00476   ParameterSet::getPSetVectorForUpdate(std::string const& name) {
00477     assert(!isRegistered());
00478     vpsettable::iterator it = vpsetTable_.find(name);
00479     if (it == vpsetTable_.end()) return 0;
00480     return &it->second;
00481   }
00482 
00483   // ----------------------------------------------------------------------
00484   // coding
00485   // ----------------------------------------------------------------------
00486 
00487   void
00488   ParameterSet::toString(std::string& rep) const {
00489     toStringImp(rep,false);
00490   }
00491 
00492   void
00493   ParameterSet::allToString(std::string& rep) const {
00494     toStringImp(rep,true);
00495   }
00496   
00497   void
00498   ParameterSet::toStringImp(std::string& rep, bool useAll) const {
00499     // make sure the PSets get filled
00500     if (empty()) {
00501       rep += "<>";
00502       return;
00503     }
00504     size_t size = 1;
00505     for(table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
00506       if (useAll || b->second.isTracked()) {
00507         size += 2;
00508         size += b->first.size();
00509         size += b->second.sizeOfString();
00510       }
00511     }
00512     for(psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
00513       if (useAll || b->second.isTracked()) {
00514         size += 2;
00515         size += b->first.size();
00516         size += b->first.size();
00517         size += b->first.size();
00518         size += sizeof(ParameterSetID);
00519       }
00520     }
00521     for(vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
00522       if (useAll || b->second.isTracked()) {
00523         size += 2;
00524         size += b->first.size();
00525         size += sizeof(ParameterSetID) * b->second.vpset().size();
00526       }
00527     }
00528 
00529     rep.reserve(rep.size()+size);
00530     rep += '<';
00531     std::string start;
00532     std::string const between(";");
00533     for(table::const_iterator b = tbl_.begin(), e = tbl_.end(); b != e; ++b) {
00534       if (useAll || b->second.isTracked()) {
00535         rep += start;
00536         rep += b->first;
00537         rep += '=';
00538         b->second.toString(rep);
00539         start = between;
00540       }
00541     }
00542     for(psettable::const_iterator b = psetTable_.begin(), e = psetTable_.end(); b != e; ++b) {
00543       if (useAll || b->second.isTracked()) {
00544         rep += start;
00545         rep += b->first;
00546         rep += '=';
00547         b->second.toString(rep);
00548         start = between;
00549       }
00550     }
00551     for(vpsettable::const_iterator b = vpsetTable_.begin(), e = vpsetTable_.end(); b != e; ++b) {
00552       if (useAll || b->second.isTracked()) {
00553         rep += start;
00554         rep += b->first;
00555         rep += '=';
00556         b->second.toString(rep);
00557         start = between;
00558       }
00559     }
00560 
00561     rep += '>';
00562   }  // to_string()
00563 
00564   std::string
00565   ParameterSet::toString() const {
00566     std::string result;
00567     toString(result);
00568     return result;
00569   }
00570 
00571   // ----------------------------------------------------------------------
00572 
00573   bool
00574   ParameterSet::fromString(std::string const& from) {
00575     std::vector<std::string> temp;
00576     if(!split(std::back_inserter(temp), from, '<', ';', '>'))
00577       return false;
00578 
00579     tbl_.clear();  // precaution
00580     for(std::vector<std::string>::const_iterator b = temp.begin(), e = temp.end(); b != e; ++b) {
00581       // locate required name/value separator
00582       std::string::const_iterator q = find_in_all(*b, '=');
00583       if(q == b->end())
00584         return false;
00585 
00586       // form name unique to this ParameterSet
00587       std::string  name = std::string(b->begin(), q);
00588       if(tbl_.find(name) != tbl_.end())
00589         return false;
00590 
00591       std::string rep(q+1, b->end());
00592       // entries are generically of the form tracked-type-rep
00593       if (rep[0] == '-') {
00594       }
00595       if(rep[1] == 'Q') {
00596         ParameterSetEntry psetEntry(rep);
00597         if(!psetTable_.insert(std::make_pair(name, psetEntry)).second) {
00598           return false;
00599         }
00600       } else if(rep[1] == 'q') {
00601         VParameterSetEntry vpsetEntry(rep);
00602         if(!vpsetTable_.insert(std::make_pair(name, vpsetEntry)).second) {
00603           return false;
00604         }
00605       } else if(rep[1] == 'P') {
00606         Entry value(name, rep);
00607         ParameterSetEntry psetEntry(value.getPSet(), value.isTracked());
00608         if(!psetTable_.insert(std::make_pair(name, psetEntry)).second) {
00609           return false;
00610         }
00611       } else if(rep[1] == 'p') {
00612         Entry value(name, rep);
00613         VParameterSetEntry vpsetEntry(value.getVPSet(), value.isTracked());
00614         if(!vpsetTable_.insert(std::make_pair(name, vpsetEntry)).second) {
00615           return false;
00616         }
00617       } else {
00618         // form value and insert name/value pair
00619         Entry  value(name, rep);
00620         if(!tbl_.insert(std::make_pair(name, value)).second) {
00621           return false;
00622         }
00623       }
00624     }
00625 
00626     return true;
00627   }  // from_string()
00628 
00629   std::vector<FileInPath>::size_type
00630   ParameterSet::getAllFileInPaths(std::vector<FileInPath>& output) const {
00631     std::vector<FileInPath>::size_type count = 0;
00632     table::const_iterator it = tbl_.begin();
00633     table::const_iterator end = tbl_.end();
00634     while (it != end) {
00635         Entry const& e = it->second;
00636         if (e.typeCode() == 'F') {
00637             ++count;
00638             output.push_back(e.getFileInPath());
00639         }
00640         ++it;
00641     }
00642     return count;
00643   }
00644 
00645   std::vector<std::string>
00646   ParameterSet::getParameterNames() const {
00647     std::vector<std::string> returnValue;
00648     std::transform(tbl_.begin(), tbl_.end(), back_inserter(returnValue),
00649                    boost::bind(&std::pair<std::string const, Entry>::first,_1));
00650     std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(returnValue),
00651                    boost::bind(&std::pair<std::string const, ParameterSetEntry>::first,_1));
00652     std::transform(vpsetTable_.begin(), vpsetTable_.end(), back_inserter(returnValue),
00653                    boost::bind(&std::pair<std::string const, VParameterSetEntry>::first,_1));
00654     return returnValue;
00655   }
00656 
00657   bool ParameterSet::exists(std::string const& parameterName) const {
00658     return(tbl_.find(parameterName) != tbl_.end() ||
00659      psetTable_.find(parameterName) != psetTable_.end() ||
00660     vpsetTable_.find(parameterName) != vpsetTable_.end());
00661   }
00662 
00663   ParameterSet
00664   ParameterSet::trackedPart() const {
00665     ParameterSet result;
00666     for(table::const_iterator tblItr = tbl_.begin(); tblItr != tbl_.end(); ++tblItr) {
00667       if(tblItr->second.isTracked()) {
00668         result.tbl_.insert(*tblItr);
00669       }
00670     }
00671     for(psettable::const_iterator psetItr = psetTable_.begin(); psetItr != psetTable_.end(); ++psetItr) {
00672       if(psetItr->second.isTracked()) {
00673         result.addParameter<ParameterSet>(psetItr->first, psetItr->second.pset().trackedPart());
00674       }
00675     }
00676     for(vpsettable::const_iterator vpsetItr = vpsetTable_.begin(); vpsetItr != vpsetTable_.end(); ++vpsetItr) {
00677       if(vpsetItr->second.isTracked()) {
00678         VParameterSet vresult;
00679         std::vector<ParameterSet> const& this_vpset = vpsetItr->second.vpset();
00680 
00681         typedef std::vector<ParameterSet>::const_iterator Iter;
00682         for (Iter i = this_vpset.begin(), e = this_vpset.end(); i != e; ++i) {
00683           vresult.push_back(i->trackedPart());
00684         }
00685         result.addParameter<VParameterSet>(vpsetItr->first, vresult);
00686       }
00687     }
00688     return result;
00689   }
00690 
00691   size_t
00692   ParameterSet::getParameterSetNames(std::vector<std::string>& output) {
00693     std::transform(psetTable_.begin(), psetTable_.end(), back_inserter(output),
00694                    boost::bind(&std::pair<std::string const, ParameterSetEntry>::first,_1));
00695     return output.size();
00696   }
00697 
00698   size_t
00699   ParameterSet::getParameterSetNames(std::vector<std::string>& output,
00700                                      bool trackiness) const {
00701     for(psettable::const_iterator psetItr = psetTable_.begin();
00702         psetItr != psetTable_.end(); ++psetItr) {
00703       if(psetItr->second.isTracked() == trackiness) {
00704         output.push_back(psetItr->first);
00705       }
00706     }
00707     return output.size();
00708   }
00709 
00710   size_t
00711   ParameterSet::getParameterSetVectorNames(std::vector<std::string>& output,
00712                                            bool trackiness) const {
00713     for(vpsettable::const_iterator vpsetItr = vpsetTable_.begin();
00714          vpsetItr != vpsetTable_.end(); ++vpsetItr) {
00715       if(vpsetItr->second.isTracked() == trackiness) {
00716         output.push_back(vpsetItr->first);
00717       }
00718     }
00719     return output.size();
00720   }
00721 
00722   size_t
00723   ParameterSet::getNamesByCode_(char code,
00724                                 bool trackiness,
00725                                 std::vector<std::string>& output) const {
00726     size_t count = 0;
00727     if (code == 'Q') {
00728       return getParameterSetNames(output, trackiness);
00729     }
00730     if (code == 'q') {
00731       return getParameterSetVectorNames(output, trackiness);
00732     }
00733     table::const_iterator it = tbl_.begin();
00734     table::const_iterator end = tbl_.end();
00735     while (it != end) {
00736       Entry const& e = it->second;
00737       if (e.typeCode() == code &&
00738           e.isTracked() == trackiness) { // if it is a vector of ParameterSet
00739           ++count;
00740           output.push_back(it->first); // save the name
00741       }
00742       ++it;
00743     }
00744     return count;
00745   }
00746 
00747   template<>
00748   std::vector<std::string> ParameterSet::getParameterNamesForType<FileInPath>(bool trackiness) const {
00749     std::vector<std::string> result;
00750     getNamesByCode_('F', trackiness, result);
00751     return result;
00752   }
00753 
00754   bool operator==(ParameterSet const& a, ParameterSet const& b) {
00755     if (a.isRegistered() && b.isRegistered()) {
00756       return (a.id() == b.id());
00757     }
00758     return isTransientEqual(a.trackedPart(), b.trackedPart());
00759   }
00760 
00761   bool isTransientEqual(ParameterSet const& a, ParameterSet const& b) {
00762     if (a.tbl().size() != b.tbl().size()) {
00763         return false;
00764     }
00765     if (a.psetTable().size() != b.psetTable().size()) {
00766         return false;
00767     }
00768     if (a.vpsetTable().size() != b.vpsetTable().size()) {
00769         return false;
00770     }
00771     typedef ParameterSet::table::const_iterator Ti;
00772     for (Ti i = a.tbl().begin(), e = a.tbl().end(),
00773             j = b.tbl().begin(), f = b.tbl().end();
00774             i != e; ++i, ++j) {
00775       if (*i != *j) {
00776         return false;
00777       }
00778     }
00779     typedef ParameterSet::psettable::const_iterator Pi;
00780     for (Pi i = a.psetTable().begin(), e = a.psetTable().end(),
00781             j = b.psetTable().begin(), f = b.psetTable().end();
00782             i != e; ++i, ++j) {
00783       if (i->first != j->first) {
00784         return false;
00785       }
00786       if (i->second.isTracked() != j->second.isTracked()) {
00787         return false;
00788       }
00789       if (!isTransientEqual(i->second.pset(), j->second.pset())) {
00790         return false;
00791       }
00792     }
00793     typedef ParameterSet::vpsettable::const_iterator PVi;
00794     for (PVi i = a.vpsetTable().begin(), e = a.vpsetTable().end(),
00795              j = b.vpsetTable().begin(), f = b.vpsetTable().end();
00796              i != e; ++i, ++j) {
00797       if (i->first != j->first) {
00798         return false;
00799       }
00800       if (i->second.isTracked() != j->second.isTracked()) {
00801         return false;
00802       }
00803       std::vector<ParameterSet> const& iv = i->second.vpset();
00804       std::vector<ParameterSet> const& jv = j->second.vpset();
00805       if (iv.size() != jv.size()) {
00806         return false;
00807       }
00808       for (size_t k = 0; k < iv.size(); ++k) {
00809         if (!isTransientEqual(iv[k], jv[k])) {
00810           return false;
00811         }
00812       }
00813     }
00814     return true;
00815   }
00816 
00817   std::string ParameterSet::dump() const {
00818     std::ostringstream os;
00819     os << "{" << std::endl;
00820     for(table::const_iterator i = tbl_.begin(), e = tbl_.end(); i != e; ++i) {
00821       // indent a bit
00822       os << "  " << i->first << ": " << i->second << std::endl;
00823     }
00824     for(psettable::const_iterator i = psetTable_.begin(), e = psetTable_.end(); i != e; ++i) {
00825       // indent a bit
00826       std::string n = i->first;
00827       ParameterSetEntry const& pe = i->second;
00828       os << "  " << n << ": " << pe <<  std::endl;
00829     }
00830     for(vpsettable::const_iterator i = vpsetTable_.begin(), e = vpsetTable_.end(); i != e; ++i) {
00831       // indent a bit
00832       std::string n = i->first;
00833       VParameterSetEntry const& pe = i->second;
00834       os << "  " << n << ": " << pe <<  std::endl;
00835     }
00836     os << "}";
00837     return os.str();
00838   }
00839 
00840   std::ostream& operator<<(std::ostream& os, ParameterSet const& pset) {
00841     os << pset.dump();
00842     return os;
00843   }
00844 
00845   // Free function to return a parameterSet given its ID.
00846   ParameterSet const&
00847   getParameterSet(ParameterSetID const& id) {
00848     ParameterSet const* result=0;
00849     if(0 == (result =pset::Registry::instance()->getMapped(id))) {
00850       throw edm::Exception(errors::Configuration,"MissingParameterSet:")
00851         << "Parameter Set ID '" << id << "' not found.";
00852     }
00853     return *result;
00854   }
00855 
00856   void ParameterSet::deprecatedInputTagWarning(std::string const& name,
00857                                                std::string const& label) const {
00858     LogWarning("Configuration") << "Warning:\n\tstring " << name
00859                                 << " = \"" << label
00860                                 << "\"\nis deprecated, "
00861                                 << "please update your config file to use\n\tInputTag "
00862                                 << name << " = " << label;
00863   }
00864 
00865   // specializations
00866   // ----------------------------------------------------------------------
00867   // Bool, vBool
00868 
00869   template<>
00870   bool
00871   ParameterSet::getParameter<bool>(std::string const& name) const {
00872     return retrieve(name).getBool();
00873   }
00874 
00875   // ----------------------------------------------------------------------
00876   // Int32, vInt32
00877 
00878   template<>
00879   int
00880   ParameterSet::getParameter<int>(std::string const& name) const {
00881     return retrieve(name).getInt32();
00882   }
00883 
00884   template<>
00885   std::vector<int>
00886   ParameterSet::getParameter<std::vector<int> >(std::string const& name) const {
00887     return retrieve(name).getVInt32();
00888   }
00889 
00890  // ----------------------------------------------------------------------
00891   // Int64, vInt64
00892 
00893   template<>
00894   long long
00895   ParameterSet::getParameter<long long>(std::string const& name) const {
00896     return retrieve(name).getInt64();
00897   }
00898 
00899   template<>
00900   std::vector<long long>
00901   ParameterSet::getParameter<std::vector<long long> >(std::string const& name) const {
00902     return retrieve(name).getVInt64();
00903   }
00904 
00905   // ----------------------------------------------------------------------
00906   // Uint32, vUint32
00907 
00908   template<>
00909   unsigned int
00910   ParameterSet::getParameter<unsigned int>(std::string const& name) const {
00911     return retrieve(name).getUInt32();
00912   }
00913 
00914   template<>
00915   std::vector<unsigned int>
00916   ParameterSet::getParameter<std::vector<unsigned int> >(std::string const& name) const {
00917     return retrieve(name).getVUInt32();
00918   }
00919 
00920   // ----------------------------------------------------------------------
00921   // Uint64, vUint64
00922 
00923   template<>
00924   unsigned long long
00925   ParameterSet::getParameter<unsigned long long>(std::string const& name) const {
00926     return retrieve(name).getUInt64();
00927   }
00928 
00929   template<>
00930   std::vector<unsigned long long>
00931   ParameterSet::getParameter<std::vector<unsigned long long> >(std::string const& name) const {
00932     return retrieve(name).getVUInt64();
00933   }
00934 
00935   // ----------------------------------------------------------------------
00936   // Double, vDouble
00937 
00938   template<>
00939   double
00940   ParameterSet::getParameter<double>(std::string const& name) const {
00941     return retrieve(name).getDouble();
00942   }
00943 
00944   template<>
00945   std::vector<double>
00946   ParameterSet::getParameter<std::vector<double> >(std::string const& name) const {
00947     return retrieve(name).getVDouble();
00948   }
00949 
00950   // ----------------------------------------------------------------------
00951   // String, vString
00952 
00953   template<>
00954   std::string
00955   ParameterSet::getParameter<std::string>(std::string const& name) const {
00956     return retrieve(name).getString();
00957   }
00958 
00959   template<>
00960   std::vector<std::string>
00961   ParameterSet::getParameter<std::vector<std::string> >(std::string const& name) const {
00962     return retrieve(name).getVString();
00963   }
00964 
00965   // ----------------------------------------------------------------------
00966   // FileInPath
00967 
00968   template<>
00969   FileInPath
00970   ParameterSet::getParameter<FileInPath>(std::string const& name) const {
00971     return retrieve(name).getFileInPath();
00972   }
00973 
00974   // ----------------------------------------------------------------------
00975   // InputTag
00976 
00977   template<>
00978   InputTag
00979   ParameterSet::getParameter<InputTag>(std::string const& name) const {
00980     Entry const& e_input = retrieve(name);
00981     switch (e_input.typeCode()) {
00982       case 't':   // InputTag
00983         return e_input.getInputTag();
00984       case 'S':   // string
00985         std::string const& label = e_input.getString();
00986         deprecatedInputTagWarning(name, label);
00987         return InputTag(label);
00988     }
00989     throw edm::Exception(errors::Configuration, "ValueError") << "type of "
00990        << name << " is expected to be InputTag or string (deprecated)";
00991 
00992   }
00993 
00994   // ----------------------------------------------------------------------
00995   // VInputTag
00996 
00997   template<>
00998   std::vector<InputTag>
00999   ParameterSet::getParameter<std::vector<InputTag> >(std::string const& name) const {
01000     return retrieve(name).getVInputTag();
01001   }
01002 
01003    // ----------------------------------------------------------------------
01004    // ESInputTag
01005 
01006    template<>
01007    ESInputTag
01008    ParameterSet::getParameter<ESInputTag>(std::string const& name) const {
01009       return retrieve(name).getESInputTag();
01010    }
01011 
01012    // ----------------------------------------------------------------------
01013    // VESInputTag
01014 
01015    template<>
01016    std::vector<ESInputTag>
01017    ParameterSet::getParameter<std::vector<ESInputTag> >(std::string const& name) const {
01018       return retrieve(name).getVESInputTag();
01019    }
01020 
01021   // ----------------------------------------------------------------------
01022   // EventID
01023 
01024   template<>
01025   EventID
01026   ParameterSet::getParameter<EventID>(std::string const& name) const {
01027     return retrieve(name).getEventID();
01028   }
01029 
01030   // ----------------------------------------------------------------------
01031   // VEventID
01032 
01033   template<>
01034   std::vector<EventID>
01035   ParameterSet::getParameter<std::vector<EventID> >(std::string const& name) const {
01036     return retrieve(name).getVEventID();
01037   }
01038 
01039   // ----------------------------------------------------------------------
01040   // LuminosityBlockID
01041 
01042   template<>
01043   LuminosityBlockID
01044   ParameterSet::getParameter<LuminosityBlockID>(std::string const& name) const {
01045     return retrieve(name).getLuminosityBlockID();
01046   }
01047 
01048   // ----------------------------------------------------------------------
01049   // VLuminosityBlockID
01050 
01051   template<>
01052   std::vector<LuminosityBlockID>
01053   ParameterSet::getParameter<std::vector<LuminosityBlockID> >(std::string const& name) const {
01054     return retrieve(name).getVLuminosityBlockID();
01055   }
01056 
01057   // ----------------------------------------------------------------------
01058   // EventRange
01059 
01060   template<>
01061   EventRange
01062   ParameterSet::getParameter<EventRange>(std::string const& name) const {
01063     return retrieve(name).getEventRange();
01064   }
01065 
01066   // ----------------------------------------------------------------------
01067   // VEventRange
01068 
01069   template<>
01070   std::vector<EventRange>
01071   ParameterSet::getParameter<std::vector<EventRange> >(std::string const& name) const {
01072     return retrieve(name).getVEventRange();
01073   }
01074 
01075   // ----------------------------------------------------------------------
01076   // LuminosityBlockRange
01077 
01078   template<>
01079   LuminosityBlockRange
01080   ParameterSet::getParameter<LuminosityBlockRange>(std::string const& name) const {
01081     return retrieve(name).getLuminosityBlockRange();
01082   }
01083 
01084   // ----------------------------------------------------------------------
01085   // VLuminosityBlockRange
01086 
01087   template<>
01088   std::vector<LuminosityBlockRange>
01089   ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(std::string const& name) const {
01090     return retrieve(name).getVLuminosityBlockRange();
01091   }
01092 
01093   // ----------------------------------------------------------------------
01094   // PSet, vPSet
01095 
01096   template<>
01097   ParameterSet
01098   ParameterSet::getParameter<ParameterSet>(std::string const& name) const {
01099     return getParameterSet(name);
01100   }
01101 
01102   template<>
01103   VParameterSet
01104   ParameterSet::getParameter<VParameterSet>(std::string const& name) const {
01105     return getParameterSetVector(name);
01106   }
01107 
01108   // untracked parameters
01109 
01110   // ----------------------------------------------------------------------
01111   // Bool, vBool
01112 
01113   template<>
01114   bool
01115   ParameterSet::getUntrackedParameter<bool>(std::string const& name, bool const& defaultValue) const {
01116     Entry const* entryPtr = retrieveUntracked(name);
01117     return entryPtr == 0 ? defaultValue : entryPtr->getBool();
01118   }
01119 
01120   template<>
01121   bool
01122   ParameterSet::getUntrackedParameter<bool>(std::string const& name) const {
01123     return getEntryPointerOrThrow_(name)->getBool();
01124   }
01125 
01126   // ----------------------------------------------------------------------
01127   // Int32, vInt32
01128 
01129   template<>
01130   int
01131   ParameterSet::getUntrackedParameter<int>(std::string const& name, int const& defaultValue) const {
01132     Entry const* entryPtr = retrieveUntracked(name);
01133     return entryPtr == 0 ? defaultValue : entryPtr->getInt32();
01134   }
01135 
01136   template<>
01137   int
01138   ParameterSet::getUntrackedParameter<int>(std::string const& name) const {
01139     return getEntryPointerOrThrow_(name)->getInt32();
01140   }
01141 
01142   template<>
01143   std::vector<int>
01144   ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name, std::vector<int> const& defaultValue) const {
01145     Entry const* entryPtr = retrieveUntracked(name);
01146     return entryPtr == 0 ? defaultValue : entryPtr->getVInt32();
01147   }
01148 
01149   template<>
01150   std::vector<int>
01151   ParameterSet::getUntrackedParameter<std::vector<int> >(std::string const& name) const {
01152     return getEntryPointerOrThrow_(name)->getVInt32();
01153   }
01154 
01155   // ----------------------------------------------------------------------
01156   // Uint32, vUint32
01157 
01158   template<>
01159   unsigned int
01160   ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name, unsigned int const& defaultValue) const {
01161     Entry const* entryPtr = retrieveUntracked(name);
01162     return entryPtr == 0 ? defaultValue : entryPtr->getUInt32();
01163   }
01164 
01165   template<>
01166   unsigned int
01167   ParameterSet::getUntrackedParameter<unsigned int>(std::string const& name) const {
01168     return getEntryPointerOrThrow_(name)->getUInt32();
01169   }
01170 
01171   template<>
01172   std::vector<unsigned int>
01173   ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(std::string const& name, std::vector<unsigned int> const& defaultValue) const {
01174     Entry const* entryPtr = retrieveUntracked(name);
01175     return entryPtr == 0 ? defaultValue : entryPtr->getVUInt32();
01176   }
01177 
01178   template<>
01179   std::vector<unsigned int>
01180   ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(std::string const& name) const {
01181     return getEntryPointerOrThrow_(name)->getVUInt32();
01182   }
01183 
01184   // ----------------------------------------------------------------------
01185   // Uint64, vUint64
01186 
01187   template<>
01188   unsigned long long
01189   ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name, unsigned long long const& defaultValue) const {
01190     Entry const* entryPtr = retrieveUntracked(name);
01191     return entryPtr == 0 ? defaultValue : entryPtr->getUInt64();
01192   }
01193 
01194   template<>
01195   unsigned long long
01196   ParameterSet::getUntrackedParameter<unsigned long long>(std::string const& name) const {
01197     return getEntryPointerOrThrow_(name)->getUInt64();
01198   }
01199 
01200   template<>
01201   std::vector<unsigned long long>
01202   ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(std::string const& name, std::vector<unsigned long long> const& defaultValue) const {
01203     Entry const* entryPtr = retrieveUntracked(name);
01204     return entryPtr == 0 ? defaultValue : entryPtr->getVUInt64();
01205   }
01206 
01207   template<>
01208   std::vector<unsigned long long>
01209   ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(std::string const& name) const {
01210     return getEntryPointerOrThrow_(name)->getVUInt64();
01211   }
01212 
01213   // ----------------------------------------------------------------------
01214   // Int64, Vint64
01215 
01216   template<>
01217   long long
01218   ParameterSet::getUntrackedParameter<long long>(std::string const& name, long long const& defaultValue) const {
01219     Entry const* entryPtr = retrieveUntracked(name);
01220     return entryPtr == 0 ? defaultValue : entryPtr->getInt64();
01221   }
01222 
01223   template<>
01224   long long
01225   ParameterSet::getUntrackedParameter<long long>(std::string const& name) const {
01226     return getEntryPointerOrThrow_(name)->getInt64();
01227   }
01228 
01229   template<>
01230   std::vector<long long>
01231   ParameterSet::getUntrackedParameter<std::vector<long long> >(std::string const& name, std::vector<long long> const& defaultValue) const {
01232     Entry const* entryPtr = retrieveUntracked(name);
01233     return entryPtr == 0 ? defaultValue : entryPtr->getVInt64();
01234   }
01235 
01236   template<>
01237   std::vector<long long>
01238   ParameterSet::getUntrackedParameter<std::vector<long long> >(std::string const& name) const {
01239     return getEntryPointerOrThrow_(name)->getVInt64();
01240   }
01241 
01242   // ----------------------------------------------------------------------
01243   // Double, vDouble
01244 
01245   template<>
01246   double
01247   ParameterSet::getUntrackedParameter<double>(std::string const& name, double const& defaultValue) const {
01248     Entry const* entryPtr = retrieveUntracked(name);
01249     return entryPtr == 0 ? defaultValue : entryPtr->getDouble();
01250   }
01251 
01252   template<>
01253   double
01254   ParameterSet::getUntrackedParameter<double>(std::string const& name) const {
01255     return getEntryPointerOrThrow_(name)->getDouble();
01256   }
01257 
01258   template<>
01259   std::vector<double>
01260   ParameterSet::getUntrackedParameter<std::vector<double> >(std::string const& name, std::vector<double> const& defaultValue) const {
01261     Entry const* entryPtr = retrieveUntracked(name); return entryPtr == 0 ? defaultValue : entryPtr->getVDouble();
01262   }
01263 
01264   template<>
01265   std::vector<double>
01266   ParameterSet::getUntrackedParameter<std::vector<double> >(std::string const& name) const {
01267     return getEntryPointerOrThrow_(name)->getVDouble();
01268   }
01269 
01270   // ----------------------------------------------------------------------
01271   // String, vString
01272 
01273   template<>
01274   std::string
01275   ParameterSet::getUntrackedParameter<std::string>(std::string const& name, std::string const& defaultValue) const {
01276     Entry const* entryPtr = retrieveUntracked(name);
01277     return entryPtr == 0 ? defaultValue : entryPtr->getString();
01278   }
01279 
01280   template<>
01281   std::string
01282   ParameterSet::getUntrackedParameter<std::string>(std::string const& name) const {
01283     return getEntryPointerOrThrow_(name)->getString();
01284   }
01285 
01286   template<>
01287   std::vector<std::string>
01288   ParameterSet::getUntrackedParameter<std::vector<std::string> >(std::string const& name, std::vector<std::string> const& defaultValue) const {
01289     Entry const* entryPtr = retrieveUntracked(name);
01290     return entryPtr == 0 ? defaultValue : entryPtr->getVString();
01291   }
01292 
01293   template<>
01294   std::vector<std::string>
01295   ParameterSet::getUntrackedParameter<std::vector<std::string> >(std::string const& name) const {
01296     return getEntryPointerOrThrow_(name)->getVString();
01297   }
01298 
01299   // ----------------------------------------------------------------------
01300   //  FileInPath
01301 
01302   template<>
01303   FileInPath
01304   ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name, FileInPath const& defaultValue) const {
01305     Entry const* entryPtr = retrieveUntracked(name);
01306     return entryPtr == 0 ? defaultValue : entryPtr->getFileInPath();
01307   }
01308 
01309   template<>
01310   FileInPath
01311   ParameterSet::getUntrackedParameter<FileInPath>(std::string const& name) const {
01312     return getEntryPointerOrThrow_(name)->getFileInPath();
01313   }
01314 
01315   // ----------------------------------------------------------------------
01316   // InputTag, VInputTag
01317 
01318   template<>
01319   InputTag
01320   ParameterSet::getUntrackedParameter<InputTag>(std::string const& name, InputTag const& defaultValue) const {
01321     Entry const* entryPtr = retrieveUntracked(name);
01322     return entryPtr == 0 ? defaultValue : entryPtr->getInputTag();
01323   }
01324 
01325   template<>
01326   InputTag
01327   ParameterSet::getUntrackedParameter<InputTag>(std::string const& name) const {
01328     return getEntryPointerOrThrow_(name)->getInputTag();
01329   }
01330 
01331   template<>
01332   std::vector<InputTag>
01333   ParameterSet::getUntrackedParameter<std::vector<InputTag> >(std::string const& name,
01334                                       std::vector<InputTag> const& defaultValue) const {
01335     Entry const* entryPtr = retrieveUntracked(name);
01336     return entryPtr == 0 ? defaultValue : entryPtr->getVInputTag();
01337   }
01338 
01339   template<>
01340   std::vector<InputTag>
01341   ParameterSet::getUntrackedParameter<std::vector<InputTag> >(std::string const& name) const {
01342     return getEntryPointerOrThrow_(name)->getVInputTag();
01343   }
01344 
01345    // ----------------------------------------------------------------------
01346    // ESInputTag, VESInputTag
01347 
01348    template<>
01349    ESInputTag
01350    ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name, ESInputTag const& defaultValue) const {
01351       Entry const* entryPtr = retrieveUntracked(name);
01352       return entryPtr == 0 ? defaultValue : entryPtr->getESInputTag();
01353    }
01354 
01355    template<>
01356    ESInputTag
01357    ParameterSet::getUntrackedParameter<ESInputTag>(std::string const& name) const {
01358       return getEntryPointerOrThrow_(name)->getESInputTag();
01359    }
01360 
01361    template<>
01362    std::vector<ESInputTag>
01363    ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(std::string const& name,
01364                                                                std::vector<ESInputTag> const& defaultValue) const {
01365       Entry const* entryPtr = retrieveUntracked(name);
01366       return entryPtr == 0 ? defaultValue : entryPtr->getVESInputTag();
01367    }
01368 
01369    template<>
01370    std::vector<ESInputTag>
01371    ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(std::string const& name) const {
01372       return getEntryPointerOrThrow_(name)->getVESInputTag();
01373    }
01374 
01375   // ----------------------------------------------------------------------
01376   // EventID, VEventID
01377 
01378   template<>
01379   EventID
01380   ParameterSet::getUntrackedParameter<EventID>(std::string const& name, EventID const& defaultValue) const {
01381     Entry const* entryPtr = retrieveUntracked(name);
01382     return entryPtr == 0 ? defaultValue : entryPtr->getEventID();
01383   }
01384 
01385   template<>
01386   EventID
01387   ParameterSet::getUntrackedParameter<EventID>(std::string const& name) const {
01388     return getEntryPointerOrThrow_(name)->getEventID();
01389   }
01390 
01391   template<>
01392   std::vector<EventID>
01393   ParameterSet::getUntrackedParameter<std::vector<EventID> >(std::string const& name,
01394                                       std::vector<EventID> const& defaultValue) const {
01395     Entry const* entryPtr = retrieveUntracked(name);
01396     return entryPtr == 0 ? defaultValue : entryPtr->getVEventID();
01397   }
01398 
01399   template<>
01400   std::vector<EventID>
01401   ParameterSet::getUntrackedParameter<std::vector<EventID> >(std::string const& name) const {
01402     return getEntryPointerOrThrow_(name)->getVEventID();
01403   }
01404 
01405   // ----------------------------------------------------------------------
01406   // LuminosityBlockID, VLuminosityBlockID
01407 
01408   template<>
01409   LuminosityBlockID
01410   ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name, LuminosityBlockID const& defaultValue) const {
01411     Entry const* entryPtr = retrieveUntracked(name);
01412     return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockID();
01413   }
01414 
01415   template<>
01416   LuminosityBlockID
01417   ParameterSet::getUntrackedParameter<LuminosityBlockID>(std::string const& name) const {
01418     return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
01419   }
01420 
01421   template<>
01422   std::vector<LuminosityBlockID>
01423   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(std::string const& name,
01424                                       std::vector<LuminosityBlockID> const& defaultValue) const {
01425     Entry const* entryPtr = retrieveUntracked(name);
01426     return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockID();
01427   }
01428 
01429   template<>
01430   std::vector<LuminosityBlockID>
01431   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(std::string const& name) const {
01432     return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
01433   }
01434 
01435   // ----------------------------------------------------------------------
01436   // EventRange, VEventRange
01437 
01438   template<>
01439   EventRange
01440   ParameterSet::getUntrackedParameter<EventRange>(std::string const& name, EventRange const& defaultValue) const {
01441     Entry const* entryPtr = retrieveUntracked(name);
01442     return entryPtr == 0 ? defaultValue : entryPtr->getEventRange();
01443   }
01444 
01445   template<>
01446   EventRange
01447   ParameterSet::getUntrackedParameter<EventRange>(std::string const& name) const {
01448     return getEntryPointerOrThrow_(name)->getEventRange();
01449   }
01450 
01451   template<>
01452   std::vector<EventRange>
01453   ParameterSet::getUntrackedParameter<std::vector<EventRange> >(std::string const& name,
01454                                       std::vector<EventRange> const& defaultValue) const {
01455     Entry const* entryPtr = retrieveUntracked(name);
01456     return entryPtr == 0 ? defaultValue : entryPtr->getVEventRange();
01457   }
01458 
01459   template<>
01460   std::vector<EventRange>
01461   ParameterSet::getUntrackedParameter<std::vector<EventRange> >(std::string const& name) const {
01462     return getEntryPointerOrThrow_(name)->getVEventRange();
01463   }
01464 
01465   // ----------------------------------------------------------------------
01466   // LuminosityBlockRange, VLuminosityBlockRange
01467 
01468   template<>
01469   LuminosityBlockRange
01470   ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name, LuminosityBlockRange const& defaultValue) const {
01471     Entry const* entryPtr = retrieveUntracked(name);
01472     return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockRange();
01473   }
01474 
01475   template<>
01476   LuminosityBlockRange
01477   ParameterSet::getUntrackedParameter<LuminosityBlockRange>(std::string const& name) const {
01478     return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
01479   }
01480 
01481   template<>
01482   std::vector<LuminosityBlockRange>
01483   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(std::string const& name,
01484                                       std::vector<LuminosityBlockRange> const& defaultValue) const {
01485     Entry const* entryPtr = retrieveUntracked(name);
01486     return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockRange();
01487   }
01488 
01489   template<>
01490   std::vector<LuminosityBlockRange>
01491   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(std::string const& name) const {
01492     return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
01493   }
01494 
01495   // specializations
01496   // ----------------------------------------------------------------------
01497   // Bool, vBool
01498 
01499   template<>
01500   bool
01501   ParameterSet::getParameter<bool>(char const* name) const {
01502     return retrieve(name).getBool();
01503   }
01504 
01505   // ----------------------------------------------------------------------
01506   // Int32, vInt32
01507 
01508   template<>
01509   int
01510   ParameterSet::getParameter<int>(char const* name) const {
01511     return retrieve(name).getInt32();
01512   }
01513 
01514   template<>
01515   std::vector<int>
01516   ParameterSet::getParameter<std::vector<int> >(char const* name) const {
01517     return retrieve(name).getVInt32();
01518   }
01519 
01520  // ----------------------------------------------------------------------
01521   // Int64, vInt64
01522 
01523   template<>
01524   long long
01525   ParameterSet::getParameter<long long>(char const* name) const {
01526     return retrieve(name).getInt64();
01527   }
01528 
01529   template<>
01530   std::vector<long long>
01531   ParameterSet::getParameter<std::vector<long long> >(char const* name) const {
01532     return retrieve(name).getVInt64();
01533   }
01534 
01535   // ----------------------------------------------------------------------
01536   // Uint32, vUint32
01537 
01538   template<>
01539   unsigned int
01540   ParameterSet::getParameter<unsigned int>(char const* name) const {
01541     return retrieve(name).getUInt32();
01542   }
01543 
01544   template<>
01545   std::vector<unsigned int>
01546   ParameterSet::getParameter<std::vector<unsigned int> >(char const* name) const {
01547     return retrieve(name).getVUInt32();
01548   }
01549 
01550   // ----------------------------------------------------------------------
01551   // Uint64, vUint64
01552 
01553   template<>
01554   unsigned long long
01555   ParameterSet::getParameter<unsigned long long>(char const* name) const {
01556     return retrieve(name).getUInt64();
01557   }
01558 
01559   template<>
01560   std::vector<unsigned long long>
01561   ParameterSet::getParameter<std::vector<unsigned long long> >(char const* name) const {
01562     return retrieve(name).getVUInt64();
01563   }
01564 
01565   // ----------------------------------------------------------------------
01566   // Double, vDouble
01567 
01568   template<>
01569   double
01570   ParameterSet::getParameter<double>(char const* name) const {
01571     return retrieve(name).getDouble();
01572   }
01573 
01574   template<>
01575   std::vector<double>
01576   ParameterSet::getParameter<std::vector<double> >(char const* name) const {
01577     return retrieve(name).getVDouble();
01578   }
01579 
01580   // ----------------------------------------------------------------------
01581   // String, vString
01582 
01583   template<>
01584   std::string
01585   ParameterSet::getParameter<std::string>(char const* name) const {
01586     return retrieve(name).getString();
01587   }
01588 
01589   template<>
01590   std::vector<std::string>
01591   ParameterSet::getParameter<std::vector<std::string> >(char const* name) const {
01592     return retrieve(name).getVString();
01593   }
01594 
01595   // ----------------------------------------------------------------------
01596   // FileInPath
01597 
01598   template<>
01599   FileInPath
01600   ParameterSet::getParameter<FileInPath>(char const* name) const {
01601     return retrieve(name).getFileInPath();
01602   }
01603 
01604   // ----------------------------------------------------------------------
01605   // InputTag
01606 
01607   template<>
01608   InputTag
01609   ParameterSet::getParameter<InputTag>(char const* name) const {
01610     Entry const& e_input = retrieve(name);
01611     switch (e_input.typeCode()) {
01612       case 't':   // InputTag
01613         return e_input.getInputTag();
01614       case 'S':   // string
01615         std::string const& label = e_input.getString();
01616         deprecatedInputTagWarning(name, label);
01617         return InputTag(label);
01618     }
01619     throw edm::Exception(errors::Configuration, "ValueError") << "type of "
01620        << name << " is expected to be InputTag or string (deprecated)";
01621   }
01622 
01623   // ----------------------------------------------------------------------
01624   // VInputTag
01625 
01626   template<>
01627   std::vector<InputTag>
01628   ParameterSet::getParameter<std::vector<InputTag> >(char const* name) const {
01629     return retrieve(name).getVInputTag();
01630   }
01631 
01632    // ----------------------------------------------------------------------
01633    // ESInputTag
01634 
01635    template<>
01636    ESInputTag
01637    ParameterSet::getParameter<ESInputTag>(char const* name) const {
01638       return retrieve(name).getESInputTag();
01639    }
01640 
01641    // ----------------------------------------------------------------------
01642    // VESInputTag
01643 
01644    template<>
01645    std::vector<ESInputTag>
01646    ParameterSet::getParameter<std::vector<ESInputTag> >(char const* name) const {
01647       return retrieve(name).getVESInputTag();
01648    }
01649 
01650 
01651   // ----------------------------------------------------------------------
01652   // EventID
01653 
01654   template<>
01655   EventID
01656   ParameterSet::getParameter<EventID>(char const* name) const {
01657     return retrieve(name).getEventID();
01658   }
01659 
01660   // ----------------------------------------------------------------------
01661   // VEventID
01662 
01663   template<>
01664   std::vector<EventID>
01665   ParameterSet::getParameter<std::vector<EventID> >(char const* name) const {
01666     return retrieve(name).getVEventID();
01667   }
01668 
01669   // ----------------------------------------------------------------------
01670   // LuminosityBlockID
01671 
01672   template<>
01673   LuminosityBlockID
01674   ParameterSet::getParameter<LuminosityBlockID>(char const* name) const {
01675     return retrieve(name).getLuminosityBlockID();
01676   }
01677 
01678   // ----------------------------------------------------------------------
01679   // VLuminosityBlockID
01680 
01681   template<>
01682   std::vector<LuminosityBlockID>
01683   ParameterSet::getParameter<std::vector<LuminosityBlockID> >(char const* name) const {
01684     return retrieve(name).getVLuminosityBlockID();
01685   }
01686 
01687   // ----------------------------------------------------------------------
01688   // EventRange
01689 
01690   template<>
01691   EventRange
01692   ParameterSet::getParameter<EventRange>(char const* name) const {
01693     return retrieve(name).getEventRange();
01694   }
01695 
01696   // ----------------------------------------------------------------------
01697   // VEventRange
01698 
01699   template<>
01700   std::vector<EventRange>
01701   ParameterSet::getParameter<std::vector<EventRange> >(char const* name) const {
01702     return retrieve(name).getVEventRange();
01703   }
01704 
01705   // ----------------------------------------------------------------------
01706   // LuminosityBlockRange
01707 
01708   template<>
01709   LuminosityBlockRange
01710   ParameterSet::getParameter<LuminosityBlockRange>(char const* name) const {
01711     return retrieve(name).getLuminosityBlockRange();
01712   }
01713 
01714   // ----------------------------------------------------------------------
01715   // VLuminosityBlockRange
01716 
01717   template<>
01718   std::vector<LuminosityBlockRange>
01719   ParameterSet::getParameter<std::vector<LuminosityBlockRange> >(char const* name) const {
01720     return retrieve(name).getVLuminosityBlockRange();
01721   }
01722 
01723   // ----------------------------------------------------------------------
01724   // PSet, vPSet
01725 
01726   template<>
01727   ParameterSet
01728   ParameterSet::getParameter<ParameterSet>(char const* name) const {
01729     return getParameterSet(name);
01730   }
01731 
01732   template<>
01733   VParameterSet
01734   ParameterSet::getParameter<VParameterSet>(char const* name) const {
01735     return getParameterSetVector(name);
01736   }
01737 
01738   // untracked parameters
01739 
01740   // ----------------------------------------------------------------------
01741   // Bool, vBool
01742 
01743   template<>
01744   bool
01745   ParameterSet::getUntrackedParameter<bool>(char const* name, bool const& defaultValue) const {
01746     Entry const* entryPtr = retrieveUntracked(name);
01747     return entryPtr == 0 ? defaultValue : entryPtr->getBool();
01748   }
01749 
01750   template<>
01751   bool
01752   ParameterSet::getUntrackedParameter<bool>(char const* name) const {
01753     return getEntryPointerOrThrow_(name)->getBool();
01754   }
01755 
01756   // ----------------------------------------------------------------------
01757   // Int32, vInt32
01758 
01759   template<>
01760   int
01761   ParameterSet::getUntrackedParameter<int>(char const* name, int const& defaultValue) const {
01762     Entry const* entryPtr = retrieveUntracked(name);
01763     return entryPtr == 0 ? defaultValue : entryPtr->getInt32();
01764   }
01765 
01766   template<>
01767   int
01768   ParameterSet::getUntrackedParameter<int>(char const* name) const {
01769     return getEntryPointerOrThrow_(name)->getInt32();
01770   }
01771 
01772   template<>
01773   std::vector<int>
01774   ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name, std::vector<int> const& defaultValue) const {
01775     Entry const* entryPtr = retrieveUntracked(name);
01776     return entryPtr == 0 ? defaultValue : entryPtr->getVInt32();
01777   }
01778 
01779   template<>
01780   std::vector<int>
01781   ParameterSet::getUntrackedParameter<std::vector<int> >(char const* name) const {
01782     return getEntryPointerOrThrow_(name)->getVInt32();
01783   }
01784 
01785   // ----------------------------------------------------------------------
01786   // Uint32, vUint32
01787 
01788   template<>
01789   unsigned int
01790   ParameterSet::getUntrackedParameter<unsigned int>(char const* name, unsigned int const& defaultValue) const {
01791     Entry const* entryPtr = retrieveUntracked(name);
01792     return entryPtr == 0 ? defaultValue : entryPtr->getUInt32();
01793   }
01794 
01795   template<>
01796   unsigned int
01797   ParameterSet::getUntrackedParameter<unsigned int>(char const* name) const {
01798     return getEntryPointerOrThrow_(name)->getUInt32();
01799   }
01800 
01801   template<>
01802   std::vector<unsigned int>
01803   ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(char const* name, std::vector<unsigned int> const& defaultValue) const {
01804     Entry const* entryPtr = retrieveUntracked(name);
01805     return entryPtr == 0 ? defaultValue : entryPtr->getVUInt32();
01806   }
01807 
01808   template<>
01809   std::vector<unsigned int>
01810   ParameterSet::getUntrackedParameter<std::vector<unsigned int> >(char const* name) const {
01811     return getEntryPointerOrThrow_(name)->getVUInt32();
01812   }
01813 
01814   // ----------------------------------------------------------------------
01815   // Uint64, vUint64
01816 
01817   template<>
01818   unsigned long long
01819   ParameterSet::getUntrackedParameter<unsigned long long>(char const* name, unsigned long long const& defaultValue) const {
01820     Entry const* entryPtr = retrieveUntracked(name);
01821     return entryPtr == 0 ? defaultValue : entryPtr->getUInt64();
01822   }
01823 
01824   template<>
01825   unsigned long long
01826   ParameterSet::getUntrackedParameter<unsigned long long>(char const* name) const {
01827     return getEntryPointerOrThrow_(name)->getUInt64();
01828   }
01829 
01830   template<>
01831   std::vector<unsigned long long>
01832   ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(char const* name, std::vector<unsigned long long> const& defaultValue) const {
01833     Entry const* entryPtr = retrieveUntracked(name);
01834     return entryPtr == 0 ? defaultValue : entryPtr->getVUInt64();
01835   }
01836 
01837   template<>
01838   std::vector<unsigned long long>
01839   ParameterSet::getUntrackedParameter<std::vector<unsigned long long> >(char const* name) const {
01840     return getEntryPointerOrThrow_(name)->getVUInt64();
01841   }
01842 
01843   // ----------------------------------------------------------------------
01844   // Int64, Vint64
01845 
01846   template<>
01847   long long
01848   ParameterSet::getUntrackedParameter<long long>(char const* name, long long const& defaultValue) const {
01849     Entry const* entryPtr = retrieveUntracked(name);
01850     return entryPtr == 0 ? defaultValue : entryPtr->getInt64();
01851   }
01852 
01853   template<>
01854   long long
01855   ParameterSet::getUntrackedParameter<long long>(char const* name) const {
01856     return getEntryPointerOrThrow_(name)->getInt64();
01857   }
01858 
01859   template<>
01860   std::vector<long long>
01861   ParameterSet::getUntrackedParameter<std::vector<long long> >(char const* name, std::vector<long long> const& defaultValue) const {
01862     Entry const* entryPtr = retrieveUntracked(name);
01863     return entryPtr == 0 ? defaultValue : entryPtr->getVInt64();
01864   }
01865 
01866   template<>
01867   std::vector<long long>
01868   ParameterSet::getUntrackedParameter<std::vector<long long> >(char const* name) const {
01869     return getEntryPointerOrThrow_(name)->getVInt64();
01870   }
01871 
01872   // ----------------------------------------------------------------------
01873   // Double, vDouble
01874 
01875   template<>
01876   double
01877   ParameterSet::getUntrackedParameter<double>(char const* name, double const& defaultValue) const {
01878     Entry const* entryPtr = retrieveUntracked(name);
01879     return entryPtr == 0 ? defaultValue : entryPtr->getDouble();
01880   }
01881 
01882   template<>
01883   double
01884   ParameterSet::getUntrackedParameter<double>(char const* name) const {
01885     return getEntryPointerOrThrow_(name)->getDouble();
01886   }
01887 
01888   template<>
01889   std::vector<double>
01890   ParameterSet::getUntrackedParameter<std::vector<double> >(char const* name, std::vector<double> const& defaultValue) const {
01891     Entry const* entryPtr = retrieveUntracked(name); return entryPtr == 0 ? defaultValue : entryPtr->getVDouble();
01892   }
01893 
01894   template<>
01895   std::vector<double>
01896   ParameterSet::getUntrackedParameter<std::vector<double> >(char const* name) const {
01897     return getEntryPointerOrThrow_(name)->getVDouble();
01898   }
01899 
01900   // ----------------------------------------------------------------------
01901   // String, vString
01902 
01903   template<>
01904   std::string
01905   ParameterSet::getUntrackedParameter<std::string>(char const* name, std::string const& defaultValue) const {
01906     Entry const* entryPtr = retrieveUntracked(name);
01907     return entryPtr == 0 ? defaultValue : entryPtr->getString();
01908   }
01909 
01910   template<>
01911   std::string
01912   ParameterSet::getUntrackedParameter<std::string>(char const* name) const {
01913     return getEntryPointerOrThrow_(name)->getString();
01914   }
01915 
01916   template<>
01917   std::vector<std::string>
01918   ParameterSet::getUntrackedParameter<std::vector<std::string> >(char const* name, std::vector<std::string> const& defaultValue) const {
01919     Entry const* entryPtr = retrieveUntracked(name);
01920     return entryPtr == 0 ? defaultValue : entryPtr->getVString();
01921   }
01922 
01923   template<>
01924   std::vector<std::string>
01925   ParameterSet::getUntrackedParameter<std::vector<std::string> >(char const* name) const {
01926     return getEntryPointerOrThrow_(name)->getVString();
01927   }
01928 
01929   // ----------------------------------------------------------------------
01930   //  FileInPath
01931 
01932   template<>
01933   FileInPath
01934   ParameterSet::getUntrackedParameter<FileInPath>(char const* name, FileInPath const& defaultValue) const {
01935     Entry const* entryPtr = retrieveUntracked(name);
01936     return entryPtr == 0 ? defaultValue : entryPtr->getFileInPath();
01937   }
01938 
01939   template<>
01940   FileInPath
01941   ParameterSet::getUntrackedParameter<FileInPath>(char const* name) const {
01942     return getEntryPointerOrThrow_(name)->getFileInPath();
01943   }
01944 
01945   // ----------------------------------------------------------------------
01946   // InputTag, VInputTag
01947 
01948   template<>
01949   InputTag
01950   ParameterSet::getUntrackedParameter<InputTag>(char const* name, InputTag const& defaultValue) const {
01951     Entry const* entryPtr = retrieveUntracked(name);
01952     return entryPtr == 0 ? defaultValue : entryPtr->getInputTag();
01953   }
01954 
01955   template<>
01956   InputTag
01957   ParameterSet::getUntrackedParameter<InputTag>(char const* name) const {
01958     return getEntryPointerOrThrow_(name)->getInputTag();
01959   }
01960 
01961   template<>
01962   std::vector<InputTag>
01963   ParameterSet::getUntrackedParameter<std::vector<InputTag> >(char const* name,
01964                                       std::vector<InputTag> const& defaultValue) const {
01965     Entry const* entryPtr = retrieveUntracked(name);
01966     return entryPtr == 0 ? defaultValue : entryPtr->getVInputTag();
01967   }
01968 
01969   template<>
01970   std::vector<InputTag>
01971   ParameterSet::getUntrackedParameter<std::vector<InputTag> >(char const* name) const {
01972     return getEntryPointerOrThrow_(name)->getVInputTag();
01973   }
01974 
01975    // ----------------------------------------------------------------------
01976    // ESInputTag, VESInputTag
01977 
01978    template<>
01979    ESInputTag
01980    ParameterSet::getUntrackedParameter<ESInputTag>(char const* name, ESInputTag const& defaultValue) const {
01981       Entry const* entryPtr = retrieveUntracked(name);
01982       return entryPtr == 0 ? defaultValue : entryPtr->getESInputTag();
01983    }
01984 
01985    template<>
01986    ESInputTag
01987    ParameterSet::getUntrackedParameter<ESInputTag>(char const* name) const {
01988       return getEntryPointerOrThrow_(name)->getESInputTag();
01989    }
01990 
01991    template<>
01992    std::vector<ESInputTag>
01993    ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(char const* name,
01994                                                                std::vector<ESInputTag> const& defaultValue) const {
01995       Entry const* entryPtr = retrieveUntracked(name);
01996       return entryPtr == 0 ? defaultValue : entryPtr->getVESInputTag();
01997    }
01998 
01999    template<>
02000    std::vector<ESInputTag>
02001    ParameterSet::getUntrackedParameter<std::vector<ESInputTag> >(char const* name) const {
02002       return getEntryPointerOrThrow_(name)->getVESInputTag();
02003    }
02004 
02005   // ----------------------------------------------------------------------
02006   // EventID, VEventID
02007 
02008   template<>
02009   EventID
02010   ParameterSet::getUntrackedParameter<EventID>(char const* name, EventID const& defaultValue) const {
02011     Entry const* entryPtr = retrieveUntracked(name);
02012     return entryPtr == 0 ? defaultValue : entryPtr->getEventID();
02013   }
02014 
02015   template<>
02016   EventID
02017   ParameterSet::getUntrackedParameter<EventID>(char const* name) const {
02018     return getEntryPointerOrThrow_(name)->getEventID();
02019   }
02020 
02021   template<>
02022   std::vector<EventID>
02023   ParameterSet::getUntrackedParameter<std::vector<EventID> >(char const* name,
02024                                       std::vector<EventID> const& defaultValue) const {
02025     Entry const* entryPtr = retrieveUntracked(name);
02026     return entryPtr == 0 ? defaultValue : entryPtr->getVEventID();
02027   }
02028 
02029   template<>
02030   std::vector<EventID>
02031   ParameterSet::getUntrackedParameter<std::vector<EventID> >(char const* name) const {
02032     return getEntryPointerOrThrow_(name)->getVEventID();
02033   }
02034 
02035   // ----------------------------------------------------------------------
02036   // LuminosityBlockID, VLuminosityBlockID
02037 
02038   template<>
02039   LuminosityBlockID
02040   ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name, LuminosityBlockID const& defaultValue) const {
02041     Entry const* entryPtr = retrieveUntracked(name);
02042     return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockID();
02043   }
02044 
02045   template<>
02046   LuminosityBlockID
02047   ParameterSet::getUntrackedParameter<LuminosityBlockID>(char const* name) const {
02048     return getEntryPointerOrThrow_(name)->getLuminosityBlockID();
02049   }
02050 
02051   template<>
02052   std::vector<LuminosityBlockID>
02053   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(char const* name,
02054                                       std::vector<LuminosityBlockID> const& defaultValue) const {
02055     Entry const* entryPtr = retrieveUntracked(name);
02056     return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockID();
02057   }
02058 
02059   template<>
02060   std::vector<LuminosityBlockID>
02061   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockID> >(char const* name) const {
02062     return getEntryPointerOrThrow_(name)->getVLuminosityBlockID();
02063   }
02064 
02065   // ----------------------------------------------------------------------
02066   // EventRange, VEventRange
02067 
02068   template<>
02069   EventRange
02070   ParameterSet::getUntrackedParameter<EventRange>(char const* name, EventRange const& defaultValue) const {
02071     Entry const* entryPtr = retrieveUntracked(name);
02072     return entryPtr == 0 ? defaultValue : entryPtr->getEventRange();
02073   }
02074 
02075   template<>
02076   EventRange
02077   ParameterSet::getUntrackedParameter<EventRange>(char const* name) const {
02078     return getEntryPointerOrThrow_(name)->getEventRange();
02079   }
02080 
02081   template<>
02082   std::vector<EventRange>
02083   ParameterSet::getUntrackedParameter<std::vector<EventRange> >(char const* name,
02084                                       std::vector<EventRange> const& defaultValue) const {
02085     Entry const* entryPtr = retrieveUntracked(name);
02086     return entryPtr == 0 ? defaultValue : entryPtr->getVEventRange();
02087   }
02088 
02089   template<>
02090   std::vector<EventRange>
02091   ParameterSet::getUntrackedParameter<std::vector<EventRange> >(char const* name) const {
02092     return getEntryPointerOrThrow_(name)->getVEventRange();
02093   }
02094 
02095   // ----------------------------------------------------------------------
02096   // LuminosityBlockRange, VLuminosityBlockRange
02097 
02098   template<>
02099   LuminosityBlockRange
02100   ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name, LuminosityBlockRange const& defaultValue) const {
02101     Entry const* entryPtr = retrieveUntracked(name);
02102     return entryPtr == 0 ? defaultValue : entryPtr->getLuminosityBlockRange();
02103   }
02104 
02105   template<>
02106   LuminosityBlockRange
02107   ParameterSet::getUntrackedParameter<LuminosityBlockRange>(char const* name) const {
02108     return getEntryPointerOrThrow_(name)->getLuminosityBlockRange();
02109   }
02110 
02111   template<>
02112   std::vector<LuminosityBlockRange>
02113   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(char const* name,
02114                                       std::vector<LuminosityBlockRange> const& defaultValue) const {
02115     Entry const* entryPtr = retrieveUntracked(name);
02116     return entryPtr == 0 ? defaultValue : entryPtr->getVLuminosityBlockRange();
02117   }
02118 
02119   template<>
02120   std::vector<LuminosityBlockRange>
02121   ParameterSet::getUntrackedParameter<std::vector<LuminosityBlockRange> >(char const* name) const {
02122     return getEntryPointerOrThrow_(name)->getVLuminosityBlockRange();
02123   }
02124 
02125   // ----------------------------------------------------------------------
02126   // PSet, vPSet
02127 
02128   template<>
02129   ParameterSet
02130   ParameterSet::getUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& defaultValue) const {
02131     return getUntrackedParameterSet(name, defaultValue);
02132   }
02133 
02134   template<>
02135   VParameterSet
02136   ParameterSet::getUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& defaultValue) const {
02137     return getUntrackedParameterSetVector(name, defaultValue);
02138   }
02139 
02140   template<>
02141   ParameterSet
02142   ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& defaultValue) const {
02143     return getUntrackedParameterSet(name, defaultValue);
02144   }
02145 
02146   template<>
02147   VParameterSet
02148   ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& defaultValue) const {
02149     return getUntrackedParameterSetVector(name, defaultValue);
02150   }
02151 
02152   template<>
02153   ParameterSet
02154   ParameterSet::getUntrackedParameter<ParameterSet>(char const* name) const {
02155     return getUntrackedParameterSet(name);
02156   }
02157 
02158   template<>
02159   VParameterSet
02160   ParameterSet::getUntrackedParameter<VParameterSet>(char const* name) const {
02161     return getUntrackedParameterSetVector(name);
02162   }
02163 
02164   template<>
02165   ParameterSet
02166   ParameterSet::getUntrackedParameter<ParameterSet>(std::string const& name) const {
02167     return getUntrackedParameterSet(name);
02168   }
02169 
02170   template<>
02171   VParameterSet
02172   ParameterSet::getUntrackedParameter<VParameterSet>(std::string const& name) const {
02173     return getUntrackedParameterSetVector(name);
02174   }
02175 
02176 //----------------------------------------------------------------------------------
02177 // specializations for addParameter and addUntrackedParameter
02178 
02179   template<>
02180   void
02181   ParameterSet::addParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
02182     invalidateRegistration(name);
02183     insertParameterSet(true, name, ParameterSetEntry(value, true));
02184   }
02185 
02186   template<>
02187   void
02188   ParameterSet::addParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
02189     invalidateRegistration(name);
02190     insertVParameterSet(true, name, VParameterSetEntry(value, true));
02191   }
02192 
02193   template<>
02194   void
02195   ParameterSet::addParameter<ParameterSet>(char const* name, ParameterSet const& value) {
02196     invalidateRegistration(name);
02197     insertParameterSet(true, name, ParameterSetEntry(value, true));
02198   }
02199 
02200   template<>
02201   void
02202   ParameterSet::addParameter<VParameterSet>(char const* name, VParameterSet const& value) {
02203     invalidateRegistration(name);
02204     insertVParameterSet(true, name, VParameterSetEntry(value, true));
02205   }
02206 
02207   template<>
02208   void
02209   ParameterSet::addUntrackedParameter<ParameterSet>(std::string const& name, ParameterSet const& value) {
02210     insertParameterSet(true, name, ParameterSetEntry(value, false));
02211   }
02212 
02213   template<>
02214   void
02215   ParameterSet::addUntrackedParameter<VParameterSet>(std::string const& name, VParameterSet const& value) {
02216     insertVParameterSet(true, name, VParameterSetEntry(value, false));
02217   }
02218 
02219   template<>
02220   void
02221   ParameterSet::addUntrackedParameter<ParameterSet>(char const* name, ParameterSet const& value) {
02222     insertParameterSet(true, name, ParameterSetEntry(value, false));
02223   }
02224 
02225   template<>
02226   void
02227   ParameterSet::addUntrackedParameter<VParameterSet>(char const* name, VParameterSet const& value) {
02228     insertVParameterSet(true, name, VParameterSetEntry(value, false));
02229   }
02230 
02231 //----------------------------------------------------------------------------------
02232 // specializations for getParameterNamesForType
02233 
02234   template<>
02235   std::vector<std::string>
02236   ParameterSet::getParameterNamesForType<ParameterSet>(bool trackiness) const {
02237     std::vector<std::string> output;
02238     getParameterSetNames(output, trackiness);
02239     return output;
02240   }
02241 
02242   template<>
02243   std::vector<std::string>
02244   ParameterSet::getParameterNamesForType<VParameterSet>(bool trackiness) const {
02245     std::vector<std::string> output;
02246     getParameterSetVectorNames(output, trackiness);
02247     return output;
02248   }
02249 
02250   ParameterSet const&
02251   ParameterSet::getParameterSet(std::string const& name) const {
02252     return retrieveParameterSet(name).pset();
02253   }
02254 
02255   ParameterSet const&
02256   ParameterSet::getParameterSet(char const* name) const {
02257     return retrieveParameterSet(name).pset();
02258   }
02259 
02260   ParameterSet const&
02261   ParameterSet::getUntrackedParameterSet(std::string const& name, ParameterSet const& defaultValue) const {
02262     return getUntrackedParameterSet(name.c_str(), defaultValue);
02263   }
02264 
02265   ParameterSet const&
02266   ParameterSet::getUntrackedParameterSet(char const* name, ParameterSet const& defaultValue) const {
02267     ParameterSetEntry const* entryPtr = retrieveUntrackedParameterSet(name);
02268     if (entryPtr == 0) {
02269       if (!defaultValue.isRegistered()) {
02270         const_cast<ParameterSet&>(defaultValue).registerIt();
02271       }
02272       return defaultValue;
02273     }
02274     return entryPtr->pset();
02275   }
02276 
02277   ParameterSet const&
02278   ParameterSet::getUntrackedParameterSet(std::string const& name) const {
02279     return getUntrackedParameterSet(name.c_str());
02280   }
02281 
02282   ParameterSet const&
02283   ParameterSet::getUntrackedParameterSet(char const* name) const {
02284     ParameterSetEntry const* result = retrieveUntrackedParameterSet(name);
02285     if (result == 0)
02286       throw edm::Exception(errors::Configuration, "MissingParameter:")
02287         << "The required ParameterSet '" << name << "' was not specified.\n";
02288     return result->pset();
02289   }
02290 
02291   VParameterSet const&
02292   ParameterSet::getParameterSetVector(std::string const& name) const {
02293     return retrieveVParameterSet(name).vpset();
02294   }
02295 
02296   VParameterSet const&
02297   ParameterSet::getParameterSetVector(char const* name) const {
02298     return retrieveVParameterSet(name).vpset();
02299   }
02300 
02301   VParameterSet const&
02302   ParameterSet::getUntrackedParameterSetVector(std::string const& name, VParameterSet const& defaultValue) const {
02303     return getUntrackedParameterSetVector(name.c_str(), defaultValue);
02304   }
02305 
02306   VParameterSet const&
02307   ParameterSet::getUntrackedParameterSetVector(char const* name, VParameterSet const& defaultValue) const {
02308     VParameterSetEntry const* entryPtr = retrieveUntrackedVParameterSet(name);
02309     return entryPtr == 0 ? defaultValue : entryPtr->vpset();
02310   }
02311 
02312   VParameterSet const&
02313   ParameterSet::getUntrackedParameterSetVector(std::string const& name) const {
02314     return getUntrackedParameterSetVector(name.c_str());
02315   }
02316 
02317   VParameterSet const&
02318   ParameterSet::getUntrackedParameterSetVector(char const* name) const {
02319     VParameterSetEntry const* result = retrieveUntrackedVParameterSet(name);
02320     if (result == 0)
02321       throw edm::Exception(errors::Configuration, "MissingParameter:")
02322         << "The required ParameterSetVector '" << name << "' was not specified.\n";
02323     return result->vpset();
02324   }
02325 
02326 //----------------------------------------------------------------------------------
02327   ParameterSet::Bool
02328   operator&&(ParameterSet::Bool a, ParameterSet::Bool b) {
02329     if (a == ParameterSet::False || b == ParameterSet::False) {
02330       return ParameterSet::False;
02331     } else if (a == ParameterSet::Unknown || b == ParameterSet::Unknown) {
02332       return ParameterSet::Unknown;
02333     }
02334     return ParameterSet::True;
02335   }
02336 
02337 
02338 } // namespace edm