CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTSequentialCellNumber.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2010/05/06 16:23:00 $
5  * $Revision: 1.1 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //----------------------
11 // This Class' Header --
12 //----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
18 
19 //---------------
20 // C++ Headers --
21 //---------------
22 namespace {
23  constexpr int cellsInTheta = 58;
24  constexpr int cellsPerLayer[] = {0, 50, 60, 72, 96};
25  constexpr int cellsInMB1 = (cellsPerLayer[1] * 8) + (cellsInTheta * 4);
26  constexpr int cellsInMB2 = (cellsPerLayer[2] * 8) + (cellsInTheta * 4);
27  constexpr int cellsInMB3 = (cellsPerLayer[3] * 8) + (cellsInTheta * 4);
28  constexpr int cellsInMB4 = cellsPerLayer[4] * 8;
29 
30  constexpr int offsetChamber[] = {0, 0, cellsInMB1, cellsInMB1 + cellsInMB2, cellsInMB1 + cellsInMB2 + cellsInMB3};
31  constexpr int cellsPerSector = cellsInMB1 + cellsInMB2 + cellsInMB3 + cellsInMB4;
32  constexpr int cellsIn13Sectors = (cellsPerSector * 12) + cellsInMB4;
33  constexpr int cellsPerWheel = cellsIn13Sectors + cellsInMB4;
34 } // namespace
35 
36 //--------------
37 // Operations --
38 //--------------
39 int DTSequentialCellNumber::id(int wheel, int station, int sector, int superlayer, int layer, int cell) {
40  wheel += 3;
41  if (wheel <= 0)
42  return -1;
43  if (station <= 0)
44  return -2;
45  if (sector <= 0)
46  return -3;
47  if (superlayer <= 0)
48  return -4;
49  if (layer <= 0)
50  return -5;
51  if (cell <= 0)
52  return -6;
53 
54  int seqWireNum = 0;
55 
56  if (wheel > 5)
57  return -1;
58  seqWireNum += (wheel - 1) * cellsPerWheel;
59 
60  if (sector > 14)
61  return -2;
62  if (sector > 12 && station < 4)
63  return -2;
64  if (sector > 13)
65  seqWireNum += cellsIn13Sectors;
66  else
67  seqWireNum += (sector - 1) * cellsPerSector;
68 
69  if (station > 4)
70  return -3;
71  if (sector < 13)
72  seqWireNum += offsetChamber[station];
73 
74  if (superlayer > 3)
75  return -4;
76  if (layer > 4)
77  return -5;
78  if (superlayer != 2) {
79  if (cell > cellsPerLayer[station])
80  return -6;
81  if (superlayer == 3)
82  layer += 4;
83  seqWireNum += (layer - 1) * cellsPerLayer[station];
84  } else {
85  if (station == 4)
86  return -4;
87  if (cell > cellsInTheta)
88  return -6;
89  seqWireNum += (8 * cellsPerLayer[station]) + ((layer - 1) * cellsInTheta);
90  }
91 
92  return seqWireNum + cell;
93 }
94 
95 int DTSequentialCellNumber::max() { return 5 * cellsPerWheel; }
constexpr std::array< uint8_t, layerIndexSize > layer
static int id(int wheel, int station, int sector, int superlayer, int layer, int cell)