CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
HGCalCell Class Reference

#include <HGCalCell.h>

Public Member Functions

 HGCalCell (double waferSize, int32_t nFine, int32_t nCoarse)
 
std::pair< int32_t, int32_t > HGCalCellUV2Cell (int32_t u, int32_t v, int32_t placementIndex, int32_t type)
 
std::pair< double, double > HGCalCellUV2XY1 (int32_t u, int32_t v, int32_t placementIndex, int32_t type)
 
std::pair< double, double > HGCalCellUV2XY2 (int32_t u, int32_t v, int32_t placementIndex, int32_t type)
 

Static Public Member Functions

static int32_t HGCalCellPlacementIndex (int32_t iz, int32_t fwdBack, int32_t orient)
 

Static Public Attributes

static constexpr int32_t cellPlacementExtra = 6
 
static constexpr int32_t cellPlacementIndex0 = 0
 
static constexpr int32_t cellPlacementIndex1 = 1
 
static constexpr int32_t cellPlacementIndex10 = 10
 
static constexpr int32_t cellPlacementIndex11 = 11
 
static constexpr int32_t cellPlacementIndex2 = 2
 
static constexpr int32_t cellPlacementIndex3 = 3
 
static constexpr int32_t cellPlacementIndex4 = 4
 
static constexpr int32_t cellPlacementIndex5 = 5
 
static constexpr int32_t cellPlacementIndex6 = 6
 
static constexpr int32_t cellPlacementIndex7 = 7
 
static constexpr int32_t cellPlacementIndex8 = 8
 
static constexpr int32_t cellPlacementIndex9 = 9
 
static constexpr int32_t cellPlacementOld = 7
 
static constexpr int32_t cellPlacementTotal = 12
 
static constexpr int32_t cornerCell = 1
 
static constexpr int32_t extendedCell = 3
 
static constexpr int32_t fullCell = 0
 
static constexpr int32_t truncatedCell = 2
 
static constexpr int32_t waferOrient0 = 0
 
static constexpr int32_t waferOrient1 = 1
 
static constexpr int32_t waferOrient2 = 2
 
static constexpr int32_t waferOrient3 = 3
 
static constexpr int32_t waferOrient4 = 4
 
static constexpr int32_t waferOrient5 = 5
 

Private Attributes

double cellX_ [2]
 
double cellY_ [2]
 
int32_t ncell_ [2]
 
const double sqrt3By2_ = (0.5 * std::sqrt(3.0))
 

Detailed Description

Definition at line 7 of file HGCalCell.h.

Constructor & Destructor Documentation

HGCalCell::HGCalCell ( double  waferSize,
int32_t  nFine,
int32_t  nCoarse 
)

Definition at line 4 of file HGCalCell.cc.

References cellX_, cellY_, isotrackApplyRegressor::k, ncell_, and sqrt3By2_.

4  {
5  ncell_[0] = nFine;
6  ncell_[1] = nCoarse;
7  for (int k = 0; k < 2; ++k) {
8  cellX_[k] = waferSize / (3 * ncell_[k]);
9  cellY_[k] = sqrt3By2_ * cellX_[k];
10  }
11 }
const double sqrt3By2_
Definition: HGCalCell.h:46
int32_t ncell_[2]
Definition: HGCalCell.h:47
double cellX_[2]
Definition: HGCalCell.h:48
double cellY_[2]
Definition: HGCalCell.h:48

Member Function Documentation

int HGCalCell::HGCalCellPlacementIndex ( int32_t  iz,
int32_t  fwdBack,
int32_t  orient 
)
static

Definition at line 230 of file HGCalCell.cc.

References cellPlacementExtra.

Referenced by algorithm(), and DDHGCalWaferFullRotated::execute().

230  {
231  int32_t indx = ((iz * fwdBack) > 0) ? orient : (orient + HGCalCell::cellPlacementExtra);
232  return indx;
233 }
static constexpr int32_t cellPlacementExtra
Definition: HGCalCell.h:31
std::pair< int, int > HGCalCell::HGCalCellUV2Cell ( int32_t  u,
int32_t  v,
int32_t  placementIndex,
int32_t  type 
)

Definition at line 94 of file HGCalCell.cc.

References cellPlacementExtra, cellPlacementIndex0, cellPlacementIndex1, cellPlacementIndex10, cellPlacementIndex2, cellPlacementIndex3, cellPlacementIndex4, cellPlacementIndex6, cellPlacementIndex7, cellPlacementIndex8, cellPlacementIndex9, cornerCell, extendedCell, fullCell, ncell_, and truncatedCell.

