CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonDDDNumbering.cc
Go to the documentation of this file.
4 
5 #include <iostream>
6 
7 //#define LOCAL_DEBUG
8 
10  // MuonDDDConstants muonConstants;
11  theLevelPart=muonConstants.getValue("level");
12  theSuperPart=muonConstants.getValue("super");
13  theBasePart=muonConstants.getValue("base");
14  theStartCopyNo=muonConstants.getValue("xml_starts_with_copyno");
15 
16  // some consistency checks
17 
18  if (theBasePart!=1) {
19  std::cout << "MuonDDDNumbering finds unusual base constant:"
20  <<theBasePart<<std::endl;
21  }
22  if (theSuperPart<100) {
23  std::cout << "MuonDDDNumbering finds unusual super constant:"
24  <<theSuperPart<<std::endl;
25  }
26  if (theLevelPart<10*theSuperPart) {
27  std::cout << "MuonDDDNumbering finds unusual level constant:"
28  <<theLevelPart<<std::endl;
29  }
30  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
31  std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
32  <<theStartCopyNo<<std::endl;
33  }
34 
35 #ifdef LOCAL_DEBUG
36  std::cout << "MuonDDDNumbering configured with"<<std::endl;
37  std::cout << "Level = "<<theLevelPart<<" ";
38  std::cout << "Super = "<<theSuperPart<<" ";
39  std::cout << "Base = "<<theBasePart<<" ";
40  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
41 #endif
42 
43 }
44 
47 
48 #ifdef LOCAL_DEBUG
49  std::cout << "MuonDDDNumbering create MuonBaseNumber for"<<std::endl;
50  std::cout << history <<std::endl;
51 #endif
52 
53  //loop over all parents and check
54  DDGeoHistory::const_iterator cur=history.begin();
55  DDGeoHistory::const_iterator end=history.end();
56  while (cur!=end) {
57  const DDLogicalPart & ddlp = cur->logicalPart();
58  const int tag=getInt("CopyNoTag",ddlp)/theLevelPart;
59  if (tag>0) {
60  const int offset=getInt("CopyNoOffset",ddlp);
61  const int copyno=(cur->copyno())+offset%theSuperPart;
62  const int super=offset/theSuperPart;
63  num.addBase(tag,super,copyno-theStartCopyNo);
64  }
65  cur++;
66  }
67 
68 #ifdef LOCAL_DEBUG
69  std::cout << num.getLevels() <<std::endl;
70  for (int i=1;i<=num.getLevels();i++) {
71  std::cout << num.getSuperNo(i)<<" "<<num.getBaseNo(i)<<std::endl;
72  }
73 #endif
74 
75  return num;
76 }
77 
78 int MuonDDDNumbering::getInt(const std::string & s, const DDLogicalPart & part)
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  std::cout << " ERROR: I need only 1 " << s << " in DDLogicalPart " << part.name() << std::endl;
95  abort();
96  }
97  return int(temp[0]);
98  }
99  else return 0;
100 }
101 
int i
Definition: DBlmapReader.cc:9
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:134
const N & name() const
Definition: DDBase.h:82
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:102
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
tuple result
Definition: query.py:137
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
#define end
Definition: vmac.h:38
unsigned int offset(bool)
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:21
long long int num
Definition: procUtils.cc:71
int getLevels() const
int getSuperNo(int level) const
tuple cout
Definition: gather_cfg.py:121
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history)