CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonBaseNumber.cc
Go to the documentation of this file.
3 #include <iostream>
4 
5 //#define LOCAL_DEBUG
6 
8  basenumber_type::iterator cur=sortedBaseNumber.begin();
9  basenumber_type::iterator end=sortedBaseNumber.end();
10 
11  // do a small check if level is already occupied
12 
13  while (cur!=end) {
14  if (num.level()==(*cur).level()) {
15  LogDebug("MuonBaseNumber") << "MuonBaseNumber::addBase was asked to add "
16  <<num.level()<<" "
17  <<num.super()<<" "
18  <<num.base()
19  <<" to existing level "
20  <<(*cur).level()<<" "
21  <<(*cur).super()<<" "
22  <<(*cur).base() << " but refused.";
23  return; // don't overwrite current volume stored
24  }
25  cur++;
26  }
27 
28  cur=sortedBaseNumber.begin();
29  while (cur!=end) {
30  if (num.level()<(*cur).level()) break;
31  cur++;
32  }
33  sortedBaseNumber.insert(cur,num);
34 
35 #ifdef LOCAL_DEBUG
36  cur=sortedBaseNumber.begin();
37  end=sortedBaseNumber.end();
38  std::cout << "MuonBaseNumber::AddBase ";
39  while (cur!=end) {
40  std::cout<<(*cur).level()<<" ";
41  std::cout<<(*cur).super()<<" ";
42  std::cout<<(*cur).base();
43  std::cout<<",";
44  cur++;
45  }
46  std::cout <<std::endl;
47 #endif
48 
49 }
50 
51 void MuonBaseNumber::addBase(const int level,const int super,const int base){
52  LevelBaseNumber num(level,super,base);
53  addBase(num);
54 }
55 
57  return sortedBaseNumber.size();
58 }
59 
61  basenumber_type::const_iterator cur=sortedBaseNumber.begin();
62  basenumber_type::const_iterator end=sortedBaseNumber.end();
63  while (cur!=end) {
64  if ((*cur).level()==level) {
65  return (*cur).super();
66  }
67  cur++;
68  }
69  return 0;
70 }
71 
73  basenumber_type::const_iterator cur=sortedBaseNumber.begin();
74  basenumber_type::const_iterator end=sortedBaseNumber.end();
75  while (cur!=end) {
76  if ((*cur).level()==level) {
77  return (*cur).base();
78  }
79  cur++;
80  }
81  return 0;
82 }
83 
84 
85 
86 
87 
#define LogDebug(id)
tuple base
Main Program
Definition: newFWLiteAna.py:92
void addBase(const int level, const int super, const int base)
int getBaseNo(int level) const
int level() const
int base() const
#define end
Definition: vmac.h:38
int super() const
long long int num
Definition: procUtils.cc:71
int getLevels() const
int getSuperNo(int level) const
basenumber_type sortedBaseNumber
tuple cout
Definition: gather_cfg.py:121
tuple level
Definition: testEve_cfg.py:34