CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
mkfit::LayerNumberConverter Class Reference

#include <LayerNumberConverter.h>

Public Member Functions

int convertBarrelLayerNumber (int cmsswdet, int cmsswlay, bool useMatched, int isStereo) const
 
int convertDiskNumber (int cmsswdet, int cmsswdisk, bool useMatched, int isStereo) const
 
int convertLayerNumber (int det, int lay, bool useMatched, int isStereo, bool posZ) const
 
bool doesHaveStereo (int det, int lay) const
 
TkLayout getEra () const
 
 LayerNumberConverter (TkLayout layout)
 
unsigned int nLayers () const
 
void reset (TkLayout layout)
 

Private Attributes

TkLayout lo_
 

Detailed Description

Definition at line 10 of file LayerNumberConverter.h.

Constructor & Destructor Documentation

◆ LayerNumberConverter()

mkfit::LayerNumberConverter::LayerNumberConverter ( TkLayout  layout)
inline

Member Function Documentation

◆ convertBarrelLayerNumber()

int mkfit::LayerNumberConverter::convertBarrelLayerNumber ( int  cmsswdet,
int  cmsswlay,
bool  useMatched,
int  isStereo 
) const
inline

Definition at line 71 of file LayerNumberConverter.h.

References lo_, mkfit::phase1, and useMatched.

Referenced by convertLayerNumber().

71  {
72  int lOffset = 0;
73  if (lo_ == TkLayout::phase1)
74  lOffset = 1;
75  if (cmsswdet == 2 || cmsswdet == 4 || cmsswdet == 6)
76  return -1; //FPIX, TID, TEC
77  if (cmsswdet == 1)
78  return cmsswlay - 1; //BPIX
79  if (useMatched) {
80  //TIB
81  if (cmsswdet == 3) {
82  if (cmsswlay == 1 && isStereo == -1)
83  return 3 + lOffset;
84  else if (cmsswlay == 2 && isStereo == -1)
85  return 4 + lOffset;
86  else if (cmsswlay == 3 && isStereo == 0)
87  return 5 + lOffset;
88  else if (cmsswlay == 4 && isStereo == 0)
89  return 6 + lOffset;
90  }
91  //TOB
92  else if (cmsswdet == 5) {
93  if (cmsswlay == 1 && isStereo == -1)
94  return 7 + lOffset;
95  else if (cmsswlay == 2 && isStereo == -1)
96  return 8 + lOffset;
97  else if (cmsswlay >= 3 && cmsswlay <= 6 && isStereo == 0)
98  return 6 + cmsswlay + lOffset;
99  }
100  return -1;
101  } else {
102  //TIB
103  if (cmsswdet == 3) {
104  if ((cmsswlay == 1 || cmsswlay == 2) && (isStereo == 0 || isStereo == 1)) {
105  return 1 + cmsswlay * 2 + isStereo + lOffset;
106  } else if (cmsswlay == 3 && isStereo == 0)
107  return 7 + lOffset;
108  else if (cmsswlay == 4 && isStereo == 0)
109  return 8 + lOffset;
110  }
111  //TOB
112  else if (cmsswdet == 5) {
113  if ((cmsswlay == 1 || cmsswlay == 2) && (isStereo == 0 || isStereo == 1)) {
114  return 7 + cmsswlay * 2 + isStereo + lOffset;
115  } else if (cmsswlay >= 3 && cmsswlay <= 6 && isStereo == 0)
116  return 10 + cmsswlay + lOffset;
117  }
118  return -1;
119  }
120  }
constexpr bool useMatched

◆ convertDiskNumber()

int mkfit::LayerNumberConverter::convertDiskNumber ( int  cmsswdet,
int  cmsswdisk,
bool  useMatched,
int  isStereo 
) const
inline

Definition at line 121 of file LayerNumberConverter.h.

References lo_, mkfit::phase1, and useMatched.

Referenced by convertLayerNumber().