Referenced by algorithm(), and DDHGCalWaferFullRotated::execute().

94  {
95  if (type != 0)
96  type = 1;
97  int cell(0), cellx(0), cellt(HGCalCell::fullCell);
98  if (placementIndex >= HGCalCell::cellPlacementExtra) {
99  const std::vector<int> itype0 = {0, 7, 8, 9, 10, 11, 6, 3, 4, 5, 4, 5, 3};
100  const std::vector<int> itype1 = {0, 0, 1, 2, 3, 4, 5, 0, 1, 2, 0, 1, 2};
101  const std::vector<int> itype2 = {0, 11, 6, 7, 8, 9, 10, 5, 3, 4, 3, 4, 5};
102  const std::vector<int> itype3 = {0, 4, 5, 0, 1, 2, 3, 2, 0, 1, 2, 0, 1};
103  const std::vector<int> itype4 = {0, 9, 10, 11, 6, 7, 8, 4, 5, 3, 5, 3, 4};
104  const std::vector<int> itype5 = {0, 2, 3, 4, 5, 0, 1, 1, 2, 0, 1, 2, 0};
105  if (u == 0 && v == 0) {
106  cellx = 1;
107  cellt = HGCalCell::cornerCell;
108  } else if (u == 0 && (v - u) == (ncell_[type] - 1)) {
109  cellx = 2;
110  cellt = HGCalCell::cornerCell;
111  } else if ((v - u) == (ncell_[type] - 1) && v == (2 * ncell_[type] - 1)) {
112  cellx = 3;
113  cellt = HGCalCell::cornerCell;
114  } else if (u == (2 * ncell_[type] - 1) && v == (2 * ncell_[type] - 1)) {
115  cellx = 4;
116  cellt = HGCalCell::cornerCell;
117  } else if (u == (2 * ncell_[type] - 1) && (u - v) == ncell_[type]) {
118  cellx = 5;
119  cellt = HGCalCell::cornerCell;
120  } else if ((u - v) == ncell_[type] && v == 0) {
121  cellx = 6;
122  cellt = HGCalCell::cornerCell;
123  } else if (u == 0) {
124  cellx = 7;
125  cellt = HGCalCell::truncatedCell;
126  } else if ((v - u) == (ncell_[type] - 1)) {
127  cellx = 10;
128  cellt = HGCalCell::extendedCell;
129  } else if (v == (2 * ncell_[type] - 1)) {
130  cellx = 8;
131  cellt = HGCalCell::truncatedCell;
132  } else if (u == (2 * ncell_[type] - 1)) {
133  cellx = 11;
134  cellt = HGCalCell::extendedCell;
135  } else if ((u - v) == ncell_[type]) {
136  cellx = 9;
137  cellt = HGCalCell::truncatedCell;
138  } else if (v == 0) {
139  cellx = 12;
140  cellt = HGCalCell::extendedCell;
141  }
142  switch (placementIndex) {
144  cell = itype0[cellx];
145  break;
147  cell = itype1[cellx];
148  break;
150  cell = itype2[cellx];
151  break;
153  cell = itype3[cellx];
154  break;
156  cell = itype4[cellx];
157  break;
158  default:
159  cell = itype5[cellx];
160  break;
161  }
162  } else {
163  const std::vector<int> itype0 = {0, 1, 2, 3, 4, 5, 0, 1, 2, 0, 0, 1, 2};
164  const std::vector<int> itype1 = {0, 8, 9, 10, 11, 6, 7, 4, 5, 3, 4, 5, 3};
165  const std::vector<int> itype2 = {0, 3, 4, 5, 0, 1, 2, 2, 0, 1, 1, 2, 0};
166  const std::vector<int> itype3 = {0, 10, 11, 6, 7, 8, 9, 5, 3, 4, 5, 3, 4};
167  const std::vector<int> itype4 = {0, 5, 0, 1, 2, 3, 4, 0, 1, 2, 2, 0, 1};
168  const std::vector<int> itype5 = {0, 6, 7, 8, 9, 10, 11, 3, 4, 5, 3, 4, 5};
169  if (u == 0 && v == 0) {
170  cellx = 1;
171  cellt = HGCalCell::cornerCell;
172  } else if (v == 0 && (u - v) == (ncell_[type])) {
173  cellx = 2;
174  cellt = HGCalCell::cornerCell;
175  } else if ((u - v) == (ncell_[type]) && u == (2 * ncell_[type] - 1)) {
176  cellx = 3;
177  cellt = HGCalCell::cornerCell;
178  } else if (u == (2 * ncell_[type] - 1) && v == (2 * ncell_[type] - 1)) {
179  cellx = 4;
180  cellt = HGCalCell::cornerCell;
181  } else if (v == (2 * ncell_[type] - 1) && (v - u) == (ncell_[type] - 1)) {
182  cellx = 5;
183  cellt = HGCalCell::cornerCell;
184  } else if ((v - u) == (ncell_[type] - 1) && u == 0) {
185  cellx = 6;
186  cellt = HGCalCell::cornerCell;
187  } else if (v == 0) {
188  cellx = 10;
189  cellt = HGCalCell::extendedCell;
190  } else if ((u - v) == ncell_[type]) {
191  cellx = 7;
192  cellt = HGCalCell::truncatedCell;
193  } else if (u == (2 * ncell_[type] - 1)) {
194  cellx = 11;
195  cellt = HGCalCell::extendedCell;
196  } else if (v == (2 * ncell_[type] - 1)) {
197  cellx = 8;
198  cellt = HGCalCell::truncatedCell;
199  } else if ((v - u) == (ncell_[type] - 1)) {
200  cellx = 12;
201  cellt = HGCalCell::extendedCell;
202  } else if (u == 0) {
203  cellx = 9;
204  cellt = HGCalCell::truncatedCell;
205  }
206  switch (placementIndex) {
208  cell = itype0[cellx];
209  break;
211  cell = itype1[cellx];
212  break;
214  cell = itype2[cellx];
215  break;
217  cell = itype3[cellx];
218  break;
220  cell = itype4[cellx];
221  break;
222  default:
223  cell = itype5[cellx];
224  break;
225  }
226  }
227  return std::make_pair(cell, cellt);
228 }
static constexpr int32_t fullCell
Definition: HGCalCell.h:35
static constexpr int32_t cellPlacementIndex8
Definition: HGCalCell.h:26
static constexpr int32_t cellPlacementIndex3
Definition: HGCalCell.h:21
int32_t ncell_[2]
Definition: HGCalCell.h:47
static constexpr int32_t cellPlacementIndex10
Definition: HGCalCell.h:28
static constexpr int32_t cellPlacementIndex0
Definition: HGCalCell.h:18
static constexpr int32_t cellPlacementIndex9
Definition: HGCalCell.h:27
static constexpr int32_t cellPlacementIndex7
Definition: HGCalCell.h:25
static constexpr int32_t truncatedCell
Definition: HGCalCell.h:37
static constexpr int32_t extendedCell
Definition: HGCalCell.h:38
static constexpr int32_t cornerCell
Definition: HGCalCell.h:36
static constexpr int32_t cellPlacementIndex4
Definition: HGCalCell.h:22
static constexpr int32_t cellPlacementIndex1
Definition: HGCalCell.h:19
static constexpr int32_t cellPlacementIndex6
Definition: HGCalCell.h:24
static constexpr int32_t cellPlacementIndex2
Definition: HGCalCell.h:20
static constexpr int32_t cellPlacementExtra
Definition: HGCalCell.h:31
std::pair< double, double > HGCalCell::HGCalCellUV2XY1 ( int32_t  u,
int32_t  v,
int32_t  placementIndex,
int32_t  type 
)

