CMS 3D CMS Logo

MuonDDDNumbering.cc
Go to the documentation of this file.
5 
6 //#define LOCAL_DEBUG
7 
9  // MuonDDDConstants 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("Geometry") << "MuonDDDNumbering finds unusual base constant:" << theBasePart;
19  }
20  if (theSuperPart < 100) {
21  edm::LogWarning("Geometry") << "MuonDDDNumbering finds unusual super constant:" << theSuperPart;
22  }
23  if (theLevelPart < 10 * theSuperPart) {
24  edm::LogWarning("Geometry") << "MuonDDDNumbering finds unusual level constant:" << theLevelPart;
25  }
26  if ((theStartCopyNo != 0) && (theStartCopyNo != 1)) {
27  edm::LogWarning("Geometry") << "MuonDDDNumbering finds unusual start value for copy numbers:" << theStartCopyNo;
28  }
29 
30 #ifdef LOCAL_DEBUG
31  edm::LogVerbatim("Geometry") << "MuonDDDNumbering configured with"
32  << " Level = " << theLevelPart << " Super = " << theSuperPart
33  << " Base = " << theBasePart << " StartCopyNo = " << theStartCopyNo;
34 #endif
35 }
36 
39 
40 #ifdef LOCAL_DEBUG
41  edm::LogVerbatim("Geometry") << "MuonDDDNumbering create MuonBaseNumber for " << history;
42 #endif
43 
44  //loop over all parents and check
45  DDGeoHistory::const_iterator cur = history.begin();
46  DDGeoHistory::const_iterator end = history.end();
47  while (cur != end) {
48  const DDLogicalPart &ddlp = cur->logicalPart();
49  const int tag = getInt("CopyNoTag", ddlp) / theLevelPart;
50  if (tag > 0) {
51  const int offset = getInt("CopyNoOffset", ddlp);
52  const int copyno = (cur->copyno()) + offset % theSuperPart;
53  const int super = offset / theSuperPart;
54  num.addBase(tag, super, copyno - theStartCopyNo);
55  }
56  cur++;
57  }
58 
59 #ifdef LOCAL_DEBUG
60  edm::LogVerbatim("Geometry") << "MuonDDDNumbering::" << num.getLevels();
61  for (int i = 1; i <= num.getLevels(); i++) {
62  edm::LogVerbatim("Geometry") << "[" << i << "] " << num.getSuperNo(i) << " " << num.getBaseNo(i);
63  }
64 #endif
65 
66  return num;
67 }
68 
70  DDValue val(s);
71  std::vector<const DDsvalues_type *> result = part.specifics();
72  std::vector<const DDsvalues_type *>::iterator it = result.begin();
73  bool foundIt = false;
74  for (; it != result.end(); ++it) {
75  foundIt = DDfetch(*it, val);
76  if (foundIt)
77  break;
78  }
79  if (foundIt) {
80  std::vector<double> temp = val.doubles();
81  if (temp.size() != 1) {
82  edm::LogError("Geometry") << "MuonDDDNumbering:: ERROR: I need only 1 " << s << " in DDLogicalPart "
83  << part.name();
84  abort();
85  }
86  return int(temp[0]);
87  } else
88  return 0;
89 }
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:111
const N & name() const
Definition: DDBase.h:59
void addBase(const int level, const int super, const int base)
int getBaseNo(int level) const
MuonDDDNumbering(const MuonDDDConstants &muonConstants)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode) ...
int getValue(const std::string &name) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
#define end
Definition: vmac.h:39
int getInt(const std::string &s, const DDLogicalPart &part)
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
part
Definition: HCALResponse.h:20
int getLevels() const
int getSuperNo(int level) const
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history)