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