CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //---------------
21 // C++ Headers --
22 //---------------
23 
24 
25 //-------------------
26 // Initializations --
27 //-------------------
28 
29 namespace {
30  constexpr int offsetChamber[] = { 0, 0, 12, 24, 36 };
31  constexpr int layersPerSector = 44;
32  constexpr int layersIn13Sectors = ( layersPerSector * 12 ) + 8;
33  constexpr int layersPerWheel = layersIn13Sectors + 8;
34 }
35 
36 
37 //----------------
38 // Constructors --
39 //----------------
41 }
42 
43 
44 //--------------
45 // Destructor --
46 //--------------
48 }
49 
50 
52  int station,
53  int sector,
54  int superlayer,
55  int layer ) {
56 
57  wheel += 3;
58  if ( wheel <= 0 ) return -1;
59  if ( station <= 0 ) return -2;
60  if ( sector <= 0 ) return -3;
61  if ( superlayer <= 0 ) return -4;
62  if ( layer <= 0 ) return -5;
63 
64  int seqLayerNum = 0;
65 
66  if ( wheel > 5 ) return -1;
67  seqLayerNum += ( wheel - 1 ) * layersPerWheel;
68 
69  if ( sector > 14 ) return -2;
70  if ( sector > 12 &&
71  station < 4 ) return -2;
72  if ( sector > 13 ) seqLayerNum += layersIn13Sectors;
73  else
74  seqLayerNum += ( sector - 1 ) * layersPerSector;
75 
76  if ( station > 4 ) return -3;
77  if ( sector < 13 )
78  seqLayerNum += offsetChamber[station];
79 
80  if ( superlayer > 3 ) return -4;
81  if ( layer > 4 ) return -5;
82  if ( superlayer != 2 ) {
83  if ( superlayer == 3 ) layer += 4;
84  }
85  else {
86  if ( station == 4 ) return -4;
87  layer += 8;
88  }
89 
90  return seqLayerNum + layer;
91 
92 }
93 
94 
96  return 5 * layersPerWheel;
97 }
98 
99 
#define constexpr
static int id(int wheel, int station, int sector, int superlayer, int layer)