CMS 3D CMS Logo

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