CMS 3D CMS Logo

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