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 #ifdef LOCAL_DEBUG
15  std::cout << "MuonDDDConstants;:MuonDDDConstants ( const DDCompactView& cpv ) constructor " << std::endl;
16 #endif
17  std::string attribute = "OnlyForMuonNumbering";
18  std::string value = "any";
19  DDValue val(attribute, value, 0.0);
20 
22  filter.setCriteria(val,
24  DDLogOp::AND,
25  true, // compare strings otherwise doubles
26  true // use merged-specifics or simple-specifics
27  );
28  DDFilteredView fview(cpv);
29  fview.addFilter(filter);
30 
31  DDValue val2("level");
32  const DDsvalues_type params(fview.mergedSpecifics());
33 
34  fview.firstChild();
35 
36  const DDsvalues_type mySpecs (fview.mergedSpecifics());
37 #ifdef LOCAL_DEBUG
38  std::cout << "mySpecs.size() = " << mySpecs.size() << std::endl;
39 #endif
40  if ( mySpecs.size() < 25 ) {
41  edm::LogError("MuonDDDConstants") << " MuonDDDConstants: Missing SpecPars from DetectorDescription." << std::endl;
42  std::string msg = "MuonDDDConstants does not have the appropriate number of SpecPars associated";
43  msg+= " with the part //MUON.";
44  throw cms::Exception("GeometryBuildFailure", msg);
45  }
46 
47  DDsvalues_type::const_iterator bit = mySpecs.begin();
48  DDsvalues_type::const_iterator eit = mySpecs.end();
49  for ( ; bit != eit; ++bit ) {
50  if ( bit->second.isEvaluated() ) {
51  this->addValue( bit->second.name(), int(bit->second.doubles()[0]) );
52 #ifdef LOCAL_DEBUG
53  std::cout << "adding DDConstant of " << bit->second.name() << " = " << int(bit->second.doubles()[0]) << std::endl;
54 #endif
55  }
56  // std::cout << "DDConstant of " << bit->second.name() << " = " << bit->second.strings()[0] << std::endl;
57  }
58 
59 }
60 
62  // std::cout << "destructed!!!" << std::endl;
63 }
64 
66 #ifdef LOCAL_DEBUG
67  std::cout << "about to look for ... " << name << std::endl;
68 #endif
69  if ( namesAndValues_.size() == 0 ) {
70  std::cout << "MuonDDDConstants::getValue HAS NO VALUES!" << std::endl;
71  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
72  }
73 
74  std::map<std::string, int>::const_iterator findIt = namesAndValues_.find(name);
75 
76  if ( findIt == namesAndValues_.end() ) {
77  std::cout << "MuonDDDConstants::getValue was asked for " << name << " and had NO clue!" << std::endl;
78  throw cms::Exception("GeometryBuildFailure", "MuonDDDConstants does not have requested value for " + name);
79  }
80 
81  return findIt->second;
82 }
83 
86 }
87 
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
type of data representation of DDCompactView
Definition: DDCompactView.h:76
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 ...
tuple cout
Definition: gather_cfg.py:121
tuple val2
Definition: value.py:54
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32