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 #ifdef LOCAL_DEBUG
16  std::cout << "MuonBaseNumber::addBase was asked to add "
17  <<num.level()<<" "
18  <<num.super()<<" "
19  <<num.base()
20  <<" to existing level "
21  <<(*cur).level()<<" "
22  <<(*cur).super()<<" "
23  <<(*cur).base() << " but refused.";
24 #endif
25  return; // don't overwrite current volume stored
26  }
27  cur++;
28  }
29 
30  cur=sortedBaseNumber.begin();
31  while (cur!=end) {
32  if (num.level()<(*cur).level()) break;
33  cur++;
34  }
35  sortedBaseNumber.insert(cur,num);
36 
37 #ifdef LOCAL_DEBUG
38  cur=sortedBaseNumber.begin();
39  end=sortedBaseNumber.end();
40  std::cout << "MuonBaseNumber::AddBase ";
41  while (cur!=end) {
42  std::cout<<(*cur).level()<<" ";
43  std::cout<<(*cur).super()<<" ";
44  std::cout<<(*cur).base();
45  std::cout<<",";
46  cur++;
47  }
48  std::cout <<std::endl;
49 #endif
50 
51 }
52 
53 void MuonBaseNumber::addBase(const int level,const int super,const int base){
54  LevelBaseNumber num(level,super,base);
55  addBase(num);
56 }
57 
59  return sortedBaseNumber.size();
60 }
61 
63  basenumber_type::const_iterator cur=sortedBaseNumber.begin();
64  basenumber_type::const_iterator end=sortedBaseNumber.end();
65  while (cur!=end) {
66  if ((*cur).level()==level) {
67  return (*cur).super();
68  }
69  cur++;
70  }
71  return 0;
72 }
73 
75  basenumber_type::const_iterator cur=sortedBaseNumber.begin();
76  basenumber_type::const_iterator end=sortedBaseNumber.end();
77  while (cur!=end) {
78  if ((*cur).level()==level) {
79  return (*cur).base();
80  }
81  cur++;
82  }
83  return 0;
84 }
85 
86 
87 
88 
89 
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