CMS 3D CMS Logo

HGCalGeometry.cc
Go to the documentation of this file.
1 /* for High Granularity Calorimeter
2  * This geometry is essentially driven by topology,
3  * which is thus encapsulated in this class.
4  * This makes this geometry not suitable to be loaded
5  * by regular CaloGeometryLoader<T>
6  */
15 
16 #include <cmath>
17 
18 #include <Math/Transform3D.h>
19 #include <Math/EulerAngles.h>
20 
22 typedef std::vector<float> ParmVec;
23 
24 //#define EDM_ML_DEBUG
25 
26 const bool debugLocate = false;
27 
29  : m_topology(topology_),
30  m_validGeomIds(topology_.totalGeomModules()),
31  m_det(topology_.detector()),
32  m_subdet(topology_.subDetector()),
33  twoBysqrt3_(2.0 / std::sqrt(3.0)) {
34  if (m_det == DetId::HGCalHSc) {
35  m_cellVec2 = CellVec2(topology_.totalGeomModules());
36  } else {
37  m_cellVec = CellVec(topology_.totalGeomModules());
38  }
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HGCalGeom") << "Expected total # of Geometry Modules " << m_topology.totalGeomModules();
42 #endif
43 }
44 
46 
48 
49 void HGCalGeometry::localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref) {
50  if (m_det == DetId::HGCalHSc) {
51  FlatTrd::localCorners(lc, pv, ref);
52  } else {
53  FlatHexagon::localCorners(lc, pv, ref);
54  }
55 }
56 
58  const GlobalPoint& f1, const GlobalPoint& f2, const GlobalPoint& f3, const CCGFloat* parm, const DetId& detId) {
59  DetId geomId = getGeometryDetId(detId);
60  int cells(0);
62  if (m_topology.waferHexagon6()) {
64 #ifdef EDM_ML_DEBUG
65  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCalDetId(detId) << " GEOM " << HGCalDetId(geomId);
66 #endif
67  } else if (m_topology.tileTrapezoid()) {
68  cells = 1;
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCScintillatorDetId(detId) << " GEOM "
71  << HGCScintillatorDetId(geomId);
72 #endif
73  } else {
74  cells = m_topology.dddConstants().numberCellsHexagon(id.iLay, id.iSec1, id.iSec2, false);
75 #ifdef EDM_ML_DEBUG
76  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCSiliconDetId(detId) << " GEOM " << HGCSiliconDetId(geomId);
77 #endif
78  }
79  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
80 
81  if (m_det == DetId::HGCalHSc) {
82  m_cellVec2.at(cellIndex) = FlatTrd(cornersMgr(), f1, f2, f3, parm);
83  } else {
84  m_cellVec.at(cellIndex) = FlatHexagon(cornersMgr(), f1, f2, f3, parm);
85  }
86  m_validGeomIds.at(cellIndex) = geomId;
87 
88 #ifdef EDM_ML_DEBUG
89  edm::LogVerbatim("HGCalGeom") << "Store for DetId " << std::hex << detId.rawId() << " GeomId " << geomId.rawId()
90  << std::dec << " Index " << cellIndex << " cells " << cells;
91  unsigned int nOld = m_validIds.size();
92 #endif
93  if (m_topology.waferHexagon6()) {
94  for (int cell = 0; cell < cells; ++cell) {
95  id.iCell1 = cell;
96  DetId idc = m_topology.encode(id);
97  if (m_topology.valid(idc)) {
98  m_validIds.emplace_back(idc);
99 #ifdef EDM_ML_DEBUG
100  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << cell << "] " << HGCalDetId(idc);
101 #endif
102  }
103  }
104  } else if (m_topology.tileTrapezoid()) {
105  DetId idc = m_topology.encode(id);
106  if (m_topology.valid(idc)) {
107  HGCScintillatorDetId hid(idc);
108  std::pair<int, int> typm = m_topology.dddConstants().tileType(hid.layer(), hid.ring(), 0);
109  if (typm.first >= 0) {
110  hid.setType(typm.first);
111  hid.setSiPM(typm.second);
112  idc = static_cast<DetId>(hid);
113  }
114  m_validIds.emplace_back(idc);
115 #ifdef EDM_ML_DEBUG
116  edm::LogVerbatim("HGCalGeom") << "Valid Id [0] " << HGCScintillatorDetId(idc);
117 #endif
118  } else {
119  edm::LogWarning("HGCalGeom") << "Check " << HGCScintillatorDetId(idc) << " from " << HGCScintillatorDetId(detId)
120  << " ERROR ???";
121  }
122  } else {
123 #ifdef EDM_ML_DEBUG
124  unsigned int cellAll(0), cellSelect(0);
125 #endif
126  for (int u = 0; u < 2 * cells; ++u) {
127  for (int v = 0; v < 2 * cells; ++v) {
128  if (((v - u) < cells) && (u - v) <= cells) {
129  id.iCell1 = u;
130  id.iCell2 = v;
131  DetId idc = m_topology.encode(id);
132 #ifdef EDM_ML_DEBUG
133  ++cellAll;
134 #endif
135  if (m_topology.dddConstants().cellInLayer(id.iSec1, id.iSec2, u, v, id.iLay, true)) {
136  m_validIds.emplace_back(idc);
137 #ifdef EDM_ML_DEBUG
138  ++cellSelect;
139  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << u << ", " << v << "] " << HGCSiliconDetId(idc);
140 #endif
141  }
142  }
143  }
144  }
145 #ifdef EDM_ML_DEBUG
146  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry keeps " << cellSelect << " out of " << cellAll << " for wafer "
147  << id.iSec1 << ":" << id.iSec2 << " in "
148  << " layer " << id.iLay;
149 #endif
150  }
151 #ifdef EDM_ML_DEBUG
152  if (m_det == DetId::HGCalHSc) {
153  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex << "]"
154  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
155  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec2[cellIndex].etaPos() << ":"
156  << m_cellVec2[cellIndex].phiPos();
157  } else {
158  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex << "]"
159  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
160  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec[cellIndex].etaPos() << ":"
161  << m_cellVec[cellIndex].phiPos();
162  }
163  unsigned int nNew = m_validIds.size();
164  if (m_topology.waferHexagon6()) {
165  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCalDetId(detId) << " with valid DetId from " << nOld << " to " << nNew;
166  } else if (m_topology.tileTrapezoid()) {
167  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCScintillatorDetId(detId) << " with valid DetId from " << nOld
168  << " to " << nNew;
169  } else if (m_topology.isHFNose()) {
170  edm::LogVerbatim("HGCalGeom") << "ID: " << HFNoseDetId(detId) << " with valid DetId from " << nOld << " to "
171  << nNew;
172  } else {
173  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCSiliconDetId(detId) << " with valid DetId from " << nOld << " to "
174  << nNew;
175  }
176  edm::LogVerbatim("HGCalGeom") << "Cell[" << cellIndex << "] " << std::hex << geomId.rawId() << ":"
177  << m_validGeomIds[cellIndex].rawId() << std::dec;
178 #endif
179 }
180 
181 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::getGeometry(const DetId& detId) const {
182  if (detId == DetId())
183  return nullptr; // nothing to get
184  DetId geomId = getGeometryDetId(detId);
185  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
186  const GlobalPoint pos = (detId != geomId) ? getPosition(detId, false) : GlobalPoint();
187  return cellGeomPtr(cellIndex, pos);
188 }
189 
190 bool HGCalGeometry::present(const DetId& detId) const {
191  if (detId == DetId())
192  return false;
193  DetId geomId = getGeometryDetId(detId);
194  const uint32_t index(m_topology.detId2denseGeomId(geomId));
195  return (nullptr != getGeometryRawPtr(index));
196 }
197 
199  unsigned int cellIndex = indexFor(detid);
200  GlobalPoint glob;
201  unsigned int maxSize = (m_topology.tileTrapezoid() ? m_cellVec2.size() : m_cellVec.size());
202  if (cellIndex < maxSize) {
204  std::pair<float, float> xy;
205  if (m_topology.waferHexagon6()) {
206  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
207  const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0);
208  glob = m_cellVec[cellIndex].getPosition(lcoord);
209  if (debug)
210  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex << " Local " << lcoord.x() << ":"
211  << lcoord.y() << " ID " << id.iCell1 << ":" << id.iSec1 << " Global " << glob;
212  } else if (m_topology.tileTrapezoid()) {
213  const HepGeom::Point3D<float> lcoord(0, 0, 0);
214  glob = m_cellVec2[cellIndex].getPosition(lcoord);
215  if (debug)
216  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: index " << cellIndex << " Local " << lcoord.x() << ":"
217  << lcoord.y() << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iCell1
218  << " Global " << glob;
219  } else {
220  if (debug)
221  edm::LogVerbatim("HGCalGeom") << "getPosition for " << HGCSiliconDetId(detid) << " Layer " << id.iLay
222  << " Wafer " << id.iSec1 << ":" << id.iSec2 << " Cell " << id.iCell1 << ":"
223  << id.iCell2;
225  id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, true, false, debug);
226  double xx = id.zSide * xy.first;
227  double zz = id.zSide * m_topology.dddConstants().waferZ(id.iLay, true);
228  glob = GlobalPoint(xx, xy.second, zz);
229  if (debug)
230  edm::LogVerbatim("HGCalGeom") << "getPositionWafer:: index " << cellIndex << " Local " << xy.first << ":"
231  << xy.second << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
232  << id.iCell1 << ":" << id.iCell2 << " Global " << glob;
233  }
234  } else {
235  edm::LogVerbatim("HGCalGeom") << "Cannot recognize " << std::hex << detid.rawId() << " cellIndex " << cellIndex
236  << ":" << maxSize << " Type " << m_topology.tileTrapezoid();
237  }
238  return glob;
239 }
240 
242  unsigned int cellIndex = indexFor(detid);
243  GlobalPoint glob;
244  unsigned int maxSize = (m_topology.tileTrapezoid() ? m_cellVec2.size() : m_cellVec.size());
245  if (cellIndex < maxSize) {
246  const HepGeom::Point3D<float> lcoord(0, 0, 0);
247  if (m_topology.tileTrapezoid()) {
248  glob = m_cellVec2[cellIndex].getPosition(lcoord);
249  } else {
250  glob = m_cellVec[cellIndex].getPosition(lcoord);
251  }
252 #ifdef EDM_ML_DEBUG
253  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: ID " << std::hex << detid.rawId() << std::dec << " index "
254  << cellIndex << " Global " << glob;
255 #endif
256  }
257  return glob;
258 }
259 
260 double HGCalGeometry::getArea(const DetId& detid) const {
261  HGCalGeometry::CornersVec corners = getNewCorners(detid);
262  double area(0);
263  if (corners.size() > 1) {
264  int n = corners.size() - 1;
265  int j = n - 1;
266  for (int i = 0; i < n; ++i) {
267  area += ((corners[j].x() + corners[i].x()) * (corners[i].y() - corners[j].y()));
268  j = i;
269  }
270  }
271  return std::abs(0.5 * area);
272 }
273 
275  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ : FlatHexagon::ncorner_);
276  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
277  unsigned int cellIndex = indexFor(detid);
279  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
280  GlobalPoint v = getPosition(detid, false);
281  int type = std::min(id.iType, 1);
282  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
283  float dr = k_half * (rr.second - rr.first);
284  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
285  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
286  float r = v.perp();
287  float fi = v.phi();
288  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
289  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
290  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
291  for (unsigned int i = 0; i < ncorner; ++i) {
292  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
293  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
294  (v.z() + signz[i] * dz));
295  }
296  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
297  std::pair<float, float> xy;
298  if (m_topology.waferHexagon6()) {
299  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
300  float dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
301  float dy = k_half * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
302  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
303  static const int signx[] = {0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1};
304  static const int signy[] = {-2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1};
305  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
306  for (unsigned int i = 0; i < ncorner; ++i) {
307  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, signz[i] * dz);
308  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
309  }
310  } else {
312  id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true, debugLocate);
313  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
314  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
315  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
316  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
317  static const int signx[] = {1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2};
318  static const int signy[] = {1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0};
319  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
320  for (unsigned int i = 0; i < ncorner; ++i) {
321  auto xyglob = m_topology.dddConstants().localToGlobal8(
322  id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
323  double xx = id.zSide * xyglob.first;
324  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + signz[i] * dz));
325  }
326  }
327  }
328  return co;
329 }
330 
332  unsigned int ncorner = FlatTrd::ncorner_;
333  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
334  unsigned int cellIndex = indexFor(detid);
336  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
337  GlobalPoint v = getPosition(detid, false);
338  int type = std::min(id.iType, 1);
339  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
340  float dr = k_half * (rr.second - rr.first);
341  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
342  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
343  float r = v.perp();
344  float fi = v.phi();
345  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
346  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
347  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
348  for (unsigned int i = 0; i < ncorner; ++i) {
349  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
350  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
351  (v.z() + signz[i] * dz));
352  }
353  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
354  std::pair<float, float> xy;
355  float dx(0);
356  static const int signx[] = {-1, -1, 1, 1, -1, -1, 1, 1};
357  static const int signy[] = {-1, 1, 1, -1, -1, 1, 1, -1};
358  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
359  if (m_topology.waferHexagon6()) {
360  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
361  dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
362  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
363  for (unsigned int i = 0; i < ncorner; ++i) {
364  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dx, signz[i] * dz);
365  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
366  }
367  } else {
369  id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true, debugLocate);
370  dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
371  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
372  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
373  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
374  for (unsigned int i = 0; i < ncorner; ++i) {
375  auto xyglob = m_topology.dddConstants().localToGlobal8(
376  id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
377  double xx = id.zSide * xyglob.first;
378  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + signz[i] * dz));
379  }
380  }
381  }
382  return co;
383 }
384 
386  unsigned int ncorner = (m_det == DetId::HGCalHSc) ? 5 : 7;
387  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
388  unsigned int cellIndex = indexFor(detid);
390  if (debug)
391  edm::LogVerbatim("HGCalGeom") << "NewCorners for Layer " << id.iLay << " Wafer " << id.iSec1 << ":" << id.iSec2
392  << " Cell " << id.iCell1 << ":" << id.iCell2;
393  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
394  GlobalPoint v = getPosition(detid, false);
395  int type = std::min(id.iType, 1);
396  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
397  float dr = k_half * (rr.second - rr.first);
398  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
399  float dz = -id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
400  float r = v.perp();
401  float fi = v.phi();
402  static const int signr[] = {1, 1, -1, -1};
403  static const int signf[] = {-1, 1, 1, -1};
404  for (unsigned int i = 0; i < ncorner - 1; ++i) {
405  co[i] = GlobalPoint(
406  (r + signr[i] * dr) * cos(fi + signf[i] * dfi), (r + signr[i] * dr) * sin(fi + signf[i] * dfi), (v.z() + dz));
407  }
408  // Used to pass downstream the thickness of this cell
409  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
410  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
411  std::pair<float, float> xy;
412  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
413  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
414  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
415  static const int signx[] = {1, -1, -2, -1, 1, 2};
416  static const int signy[] = {1, 1, 0, -1, -1, 0};
417 #ifdef EDM_ML_DEBUG
418  if (debug)
419  edm::LogVerbatim("HGCalGeom") << "kfac " << k_fac1 << ":" << k_fac2 << " dx:dy:dz " << dx << ":" << dy << ":"
420  << dz;
421 #endif
422  if (m_topology.waferHexagon6()) {
423  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
424  for (unsigned int i = 0; i < ncorner - 1; ++i) {
425  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, dz);
426  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
427  }
428  } else {
430  id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true, debug);
431  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
432  for (unsigned int i = 0; i < ncorner; ++i) {
433  double xloc = xy.first + signx[i] * dx;
434  double yloc = xy.second + signy[i] * dy;
435 #ifdef EDM_ML_DEBUG
436  if (debug)
437  edm::LogVerbatim("HGCalGeom") << "Corner " << i << " x " << xy.first << ":" << xloc << " y " << xy.second
438  << ":" << yloc << " z " << zz << ":" << id.zSide * (zz + dz);
439 #endif
440  auto xyglob = m_topology.dddConstants().localToGlobal8(id.iLay, id.iSec1, id.iSec2, xloc, yloc, true, debug);
441  double xx = id.zSide * xyglob.first;
442  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + dz));
443  }
444  }
445  // Used to pass downstream the thickness of this cell
446  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
447  }
448  return co;
449 }
450 
451 DetId HGCalGeometry::neighborZ(const DetId& idin, const GlobalVector& momentum) const {
452  DetId idnew;
454  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
455 #ifdef EDM_ML_DEBUG
456  edm::LogVerbatim("HGCalGeom") << "neighborz1:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
457  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
458  << m_topology.dddConstants().firstLayer() << ":"
459  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
460 #endif
461  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
462  (momentum.z() != 0.0)) {
463  GlobalPoint v = getPosition(idin, false);
464  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
465  double grad = (z - v.z()) / momentum.z();
466  GlobalPoint p(v.x() + grad * momentum.x(), v.y() + grad * momentum.y(), z);
467  double r = p.perp();
468  auto rlimit = topology().dddConstants().rangeR(z, true);
469  if (r >= rlimit.first && r <= rlimit.second)
470  idnew = getClosestCell(p);
471 #ifdef EDM_ML_DEBUG
472  edm::LogVerbatim("HGCalGeom") << "neighborz1:: Position " << v << " New Z " << z << ":" << grad << " new position "
473  << p << " r-limit " << rlimit.first << ":" << rlimit.second;
474 #endif
475  }
476  return idnew;
477 }
478 
480  const MagneticField* bField,
481  int charge,
482  const GlobalVector& momentum) const {
483  DetId idnew;
485  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
486 #ifdef EDM_ML_DEBUG
487  edm::LogVerbatim("HGCalGeom") << "neighborz2:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
488  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
489  << m_topology.dddConstants().firstLayer() << ":"
490  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
491 #endif
492  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
493  (momentum.z() != 0.0)) {
494  GlobalPoint v = getPosition(idin, false);
495  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
496  FreeTrajectoryState fts(v, momentum, charge, bField);
499  TrajectoryStateOnSurface tsos = myAP.propagate(fts, *nPlane);
500  GlobalPoint p;
501  auto rlimit = topology().dddConstants().rangeR(z, true);
502  if (tsos.isValid()) {
503  p = tsos.globalPosition();
504  double r = p.perp();
505  if (r >= rlimit.first && r <= rlimit.second)
506  idnew = getClosestCell(p);
507  }
508 #ifdef EDM_ML_DEBUG
509  edm::LogVerbatim("HGCalGeom") << "neighborz2:: Position " << v << " New Z " << z << ":" << charge << ":"
510  << tsos.isValid() << " new position " << p << " r limits " << rlimit.first << ":"
511  << rlimit.second;
512 #endif
513  }
514  return idnew;
515 }
516 
518  unsigned int cellIndex = getClosestCellIndex(r);
519  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
520  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
522  if (id.det == 0)
523  id.det = static_cast<int>(m_topology.detector());
524  HepGeom::Point3D<float> local;
525  if (r.z() > 0) {
526  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
527  id.zSide = 1;
528  } else {
529  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
530  id.zSide = -1;
531  }
532  if (m_topology.waferHexagon6()) {
533  const auto& kxy = m_topology.dddConstants().assignCell(local.x(), local.y(), id.iLay, id.iType, true);
534  id.iCell1 = kxy.second;
535  id.iSec1 = kxy.first;
536  id.iType = m_topology.dddConstants().waferTypeT(kxy.first);
537  if (id.iType != 1)
538  id.iType = -1;
539  } else if (m_topology.tileTrapezoid()) {
540  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
541  const auto& kxy = m_topology.dddConstants().assignCellTrap(r.x(), r.y(), r.z(), id.iLay, true);
542  id.iSec1 = kxy[0];
543  id.iCell1 = kxy[1];
544  id.iType = kxy[2];
545  } else {
546  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
547 #ifdef EDM_ML_DEBUG
548  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << " Layer " << id.iLay << " Global " << r << " Local " << local;
549 #endif
550  const auto& kxy = m_topology.dddConstants().assignCellHex(local.x(), local.y(), id.iLay, false, true);
551  id.iSec1 = kxy[0];
552  id.iSec2 = kxy[1];
553  id.iType = kxy[2];
554  id.iCell1 = kxy[3];
555  id.iCell2 = kxy[4];
556  }
557 #ifdef EDM_ML_DEBUG
558  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
559  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
560  << id.iCell1 << ":" << id.iCell2;
561 #endif
562 
563  //check if returned cell is valid
564  if (id.iCell1 >= 0)
565  return m_topology.encode(id);
566  }
567 
568  //if not valid or out of bounds return a null DetId
569  return DetId();
570 }
571 
573  unsigned int cellIndex = getClosestCellIndex(r);
574  if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
576  if (id.det == 0)
577  id.det = static_cast<int>(m_topology.detector());
578  HepGeom::Point3D<float> local;
579  if (r.z() > 0) {
580  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
581  id.zSide = 1;
582  } else {
583  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
584  id.zSide = -1;
585  }
586  if (m_topology.waferHexagon8()) {
587  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
588 #ifdef EDM_ML_DEBUG
589  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << " Layer " << id.iLay << " Global " << r << " Local " << local;
590 #endif
591  const auto& kxy = m_topology.dddConstants().assignCellHex(local.x(), local.y(), id.iLay, extend, true);
592  id.iSec1 = kxy[0];
593  id.iSec2 = kxy[1];
594  id.iType = kxy[2];
595  id.iCell1 = kxy[3];
596  id.iCell2 = kxy[4];
597  }
598 #ifdef EDM_ML_DEBUG
599  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
600  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
601  << id.iCell1 << ":" << id.iCell2;
602 #endif
603 
604  //check if returned cell is valid
605  if (id.iCell1 >= 0)
606  return m_topology.encode(id);
607  }
608 
609  //if not valid or out of bounds return a null DetId
610  return DetId();
611 }
612 
615  return dss;
616 }
617 
619  if (m_subdet == HGCEE || m_det == DetId::HGCalEE)
620  return "HGCalEE";
621  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi)
622  return "HGCalHEFront";
623  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc)
624  return "HGCalHEBack";
625  else
626  return "Unknown";
627 }
628 
629 unsigned int HGCalGeometry::indexFor(const DetId& detId) const {
630  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() : m_cellVec.size());
631  if (detId != DetId()) {
632  DetId geomId = getGeometryDetId(detId);
633  cellIndex = m_topology.detId2denseGeomId(geomId);
634 #ifdef EDM_ML_DEBUG
635  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId() << ":" << geomId.rawId() << std::dec
636  << " index " << cellIndex;
637 #endif
638  }
639  return cellIndex;
640 }
641 
643 
645  // Modify the RawPtr class
646  if (m_det == DetId::HGCalHSc) {
647  if (m_cellVec2.size() < index)
648  return nullptr;
649  const CaloCellGeometry* cell(&m_cellVec2[index]);
650  return (nullptr == cell->param() ? nullptr : cell);
651  } else {
652  if (m_cellVec2.size() < index)
653  return nullptr;
654  const CaloCellGeometry* cell(&m_cellVec[index]);
655  return (nullptr == cell->param() ? nullptr : cell);
656  }
657 }
658 
659 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index) const {
660  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
661  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
662  return nullptr;
663  static const auto do_not_delete = [](const void*) {};
664  if (m_det == DetId::HGCalHSc) {
665  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index], do_not_delete);
666  if (nullptr == cell->param())
667  return nullptr;
668  return cell;
669  } else {
670  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index], do_not_delete);
671  if (nullptr == cell->param())
672  return nullptr;
673  return cell;
674  }
675 }
676 
677 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index, const GlobalPoint& pos) const {
678  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
679  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
680  return nullptr;
681  if (pos == GlobalPoint())
682  return cellGeomPtr(index);
683  if (m_det == DetId::HGCalHSc) {
684  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
685  cell->setPosition(pos);
686 #ifdef EDM_ML_DEBUG
687  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
688 #endif
689  if (nullptr == cell->param())
690  return nullptr;
691  return cell;
692  } else {
693  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
694  cell->setPosition(pos);
695 #ifdef EDM_ML_DEBUG
696  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
697 #endif
698  if (nullptr == cell->param())
699  return nullptr;
700  return cell;
701  }
702 }
703 
705  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
706 }
707 
710 }
711 
712 template <class T>
713 unsigned int HGCalGeometry::getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const {
714  float phip = r.phi();
715  float zp = r.z();
716  float dzmin(9999), dphimin(9999), dphi10(0.175);
717  unsigned int cellIndex = vec.size();
718  for (unsigned int k = 0; k < vec.size(); ++k) {
719  float dphi = phip - vec[k].phiPos();
720  while (dphi > M_PI)
721  dphi -= 2 * M_PI;
722  while (dphi <= -M_PI)
723  dphi += 2 * M_PI;
724  if (std::abs(dphi) < dphi10) {
725  float dz = std::abs(zp - vec[k].getPosition().z());
726  if (dz < (dzmin + 0.001)) {
727  dzmin = dz;
728  if (std::abs(dphi) < (dphimin + 0.01)) {
729  cellIndex = k;
730  dphimin = std::abs(dphi);
731  } else {
732  if (cellIndex >= vec.size())
733  cellIndex = k;
734  }
735  }
736  }
737  }
738 #ifdef EDM_ML_DEBUG
739  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":" << phip << " Index " << cellIndex;
740  if (cellIndex < vec.size())
741  edm::LogVerbatim("HGCalGeom") << " Cell z " << vec[cellIndex].getPosition().z() << ":" << dzmin << " phi "
742  << vec[cellIndex].phiPos() << ":" << dphimin;
743 #endif
744  return cellIndex;
745 }
746 
747 // FIXME: Change sorting algorithm if needed
748 namespace {
749  struct rawIdSort {
750  bool operator()(const DetId& a, const DetId& b) { return (a.rawId() < b.rawId()); }
751  };
752 } // namespace
753 
755  m_validIds.shrink_to_fit();
756  std::sort(m_validIds.begin(), m_validIds.end(), rawIdSort());
757 }
758 
762  CaloSubdetectorGeometry::IVec& dinsVector) const {
763  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
764  unsigned int numberOfShapes = k_NumberOfShapes;
765  unsigned int numberOfParametersPerShape = ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd)
766  : (unsigned int)(k_NumberOfParametersPerHex));
767 
768  trVector.reserve(numberOfCells * numberOfTransformParms());
769  iVector.reserve(numberOfCells);
770  dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
771  dinsVector.reserve(numberOfCells);
772 
773  for (unsigned itr = 0; itr < m_topology.dddConstants().getTrFormN(); ++itr) {
775  int layer = mytr.lay;
776 
777  if (m_topology.waferHexagon6()) {
778  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
779  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
780  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
782  params[FlatHexagon::k_dZ] = vol.dz;
785  dimVector.insert(dimVector.end(), params.begin(), params.end());
786  }
787  }
788  } else if (m_topology.tileTrapezoid()) {
789  int indx = m_topology.dddConstants().layerIndex(layer, true);
790  for (int md = m_topology.dddConstants().getParameter()->firstModule_[indx];
792  ++md) {
795  params[FlatTrd::k_dZ] = vol.dz;
802  dimVector.insert(dimVector.end(), params.begin(), params.end());
803  }
804  } else {
805  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
806  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
807  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
809  params[FlatHexagon::k_dZ] = vol.dz;
812  dimVector.insert(dimVector.end(), params.begin(), params.end());
813  }
814  }
815  }
816  }
817 
818  for (unsigned int i(0); i < numberOfCells; ++i) {
819  DetId detId = m_validGeomIds[i];
820  int layer(0);
821  if (m_topology.waferHexagon6()) {
822  layer = HGCalDetId(detId).layer();
823  } else if (m_topology.tileTrapezoid()) {
824  layer = HGCScintillatorDetId(detId).layer();
825  } else if (m_topology.isHFNose()) {
826  layer = HFNoseDetId(detId).layer();
827  } else {
828  layer = HGCSiliconDetId(detId).layer();
829  }
830  dinsVector.emplace_back(m_topology.detId2denseGeomId(detId));
831  iVector.emplace_back(layer);
832 
833  Tr3D tr;
834  auto ptr = cellGeomPtr(i);
835  if (nullptr != ptr) {
836  ptr->getTransform(tr, (Pt3DVec*)nullptr);
837 
838  if (Tr3D() == tr) { // there is no rotation
839  const GlobalPoint& gp(ptr->getPosition());
840  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
841  }
842 
843  const CLHEP::Hep3Vector tt(tr.getTranslation());
844  trVector.emplace_back(tt.x());
845  trVector.emplace_back(tt.y());
846  trVector.emplace_back(tt.z());
847  if (6 == numberOfTransformParms()) {
848  const CLHEP::HepRotation rr(tr.getRotation());
849  const ROOT::Math::Transform3D rtr(
850  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
852  rtr.GetRotation(ea);
853  trVector.emplace_back(ea.Phi());
854  trVector.emplace_back(ea.Theta());
855  trVector.emplace_back(ea.Psi());
856  }
857  }
858  }
859 }
860 
862  DetId geomId;
863  if (m_topology.waferHexagon6()) {
864  geomId = static_cast<DetId>(HGCalDetId(detId).geometryCell());
865  } else if (m_topology.tileTrapezoid()) {
866  geomId = static_cast<DetId>(HGCScintillatorDetId(detId).geometryCell());
867  } else if (m_topology.isHFNose()) {
868  geomId = static_cast<DetId>(HFNoseDetId(detId).geometryCell());
869  } else {
870  geomId = static_cast<DetId>(HGCSiliconDetId(detId).geometryCell());
871  }
872  return geomId;
873 }
874 
876 
DetId getClosestCellHex(const GlobalPoint &r, bool extend) const
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
double waferZ(int layer, bool reco) const
std::vector< DetId > m_validGeomIds
Log< level::Info, true > LogVerbatim
DetId neighborZ(const DetId &idin, const GlobalVector &p) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
A base class to handle the particular shape of HGCal volumes.
Definition: FlatTrd.h:19
std::vector< CCGFloat > DimVec
std::pair< double, double > cellSizeTrap(int type, int irad) const
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:93
int layer() const
get the layer #
Definition: HFNoseDetId.h:57
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:31
const HGCalParameters * getParameter() const
DetId::Detector detector() const
bool tileTrapezoid() const
GlobalPoint getWaferPosition(const DetId &id) const
T z() const
Definition: PV3DBase.h:61
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
virtual unsigned int numberOfTransformParms() const
bool valid(const DetId &id) const override
Is this a valid cell id.
const HGCalTopology & m_topology
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
unsigned int totalModules() const
Definition: HGCalTopology.h:92
bool waferHexagon6() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< unsigned int > IVec
static constexpr uint32_t k_Theta
Definition: FlatTrd.h:27
int lastLayer(bool reco) const
bool present(const DetId &id) const override
is this detid present in the geometry?
int waferTypeT(int wafer) const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:38
std::vector< CCGFloat > TrVec
static constexpr double k_fac2
HepGeom::Transform3D Tr3D
virtual unsigned int numberOfShapes() const
static constexpr uint32_t k_Cell
Definition: FlatTrd.h:45
int firstLayer() const
static constexpr uint32_t k_dY1
Definition: FlatTrd.h:31
Log< level::Error, false > LogError
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
__host__ __device__ VT * co
Definition: prefixScan.h:47
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Tr3D Tr3D
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:34
static constexpr double k_half
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatHexagon.cc:154
CornersVec getNewCorners(const DetId &id, bool debug=false) const
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
constexpr std::array< uint8_t, layerIndexSize > layer
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: HGCalGeometry.h:35
static constexpr double k_fac1
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
bool waferInLayer(int wafer, int lay, bool reco) const
const double twoBysqrt3_
int layer() const
get the layer #
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
HGCalGeometry(const HGCalTopology &topology)
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:97
std::vector< int > firstModule_
DetId getClosestCell(const GlobalPoint &r) const override
Definition: TTTypes.h:54
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
void initializeParms() override
GlobalPoint globalPosition() const
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
unsigned int getClosestCellIndex(const GlobalPoint &r) const
std::vector< float > ParmVec
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr uint32_t k_dX1
Definition: FlatTrd.h:32
std::vector< DetId > m_validIds
int layerIndex(int lay, bool reco) const
std::pair< float, float > localToGlobal8(int lay, int waferU, int waferV, double localX, double localY, bool reco, bool debug) const
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
virtual uint32_t detId2denseGeomId(const DetId &id) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static constexpr unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:43
int layer() const
get the layer #
unsigned int indexFor(const DetId &id) const override
unsigned int sizeForDenseIndex() const
A base class to handle the hexagonal shape of HGCal silicon volumes.
Definition: FlatHexagon.h:20
DecodedDetId decode(const DetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:37
static constexpr uint32_t k_dY2
Definition: FlatTrd.h:38
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
DetId getGeometryDetId(DetId detId) const
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
std::pair< int, int > tileType(int layer, int ring, int phi) const
CellVec2 m_cellVec2
static constexpr uint32_t k_dX4
Definition: FlatTrd.h:41
const HGCalTopology & topology() const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatTrd.cc:153
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:47
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
bool isHFNose() const
#define M_PI
int ring() const
get the eta index
std::pair< double, double > rangeR(double z, bool reco) const
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
Definition: DetId.h:17
std::vector< int > lastModule_
int numberCellsHexagon(int wafer) const
AlgebraicVector EulerAngles
Definition: Definitions.h:34
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
ForwardSubdetector m_subdet
#define debug
Definition: HDRShower.cc:19
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:32
static constexpr uint32_t k_Phi
Definition: FlatTrd.h:29
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CaloCellGeometry::CornersMgr * cornersMgr()
DetId encode(const DecodedDetId &id_) const
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
int layer() const
get the layer #
Definition: HGCalDetId.h:46
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const override
Get the cell geometry of a given detector id. Should return false if not found.
HGCScintillatorDetId geometryCell() const
double b
Definition: hdecay.h:118
unsigned int getTrFormN() const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
const bool debugLocate
CaloCellGeometry::Tr3D Tr3D
bool waferHexagon8() const
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco, bool extend=false, bool debug=false) const
GlobalPoint getPosition(const DetId &id, bool debug=false) const
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:34
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
int getLayer(double z, bool reco) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
double a
Definition: hdecay.h:119
static constexpr uint32_t k_dZ
Definition: FlatTrd.h:26
virtual void fillNamedParams(DDFilteredView fv)
DetId::Detector m_det
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
static constexpr uint32_t k_Alp1
Definition: FlatTrd.h:36
void addValidID(const DetId &id)
static constexpr uint32_t k_dX3
Definition: FlatTrd.h:39
Log< level::Warning, false > LogWarning
HGCSiliconDetId geometryCell() const
std::string cellElement() const
double getArea(const DetId &detid) const
Returns area of a cell.
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
const CCGFloat * param() const
static constexpr uint32_t k_dX2
Definition: FlatTrd.h:34
CellVec m_cellVec
CornersVec get8Corners(const DetId &id) const
virtual unsigned int numberOfParametersPerShape() const
static constexpr uint32_t k_Alp2
Definition: FlatTrd.h:43