CMS 3D CMS Logo

MuonBaseNumber.cc
Go to the documentation of this file.
3 
4 //#define EDM_ML_DEBUG
5 
7  basenumber_type::iterator cur = sortedBaseNumber.begin();
8  basenumber_type::iterator end = sortedBaseNumber.end();
9 
10  // do a small check if level is already occupied
11 
12  while (cur != end) {
13  if (num.level() == (*cur).level()) {
14 #ifdef EDM_ML_DEBUG
15  edm::LogVerbatim("MuonGeom") << "MuonBaseNumber::addBase was asked to add " << num.level() << " " << num.super()
16  << " " << num.base() << " to existing level " << (*cur).level() << " "
17  << (*cur).super() << " " << (*cur).base() << " but refused.";
18 #endif
19  return; // don't overwrite current volume stored
20  }
21  cur++;
22  }
23 
24  cur = sortedBaseNumber.begin();
25  while (cur != end) {
26  if (num.level() < (*cur).level())
27  break;
28  cur++;
29  }
30  sortedBaseNumber.insert(cur, num);
31 
32 #ifdef EDM_ML_DEBUG
33  cur = sortedBaseNumber.begin();
34  end = sortedBaseNumber.end();
35  edm::LogVerbatim("MuonGeom") << "MuonBaseNumber::AddBase ";
36  unsigned int k(0);
37  while (cur != end) {
38  edm::LogVerbatim("MuonGeom") << "[" << k << "] " << (*cur).level() << " " << (*cur).super() << " " << (*cur).base();
39  cur++;
40  ++k;
41  }
42 #endif
43 }
44 
45 void MuonBaseNumber::addBase(const int level, const int super, const int base) {
46  LevelBaseNumber num(level, super, base);
47  addBase(num);
48 }
49 
50 int MuonBaseNumber::getLevels() const { return sortedBaseNumber.size(); }
51 
53  basenumber_type::const_iterator cur = sortedBaseNumber.begin();
54  basenumber_type::const_iterator end = sortedBaseNumber.end();
55  while (cur != end) {
56  if ((*cur).level() == level) {
57  return (*cur).super();
58  }
59  cur++;
60  }
61  return 0;
62 }
63 
65  basenumber_type::const_iterator cur = sortedBaseNumber.begin();
66  basenumber_type::const_iterator end = sortedBaseNumber.end();
67  while (cur != end) {
68  if ((*cur).level() == level) {
69  return (*cur).base();
70  }
71  cur++;
72  }
73  return 0;
74 }
Log< level::Info, true > LogVerbatim
void addBase(const int level, const int super, const int base)
int getLevels() const
int getBaseNo(int level) const
basenumber_type sortedBaseNumber
int getSuperNo(int level) const