CMS 3D CMS Logo

EcalPreshowerNumberingScheme.cc
Go to the documentation of this file.
1 // File: EcalPreshowerNumberingScheme.cc
3 // Description: Numbering scheme for preshower detector
5 
8 
9 #include <iostream>
10 using namespace std;
11 
13  // For SFLX2a, we use copy# 1-3
14  int vL2ax[3] = {4, 6, 10};
15  int vL2ay[3] = {29, 31, 35};
16  // For SFLX2b, we use copy# 1
17  int vL2bx[1] = {2};
18  int vL2by[1] = {25};
19  // For SFLX3a, we use copy# 4-6
20  int vL3ax[3] = {30, 34, 36};
21  int vL3ay[3] = {35, 31, 29};
22  // For SFLX3b, we use copy# 2
23  int vL3bx[1] = {38};
24  int vL3by[1] = {25};
25  // For SFLX1a, we use odd number in copy# 1-52
26  int vL1ax[26] = {2, 4, 4, 8, 8, 8, 8, 10, 12, 12, 14, 14, 20, 20, 26, 26, 28, 28, 30, 32, 32, 32, 32, 36, 36, 38};
27  int vL1ay[26] = {21, 25, 21, 33, 29, 25, 21, 21, 25, 21, 31, 27, 32,
28  28, 31, 27, 25, 21, 21, 33, 29, 25, 21, 25, 21, 21};
29  // For SFLX1b, we use copy# 2
30  int vL1bx[1] = {22};
31  int vL1by[1] = {27};
32  // For SFLX1c, we use copy# 1
33  int vL1cx[1] = {18};
34  int vL1cy[1] = {27};
35  // For SFLX1d, we use copy# 2
36  int vL1dx[1] = {26};
37  int vL1dy[1] = {23};
38  // For SFLX1e, we use copy# 1
39  int vL1ex[1] = {14};
40  int vL1ey[1] = {23};
41  // For SFLX0a, we use odd number if copy# 1-46
42  int vL0ax[23] = {6, 6, 10, 10, 12, 12, 14, 16, 16, 18, 18, 20, 22, 22, 24, 24, 26, 28, 28, 30, 30, 34, 34};
43  int vL0ay[23] = {26, 21, 30, 25, 34, 29, 35, 36, 31, 36, 31, 36, 36, 31, 36, 31, 35, 34, 29, 30, 25, 26, 21};
44  // For SFL0b, we use copy# 2
45  int vL0bx[1] = {24};
46  int vL0by[1] = {26};
47  // For SFL0c, we use copy# 1
48  int vL0cx[1] = {16};
49  int vL0cy[1] = {26};
50 
51  for (int i = 0; i < 1; ++i) {
52  L1bx[i] = vL1bx[i];
53  L1by[i] = vL1by[i];
54  L1cx[i] = vL1cx[i];
55  L1cy[i] = vL1cy[i];
56  L1dx[i] = vL1dx[i];
57  L1dy[i] = vL1dy[i];
58  L1ex[i] = vL1ex[i];
59  L1ey[i] = vL1ey[i];
60  L0bx[i] = vL0bx[i];
61  L0by[i] = vL0by[i];
62  L0cx[i] = vL0cx[i];
63  L0cy[i] = vL0cy[i];
64  L3bx[i] = vL3bx[i];
65  L3by[i] = vL3by[i];
66  L2bx[i] = vL2bx[i];
67  L2by[i] = vL2by[i];
68  }
69 
70  for (int i = 0; i < 3; ++i) {
71  L3ax[i] = vL3ax[i];
72  L3ay[i] = vL3ay[i];
73  L2ax[i] = vL2ax[i];
74  L2ay[i] = vL2ay[i];
75  }
76 
77  for (int i = 0; i < 23; ++i) {
78  L0ax[i] = vL0ax[i];
79  L0ay[i] = vL0ay[i];
80  }
81 
82  for (int i = 0; i < 26; ++i) {
83  L1ax[i] = vL1ax[i];
84  L1ay[i] = vL1ay[i];
85  }
86 
87  edm::LogInfo("EcalGeom") << "Creating EcalPreshowerNumberingScheme";
88 }
89 
91  edm::LogInfo("EcalGeom") << "Deleting EcalPreshowerNumberingScheme";
92 }
93 
94 uint32_t EcalPreshowerNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
95  int level = baseNumber.getLevels();
96  uint32_t intIndex = 0;
97  if (level > 0) {
98  // depth index - silicon layer 1-st or 2-nd
99  int layer = 0;
100  if (baseNumber.getLevelName(0) == "SFSX") {
101  layer = 1;
102  } else if (baseNumber.getLevelName(0) == "SFSY") {
103  layer = 2;
104  } else {
105  edm::LogWarning("EcalGeom") << "EcalPreshowerNumberingScheme: Wrong name"
106  << " of Presh. Si. Strip : " << baseNumber.getLevelName(0);
107  }
108 
109  // Z index +Z = 1 ; -Z = 2
110  int zside = baseNumber.getCopyNumber("EREG");
111  zside = 2 * (1 - zside) + 1;
112 
113  // box number
114  int box = baseNumber.getCopyNumber(2);
115 
116  int x = 0, y = 0, ix, iy, id;
117  int mapX[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
118  int mapY[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
119  const std::string& ladd = baseNumber.getLevelName(3);
120  int ladd_copy = baseNumber.getCopyNumber(3);
121 
122  if (ladd == "SFLX0a" || ladd == "SFLY0a") {
123  mapX[5] = mapX[6] = mapX[7] = mapX[8] = mapX[9] = 1;
124  mapY[0] = 0;
125  mapY[1] = 1;
126  mapY[2] = 2;
127  mapY[3] = 3;
128  mapY[4] = 4;
129  mapY[5] = 0;
130  mapY[6] = 1;
131  mapY[7] = 2;
132  mapY[8] = 3;
133  mapY[9] = 4;
134 
135  id = (int)((float)ladd_copy / 2 + 0.5);
136 
137  x = L0ax[id - 1] + mapX[box - 1000 - 1];
138  y = L0ay[id - 1] + mapY[box - 1000 - 1];
139 
140  if ((ladd_copy % 2) == 0) {
141  if (mapX[box - 1000 - 1] == 0)
142  x += 1;
143  else if (mapX[box - 1000 - 1] == 1)
144  x -= 1;
145  y = 41 - y;
146  }
147  }
148  if (ladd == "SFLX0b" || ladd == "SFLY0b") {
149  mapX[4] = mapX[5] = mapX[6] = mapX[7] = mapX[8] = 1;
150  mapY[0] = 1;
151  mapY[1] = 2;
152  mapY[2] = 3;
153  mapY[3] = 4;
154  mapY[4] = 0;
155  mapY[5] = 1;
156  mapY[6] = 2;
157  mapY[7] = 3;
158  mapY[8] = 4;
159  mapY[9] = 0;
160 
161  x = L0bx[0] + mapX[box - 2000 - 1];
162  y = L0by[0] + mapY[box - 2000 - 1];
163 
164  if (ladd_copy == 1) {
165  x = 41 - x;
166  y = 41 - y;
167  }
168  }
169  if (ladd == "SFLX0c" || ladd == "SFLY0c") {
170  mapX[5] = mapX[6] = mapX[7] = mapX[8] = 1;
171  mapY[0] = 0;
172  mapY[1] = 1;
173  mapY[2] = 2;
174  mapY[3] = 3;
175  mapY[4] = 4;
176  mapY[5] = 1;
177  mapY[6] = 2;
178  mapY[7] = 3;
179  mapY[8] = 4;
180  mapY[9] = 0;
181 
182  x = L0cx[0] + mapX[box - 3000 - 1];
183  y = L0cy[0] + mapY[box - 3000 - 1];
184 
185  if (ladd_copy == 2) {
186  x = 41 - x;
187  y = 41 - y;
188  }
189  }
190  if (ladd == "SFLX1a" || ladd == "SFLY1a") {
191  mapX[4] = mapX[5] = mapX[6] = mapX[7] = 1;
192  mapY[0] = 0;
193  mapY[1] = 1;
194  mapY[2] = 2;
195  mapY[3] = 3;
196  mapY[4] = 0;
197  mapY[5] = 1;
198  mapY[6] = 2;
199  mapY[7] = 3;
200  mapY[8] = 0;
201  mapY[9] = 0;
202 
203  id = (int)((float)ladd_copy / 2 + 0.5);
204 
205  x = L1ax[id - 1] + mapX[box - 4000 - 1];
206  y = L1ay[id - 1] + mapY[box - 4000 - 1];
207 
208  if ((ladd_copy % 2) == 0) {
209  if (mapX[box - 4000 - 1] == 0)
210  x += 1;
211  else if (mapX[box - 4000 - 1] == 1)
212  x -= 1;
213  y = 41 - y;
214  }
215  }
216  if (ladd == "SFLX1b" || ladd == "SFLY1b") {
217  mapX[3] = mapX[4] = mapX[5] = mapX[6] = 1;
218  mapY[0] = 1;
219  mapY[1] = 2;
220  mapY[2] = 3;
221  mapY[3] = 0;
222  mapY[4] = 1;
223  mapY[5] = 2;
224  mapY[6] = 3;
225  mapY[7] = 0;
226  mapY[8] = 0;
227  mapY[9] = 0;
228 
229  x = L1bx[0] + mapX[box - 5000 - 1];
230  y = L1by[0] + mapY[box - 5000 - 1];
231 
232  if (ladd_copy == 1) {
233  x = 41 - x;
234  y = 41 - y;
235  }
236  }
237  if (ladd == "SFLX1c" || ladd == "SFLY1c") {
238  mapX[4] = mapX[5] = mapX[6] = 1;
239  mapY[0] = 0;
240  mapY[1] = 1;
241  mapY[2] = 2;
242  mapY[3] = 3;
243  mapY[4] = 1;
244  mapY[5] = 2;
245  mapY[6] = 3;
246  mapY[7] = 0;
247  mapY[8] = 0;
248  mapY[9] = 0;
249 
250  x = L1cx[0] + mapX[box - 6000 - 1];
251  y = L1cy[0] + mapY[box - 6000 - 1];
252 
253  if (ladd_copy == 2) {
254  x = 41 - x;
255  y = 41 - y;
256  }
257  }
258  if (ladd == "SFLX1d" || ladd == "SFLY1d") {
259  mapX[2] = mapX[3] = mapX[4] = mapX[5] = 1;
260  mapY[0] = 2;
261  mapY[1] = 3;
262  mapY[2] = 0;
263  mapY[3] = 1;
264  mapY[4] = 2;
265  mapY[5] = 3;
266  mapY[6] = 0;
267  mapY[7] = 0;
268  mapY[8] = 0;
269  mapY[9] = 0;
270 
271  x = L1dx[0] + mapX[box - 7000 - 1];
272  y = L1dy[0] + mapY[box - 7000 - 1];
273 
274  if (ladd_copy == 1) {
275  x = 41 - x;
276  y = 41 - y;
277  }
278  }
279  if (ladd == "SFLX1e" || ladd == "SFLY1e") {
280  mapX[4] = mapX[5] = 1;
281  mapY[0] = 0;
282  mapY[1] = 1;
283  mapY[2] = 2;
284  mapY[3] = 3;
285  mapY[4] = 2;
286  mapY[5] = 3;
287  mapY[6] = 0;
288  mapY[7] = 0;
289  mapY[8] = 0;
290  mapY[9] = 0;
291 
292  x = L1ex[0] + mapX[box - 8000 - 1];
293  y = L1ey[0] + mapY[box - 8000 - 1];
294 
295  if (ladd_copy == 2) {
296  x = 41 - x;
297  y = 41 - y;
298  }
299  }
300  if (ladd == "SFLX3a" || ladd == "SFLY3a") {
301  mapX[4] = mapX[5] = mapX[6] = 1;
302  mapY[0] = 0;
303  mapY[1] = 1;
304  mapY[2] = 2;
305  mapY[3] = 3;
306  mapY[4] = 0;
307  mapY[5] = 1;
308  mapY[6] = 2;
309  mapY[7] = 0;
310  mapY[8] = 0;
311  mapY[9] = 0;
312 
313  id = (ladd_copy > 3) ? ladd_copy - 3 : 4 - ladd_copy;
314 
315  x = L3ax[id - 1] + mapX[box - 9000 - 1];
316  y = L3ay[id - 1] + mapY[box - 9000 - 1];
317 
318  if (ladd_copy < 4) {
319  x = 41 - x;
320  y = 41 - y;
321  }
322  }
323  if (ladd == "SFLX3b" || ladd == "SFLY3b") {
324  mapX[4] = mapX[5] = 1;
325  mapY[0] = 0;
326  mapY[1] = 1;
327  mapY[2] = 2;
328  mapY[3] = 3;
329  mapY[4] = 0;
330  mapY[5] = 1;
331  mapY[6] = 0;
332  mapY[7] = 0;
333  mapY[8] = 0;
334  mapY[9] = 0;
335 
336  x = L3bx[0] + mapX[box - 11000 - 1];
337  y = L3by[0] + mapY[box - 11000 - 1];
338 
339  if (ladd_copy == 1) {
340  x = 41 - x;
341  y = 41 - y;
342  }
343  }
344  if (ladd == "SFLX2a" || ladd == "SFLY2a") {
345  mapX[3] = mapX[4] = mapX[5] = mapX[6] = 1;
346  mapY[0] = 0;
347  mapY[1] = 1;
348  mapY[2] = 2;
349  mapY[3] = 0;
350  mapY[4] = 1;
351  mapY[5] = 2;
352  mapY[6] = 3;
353  mapY[7] = 0;
354  mapY[8] = 0;
355  mapY[9] = 0;
356 
357  id = (ladd_copy > 3) ? 7 - ladd_copy : ladd_copy;
358 
359  x = L2ax[id - 1] + mapX[box - 10000 - 1];
360  y = L2ay[id - 1] + mapY[box - 10000 - 1];
361 
362  if (ladd_copy > 3) {
363  x = 41 - x;
364  y = 41 - y;
365  }
366  }
367  if (ladd == "SFLX2b" || ladd == "SFLY2b") {
368  mapX[2] = mapX[3] = mapX[4] = mapX[5] = 1;
369  mapY[0] = 0;
370  mapY[1] = 1;
371  mapY[2] = 0;
372  mapY[3] = 1;
373  mapY[4] = 2;
374  mapY[5] = 3;
375  mapY[6] = 0;
376  mapY[7] = 0;
377  mapY[8] = 0;
378  mapY[9] = 0;
379 
380  x = L2bx[0] + mapX[box - 12000 - 1];
381  y = L2by[0] + mapY[box - 12000 - 1];
382 
383  if (ladd_copy == 2) {
384  x = 41 - x;
385  y = 41 - y;
386  }
387  }
388 
389  if (zside < 0 && layer == 1)
390  x = 41 - x;
391 
392  ix = x;
393  iy = y;
394 
395  if (layer == 2) {
396  x = (zside > 0) ? iy : 41 - iy;
397  y = 41 - ix;
398  }
399 
400  // strip number inside wafer
401  int strip = baseNumber.getCopyNumber(0);
402 
403  if (layer == 1) {
404  if (zside > 0 && y <= 20)
405  strip = 33 - strip;
406  else if (zside < 0 && y > 20)
407  strip = 33 - strip;
408  } else if (layer == 2) {
409  if (zside > 0 && x <= 20)
410  strip = 33 - strip;
411  else if (zside < 0 && x > 20)
412  strip = 33 - strip;
413  }
414 
415  intIndex = ESDetId(strip, x, y, layer, zside).rawId();
416 
417  LogDebug("EcalGeom") << "EcalPreshowerNumberingScheme : zside " << zside << " Ladd " << ladd
418  << " ladd_copy: " << ladd_copy << " box " << box << " x " << x << " y " << y << " layer "
419  << layer << " strip " << strip << " UnitID 0x" << std::hex << intIndex << std::dec;
420 
421  for (int ich = 0; ich < level; ich++) {
422  LogDebug("EcalGeom") << "Name = " << baseNumber.getLevelName(ich) << " copy = " << baseNumber.getCopyNumber(ich);
423  }
424  }
425 
426  return intIndex;
427 }
personalPlayback.level
level
Definition: personalPlayback.py:22
EcalPreshowerNumberingScheme::L0by
int L0by[1]
Definition: EcalPreshowerNumberingScheme.h:38
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
EcalPreshowerNumberingScheme::L1dy
int L1dy[1]
Definition: EcalPreshowerNumberingScheme.h:32
EcalBaseNumber::getCopyNumber
int getCopyNumber(int level) const
Definition: EcalBaseNumber.cc:23
EcalBaseNumber::getLevelName
std::string const & getLevelName(int level) const
Definition: EcalBaseNumber.cc:34
EcalPreshowerNumberingScheme::L1ex
int L1ex[1]
Definition: EcalPreshowerNumberingScheme.h:33
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
EcalPreshowerNumberingScheme::L3bx
int L3bx[1]
Definition: EcalPreshowerNumberingScheme.h:19
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
EcalPreshowerNumberingScheme::L3by
int L3by[1]
Definition: EcalPreshowerNumberingScheme.h:20
edm::LogInfo
Definition: MessageLogger.h:254
EcalPreshowerNumberingScheme::~EcalPreshowerNumberingScheme
~EcalPreshowerNumberingScheme() override
Definition: EcalPreshowerNumberingScheme.cc:90
EcalBaseNumber
Definition: EcalBaseNumber.h:12
ESDetId
Definition: ESDetId.h:15
DDAxes::x
ESDetId.h
EcalPreshowerNumberingScheme::getUnitID
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
Definition: EcalPreshowerNumberingScheme.cc:94
EcalPreshowerNumberingScheme::L0cy
int L0cy[1]
Definition: EcalPreshowerNumberingScheme.h:40
EcalPreshowerNumberingScheme::L2bx
int L2bx[1]
Definition: EcalPreshowerNumberingScheme.h:23
EcalPreshowerNumberingScheme::L0ax
int L0ax[23]
Definition: EcalPreshowerNumberingScheme.h:35
EcalPreshowerNumberingScheme::L2by
int L2by[1]
Definition: EcalPreshowerNumberingScheme.h:24
EcalPreshowerNumberingScheme::L2ax
int L2ax[3]
Definition: EcalPreshowerNumberingScheme.h:21
EcalNumberingScheme
Definition: EcalNumberingScheme.h:14
EcalPreshowerNumberingScheme::L1cy
int L1cy[1]
Definition: EcalPreshowerNumberingScheme.h:30
EcalPreshowerNumberingScheme::L1bx
int L1bx[1]
Definition: EcalPreshowerNumberingScheme.h:27
EcalPreshowerNumberingScheme::L3ay
int L3ay[3]
Definition: EcalPreshowerNumberingScheme.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
createfilelist.int
int
Definition: createfilelist.py:10
EcalPreshowerNumberingScheme::L1cx
int L1cx[1]
Definition: EcalPreshowerNumberingScheme.h:29
EcalPreshowerNumberingScheme::EcalPreshowerNumberingScheme
EcalPreshowerNumberingScheme()
Definition: EcalPreshowerNumberingScheme.cc:12
EcalPreshowerNumberingScheme::L1ax
int L1ax[26]
Definition: EcalPreshowerNumberingScheme.h:25
EcalPreshowerNumberingScheme::L0ay
int L0ay[23]
Definition: EcalPreshowerNumberingScheme.h:36
EcalPreshowerNumberingScheme::L0cx
int L0cx[1]
Definition: EcalPreshowerNumberingScheme.h:39
EcalBaseNumber::getLevels
int getLevels() const
Definition: EcalBaseNumber.cc:21
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
EcalPreshowerNumberingScheme::L1by
int L1by[1]
Definition: EcalPreshowerNumberingScheme.h:28
EcalPreshowerNumberingScheme.h
EcalPreshowerNumberingScheme::L3ax
int L3ax[3]
Definition: EcalPreshowerNumberingScheme.h:17
EcalPreshowerNumberingScheme::L1ay
int L1ay[26]
Definition: EcalPreshowerNumberingScheme.h:26
EcalPreshowerNumberingScheme::L0bx
int L0bx[1]
Definition: EcalPreshowerNumberingScheme.h:37
EcalPreshowerNumberingScheme::L2ay
int L2ay[3]
Definition: EcalPreshowerNumberingScheme.h:22
EcalPreshowerNumberingScheme::L1dx
int L1dx[1]
Definition: EcalPreshowerNumberingScheme.h:31
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
EcalPreshowerNumberingScheme::L1ey
int L1ey[1]
Definition: EcalPreshowerNumberingScheme.h:34