CMS 3D CMS Logo

MuonDDDConstants.cc
Go to the documentation of this file.
2 
3 
6 
9 
10 
11 //#define LOCAL_DEBUG
12 
14 #ifdef LOCAL_DEBUG
15  std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl;
16 #endif
17  std::string attribute = "OnlyForMuonNumbering";
18 
20  DDFilteredView fview(cpv,filter);
21 
22  DDValue val2("level");
23  const DDsvalues_type params(fview.mergedSpecifics());
24 
25  fview.firstChild();
26 
27  const DDsvalues_type mySpecs (fview.mergedSpecifics());
28 #ifdef LOCAL_DEBUG
29  std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl;
30 #endif
31  if ( mySpecs.size() < 25 ) {
32  edm::LogError("MuonDDDConstants") << " MuonDDDConstants: Missing SpecPars from DetectorDescription." << std::endl;
33  std::string msg = "MuonDDDConstants does not have the appropriate number of SpecPars associated";
34  msg+= " with the part //MUON.";
35  throw cms::Exception("GeometryBuildFailure", msg);
36  }
37 
38  DDsvalues_type::const_iterator bit = mySpecs.begin();
39  DDsvalues_type::const_iterator eit = mySpecs.end();
40  for ( ; bit != eit; ++bit ) {
41  if ( bit->second.isEvaluated() ) {
42  this->addValue( bit->second.name(), int(bit->second.doubles()[0]) );
43 #ifdef LOCAL_DEBUG
44  std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl;
45 #endif
46  }
47  }
48 
49 }
50 
52  // std::cout << "destructed!!!" << std::endl;
53 }
54 
56 #ifdef LOCAL_DEBUG
57  std::cout << "about to look for ... " << name << std::endl;
58 #endif
59  if ( namesAndValues_.size() == 0 ) {
60  std::cout << "MuonDDDConstants::getValue HAS NO VALUES!" << std::endl;
61  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
62  }
63 
64  std::map<std::string, int>::const_iterator findIt = namesAndValues_.find(name);
65 
66  if ( findIt == namesAndValues_.end() ) {
67  std::cout << "MuonDDDConstants::getValue was asked for " << name << " and had NO clue!" << std::endl;
68  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
69  }
70 #ifdef LOCAL_DEBUG
71  std::cout << "Value for " << name << " is " << findIt->second << std::endl;
72 #endif
73  return findIt->second;
74 }
75 
78 }
79 
type of data representation of DDCompactView
Definition: DDCompactView.h:90
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:20
Definition: value.py:1
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 ...