Definition at line 13 of file HGCalCell.cc.

References cellPlacementIndex0, cellPlacementIndex1, cellPlacementIndex10, cellPlacementIndex11, cellPlacementIndex2, cellPlacementIndex3, cellPlacementIndex4, cellPlacementIndex6, cellPlacementIndex7, cellPlacementIndex8, cellPlacementIndex9, cellX_, cellY_, ncell_, findQualityFiles::v, x, and y.

Referenced by algorithm(), and DDHGCalWaferFullRotated::execute().

13  {
14  if (type != 0)
15  type = 1;
16  double x(0), y(0);
17  switch (placementIndex) {
19  x = (1.5 * (v - u) + 0.5) * cellX_[type];
20  y = (v + u - 2 * ncell_[type] + 1) * cellY_[type];
21  break;
23  x = (1.5 * (v - ncell_[type]) + 1.0) * cellX_[type];
24  y = (2 * u - v - ncell_[type]) * cellY_[type];
25  break;
27  x = (1.5 * (u - ncell_[type]) + 0.5) * cellX_[type];
28  y = -(2 * v - u - ncell_[type] + 1) * cellY_[type];
29  break;
31  x = -(1.5 * (v - u) + 0.5) * cellX_[type];
32  y = -(v + u - 2 * ncell_[type] + 1) * cellY_[type];
33  break;
35  x = -(1.5 * (v - ncell_[type]) + 1) * cellX_[type];
36  y = -(2 * u - v - ncell_[type]) * cellY_[type];
37  break;
39  x = -(1.5 * (u - ncell_[type]) + 0.5) * cellX_[type];
40  y = (2 * v - u - ncell_[type] + 1) * cellY_[type];
41  break;
43  x = (1.5 * (u - v) - 0.5) * cellX_[type];
44  y = (v + u - 2 * ncell_[type] + 1) * cellY_[type];
45  break;
47  x = -(1.5 * (v - ncell_[type]) + 1.0) * cellX_[type];
48  y = (2 * u - v - ncell_[type]) * cellY_[type];
49  break;
51  x = -(1.5 * (u - ncell_[type]) + 0.5) * cellX_[type];
52  y = -(2 * v - u - ncell_[type] + 1) * cellY_[type];
53  break;
55  x = -(1.5 * (u - v) - 0.5) * cellX_[type];
56  y = -(v + u - 2 * ncell_[type] + 1) * cellY_[type];
57  break;
59  x = (1.5 * (v - ncell_[type]) + 1) * cellX_[type];
60  y = -(2 * u - v - ncell_[type]) * cellY_[type];
61  break;
62  default:
63  x = (1.5 * (u - ncell_[type]) + 0.5) * cellX_[type];
64  y = (2 * v - u - ncell_[type] + 1) * cellY_[type];
65  break;
66  }
67  return std::make_pair(x, y);
68 }
static constexpr int32_t cellPlacementIndex8
Definition: HGCalCell.h:26
static constexpr int32_t cellPlacementIndex3
Definition: HGCalCell.h:21
int32_t ncell_[2]
Definition: HGCalCell.h:47
static constexpr int32_t cellPlacementIndex10
Definition: HGCalCell.h:28
static constexpr int32_t cellPlacementIndex0
Definition: HGCalCell.h:18
static constexpr int32_t cellPlacementIndex9
Definition: HGCalCell.h:27
static constexpr int32_t cellPlacementIndex7
Definition: HGCalCell.h:25
static constexpr int32_t cellPlacementIndex11
Definition: HGCalCell.h:29
static constexpr int32_t cellPlacementIndex4
Definition: HGCalCell.h:22
static constexpr int32_t cellPlacementIndex1
Definition: HGCalCell.h:19
double cellX_[2]
Definition: HGCalCell.h:48
static constexpr int32_t cellPlacementIndex6
Definition: HGCalCell.h:24
double cellY_[2]
Definition: HGCalCell.h:48
static constexpr int32_t cellPlacementIndex2
Definition: HGCalCell.h:20
std::pair< double, double > HGCalCell::HGCalCellUV2XY2 ( int32_t  u,
int32_t  v,
int32_t  placementIndex,
int32_t  type 
)

