CMS 3D CMS Logo

HcalHardcodeGeometryLoader.cc
Go to the documentation of this file.
7 
8 #include <algorithm>
9 #include <vector>
10 #include <sstream>
11 
13 //#define EDM_ML_DEBUG
14 // ==============> Loader Itself <==========================
15 
17  MAX_HCAL_PHI = 72;
18  DEGREE2RAD = M_PI / 180.;
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("HCalGeom") << "Instantiate HcalHardCodeGeometryLoader";
21 #endif
22 }
23 
25  int maxEta = fTopology.lastHERing();
26  m_segmentation.resize(maxEta);
27  for (int i = 0; i < maxEta; i++) {
28  fTopology.getDepthSegmentation(i + 1, m_segmentation[i]);
29 #ifdef EDM_ML_DEBUG
30  std::ostringstream st1;
31  st1 << "Eta" << i + 1;
32  for (unsigned int k = 0; k < m_segmentation[i].size(); ++k) {
33  st1 << " [" << k << "] " << m_segmentation[i][k];
34  }
35  edm::LogVerbatim("HCalGeom") << st1.str();
36 #endif
37  }
38  HcalGeometry* hcalGeometry = new HcalGeometry(fTopology);
39  if (nullptr == hcalGeometry->cornersMgr())
40  hcalGeometry->allocateCorners(fTopology.ncells() + fTopology.getHFSize());
41  if (nullptr == hcalGeometry->parMgr())
43  if (fTopology.mode() == HcalTopologyMode::H2) { // TB geometry
44  fillHBHO(hcalGeometry, makeHBCells(fTopology), true);
45  fillHBHO(hcalGeometry, makeHOCells(), false);
46  fillHE(hcalGeometry, makeHECells_H2());
47  } else { // regular geometry
48  fillHBHO(hcalGeometry, makeHBCells(fTopology), true);
49  fillHBHO(hcalGeometry, makeHOCells(), false);
50  fillHF(hcalGeometry, makeHFCells());
51  fillHE(hcalGeometry, makeHECells(fTopology));
52  }
53  //fast insertion of valid ids requires sort at end
54  hcalGeometry->sortValidIds();
55  return hcalGeometry;
56 }
57 
58 // ----------> HB <-----------
59 std::vector<HcalHardcodeGeometryLoader::HBHOCellParameters> HcalHardcodeGeometryLoader::makeHBCells(
60  const HcalTopology& topology) {
61  const float HBRMIN = 181.1;
62  const float HBRMAX = 288.8;
63 
64  float normalDepths[2] = {HBRMIN, HBRMAX};
65  float ring15Depths[3] = {HBRMIN, 258.4, HBRMAX};
66  float ring16Depths[3] = {HBRMIN, 190.4, 232.6};
67  float layerDepths[18] = {HBRMIN,
68  188.7,
69  194.7,
70  200.7,
71  206.7,
72  212.7,
73  218.7,
74  224.7,
75  230.7,
76  236.7,
77  242.7,
78  249.3,
79  255.9,
80  262.5,
81  269.1,
82  275.7,
83  282.3,
84  HBRMAX};
85  float slhcDepths[4] = {HBRMIN, 214., 239., HBRMAX};
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("HCalGeom") << "FlexiGeometryLoader called for " << topology.mode() << ":" << HcalTopologyMode::SLHC;
88 #endif
89  std::vector<HcalHardcodeGeometryLoader::HBHOCellParameters> result;
90  for (int iring = 1; iring <= 16; ++iring) {
91  std::vector<float> depths;
92  if (topology.mode() != HcalTopologyMode::SLHC) {
93  if (iring == 15) {
94  for (float ring15Depth : ring15Depths)
95  depths.emplace_back(ring15Depth);
96  } else if (iring == 16) {
97  for (float ring16Depth : ring16Depths)
98  depths.emplace_back(ring16Depth);
99  } else {
100  for (float normalDepth : normalDepths)
101  depths.emplace_back(normalDepth);
102  }
103  } else {
104  if (m_segmentation.size() >= (unsigned int)(iring)) {
105  int depth = m_segmentation[iring - 1][0];
106  depths.emplace_back(layerDepths[depth]);
107  int layer = 1;
108  for (unsigned int i = 1; i < m_segmentation[iring - 1].size(); ++i) {
109  if (depth != m_segmentation[iring - 1][i]) {
110  depth = m_segmentation[iring - 1][i];
111  layer = i;
112  if (iring != 16 || depth < 3)
113  depths.emplace_back(layerDepths[depth]);
114  }
115  if (i >= 17)
116  break;
117  }
118  if (layer <= 17)
119  depths.emplace_back(HBRMAX);
120  } else {
121  for (int i = 0; i < 4; ++i) {
122  if (iring != 16 || i < 3) {
123  depths.emplace_back(slhcDepths[i]);
124  }
125  }
126  }
127  }
128  unsigned int ndepth = depths.size() - 1;
129  unsigned int startingDepth = 1;
130  float etaMin = (iring - 1) * 0.087;
131  float etaMax = iring * 0.087;
132  // topology.depthBinInformation(HcalBarrel, iring, ndepth, startingDepth);
133 #ifdef EDM_ML_DEBUG
134  std::ostringstream st2;
135  st2 << "HBRing " << iring << " eta " << etaMin << ":" << etaMax << " depths " << ndepth << ":" << startingDepth;
136  for (unsigned int i = 0; i < depths.size(); ++i)
137  st2 << ":" << depths[i];
138  edm::LogVerbatim("HCalGeom") << st2.str();
139 #endif
140  for (unsigned int idepth = startingDepth; idepth <= ndepth; ++idepth) {
141  float rmin = depths[idepth - 1];
142  float rmax = depths[idepth];
143 #ifdef EDM_ML_DEBUG
144  edm::LogVerbatim("HCalGeom") << "HB " << idepth << " R " << rmin << ":" << rmax;
145 #endif
146  result.emplace_back(
147  HcalHardcodeGeometryLoader::HBHOCellParameters(iring, (int)idepth, 1, 1, 5, rmin, rmax, etaMin, etaMax));
148  }
149  }
150  return result;
151 }
152 
153 // ----------> HO <-----------
154 std::vector<HcalHardcodeGeometryLoader::HBHOCellParameters> HcalHardcodeGeometryLoader::makeHOCells() {
155  const float HORMIN0 = 390.0;
156  const float HORMIN1 = 412.6;
157  const float HORMAX = 413.6;
158 
160  // eta, depth, firstPhi, stepPhi, deltaPhi, rMin, rMax, etaMin, etaMax
161  HcalHardcodeGeometryLoader::HBHOCellParameters(1, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087 * 0, 0.087 * 1),
162  HcalHardcodeGeometryLoader::HBHOCellParameters(2, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087 * 1, 0.087 * 2),
163  HcalHardcodeGeometryLoader::HBHOCellParameters(3, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087 * 2, 0.087 * 3),
164  HcalHardcodeGeometryLoader::HBHOCellParameters(4, 4, 1, 1, 5, HORMIN0, HORMAX, 0.087 * 3, 0.3075),
165  HcalHardcodeGeometryLoader::HBHOCellParameters(5, 4, 1, 1, 5, HORMIN1, HORMAX, 0.3395, 0.087 * 5),
166  HcalHardcodeGeometryLoader::HBHOCellParameters(6, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 5, 0.087 * 6),
167  HcalHardcodeGeometryLoader::HBHOCellParameters(7, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 6, 0.087 * 7),
168  HcalHardcodeGeometryLoader::HBHOCellParameters(8, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 7, 0.087 * 8),
169  HcalHardcodeGeometryLoader::HBHOCellParameters(9, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 8, 0.087 * 9),
170  HcalHardcodeGeometryLoader::HBHOCellParameters(10, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 9, 0.8494),
171  HcalHardcodeGeometryLoader::HBHOCellParameters(11, 4, 1, 1, 5, HORMIN1, HORMAX, 0.873, 0.087 * 11),
172  HcalHardcodeGeometryLoader::HBHOCellParameters(12, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 11, 0.087 * 12),
173  HcalHardcodeGeometryLoader::HBHOCellParameters(13, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 12, 0.087 * 13),
174  HcalHardcodeGeometryLoader::HBHOCellParameters(14, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 13, 0.087 * 14),
175  HcalHardcodeGeometryLoader::HBHOCellParameters(15, 4, 1, 1, 5, HORMIN1, HORMAX, 0.087 * 14, 0.087 * 15)};
177  std::vector<HcalHardcodeGeometryLoader::HBHOCellParameters> result;
178  result.reserve(nCells);
179  for (int i = 0; i < nCells; ++i)
180  result.emplace_back(cells[i]);
181  return result;
182 }
183 
184 //
185 // Convert constants to appropriate cells
186 //
188  const std::vector<HcalHardcodeGeometryLoader::HBHOCellParameters>& fCells,
189  bool fHB) {
190  fGeometry->increaseReserve(fCells.size());
191  for (const auto& param : fCells) {
192  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
193  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
194  HcalDetId hid(fHB ? HcalBarrel : HcalOuter, param.eta * iside, iPhi, param.depth);
195  float phiCenter = ((iPhi - 1) * 360. / MAX_HCAL_PHI + 0.5 * param.dphi) * DEGREE2RAD; // middle of the cell
196  float etaCenter = 0.5 * (param.etaMin + param.etaMax);
197  float x = param.rMin * cos(phiCenter);
198  float y = param.rMin * sin(phiCenter);
199  float z = iside * param.rMin * sinh(etaCenter);
200  // make cell geometry
201  GlobalPoint refPoint(x, y, z); // center of the cell's face
202  std::vector<CCGFloat> cellParams;
203  cellParams.reserve(5);
204  cellParams.emplace_back(0.5 * (param.etaMax - param.etaMin)); // deta_half
205  cellParams.emplace_back(0.5 * param.dphi * DEGREE2RAD); // dphi_half
206  cellParams.emplace_back(0.5 * (param.rMax - param.rMin) * cosh(etaCenter)); // dr_half
207  cellParams.emplace_back(fabs(refPoint.eta()));
208  cellParams.emplace_back(fabs(refPoint.z()));
209 #ifdef EDM_ML_DEBUG
210  edm::LogVerbatim("HCalGeom") << "HcalHardcodeGeometryLoader::fillHBHO-> " << hid << hid.ieta() << '/'
211  << hid.iphi() << '/' << hid.depth() << refPoint << '/' << cellParams[0] << '/'
212  << cellParams[1] << '/' << cellParams[2];
213 #endif
214  fGeometry->newCellFast(refPoint,
215  refPoint,
216  refPoint,
217  CaloCellGeometry::getParmPtr(cellParams, fGeometry->parMgr(), fGeometry->parVecVec()),
218  hid);
219  }
220  }
221  }
222 }
223 
224 // ----------> HE <-----------
225 std::vector<HcalHardcodeGeometryLoader::HECellParameters> HcalHardcodeGeometryLoader::makeHECells(
226  const HcalTopology& topology) {
227  std::vector<HcalHardcodeGeometryLoader::HECellParameters> result;
228  const float HEZMIN = 400.458;
229  const float HEZMID = 436.168;
230  const float HEZMAX = 549.268;
231  float normalDepths[3] = {HEZMIN, HEZMID, HEZMAX};
232  float tripleDepths[4] = {HEZMIN, 418.768, HEZMID, HEZMAX};
233  float slhcDepths[5] = {HEZMIN, 418.768, HEZMID, 493., HEZMAX};
234  float ring16Depths[2] = {418.768, 470.968};
235  float ring16slhcDepths[3] = {418.768, 450., 470.968};
236  float ring17Depths[2] = {409.698, 514.468};
237  float ring17slhcDepths[5] = {409.698, 435., 460., 495., 514.468};
238  float ring18Depths[3] = {391.883, 427.468, 540.568};
239  float ring18slhcDepths[5] = {391.883, 439., 467., 504., 540.568};
240  float etaBounds[] = {0.087 * 15,
241  0.087 * 16,
242  0.087 * 17,
243  0.087 * 18,
244  0.087 * 19,
245  1.74,
246  1.83,
247  1.93,
248  2.043,
249  2.172,
250  2.322,
251  2.500,
252  2.650,
253  2.868,
254  3.000};
255  float layerDepths[19] = {HEZMIN,
256  408.718,
257  416.978,
258  425.248,
259  433.508,
260  441.768,
261  450.038,
262  458.298,
263  466.558,
264  474.828,
265  483.088,
266  491.348,
267  499.618,
268  507.878,
269  516.138,
270  524.398,
271  532.668,
272  540.928,
273  HEZMAX};
274 
275  // count by ring - 16
276  for (int iringm16 = 0; iringm16 <= 13; ++iringm16) {
277  int iring = iringm16 + 16;
278  std::vector<float> depths;
279  unsigned int startingDepth = 1;
280  if (topology.mode() != HcalTopologyMode::SLHC) {
281  if (iring == 16) {
282  for (float ring16Depth : ring16Depths)
283  depths.emplace_back(ring16Depth);
284  startingDepth = 3;
285  } else if (iring == 17)
286  for (float ring17Depth : ring17Depths)
287  depths.emplace_back(ring17Depth);
288  else if (iring == 18)
289  for (float ring18Depth : ring18Depths)
290  depths.emplace_back(ring18Depth);
291  else if (iring == topology.lastHERing())
292  for (int i = 0; i < 3; ++i)
293  depths.emplace_back(tripleDepths[i]);
294  else if (iring >= topology.firstHETripleDepthRing())
295  for (float tripleDepth : tripleDepths)
296  depths.emplace_back(tripleDepth);
297  else
298  for (float normalDepth : normalDepths)
299  depths.emplace_back(normalDepth);
300  } else {
301  if (m_segmentation.size() >= (unsigned int)(iring)) {
302  int depth = m_segmentation[iring - 1][0];
303  if (iring == 16)
304  depths.emplace_back(ring16Depths[0]);
305  else if (iring == 17)
306  depths.emplace_back(ring17Depths[0]);
307  else if (iring == 18)
308  depths.emplace_back(ring18Depths[0]);
309  else
310  depths.emplace_back(layerDepths[depth]);
311  int layer = 1;
312  float lastDepth = depths[0];
313  for (unsigned int i = 1; i < m_segmentation[iring - 1].size(); ++i) {
314  if (depth != m_segmentation[iring - 1][i]) {
315  depth = m_segmentation[iring - 1][i];
316  layer = i;
317  if (layerDepths[depth] > lastDepth && (iring != 16 || depth > 3)) {
318  depths.emplace_back(layerDepths[depth]);
319  lastDepth = layerDepths[depth];
320  }
321  }
322  }
323  if (layer <= 17)
324  depths.emplace_back(HEZMAX);
325  if (iring == 16)
326  startingDepth = 3;
327  } else {
328  if (iring == 16) {
329  for (float ring16slhcDepth : ring16slhcDepths)
330  depths.emplace_back(ring16slhcDepth);
331  startingDepth = 3;
332  } else if (iring == 17)
333  for (float ring17slhcDepth : ring17slhcDepths)
334  depths.emplace_back(ring17slhcDepth);
335  else if (iring == 18)
336  for (float ring18slhcDepth : ring18slhcDepths)
337  depths.emplace_back(ring18slhcDepth);
338  else
339  for (float slhcDepth : slhcDepths)
340  depths.emplace_back(slhcDepth);
341  }
342  }
343  float etamin = etaBounds[iringm16];
344  float etamax = etaBounds[iringm16 + 1];
345  unsigned int ndepth = depths.size() - 1;
346  // topology.depthBinInformation(HcalEndcap, iring, ndepth, startingDepth);
347 #ifdef EDM_ML_DEBUG
348  std::ostringstream st3;
349  st3 << "HERing " << iring << " eta " << etamin << ":" << etamax << " depths " << ndepth << ":" << startingDepth;
350  for (unsigned int i = 0; i < depths.size(); ++i)
351  st3 << ":" << depths[i];
352  edm::LogVerbatim("HCalGeom") << st3.str();
353 #endif
354  for (unsigned int idepth = 0; idepth < ndepth; ++idepth) {
355  int depthIndex = (int)(idepth + startingDepth);
356  float zmin = depths[idepth];
357  float zmax = depths[idepth + 1];
358  if (depthIndex <= 7) {
359 #ifdef EDM_ML_DEBUG
360  edm::LogVerbatim("HCalGeom") << "HE Depth " << idepth << ":" << depthIndex << " Z " << zmin << ":" << zmax;
361 #endif
362  int stepPhi = (iring >= topology.firstHEDoublePhiRing() ? 2 : 1);
363  int deltaPhi = (iring >= topology.firstHEDoublePhiRing() ? 10 : 5);
364  if (topology.mode() != HcalTopologyMode::SLHC && iring == topology.lastHERing() - 1 && idepth == ndepth - 1) {
365 #ifdef EDM_ML_DEBUG
366  edm::LogVerbatim("HCalGeom") << "HE iEta " << iring << " Depth " << depthIndex << " Eta " << etamin << ":"
367  << etaBounds[iringm16 + 2];
368 #endif
370  iring, depthIndex, 1, stepPhi, deltaPhi, zmin, zmax, etamin, etaBounds[iringm16 + 2]));
371  } else {
372 #ifdef EDM_ML_DEBUG
373  edm::LogVerbatim("HCalGeom") << "HE iEta " << iring << " Depth " << depthIndex << " Eta " << etamin << ":"
374  << etamax;
375 #endif
377  iring, depthIndex, 1, stepPhi, deltaPhi, zmin, zmax, etamin, etamax));
378  }
379  }
380  }
381  }
382 
383  return result;
384 }
385 
386 // ----------> HE @ H2 <-----------
387 std::vector<HcalHardcodeGeometryLoader::HECellParameters> HcalHardcodeGeometryLoader::makeHECells_H2() {
388  const float HEZMIN_H2 = 400.715;
389  const float HEZMID_H2 = 436.285;
390  const float HEZMAX_H2 = 541.885;
391 
393  // eta, depth, firstPhi, stepPhi, deltaPhi, zMin, zMax, etaMin, etaMax
394  HcalHardcodeGeometryLoader::HECellParameters(16, 3, 1, 1, 5, 409.885, 462.685, 1.305, 1.373),
395  HcalHardcodeGeometryLoader::HECellParameters(17, 1, 1, 1, 5, HEZMIN_H2, 427.485, 1.373, 1.444),
396  HcalHardcodeGeometryLoader::HECellParameters(17, 2, 1, 1, 5, 427.485, 506.685, 1.373, 1.444),
397  HcalHardcodeGeometryLoader::HECellParameters(18, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.444, 1.521),
398  HcalHardcodeGeometryLoader::HECellParameters(18, 2, 1, 1, 5, HEZMID_H2, 524.285, 1.444, 1.521),
399  HcalHardcodeGeometryLoader::HECellParameters(19, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.521, 1.603),
400  HcalHardcodeGeometryLoader::HECellParameters(19, 2, 1, 1, 5, HEZMID_H2, HEZMAX_H2, 1.521, 1.603),
401  HcalHardcodeGeometryLoader::HECellParameters(20, 1, 1, 1, 5, HEZMIN_H2, HEZMID_H2, 1.603, 1.693),
402  HcalHardcodeGeometryLoader::HECellParameters(20, 2, 1, 1, 5, HEZMID_H2, HEZMAX_H2, 1.603, 1.693),
403  HcalHardcodeGeometryLoader::HECellParameters(21, 1, 1, 2, 5, HEZMIN_H2, HEZMID_H2, 1.693, 1.79),
404  HcalHardcodeGeometryLoader::HECellParameters(21, 2, 1, 2, 5, HEZMID_H2, HEZMAX_H2, 1.693, 1.79),
405  HcalHardcodeGeometryLoader::HECellParameters(22, 1, 1, 2, 10, HEZMIN_H2, HEZMID_H2, 1.79, 1.88),
406  HcalHardcodeGeometryLoader::HECellParameters(22, 2, 1, 2, 10, HEZMID_H2, HEZMAX_H2, 1.79, 1.88),
407  HcalHardcodeGeometryLoader::HECellParameters(23, 1, 1, 2, 10, HEZMIN_H2, HEZMID_H2, 1.88, 1.98),
408  HcalHardcodeGeometryLoader::HECellParameters(23, 2, 1, 2, 10, HEZMID_H2, HEZMAX_H2, 1.88, 1.98),
409  HcalHardcodeGeometryLoader::HECellParameters(24, 1, 1, 2, 10, HEZMIN_H2, 418.685, 1.98, 2.09),
410  HcalHardcodeGeometryLoader::HECellParameters(24, 2, 1, 2, 10, 418.685, HEZMID_H2, 1.98, 2.09),
411  HcalHardcodeGeometryLoader::HECellParameters(24, 3, 1, 2, 10, HEZMID_H2, HEZMAX_H2, 1.98, 2.09),
412  HcalHardcodeGeometryLoader::HECellParameters(25, 1, 1, 2, 10, HEZMIN_H2, 418.685, 2.09, 2.21),
413  HcalHardcodeGeometryLoader::HECellParameters(25, 2, 1, 2, 10, 418.685, HEZMID_H2, 2.09, 2.21),
414  HcalHardcodeGeometryLoader::HECellParameters(25, 3, 1, 2, 10, HEZMID_H2, HEZMAX_H2, 2.09, 2.21)};
416  std::vector<HcalHardcodeGeometryLoader::HECellParameters> result;
417  result.reserve(nCells);
418  for (int i = 0; i < nCells; ++i)
419  result.emplace_back(cells[i]);
420  return result;
421 }
422 
423 // ----------> HF <-----------
424 std::vector<HcalHardcodeGeometryLoader::HFCellParameters> HcalHardcodeGeometryLoader::makeHFCells() {
425  const float HFZMIN1 = 1115.;
426  const float HFZMIN2 = 1137.;
427  const float HFZMAX = 1280.1;
428 
430  // eta, depth, firstPhi, stepPhi, deltaPhi, zMin, zMax, rMin, rMax
431  HcalHardcodeGeometryLoader::HFCellParameters(29, 1, 1, 2, 10, HFZMIN1, HFZMAX, 116.2, 130.0),
432  HcalHardcodeGeometryLoader::HFCellParameters(29, 2, 1, 2, 10, HFZMIN2, HFZMAX, 116.2, 130.0),
433  HcalHardcodeGeometryLoader::HFCellParameters(30, 1, 1, 2, 10, HFZMIN1, HFZMAX, 97.5, 116.2),
434  HcalHardcodeGeometryLoader::HFCellParameters(30, 2, 1, 2, 10, HFZMIN2, HFZMAX, 97.5, 116.2),
435  HcalHardcodeGeometryLoader::HFCellParameters(31, 1, 1, 2, 10, HFZMIN1, HFZMAX, 81.8, 97.5),
436  HcalHardcodeGeometryLoader::HFCellParameters(31, 2, 1, 2, 10, HFZMIN2, HFZMAX, 81.8, 97.5),
437  HcalHardcodeGeometryLoader::HFCellParameters(32, 1, 1, 2, 10, HFZMIN1, HFZMAX, 68.6, 81.8),
438  HcalHardcodeGeometryLoader::HFCellParameters(32, 2, 1, 2, 10, HFZMIN2, HFZMAX, 68.6, 81.8),
439  HcalHardcodeGeometryLoader::HFCellParameters(33, 1, 1, 2, 10, HFZMIN1, HFZMAX, 57.6, 68.6),
440  HcalHardcodeGeometryLoader::HFCellParameters(33, 2, 1, 2, 10, HFZMIN2, HFZMAX, 57.6, 68.6),
441  HcalHardcodeGeometryLoader::HFCellParameters(34, 1, 1, 2, 10, HFZMIN1, HFZMAX, 48.3, 57.6),
442  HcalHardcodeGeometryLoader::HFCellParameters(34, 2, 1, 2, 10, HFZMIN2, HFZMAX, 48.3, 57.6),
443  HcalHardcodeGeometryLoader::HFCellParameters(35, 1, 1, 2, 10, HFZMIN1, HFZMAX, 40.6, 48.3),
444  HcalHardcodeGeometryLoader::HFCellParameters(35, 2, 1, 2, 10, HFZMIN2, HFZMAX, 40.6, 48.3),
445  HcalHardcodeGeometryLoader::HFCellParameters(36, 1, 1, 2, 10, HFZMIN1, HFZMAX, 34.0, 40.6),
446  HcalHardcodeGeometryLoader::HFCellParameters(36, 2, 1, 2, 10, HFZMIN2, HFZMAX, 34.0, 40.6),
447  HcalHardcodeGeometryLoader::HFCellParameters(37, 1, 1, 2, 10, HFZMIN1, HFZMAX, 28.6, 34.0),
448  HcalHardcodeGeometryLoader::HFCellParameters(37, 2, 1, 2, 10, HFZMIN2, HFZMAX, 28.6, 34.0),
449  HcalHardcodeGeometryLoader::HFCellParameters(38, 1, 1, 2, 10, HFZMIN1, HFZMAX, 24.0, 28.6),
450  HcalHardcodeGeometryLoader::HFCellParameters(38, 2, 1, 2, 10, HFZMIN2, HFZMAX, 24.0, 28.6),
451  HcalHardcodeGeometryLoader::HFCellParameters(39, 1, 1, 2, 10, HFZMIN1, HFZMAX, 20.1, 24.0),
452  HcalHardcodeGeometryLoader::HFCellParameters(39, 2, 1, 2, 10, HFZMIN2, HFZMAX, 20.1, 24.0),
453  HcalHardcodeGeometryLoader::HFCellParameters(40, 1, 3, 4, 20, HFZMIN1, HFZMAX, 16.9, 20.1),
454  HcalHardcodeGeometryLoader::HFCellParameters(40, 2, 3, 4, 20, HFZMIN2, HFZMAX, 16.9, 20.1),
455  HcalHardcodeGeometryLoader::HFCellParameters(41, 1, 3, 4, 20, HFZMIN1, HFZMAX, 12.5, 16.9),
456  HcalHardcodeGeometryLoader::HFCellParameters(41, 2, 3, 4, 20, HFZMIN2, HFZMAX, 12.5, 16.9)};
458  std::vector<HcalHardcodeGeometryLoader::HFCellParameters> result;
459  result.reserve(nCells);
460  for (int i = 0; i < nCells; ++i)
461  result.emplace_back(cells[i]);
462  return result;
463 }
464 
466  const std::vector<HcalHardcodeGeometryLoader::HECellParameters>& fCells) {
467  fGeometry->increaseReserve(fCells.size());
468  for (const auto& param : fCells) {
469  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
470  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
471  HcalDetId hid(HcalEndcap, param.eta * iside, iPhi, param.depth);
472  float phiCenter = ((iPhi - 1) * 360. / MAX_HCAL_PHI + 0.5 * param.dphi) * DEGREE2RAD; // middle of the cell
473  float etaCenter = 0.5 * (param.etaMin + param.etaMax);
474 
475  float perp = param.zMin / sinh(etaCenter);
476  float x = perp * cos(phiCenter);
477  float y = perp * sin(phiCenter);
478  float z = iside * param.zMin;
479  // make cell geometry
480  GlobalPoint refPoint(x, y, z); // center of the cell's face
481  std::vector<CCGFloat> cellParams;
482  cellParams.reserve(5);
483  cellParams.emplace_back(0.5 * (param.etaMax - param.etaMin)); //deta_half
484  cellParams.emplace_back(0.5 * param.dphi * DEGREE2RAD); // dphi_half
485  cellParams.emplace_back(-0.5 * (param.zMax - param.zMin) / tanh(etaCenter)); // dz_half, "-" means edges in Z
486  cellParams.emplace_back(fabs(refPoint.eta()));
487  cellParams.emplace_back(fabs(refPoint.z()));
488 #ifdef EDM_ML_DEBUG
489  edm::LogVerbatim("HCalGeom") << "HcalHardcodeGeometryLoader::fillHE-> " << hid << refPoint << '/'
490  << cellParams[0] << '/' << cellParams[1] << '/' << cellParams[2];
491 #endif
492  fGeometry->newCellFast(refPoint,
493  refPoint,
494  refPoint,
495  CaloCellGeometry::getParmPtr(cellParams, fGeometry->parMgr(), fGeometry->parVecVec()),
496  hid);
497  }
498  }
499  }
500 }
501 
503  const std::vector<HcalHardcodeGeometryLoader::HFCellParameters>& fCells) {
504  fGeometry->increaseReserve(fCells.size());
505  for (const auto& param : fCells) {
506  for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
507  for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
508  HcalDetId hid(HcalForward, param.eta * iside, iPhi, param.depth);
509  float phiCenter = ((iPhi - 1) * 360. / MAX_HCAL_PHI + 0.5 * param.dphi) * DEGREE2RAD; // middle of the cell
510  GlobalPoint inner(param.rMin, 0, param.zMin);
511  GlobalPoint outer(param.rMax, 0, param.zMin);
512  float iEta = inner.eta();
513  float oEta = outer.eta();
514  float etaCenter = 0.5 * (iEta + oEta);
515 
516  float perp = param.zMin / sinh(etaCenter);
517  float x = perp * cos(phiCenter);
518  float y = perp * sin(phiCenter);
519  float z = iside * param.zMin;
520  // make cell geometry
521  GlobalPoint refPoint(x, y, z); // center of the cell's face
522  std::vector<CCGFloat> cellParams;
523  cellParams.reserve(5);
524  cellParams.emplace_back(0.5 * (iEta - oEta)); // deta_half
525  cellParams.emplace_back(0.5 * param.dphi * DEGREE2RAD); // dphi_half
526  cellParams.emplace_back(0.5 * (param.zMax - param.zMin)); // dz_half
527  cellParams.emplace_back(fabs(refPoint.eta()));
528  cellParams.emplace_back(fabs(refPoint.z()));
529 #ifdef EDM_ML_DEBUG
530  edm::LogVerbatim("HCalGeom") << "HcalHardcodeGeometryLoader::fillHF-> " << hid << refPoint << '/'
531  << cellParams[0] << '/' << cellParams[1] << '/' << cellParams[2];
532 #endif
533  fGeometry->newCellFast(refPoint,
534  refPoint,
535  refPoint,
536  CaloCellGeometry::getParmPtr(cellParams, fGeometry->parMgr(), fGeometry->parVecVec()),
537  hid);
538  }
539  }
540  }
541 }
void fillHBHO(HcalGeometry *fGeometry, const std::vector< HBHOCellParameters > &fCells, bool fHB)
Log< level::Info, true > LogVerbatim
std::vector< HFCellParameters > makeHFCells()
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
std::vector< HBHOCellParameters > makeHOCells()
T z() const
Definition: PV3DBase.h:61
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
Definition: PV3DBase.h:73
void fillHF(HcalGeometry *fGeometry, const std::vector< HFCellParameters > &fCells)
int firstHETripleDepthRing() const
Definition: HcalTopology.h:104
void allocatePar(ParVec::size_type n, unsigned int m)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
void sortValidIds()
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:34
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry * load(const HcalTopology &fTopology)
unsigned int getHFSize() const
Definition: HcalTopology.h:135
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
T perp() const
Magnitude of transverse component.
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
#define M_PI
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ nCells
std::vector< HECellParameters > makeHECells(const HcalTopology &topology)
unsigned int numberOfShapes() const override
Definition: HcalGeometry.h:42
CaloCellGeometry::CornersMgr * cornersMgr()
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:101
std::vector< std::vector< int > > m_segmentation
void increaseReserve(unsigned int extra)
int lastHERing() const
Definition: HcalTopology.h:94
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
const int ndepth
std::vector< HBHOCellParameters > makeHBCells(const HcalTopology &topology)
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
void fillHE(HcalGeometry *fGeometry, const std::vector< HECellParameters > &fCells)
std::vector< HECellParameters > makeHECells_H2()
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164