CMS 3D CMS Logo

DTSequentialLayerNumber.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2010/04/30 16:20:08 $
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 
23 //-------------------
24 // Initializations --
25 //-------------------
26 
27 namespace {
28  constexpr int offsetChamber[] = {0, 0, 12, 24, 36};
29  constexpr int layersPerSector = 44;
30  constexpr int layersIn13Sectors = (layersPerSector * 12) + 8;
31  constexpr int layersPerWheel = layersIn13Sectors + 8;
32 } // namespace
33 
34 //----------------
35 // Constructors --
36 //----------------
38 
39 //--------------
40 // Destructor --
41 //--------------
43 
44 int DTSequentialLayerNumber::id(int wheel, int station, int sector, int superlayer, int layer) {
45  wheel += 3;
46  if (wheel <= 0)
47  return -1;
48  if (station <= 0)
49  return -2;
50  if (sector <= 0)
51  return -3;
52  if (superlayer <= 0)
53  return -4;
54  if (layer <= 0)
55  return -5;
56 
57  int seqLayerNum = 0;
58 
59  if (wheel > 5)
60  return -1;
61  seqLayerNum += (wheel - 1) * layersPerWheel;
62 
63  if (sector > 14)
64  return -2;
65  if (sector > 12 && station < 4)
66  return -2;
67  if (sector > 13)
68  seqLayerNum += layersIn13Sectors;
69  else
70  seqLayerNum += (sector - 1) * layersPerSector;
71 
72  if (station > 4)
73  return -3;
74  if (sector < 13)
75  seqLayerNum += offsetChamber[station];
76 
77  if (superlayer > 3)
78  return -4;
79  if (layer > 4)
80  return -5;
81  if (superlayer != 2) {
82  if (superlayer == 3)
83  layer += 4;
84  } else {
85  if (station == 4)
86  return -4;
87  layer += 8;
88  }
89 
90  return seqLayerNum + layer;
91 }
92 
93 int DTSequentialLayerNumber::max() { return 5 * layersPerWheel; }
static int id(int wheel, int station, int sector, int superlayer, int layer)