CMS 3D CMS Logo

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