CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ME0NumberingScheme.cc
Go to the documentation of this file.
6 
7 #include <iostream>
8 
9 //#define LOCAL_DEBUG
10 
12  initMe(muonConstants);
13 }
14 
16  MuonDDDConstants muonConstants(cpv);
17  initMe(muonConstants);
18 }
19 
20 void ME0NumberingScheme::initMe ( const MuonDDDConstants& muonConstants ) {
21  int theLevelPart= muonConstants.getValue("level");
22  theRegionLevel = muonConstants.getValue("m0_region")/theLevelPart;
23  theLayerLevel = muonConstants.getValue("m0_layer")/theLevelPart;
24  theSectorLevel = muonConstants.getValue("m0_sector")/theLevelPart;
25  theRollLevel = muonConstants.getValue("m0_roll")/theLevelPart;
26 
27  // Debug using LOCAL_DEBUG
28  #ifdef LOCAL_DEBUG
29  std::cout << "Initialize ME0NumberingScheme" <<std::endl;
30  std::cout << "theRegionLevel " << theRegionLevel <<std::endl;
31  std::cout << "theLayerLevel " << theLayerLevel <<std::endl;
32  std::cout << "theSectorLevel " << theSectorLevel <<std::endl;
33  std::cout << "theRollLevel " << theRollLevel <<std::endl;
34  #endif
35  // -----------------------
36 
37  // Debug using LogDebug
38  std::stringstream DebugStringStream;
39  DebugStringStream << "Initialize ME0NumberingScheme" <<std::endl;
40  DebugStringStream << "theRegionLevel " << theRegionLevel <<std::endl;
41  DebugStringStream << "theLayerLevel " << theLayerLevel <<std::endl;
42  DebugStringStream << "theSectorLevel " << theSectorLevel <<std::endl;
43  DebugStringStream << "theRollLevel " << theRollLevel <<std::endl;
44  std::string DebugString = DebugStringStream.str();
45  edm::LogVerbatim("ME0NumberingScheme")<<DebugString;
46  // --------------------
47 }
48 
50 
51  edm::LogVerbatim("ME0NumberingScheme")<<"ME0NumberingScheme::baseNumberToUnitNumber BEGIN "<<std::endl;
52  // Debug using LOCAL_DEBUG
53  #ifdef LOCAL_DEBUG
54  std::cout << "ME0Numbering "<<num.getLevels()<<std::endl;
55  for (int level=1;level<=num.getLevels();level++) {
56  std::cout << "level "<<level << " " << num.getSuperNo(level)
57  << " " << num.getBaseNo(level) << std::endl;
58  }
59  #endif
60  // -----------------------
61 
62  // Debug using LogDebug
63  std::stringstream DebugStringStream;
64  DebugStringStream << "ME0Numbering :: number of levels = "<<num.getLevels()<<std::endl;
65  DebugStringStream << "Level \t SuperNo \t BaseNo"<<std::endl;
66  for (int level=1;level<=num.getLevels();level++) {
67  DebugStringStream <<level << " \t " << num.getSuperNo(level)
68  << " \t " << num.getBaseNo(level) << std::endl;
69  }
70  std::string DebugString = DebugStringStream.str();
71  edm::LogVerbatim("ME0NumberingScheme")<<DebugString;
72  // -----------------------
73 
74 
75 
76  int maxLevel = theLayerLevel;
77  if (num.getLevels()!=maxLevel) {
78  std::cout << "MuonME0NS::BNToUN "
79  << "BaseNumber has " << num.getLevels() << " levels,"
80  << "need "<<maxLevel<<std::endl;
81  return 0;
82  }
83 
84  int region(0), layer(0), chamber(0), roll(0);
85 
86  //decode significant ME0 levels
87 
88  if (num.getBaseNo(theRegionLevel) == 0)
89  region = 1;
90  else
91  region =-1;
92  layer = num.getBaseNo(theLayerLevel)+1;
93  roll=1;
94  chamber = num.getBaseNo(theSectorLevel) + 1;
95  // collect all info
96 
97  // Debug using LOCAL_DEBUG
98  #ifdef LOCAL_DEBUG
99  std::cout << "ME0NumberingScheme: Region " << region
100  << " Layer " << layer
101  << " Chamber " << chamber << " Roll " << roll << std::endl;
102  #endif
103  // -----------------------
104 
105  // Debug using LogDebug
106  edm::LogVerbatim("ME0NumberingScheme") << "ME0NumberingScheme: Region " << region
107  << " Layer " << layer
108  << " Chamber " << chamber << " Roll " << roll << std::endl;
109  // -----------------------
110 
111  // Build the actual numbering
112  ME0DetId id(region,layer,chamber,roll);
113 
114  // Debug using LOCAL_DEBUG
115  #ifdef LOCAL_DEBUG
116  std::cout << " DetId " << id << std::endl;
117  #endif
118  // ---------------------
119 
120  // Debug using LogDebug
121  edm::LogVerbatim("ME0NumberingScheme")<< " DetId " << id << std::endl;
122  // -----------------------
123 
124  return id.rawId();
125 }
126 
127 
128 
129 
int getBaseNo(int level) const
ME0NumberingScheme(const DDCompactView &cpv)
type of data representation of DDCompactView
Definition: DDCompactView.h:77
int getValue(const std::string &name) const
virtual int baseNumberToUnitNumber(const MuonBaseNumber &)
int getLevels() const
int getSuperNo(int level) const
tuple cout
Definition: gather_cfg.py:145
tuple level
Definition: testEve_cfg.py:34
void initMe(const MuonDDDConstants &muonConstants)