CMS 3D CMS Logo

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