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