CMS 3D CMS Logo

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