CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LayerNumberConverter.h
Go to the documentation of this file.
1 #ifndef RecoTracker_MkFitCMS_interface_LayerNumberConverter_h
2 #define RecoTracker_MkFitCMS_interface_LayerNumberConverter_h
3 
4 namespace mkfit {
5 
6  enum struct TkLayout { phase0 = 0, phase1 = 1 };
7 
9  public:
11  unsigned int nLayers() const {
12  if (lo_ == TkLayout::phase0)
13  return 69;
14  if (lo_ == TkLayout::phase1)
15  return 72;
16  return 10;
17  }
18  int convertLayerNumber(int det, int lay, bool useMatched, int isStereo, bool posZ) const {
19  if (det == 1 || det == 3 || det == 5) {
20  return convertBarrelLayerNumber(det, lay, useMatched, isStereo);
21  } else {
22  int disk = convertDiskNumber(det, lay, useMatched, isStereo);
23  if (disk < 0)
24  return -1;
25 
26  int lOffset = 0;
27  if (lo_ == TkLayout::phase1)
28  lOffset = 1;
29  disk += 17 + lOffset;
30  if (!posZ)
31  disk += 25 + 2 * lOffset;
32  return disk;
33  }
34  return -1;
35  }
36 
37  int convertBarrelLayerNumber(int cmsswdet, int cmsswlay, bool useMatched, int isStereo) const {
38  int lOffset = 0;
39  if (lo_ == TkLayout::phase1)
40  lOffset = 1;
41  if (cmsswdet == 2 || cmsswdet == 4 || cmsswdet == 6)
42  return -1; //FPIX, TID, TEC
43  if (cmsswdet == 1)
44  return cmsswlay - 1; //BPIX
45  if (useMatched) {
46  //TIB
47  if (cmsswdet == 3) {
48  if (cmsswlay == 1 && isStereo == -1)
49  return 3 + lOffset;
50  else if (cmsswlay == 2 && isStereo == -1)
51  return 4 + lOffset;
52  else if (cmsswlay == 3 && isStereo == 0)
53  return 5 + lOffset;
54  else if (cmsswlay == 4 && isStereo == 0)
55  return 6 + lOffset;
56  }
57  //TOB
58  else if (cmsswdet == 5) {
59  if (cmsswlay == 1 && isStereo == -1)
60  return 7 + lOffset;
61  else if (cmsswlay == 2 && isStereo == -1)
62  return 8 + lOffset;
63  else if (cmsswlay >= 3 && cmsswlay <= 6 && isStereo == 0)
64  return 6 + cmsswlay + lOffset;
65  }
66  return -1;
67  } else {
68  //TIB
69  if (cmsswdet == 3) {
70  if ((cmsswlay == 1 || cmsswlay == 2) && (isStereo == 0 || isStereo == 1)) {
71  return 1 + cmsswlay * 2 + isStereo + lOffset;
72  } else if (cmsswlay == 3 && isStereo == 0)
73  return 7 + lOffset;
74  else if (cmsswlay == 4 && isStereo == 0)
75  return 8 + lOffset;
76  }
77  //TOB
78  else if (cmsswdet == 5) {
79  if ((cmsswlay == 1 || cmsswlay == 2) && (isStereo == 0 || isStereo == 1)) {
80  return 7 + cmsswlay * 2 + isStereo + lOffset;
81  } else if (cmsswlay >= 3 && cmsswlay <= 6 && isStereo == 0)
82  return 10 + cmsswlay + lOffset;
83  }
84  return -1;
85  }
86  }
87  int convertDiskNumber(int cmsswdet, int cmsswdisk, bool useMatched, int isStereo) const {
88  if (cmsswdet == 1 || cmsswdet == 3 || cmsswdet == 5)
89  return -1; //BPIX, TIB, TOB
90  if (cmsswdet == 2)
91  return cmsswdisk - 1; //FPIX
92  int lOffset = 0;
93  if (lo_ == TkLayout::phase1)
94  lOffset = 1;
95  if (useMatched) {
96  return -1;
97  } else {
98  if ((isStereo != 0 && isStereo != 1) || cmsswdisk < 1)
99  return -1;
100  //TID
101  if (cmsswdet == 4 && cmsswdisk <= 3)
102  return cmsswdisk * 2 + isStereo + lOffset;
103  //TEC
104  else if (cmsswdet == 6 && cmsswdisk <= 9)
105  return 6 + cmsswdisk * 2 + isStereo + lOffset;
106  return -1;
107  }
108  }
109 
110  private:
112  };
113 
114 } // end namespace mkfit
115 
116 #endif
constexpr bool useMatched
unsigned int nLayers() const
int convertLayerNumber(int det, int lay, bool useMatched, int isStereo, bool posZ) const
int convertDiskNumber(int cmsswdet, int cmsswdisk, bool useMatched, int isStereo) const
int convertBarrelLayerNumber(int cmsswdet, int cmsswlay, bool useMatched, int isStereo) const