CMS 3D CMS Logo

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