CMS 3D CMS Logo

ME0NumberingScheme.cc
Go to the documentation of this file.
7 
8 //#define LOCAL_DEBUG
9 
10 ME0NumberingScheme::ME0NumberingScheme(const MuonDDDConstants& muonConstants) { initMe(muonConstants); }
11 
13  MuonDDDConstants muonConstants(cpv);
14  initMe(muonConstants);
15 }
16 
17 void ME0NumberingScheme::initMe(const MuonDDDConstants& muonConstants) {
18  int theLevelPart = muonConstants.getValue("level");
19  theRegionLevel = muonConstants.getValue("m0_region") / theLevelPart;
20  theLayerLevel = muonConstants.getValue("m0_layer") / theLevelPart;
21  theSectorLevel = muonConstants.getValue("m0_sector") / theLevelPart;
22  theRollLevel = muonConstants.getValue("m0_roll") / theLevelPart;
23  theNEtaPart = muonConstants.getValue("m0_nroll");
24 
25  // Debug using LOCAL_DEBUG
26 #ifdef LOCAL_DEBUG
27  edm::LogVerbatim("ME0NumberingScheme") << "Initialize ME0NumberingScheme"
28  << "\ntheRegionLevel " << theRegionLevel << "\ntheLayerLevel " << theLayerLevel
29  << "\ntheSectorLevel " << theSectorLevel << "\ntheRollLevel " << theRollLevel
30  << "\ntheNEtaPart " << theNEtaPart;
31 #endif
32  // -----------------------
33 }
34 
36  edm::LogVerbatim("ME0NumberingScheme") << "ME0NumberingScheme::baseNumberToUnitNumber BEGIN ";
37  // Debug using LOCAL_DEBUG
38 #ifdef LOCAL_DEBUG
39  edm::LogVerbatim("ME0NumberingScheme") << "ME0Numbering " << num.getLevels();
40  for (int level = 1; level <= num.getLevels(); level++) {
41  edm::LogVerbatim("ME0NumberingScheme")
42  << "level " << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
43  }
44 #endif
45  // -----------------------
46 
47  int maxLevel = theRollLevel;
48  if (num.getLevels() != maxLevel) {
49  throw cms::Exception("MuonNumbering") << "MuonME0NS::BNToUN "
50  << "BaseNumber has " << num.getLevels() << " levels,"
51  << "need " << maxLevel << std::endl;
52  return 0;
53  }
54 
55  int region(0), layer(0), chamber(0), roll(0);
56 
57  //decode significant ME0 levels
58 
59  if (num.getBaseNo(theRegionLevel) == 0)
60  region = 1;
61  else
62  region = -1;
63  layer = num.getBaseNo(theLayerLevel) + 1;
64  chamber = num.getBaseNo(theSectorLevel) + 1;
65  roll = num.getBaseNo(theRollLevel) + 1;
66 
67  // collect all info
68 
69  // Debug using LOCAL_DEBUG
70 #ifdef LOCAL_DEBUG
71  edm::LogVerbatim("ME0NumberingScheme") << "ME0NumberingScheme: Region " << region << " Layer " << layer << " Chamber "
72  << chamber << " Roll " << roll;
73 #endif
74  // -----------------------
75 
76  // Build the actual numbering
77  ME0DetId id(region, layer, chamber, roll);
78 
79  // Debug using LOCAL_DEBUG
80 #ifdef LOCAL_DEBUG
81  edm::LogVerbatim("ME0NumberingScheme") << " DetId " << id;
82 #endif
83  // ---------------------
84 
85  return id.rawId();
86 }
int getBaseNo(int level) const
ME0NumberingScheme(const DDCompactView &cpv)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
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)