CMS 3D CMS Logo

DD4hep_MuonNumbering.cc
Go to the documentation of this file.
4 
5 using namespace cms;
6 using namespace edm;
7 
8 const MuonBaseNumber
11 
12  int levelPart = get("level");
13  int superPart = get("super");
14  int basePart = get("base");
15  int startCopyNo = get("xml_starts_with_copyno");
16 
17  // some consistency checks
18  if(basePart != 1) {
19  edm::LogError("Geometry") << "MuonNumbering finds unusual base constant:"
20  << basePart;
21  }
22  if(superPart < 100) {
23  edm::LogError("Geometry") << "MuonNumbering finds unusual super constant:"
24  << superPart;
25  }
26  if(levelPart < 10*superPart) {
27  edm::LogError("Geometry") << "MuonNumbering finds unusual level constant:"
28  << levelPart;
29  }
30  if((startCopyNo !=0 ) && (startCopyNo != 1)) {
31  edm::LogError("Geometry") << "MuonNumbering finds unusual start value for copy numbers:"
32  << startCopyNo;
33  }
34  int ctr(0);
35  for(auto const& it : nodes.tags) {
36  int tag = it/levelPart;
37  if(tag > 0) {
38  int offset = nodes.offsets[ctr];
39  int copyno = nodes.copyNos[ctr] + offset%superPart;
40  int super = offset/superPart;
41  num.addBase(tag, super, copyno - startCopyNo);
42  }
43  ++ctr;
44  }
45  return num;
46 }
47 
48 const int
49 MuonNumbering::get(const char* key) const {
50  int result(0);
51  auto const& it = values_.find(key);
52  if(it != end(values_))
53  result = it->second;
54  return result;
55 }
56 
57 void
58 MuonNumbering::put(std::string_view str, int num) {
59  values_.emplace(str, num);
60 }
61 
63 
void addBase(const int level, const int super, const int base)
std::vector< int > copyNos
Definition: ExpandedNodes.h:29
std::vector< double > offsets
Definition: ExpandedNodes.h:28
const MuonBaseNumber geoHistoryToBaseNumber(const cms::ExpandedNodes &) const
#define end
Definition: vmac.h:39
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
Namespace of DDCMS conversion namespace.
const int get(const char *) const
HLT enums.
std::vector< double > tags
Definition: ExpandedNodes.h:27
#define str(s)
void put(std::string_view, int)