121  {
122  if (cmsswdet == 1 || cmsswdet == 3 || cmsswdet == 5)
123  return -1; //BPIX, TIB, TOB
124  if (cmsswdet == 2)
125  return cmsswdisk - 1; //FPIX
126  int lOffset = 0;
127  if (lo_ == TkLayout::phase1)
128  lOffset = 1;
129  if (useMatched) {
130  return -1;
131  } else {
132  if ((isStereo != 0 && isStereo != 1) || cmsswdisk < 1)
133  return -1;
134  //TID
135  if (cmsswdet == 4 && cmsswdisk <= 3)
136  return cmsswdisk * 2 + isStereo + lOffset;
137  //TEC
138  else if (cmsswdet == 6 && cmsswdisk <= 9)
139  return 6 + cmsswdisk * 2 + isStereo + lOffset;
140  return -1;
141  }
142  }
constexpr bool useMatched

◆ convertLayerNumber()

int mkfit::LayerNumberConverter::convertLayerNumber ( int  det,
int  lay,
bool  useMatched,
int  isStereo,
bool  posZ 
) const
inline

Definition at line 24 of file LayerNumberConverter.h.

References convertBarrelLayerNumber(), convertDiskNumber(), lo_, mkfit::phase1, mkfit::phase2, and useMatched.

Referenced by MkFitSeedConverter::convertSeeds(), MkFitGeometryESProducer::fillShapeAndPlacement(), and main().

24  {
25  if (lo_ == TkLayout::phase2) {
26  if (det == 1)
27  return lay - 1;
28  if (det == 2)
29  return 16 + lay - 1 + (posZ ? 0 : 22);
30  if (det == 5)
31  return 4 + (2 * (lay - 1)) + isStereo;
32  if (det == 4)
33  return 16 + 12 + (2 * (lay - 1)) + isStereo + (posZ ? 0 : 22);
34  throw std::runtime_error("bad subDet");
35  }
36 
37  if (det == 1 || det == 3 || det == 5) {
38  return convertBarrelLayerNumber(det, lay, useMatched, isStereo);
39  } else {
40  int disk = convertDiskNumber(det, lay, useMatched, isStereo);
41  if (disk < 0)
42  return -1;
43 
44  int lOffset = 0;
45  if (lo_ == TkLayout::phase1)
46  lOffset = 1;
47  disk += 17 + lOffset;
48  if (!posZ)
49  disk += 25 + 2 * lOffset;
50  return disk;
51  }
52  return -1;
53  }
constexpr bool useMatched
int convertDiskNumber(int cmsswdet, int cmsswdisk, bool useMatched, int isStereo) const
int convertBarrelLayerNumber(int cmsswdet, int cmsswlay, bool useMatched, int isStereo) const

◆ doesHaveStereo()

bool mkfit::LayerNumberConverter::doesHaveStereo ( int  det,
int  lay 
) const
inline

Definition at line 54 of file LayerNumberConverter.h.

References lo_, and mkfit::phase2.

54  {
55  if (lo_ == TkLayout::phase2) {
56  if (det == 1 || det == 2)
57  return false;
58  if (det == 4 || det == 5)
59  return true;
60  throw std::runtime_error("bad subDet");
61  }
62  if (det == 3 || det == 5) {
63  return lay == 1 || lay == 2;
64  }
65  if (det == 4 || det == 6) {
66  return true;
67  }
68  return false;
69  }

◆ getEra()

TkLayout mkfit::LayerNumberConverter::getEra ( ) const
inline

Definition at line 23 of file LayerNumberConverter.h.

References lo_.

23 { return lo_; }

◆ nLayers()

unsigned int mkfit::LayerNumberConverter::nLayers ( ) const
inline

Definition at line 14 of file LayerNumberConverter.h.

References lo_, mkfit::phase0, mkfit::phase1, and mkfit::phase2.

Referenced by main().

14  {
15  if (lo_ == TkLayout::phase0)
16  return 69;
17  if (lo_ == TkLayout::phase1)
18  return 72;
19  if (lo_ == TkLayout::phase2)
20  return 60; // 4 + 12 + 2*(12 + 10) = 16 + 22 + 22 = 60
21  return 10;
22  }

◆ reset()

void mkfit::LayerNumberConverter::reset ( TkLayout  layout)
inline

Member Data Documentation

◆ lo_

TkLayout mkfit::LayerNumberConverter::lo_
private