Definition at line 70 of file HGCalCell.cc.

References cellPlacementExtra, cellX_, cellY_, ncell_, sqrt3By2_, findQualityFiles::v, x, and y.

70  {
71  if (type != 0)
72  type = 1;
73  double x(0), y(0);
74  if (placementIndex < HGCalCell::cellPlacementExtra) {
75  double x0 = (1.5 * (u - v) - 0.5) * cellX_[type];
76  double y0 = (u + v - 2 * ncell_[type] + 1) * cellY_[type];
77  const std::vector<double> fcos = {1.0, 0.5, -0.5, -1.0, -0.5, 0.5};
78  const std::vector<double> fsin = {0.0, sqrt3By2_, sqrt3By2_, 0.0, -sqrt3By2_, -sqrt3By2_};
79  x = x0 * fcos[placementIndex] - y0 * fsin[placementIndex];
80  y = x0 * fsin[placementIndex] + y0 * fcos[placementIndex];
81  } else {
82  double x0 = (1.5 * (v - ncell_[type]) + 1.0) * cellX_[type];
83  double y0 = (2 * u - v - ncell_[type]) * cellY_[type];
84  const std::vector<double> fcos = {0.5, 1.0, 0.5, -0.5, -1.0, -0.5};
85  const std::vector<double> fsin = {sqrt3By2_, 0.0, -sqrt3By2_, -sqrt3By2_, 0.0, sqrt3By2_};
86  x = x0 * fcos[placementIndex - HGCalCell::cellPlacementExtra] -
87  y0 * fsin[placementIndex - HGCalCell::cellPlacementExtra];
88  y = x0 * fsin[placementIndex - HGCalCell::cellPlacementExtra] +
89  y0 * fcos[placementIndex - HGCalCell::cellPlacementExtra];
90  }
91  return std::make_pair(x, y);
92 }
const double sqrt3By2_
Definition: HGCalCell.h:46
int32_t ncell_[2]
Definition: HGCalCell.h:47
double cellX_[2]
Definition: HGCalCell.h:48
double cellY_[2]
Definition: HGCalCell.h:48
static constexpr int32_t cellPlacementExtra
Definition: HGCalCell.h:31

