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")
19  << "MuonDDDNumbering finds unusual base constant:" << theBasePart;
20  }
21  if (theSuperPart<100) {
22  edm::LogWarning("Geometry")
23  << "MuonDDDNumbering finds unusual super constant:" << theSuperPart;
24  }
25  if (theLevelPart<10*theSuperPart) {
26  edm::LogWarning("Geometry")
27  << "MuonDDDNumbering finds unusual level constant:" << theLevelPart;
28  }
29  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
30  edm::LogWarning("Geometry")
31  << "MuonDDDNumbering finds unusual start value for copy numbers:"
32  << theStartCopyNo;
33  }
34 
35 #ifdef LOCAL_DEBUG
36  edm::LogVerbatim("Geometry")
37  << "MuonDDDNumbering configured with"
38  << " Level = " << theLevelPart << " Super = " << theSuperPart
39  << " Base = " << theBasePart << " StartCopyNo = " << theStartCopyNo;
40 #endif
41 
42 }
43 
46 
47 #ifdef LOCAL_DEBUG
48  edm::LogVerbatim("Geometry")
49  << "MuonDDDNumbering create MuonBaseNumber for " << history;
50 #endif
51 
52  //loop over all parents and check
53  DDGeoHistory::const_iterator cur=history.begin();
54  DDGeoHistory::const_iterator end=history.end();
55  while (cur!=end) {
56  const DDLogicalPart & ddlp = cur->logicalPart();
57  const int tag=getInt("CopyNoTag",ddlp)/theLevelPart;
58  if (tag>0) {
59  const int offset=getInt("CopyNoOffset",ddlp);
60  const int copyno=(cur->copyno())+offset%theSuperPart;
61  const int super=offset/theSuperPart;
62  num.addBase(tag,super,copyno-theStartCopyNo);
63  }
64  cur++;
65  }
66 
67 #ifdef LOCAL_DEBUG
68  edm::LogVerbatim("Geometry") << "MuonDDDNumbering::" << num.getLevels();
69  for (int i=1;i<=num.getLevels();i++) {
70  edm::LogVerbatim("Geometry")
71  << "[" << i << "] " << num.getSuperNo(i) << " " << num.getBaseNo(i);
72  }
73 #endif
74 
75  return num;
76 }
77 
79 {
80  DDValue val(s);
81  std::vector<const DDsvalues_type *> result = part.specifics();
82  std::vector<const DDsvalues_type *>::iterator it = result.begin();
83  bool foundIt = false;
84  for (; it != result.end(); ++it)
85  {
86  foundIt = DDfetch(*it,val);
87  if (foundIt) break;
88  }
89  if (foundIt)
90  {
91  std::vector<double> temp = val.doubles();
92  if (temp.size() != 1)
93  {
94  edm::LogError("Geometry")
95  << "MuonDDDNumbering:: ERROR: I need only 1 " << s
96  << " in DDLogicalPart " << part.name();
97  abort();
98  }
99  return int(temp[0]);
100  }
101  else return 0;
102 }
103 
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:140
const N & name() const
Definition: DDBase.h:74
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:81
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)