CMS 3D CMS Logo

DTNumberingScheme.cc
Go to the documentation of this file.
6 
7 //#define LOCAL_DEBUG
8 
9 DTNumberingScheme::DTNumberingScheme(const MuonDDDConstants& muonConstants) { initMe(muonConstants); }
10 
12  MuonDDDConstants muonConstants(cpv);
13  initMe(muonConstants);
14 }
15 
16 void DTNumberingScheme::initMe(const MuonDDDConstants& muonConstants) {
17  int theLevelPart = muonConstants.getValue("level");
18  theRegionLevel = muonConstants.getValue("mb_region") / theLevelPart;
19  theWheelLevel = muonConstants.getValue("mb_wheel") / theLevelPart;
20  theStationLevel = muonConstants.getValue("mb_station") / theLevelPart;
21  theSuperLayerLevel = muonConstants.getValue("mb_superlayer") / theLevelPart;
22  theLayerLevel = muonConstants.getValue("mb_layer") / theLevelPart;
23  theWireLevel = muonConstants.getValue("mb_wire") / theLevelPart;
24 #ifdef LOCAL_DEBUG
25  edm::LogVerbatim("DTNumberingScheme") << "Initialize DTNumberingScheme"
26  << "\ntheRegionLevel " << theRegionLevel << "\ntheWheelLevel " << theWheelLevel
27  << "\ntheStationLevel " << theStationLevel << "\ntheSuperLayerLevel "
28  << theSuperLayerLevel << "\ntheLayerLevel " << theLayerLevel
29  << "\ntheWireLevel " << theWireLevel;
30 #endif
31 }
32 
34 #ifdef LOCAL_DEBUG
35  edm::LogVerbatim("DTNumberingScheme") << "DTNumbering " << num.getLevels();
36  for (int level = 1; level <= num.getLevels(); level++) {
37  edm::LogVerbatim("DTNumberingScheme") << level << " " << num.getSuperNo(level) << " " << num.getBaseNo(level);
38  }
39 #endif
40  if (num.getLevels() != theWireLevel) {
41  edm::LogWarning("DTNumberingScheme") << "DTNumberingScheme::BNToUN: BaseNumber has " << num.getLevels()
42  << " levels, need " << theWireLevel;
43  return 0;
44  }
45 
46  // // Meaningful ranges are enforced by DTWireId, (which
47  // // however allows for 0 in wire, layer, superlayer!!!)
48  //
49  // if ((wire_id < 1) || (wire_id > 100)) {
50  // std::cout << "DTNumberingScheme: ";
51  // std::cout << "wire id out of range: ";
52  // std::cout << wire_id <<std::endl;
53  // }
54 
55  // if ((layer_id < 1) || (layer_id > 4)) {
56  // std::cout << "DTNumberingScheme: ";
57  // std::cout << "layer id out of range: ";
58  // std::cout << layer_id <<std::endl;
59  // }
60 
61  // if ((superlayer_id < 1) || (superlayer_id > 3)) {
62  // std::cout << "DTNumberingScheme: ";
63  // std::cout << "super-layer id out of range: ";
64  // std::cout << superlayer_id <<std::endl;
65  // }
66 
67  return getDetId(num);
68 }
69 
71  int wire_id = 0;
72  int layer_id = 0;
73  int superlayer_id = 0;
74  int sector_id = 0;
75  int station_id = 0;
76  int wheel_id = 0;
77 
78  //decode significant barrel levels
79  decode(num, wire_id, layer_id, superlayer_id, sector_id, station_id, wheel_id);
80 
81  // These ranges are enforced by DTWireId
82  // if ((sector_id < 1) || (sector_id > 14)) {
83  // std::cout << "DTNumberingScheme: ";
84  // std::cout << "sector id out of range: ";
85  // std::cout << sector_id <<std::endl;
86  // }
87 
88  // if ((station_id < 1) || (station_id > 4)) {
89  // std::cout << "DTNumberingScheme: ";
90  // std::cout << "station id out of range: ";
91  // std::cout << station_id <<std::endl;
92  // }
93 
94  // if ((wheel_id < -2) || (wheel_id > 2)) {
95  // std::cout << "DTNumberingScheme: ";
96  // std::cout << "wheel id out of range: ";
97  // std::cout << wheel_id <<std::endl;
98  // }
99 
100  DTWireId id(wheel_id, station_id, sector_id, superlayer_id, layer_id, wire_id);
101 
102 #ifdef LOCAL_DEBUG
103  edm::LogVerbatim("DTNumberingScheme") << "DTNumberingScheme: " << id;
104 #endif
105 
106  return id.rawId();
107 }
108 
110  int& wire_id,
111  int& layer_id,
112  int& superlayer_id,
113  int& sector_id,
114  int& station_id,
115  int& wheel_id) const {
116  for (int level = 1; level <= num.getLevels(); level++) {
117  //decode
118  if (level == theWheelLevel) {
119  const int copyno = num.getBaseNo(level);
120  wheel_id = copyno - 2;
121 
122  } else if (level == theStationLevel) {
123  const int station_tag = num.getSuperNo(level);
124  const int copyno = num.getBaseNo(level);
125  station_id = station_tag;
126  sector_id = copyno + 1;
127 
128  } else if (level == theSuperLayerLevel) {
129  const int copyno = num.getBaseNo(level);
130  superlayer_id = copyno + 1;
131 
132  } else if (level == theLayerLevel) {
133  const int copyno = num.getBaseNo(level);
134  layer_id = copyno + 1;
135 
136  } else if (level == theWireLevel) {
137  const int copyno = num.getBaseNo(level);
138  wire_id = copyno + 1;
139  }
140  }
141 }
int getBaseNo(int level) const
void decode(const MuonBaseNumber &num, int &wire_id, int &layer_id, int &superlayer_id, int &sector_id, int &station_id, int &wheel_id) const
int baseNumberToUnitNumber(const MuonBaseNumber &num) override
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
DTNumberingScheme(const DDCompactView &cpv)
int getValue(const std::string &name) const
void initMe(const MuonDDDConstants &muonConstants)
int getLevels() const
int getSuperNo(int level) const
int getDetId(const MuonBaseNumber &num) const