#include <Geometry/MuonNumbering/interface/MuonDDDConstants.h>
Public Member Functions | |
void | addValue (const std::string &name, const int &value) |
int | getValue (const std::string &name) const |
MuonDDDConstants (const DDCompactView &cpv) | |
~MuonDDDConstants () | |
Private Member Functions | |
MuonDDDConstants () | |
Private Attributes | |
std::map< std::string, int > | namesAndValues_ |
Definition at line 23 of file MuonDDDConstants.h.
MuonDDDConstants::MuonDDDConstants | ( | const DDCompactView & | cpv | ) |
Definition at line 13 of file MuonDDDConstants.cc.
References DDFilteredView::addFilter(), addValue(), DDSpecificsFilter::AND, lat::endl(), Exception, filter, DDFilteredView::firstChild(), int, DDFilteredView::mergedSpecifics(), alivecheck_mergeAndRegister::msg, DDSpecificsFilter::not_equals, params, DDSpecificsFilter::setCriteria(), and value.
00013 { 00014 // std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl; 00015 std::string attribute = "OnlyForMuonNumbering"; 00016 std::string value = "any"; 00017 DDValue val(attribute, value, 0.0); 00018 00019 DDSpecificsFilter filter; 00020 filter.setCriteria(val, 00021 DDSpecificsFilter::not_equals, 00022 DDSpecificsFilter::AND, 00023 true, // compare strings otherwise doubles 00024 true // use merged-specifics or simple-specifics 00025 ); 00026 DDFilteredView fview(cpv); 00027 fview.addFilter(filter); 00028 00029 DDValue val2("level"); 00030 const DDsvalues_type params(fview.mergedSpecifics()); 00031 00032 fview.firstChild(); 00033 00034 const DDsvalues_type mySpecs (fview.mergedSpecifics()); 00035 //std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl; 00036 if ( mySpecs.size() < 25 ) { 00037 edm::LogError("MuonDDDConstants") << " MuonDDDConstants: Missing SpecPars from DetectorDescription." << std::endl; 00038 std::string msg = "MuonDDDConstants does not have the appropriate number of SpecPars associated"; 00039 msg+= " with the part //MUON."; 00040 throw cms::Exception("GeometryBuildFailure", msg); 00041 } 00042 00043 DDsvalues_type::const_iterator bit = mySpecs.begin(); 00044 DDsvalues_type::const_iterator eit = mySpecs.end(); 00045 for ( ; bit != eit; ++bit ) { 00046 if ( bit->second.isEvaluated() ) { 00047 this->addValue( bit->second.name(), int(bit->second.doubles()[0]) ); 00048 // std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl; 00049 } 00050 // std::cout << "DDConstant of " << bit->second.name() << " = " << bit->second.strings()[0] << std::endl; 00051 } 00052 00053 }
MuonDDDConstants::~MuonDDDConstants | ( | ) |
MuonDDDConstants::MuonDDDConstants | ( | ) | [private] |
Definition at line 77 of file MuonDDDConstants.cc.
References namesAndValues_.
Referenced by MuonDDDConstants().
00077 { 00078 namesAndValues_[name] = value; 00079 }
int MuonDDDConstants::getValue | ( | const std::string & | name | ) | const |
Definition at line 59 of file MuonDDDConstants.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), Exception, and namesAndValues_.
Referenced by RPCNumberingScheme::initMe(), CSCNumberingScheme::initMe(), DTNumberingScheme::initMe(), MuonDDDNumbering::MuonDDDNumbering(), MuonG4Numbering::MuonG4Numbering(), and MuonRpcFrameRotation::MuonRpcFrameRotation().
00059 { 00060 // std::cout << "about to look for ... " << name << std::endl; 00061 00062 if ( namesAndValues_.size() == 0 ) { 00063 std::cout << "MuonDDDConstants::getValue HAS NO VALUES!" << std::endl; 00064 throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name); 00065 } 00066 00067 std::map<std::string, int>::const_iterator findIt = namesAndValues_.find(name); 00068 00069 if ( findIt == namesAndValues_.end() ) { 00070 std::cout << "MuonDDDConstants::getValue was asked for " << name << " and had NO clue!" << std::endl; 00071 throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name); 00072 } 00073 00074 return findIt->second; 00075 }
std::map<std::string, int> MuonDDDConstants::namesAndValues_ [private] |