CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonDDDConstants.cc
Go to the documentation of this file.
2 
3 
6 
9 
10 
11 //#define LOCAL_DEBUG
12 
14  // std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl;
15  std::string attribute = "OnlyForMuonNumbering";
16  std::string value = "any";
17  DDValue val(attribute, value, 0.0);
18 
20  filter.setCriteria(val,
23  true, // compare strings otherwise doubles
24  true // use merged-specifics or simple-specifics
25  );
26  DDFilteredView fview(cpv);
27  fview.addFilter(filter);
28 
29  DDValue val2("level");
30  const DDsvalues_type params(fview.mergedSpecifics());
31 
32  fview.firstChild();
33 
34  const DDsvalues_type mySpecs (fview.mergedSpecifics());
35  //std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl;
36  if ( mySpecs.size() < 25 ) {
37  edm::LogError("MuonDDDConstants") << " MuonDDDConstants: Missing SpecPars from DetectorDescription." << std::endl;
38  std::string msg = "MuonDDDConstants does not have the appropriate number of SpecPars associated";
39  msg+= " with the part //MUON.";
40  throw cms::Exception("GeometryBuildFailure", msg);
41  }
42 
43  DDsvalues_type::const_iterator bit = mySpecs.begin();
44  DDsvalues_type::const_iterator eit = mySpecs.end();
45  for ( ; bit != eit; ++bit ) {
46  if ( bit->second.isEvaluated() ) {
47  this->addValue( bit->second.name(), int(bit->second.doubles()[0]) );
48  // std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl;
49  }
50  // std::cout << "DDConstant of " << bit->second.name() << " = " << bit->second.strings()[0] << std::endl;
51  }
52 
53 }
54 
56  // std::cout << "destructed!!!" << std::endl;
57 }
58 
59 int MuonDDDConstants::getValue( const std::string& name ) const {
60  // std::cout << "about to look for ... " << name << std::endl;
61 
62  if ( namesAndValues_.size() == 0 ) {
63  std::cout << "MuonDDDConstants::getValue HAS NO VALUES!" << std::endl;
64  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
65  }
66 
67  std::map<std::string, int>::const_iterator findIt = namesAndValues_.find(name);
68 
69  if ( findIt == namesAndValues_.end() ) {
70  std::cout << "MuonDDDConstants::getValue was asked for " << name << " and had NO clue!" << std::endl;
71  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
72  }
73 
74  return findIt->second;
75 }
76 
77 void MuonDDDConstants::addValue(const std::string& name, const int& value) {
79 }
80 
void addFilter(const DDFilter &, log_op op=AND)
type of data representation of DDCompactView
Definition: DDCompactView.h:77
int getValue(const std::string &name) const
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
std::map< std::string, int > namesAndValues_
void addValue(const std::string &name, const int &value)
DDsvalues_type mergedSpecifics() const
bool firstChild()
set the current node to the first child ...
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
tuple cout
Definition: gather_cfg.py:121
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37