CMS 3D CMS Logo

MuonGeometryNumbering.cc
Go to the documentation of this file.
5 
6 //#define EDM_ML_DEBUG
7 
9  // Get constant values from muonConstants
10  theLevelPart = muonConstants.getValue("level");
11  theSuperPart = muonConstants.getValue("super");
12  theBasePart = muonConstants.getValue("base");
13  theStartCopyNo = muonConstants.getValue("xml_starts_with_copyno");
14 
15  // some consistency checks
16 
17  if (theBasePart != 1) {
18  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual base constant:" << theBasePart;
19  }
20  if (theSuperPart < 100) {
21  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual super constant:" << theSuperPart;
22  }
23  if (theLevelPart < 10 * theSuperPart) {
24  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual level constant:" << theLevelPart;
25  }
26  if ((theStartCopyNo != 0) && (theStartCopyNo != 1)) {
27  edm::LogWarning("MuonGeom") << "MuonGeometryNumbering finds unusual start value for copy numbers:"
28  << theStartCopyNo;
29  }
30 
31 #ifdef EDM_ML_DEBUG
32  edm::LogVerbatim("MuonGeom") << "MuonGeometryNumbering configured with"
33  << " Level = " << theLevelPart << " Super = " << theSuperPart
34  << " Base = " << theBasePart << " StartCopyNo = " << theStartCopyNo;
35 #endif
36 }
37 
40 
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("MuonGeom") << "MuonGeometryNumbering create MuonBaseNumber for " << history;
43 #endif
44 
45  //loop over all parents and check
46  DDGeoHistory::const_iterator cur = history.begin();
47  DDGeoHistory::const_iterator end = history.end();
48  while (cur != end) {
49  const DDLogicalPart &ddlp = cur->logicalPart();
50  const int tag = getInt("CopyNoTag", ddlp) / theLevelPart;
51  if (tag > 0) {
52  const int offset = getInt("CopyNoOffset", ddlp);
53  const int copyno = (cur->copyno()) + offset % theSuperPart;
54  const int super = offset / theSuperPart;
55  num.addBase(tag, super, copyno - theStartCopyNo);
56  }
57  cur++;
58  }
59 
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("MuonGeom") << "MuonGeometryNumbering::" << num.getLevels();
62  for (int i = 1; i <= num.getLevels(); i++) {
63  edm::LogVerbatim("MuonGeom") << "[" << i << "] " << num.getSuperNo(i) << " " << num.getBaseNo(i);
64  }
65 #endif
66 
67  return num;
68 }
69 
72 
73  int ctr(0);
74  for (auto const &it : nodes.tags) {
75  int tag = it / theLevelPart;
76  if (tag > 0) {
77  int offset = nodes.offsets[ctr];
78  int copyno = nodes.copyNos[ctr] + offset % theSuperPart;
79  int super = offset / theSuperPart;
80  num.addBase(tag, super, copyno - theStartCopyNo);
81  }
82  ++ctr;
83  }
84  return num;
85 }
86 
88  DDValue val(s);
89  std::vector<const DDsvalues_type *> result = part.specifics();
90  std::vector<const DDsvalues_type *>::iterator it = result.begin();
91  bool foundIt = false;
92  for (; it != result.end(); ++it) {
93  foundIt = DDfetch(*it, val);
94  if (foundIt)
95  break;
96  }
97  if (foundIt) {
98  std::vector<double> temp = val.doubles();
99  if (temp.size() != 1) {
100  edm::LogError("MuonGeom") << "MuonGeometryNumbering:: ERROR: I need only 1 " << s << " in DDLogicalPart "
101  << part.name();
102  abort();
103  }
104  return int(temp[0]);
105  } else
106  return 0;
107 }
int getValue(const std::string &name) const
Log< level::Info, true > LogVerbatim
int getInt(const std::string &s, const DDLogicalPart &part) const
Log< level::Error, false > LogError
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
part
Definition: HCALResponse.h:20
MuonGeometryNumbering(const MuonGeometryConstants &muonConstants)
Log< level::Warning, false > LogWarning
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const