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
 
bool isPhase1 () const
 
bool isPhase2 () 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 73 of file LayerNumberConverter.h.

References lo_, mkfit::phase1, and useMatched.

Referenced by convertLayerNumber().

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

◆ convertDiskNumber()

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

Definition at line 123 of file LayerNumberConverter.h.

References lo_, mkfit::phase1, and useMatched.

Referenced by convertLayerNumber().

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

◆ convertLayerNumber()

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

Definition at line 26 of file LayerNumberConverter.h.

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

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

26  {
27  if (lo_ == TkLayout::phase2) {
28  if (det == 1)
29  return lay - 1;
30  if (det == 2)
31  return 16 + lay - 1 + (posZ ? 0 : 22);
32  if (det == 5)
33  return 4 + (2 * (lay - 1)) + isStereo;
34  if (det == 4)
35  return 16 + 12 + (2 * (lay - 1)) + isStereo + (posZ ? 0 : 22);
36  throw std::runtime_error("bad subDet");
37  }
38 
39  if (det == 1 || det == 3 || det == 5) {
40  return convertBarrelLayerNumber(det, lay, useMatched, isStereo);
41  } else {
42  int disk = convertDiskNumber(det, lay, useMatched, isStereo);
43  if (disk < 0)
44  return -1;
45 
46  int lOffset = 0;
47  if (lo_ == TkLayout::phase1)
48  lOffset = 1;
49  disk += 17 + lOffset;
50  if (!posZ)
51  disk += 25 + 2 * lOffset;
52  return disk;
53  }
54  return -1;
55  }
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 56 of file LayerNumberConverter.h.

References lo_, and mkfit::phase2.

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

◆ getEra()

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

Definition at line 23 of file LayerNumberConverter.h.

References lo_.

23 { return lo_; }

◆ isPhase1()

bool mkfit::LayerNumberConverter::isPhase1 ( ) const
inline

Definition at line 24 of file LayerNumberConverter.h.

References lo_, and mkfit::phase1.

◆ isPhase2()

bool mkfit::LayerNumberConverter::isPhase2 ( ) const
inline

◆ 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