Member Data Documentation

constexpr int32_t HGCalCell::cellPlacementExtra = 6
static

Definition at line 31 of file HGCalCell.h.

Referenced by HGCalCellPlacementIndex(), HGCalCellUV2Cell(), and HGCalCellUV2XY2().

constexpr int32_t HGCalCell::cellPlacementIndex0 = 0
static

Definition at line 18 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex1 = 1
static

Definition at line 19 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex10 = 10
static

Definition at line 28 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex11 = 11
static

Definition at line 29 of file HGCalCell.h.

Referenced by HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex2 = 2
static

Definition at line 20 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex3 = 3
static

Definition at line 21 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex4 = 4
static

Definition at line 22 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex5 = 5
static

Definition at line 23 of file HGCalCell.h.

constexpr int32_t HGCalCell::cellPlacementIndex6 = 6
static

Definition at line 24 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex7 = 7
static

Definition at line 25 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex8 = 8
static

Definition at line 26 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementIndex9 = 9
static

Definition at line 27 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell(), and HGCalCellUV2XY1().

constexpr int32_t HGCalCell::cellPlacementOld = 7
static

Definition at line 32 of file HGCalCell.h.

constexpr int32_t HGCalCell::cellPlacementTotal = 12
static

Definition at line 33 of file HGCalCell.h.

double HGCalCell::cellX_[2]
private

Definition at line 48 of file HGCalCell.h.

Referenced by HGCalCell(), HGCalCellUV2XY1(), and HGCalCellUV2XY2().

double HGCalCell::cellY_[2]
private

Definition at line 48 of file HGCalCell.h.

Referenced by HGCalCell(), HGCalCellUV2XY1(), and HGCalCellUV2XY2().

constexpr int32_t HGCalCell::cornerCell = 1
static

Definition at line 36 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell().

constexpr int32_t HGCalCell::extendedCell = 3
static

Definition at line 38 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell().

constexpr int32_t HGCalCell::fullCell = 0
static

Definition at line 35 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell().

int32_t HGCalCell::ncell_[2]
private

Definition at line 47 of file HGCalCell.h.

Referenced by HGCalCell(), HGCalCellUV2Cell(), HGCalCellUV2XY1(), and HGCalCellUV2XY2().

const double HGCalCell::sqrt3By2_ = (0.5 * std::sqrt(3.0))
private

Definition at line 46 of file HGCalCell.h.

Referenced by HGCalCell(), and HGCalCellUV2XY2().

constexpr int32_t HGCalCell::truncatedCell = 2
static

Definition at line 37 of file HGCalCell.h.

Referenced by HGCalCellUV2Cell().

constexpr int32_t HGCalCell::waferOrient0 = 0
static

Definition at line 11 of file HGCalCell.h.

constexpr int32_t HGCalCell::waferOrient1 = 1
static

Definition at line 12 of file HGCalCell.h.

constexpr int32_t HGCalCell::waferOrient2 = 2
static

Definition at line 13 of file HGCalCell.h.

constexpr int32_t HGCalCell::waferOrient3 = 3
static

Definition at line 14 of file HGCalCell.h.

constexpr int32_t HGCalCell::waferOrient4 = 4
static

Definition at line 15 of file HGCalCell.h.

constexpr int32_t HGCalCell::waferOrient5 = 5
static

Definition at line 16 of file HGCalCell.h.