CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
27  : m_topology(topology_),
28  m_validGeomIds(topology_.totalGeomModules()),
29  m_det(topology_.detector()),
30  m_subdet(topology_.subDetector()),
31  twoBysqrt3_(2.0 / std::sqrt(3.0)) {
32  if (m_det == DetId::HGCalHSc) {
33  m_cellVec2 = CellVec2(topology_.totalGeomModules());
34  } else {
35  m_cellVec = CellVec(topology_.totalGeomModules());
36  }
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HGCalGeom") << "Expected total # of Geometry Modules " << m_topology.totalGeomModules();
40 #endif
41 }
42 
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()) {
63  cells = m_topology.dddConstants().numberCellsHexagon(id.iSec1);
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) : 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 #ifdef EDM_ML_DEBUG
210  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex << " Local " << lcoord.x() << ":"
211  << lcoord.y() << " ID " << id.iCell1 << ":" << id.iSec1 << " Global " << glob;
212 #endif
213  } else if (m_topology.tileTrapezoid()) {
214  const HepGeom::Point3D<float> lcoord(0, 0, 0);
215  glob = m_cellVec2[cellIndex].getPosition(lcoord);
216 #ifdef EDM_ML_DEBUG
217  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: index " << cellIndex << " Local " << lcoord.x() << ":"
218  << lcoord.y() << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iCell1
219  << " Global " << glob;
220 #endif
221  } else {
222 #ifdef EDM_ML_DEBUG
223  edm::LogVerbatim("HGCalGeom") << "getPosition for " << HGCSiliconDetId(detid) << " Layer " << id.iLay << " Wafer "
224  << id.iSec1 << ":" << id.iSec2 << " Cell " << id.iCell1 << ":" << id.iCell2;
225 #endif
226  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, true, true);
227  double xx = id.zSide * xy.first;
228  double zz = id.zSide * m_topology.dddConstants().waferZ(id.iLay, true);
229  glob = GlobalPoint(xx, xy.second, zz);
230 #ifdef EDM_ML_DEBUG
231  edm::LogVerbatim("HGCalGeom") << "getPositionWafer:: index " << cellIndex << " Local " << xy.first << ":"
232  << xy.second << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
233  << id.iCell1 << ":" << id.iCell2 << " Global " << glob;
234 #endif
235  }
236  }
237  return glob;
238 }
239 
241  unsigned int cellIndex = indexFor(detid);
242  GlobalPoint glob;
243  unsigned int maxSize = (m_topology.tileTrapezoid() ? m_cellVec2.size() : m_cellVec.size());
244  if (cellIndex < maxSize) {
245  const HepGeom::Point3D<float> lcoord(0, 0, 0);
246  if (m_topology.tileTrapezoid()) {
247  glob = m_cellVec2[cellIndex].getPosition(lcoord);
248  } else {
249  glob = m_cellVec[cellIndex].getPosition(lcoord);
250  }
251 #ifdef EDM_ML_DEBUG
252  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: ID " << std::hex << detid.rawId() << std::dec << " index "
253  << cellIndex << " Global " << glob;
254 #endif
255  }
256  return glob;
257 }
258 
259 double HGCalGeometry::getArea(const DetId& detid) const {
260  HGCalGeometry::CornersVec corners = getNewCorners(detid);
261  double area(0);
262  if (corners.size() > 1) {
263  int n = corners.size() - 1;
264  int j = n - 1;
265  for (int i = 0; i < n; ++i) {
266  area += ((corners[j].x() + corners[i].x()) * (corners[i].y() - corners[j].y()));
267  j = i;
268  }
269  }
270  return std::abs(0.5 * area);
271 }
272 
274  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ : FlatHexagon::ncorner_);
275  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
276  unsigned int cellIndex = indexFor(detid);
278  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
279  GlobalPoint v = getPosition(detid);
280  int type = std::min(id.iType, 1);
281  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
282  float dr = k_half * (rr.second - rr.first);
283  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
284  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
285  float r = v.perp();
286  float fi = v.phi();
287  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
288  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
289  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
290  for (unsigned int i = 0; i < ncorner; ++i) {
291  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
292  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
293  (v.z() + signz[i] * dz));
294  }
295  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
296  std::pair<float, float> xy;
297  if (m_topology.waferHexagon6()) {
298  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
299  float dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
300  float dy = k_half * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
301  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
302  static const int signx[] = {0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1};
303  static const int signy[] = {-2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1};
304  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
305  for (unsigned int i = 0; i < ncorner; ++i) {
306  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, signz[i] * dz);
307  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
308  }
309  } else {
310  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false);
311  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
312  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
313  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
314  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
315  static const int signx[] = {1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2};
316  static const int signy[] = {1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0};
317  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
318  for (unsigned int i = 0; i < ncorner; ++i) {
319  auto xyglob = m_topology.dddConstants().localToGlobal8(
320  id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
321  double xx = id.zSide * xyglob.first;
322  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + signz[i] * dz));
323  }
324  }
325  }
326  return co;
327 }
328 
330  unsigned int ncorner = FlatTrd::ncorner_;
331  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
332  unsigned int cellIndex = indexFor(detid);
334  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
335  GlobalPoint v = getPosition(detid);
336  int type = std::min(id.iType, 1);
337  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
338  float dr = k_half * (rr.second - rr.first);
339  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
340  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
341  float r = v.perp();
342  float fi = v.phi();
343  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
344  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
345  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
346  for (unsigned int i = 0; i < ncorner; ++i) {
347  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
348  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
349  (v.z() + signz[i] * dz));
350  }
351  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
352  std::pair<float, float> xy;
353  float dx(0);
354  static const int signx[] = {-1, -1, 1, 1, -1, -1, 1, 1};
355  static const int signy[] = {-1, 1, 1, -1, -1, 1, 1, -1};
356  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
357  if (m_topology.waferHexagon6()) {
358  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
359  dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
360  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
361  for (unsigned int i = 0; i < ncorner; ++i) {
362  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dx, signz[i] * dz);
363  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
364  }
365  } else {
366  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false);
367  dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
368  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
369  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
370  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
371  for (unsigned int i = 0; i < ncorner; ++i) {
372  auto xyglob = m_topology.dddConstants().localToGlobal8(
373  id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
374  double xx = id.zSide * xyglob.first;
375  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + signz[i] * dz));
376  }
377  }
378  }
379  return co;
380 }
381 
383  unsigned int ncorner = (m_det == DetId::HGCalHSc) ? 5 : 7;
384  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
385  unsigned int cellIndex = indexFor(detid);
387  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
388  GlobalPoint v = getPosition(detid);
389  int type = std::min(id.iType, 1);
390  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
391  float dr = k_half * (rr.second - rr.first);
392  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
393  float dz = -id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
394  float r = v.perp();
395  float fi = v.phi();
396  static const int signr[] = {1, 1, -1, -1};
397  static const int signf[] = {-1, 1, 1, -1};
398  for (unsigned int i = 0; i < ncorner - 1; ++i) {
399  co[i] = GlobalPoint(
400  (r + signr[i] * dr) * cos(fi + signf[i] * dfi), (r + signr[i] * dr) * sin(fi + signf[i] * dfi), (v.z() + dz));
401  }
402  co[ncorner - 1] = co[0];
403  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
404  std::pair<float, float> xy;
405  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
406  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
407  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
408  static const int signx[] = {1, -1, -2, -1, 1, 2};
409  static const int signy[] = {1, 1, 0, -1, -1, 0};
410  if (m_topology.waferHexagon6()) {
411  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
412  for (unsigned int i = 0; i < ncorner - 1; ++i) {
413  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, dz);
414  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
415  }
416  } else {
417  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false);
418  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
419  for (unsigned int i = 0; i < ncorner; ++i) {
420  auto xyglob = m_topology.dddConstants().localToGlobal8(
421  id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
422  double xx = id.zSide * xyglob.first;
423  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + dz));
424  }
425  }
426  co[ncorner - 1] = co[0];
427  }
428  return co;
429 }
430 
431 DetId HGCalGeometry::neighborZ(const DetId& idin, const GlobalVector& momentum) const {
432  DetId idnew;
434  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
435 #ifdef EDM_ML_DEBUG
436  edm::LogVerbatim("HGCalGeom") << "neighborz1:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
437  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
438  << m_topology.dddConstants().firstLayer() << ":"
439  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
440 #endif
441  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
442  (momentum.z() != 0.0)) {
443  GlobalPoint v = getPosition(idin);
444  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
445  double grad = (z - v.z()) / momentum.z();
446  GlobalPoint p(v.x() + grad * momentum.x(), v.y() + grad * momentum.y(), z);
447  double r = p.perp();
448  auto rlimit = topology().dddConstants().rangeR(z, true);
449  if (r >= rlimit.first && r <= rlimit.second)
450  idnew = getClosestCell(p);
451 #ifdef EDM_ML_DEBUG
452  edm::LogVerbatim("HGCalGeom") << "neighborz1:: Position " << v << " New Z " << z << ":" << grad << " new position "
453  << p << " r-limit " << rlimit.first << ":" << rlimit.second;
454 #endif
455  }
456  return idnew;
457 }
458 
460  const MagneticField* bField,
461  int charge,
462  const GlobalVector& momentum) const {
463  DetId idnew;
465  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
466 #ifdef EDM_ML_DEBUG
467  edm::LogVerbatim("HGCalGeom") << "neighborz2:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
468  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
469  << m_topology.dddConstants().firstLayer() << ":"
470  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
471 #endif
472  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
473  (momentum.z() != 0.0)) {
474  GlobalPoint v = getPosition(idin);
475  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
476  FreeTrajectoryState fts(v, momentum, charge, bField);
478  AnalyticalPropagator myAP(bField, alongMomentum, 2 * M_PI);
479  TrajectoryStateOnSurface tsos = myAP.propagate(fts, *nPlane);
480  GlobalPoint p;
481  auto rlimit = topology().dddConstants().rangeR(z, true);
482  if (tsos.isValid()) {
483  p = tsos.globalPosition();
484  double r = p.perp();
485  if (r >= rlimit.first && r <= rlimit.second)
486  idnew = getClosestCell(p);
487  }
488 #ifdef EDM_ML_DEBUG
489  edm::LogVerbatim("HGCalGeom") << "neighborz2:: Position " << v << " New Z " << z << ":" << charge << ":"
490  << tsos.isValid() << " new position " << p << " r limits " << rlimit.first << ":"
491  << rlimit.second;
492 #endif
493  }
494  return idnew;
495 }
496 
498  unsigned int cellIndex = getClosestCellIndex(r);
499  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
500  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
502  if (id.det == 0)
503  id.det = static_cast<int>(m_topology.detector());
504  HepGeom::Point3D<float> local;
505  if (r.z() > 0) {
506  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
507  id.zSide = 1;
508  } else {
509  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
510  id.zSide = -1;
511  }
512  if (m_topology.waferHexagon6()) {
513  const auto& kxy = m_topology.dddConstants().assignCell(local.x(), local.y(), id.iLay, id.iType, true);
514  id.iCell1 = kxy.second;
515  id.iSec1 = kxy.first;
516  id.iType = m_topology.dddConstants().waferTypeT(kxy.first);
517  if (id.iType != 1)
518  id.iType = -1;
519  } else if (m_topology.tileTrapezoid()) {
520  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
521  const auto& kxy = m_topology.dddConstants().assignCellTrap(r.x(), r.y(), r.z(), id.iLay, true);
522  id.iSec1 = kxy[0];
523  id.iCell1 = kxy[1];
524  id.iType = kxy[2];
525  } else {
526  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
527 #ifdef EDM_ML_DEBUG
528  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << " Layer " << id.iLay << " Global " << r << " Local " << local;
529 #endif
530  const auto& kxy = m_topology.dddConstants().assignCellHex(local.x(), local.y(), id.iLay, false, true);
531  id.iSec1 = kxy[0];
532  id.iSec2 = kxy[1];
533  id.iType = kxy[2];
534  id.iCell1 = kxy[3];
535  id.iCell2 = kxy[4];
536  }
537 #ifdef EDM_ML_DEBUG
538  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
539  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
540  << id.iCell1 << ":" << id.iCell2;
541 #endif
542 
543  //check if returned cell is valid
544  if (id.iCell1 >= 0)
545  return m_topology.encode(id);
546  }
547 
548  //if not valid or out of bounds return a null DetId
549  return DetId();
550 }
551 
553  unsigned int cellIndex = getClosestCellIndex(r);
554  if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
556  if (id.det == 0)
557  id.det = static_cast<int>(m_topology.detector());
558  HepGeom::Point3D<float> local;
559  if (r.z() > 0) {
560  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
561  id.zSide = 1;
562  } else {
563  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
564  id.zSide = -1;
565  }
566  if (m_topology.waferHexagon8()) {
567  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
568 #ifdef EDM_ML_DEBUG
569  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << " Layer " << id.iLay << " Global " << r << " Local " << local;
570 #endif
571  const auto& kxy = m_topology.dddConstants().assignCellHex(local.x(), local.y(), id.iLay, extend, true);
572  id.iSec1 = kxy[0];
573  id.iSec2 = kxy[1];
574  id.iType = kxy[2];
575  id.iCell1 = kxy[3];
576  id.iCell2 = kxy[4];
577  }
578 #ifdef EDM_ML_DEBUG
579  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
580  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
581  << id.iCell1 << ":" << id.iCell2;
582 #endif
583 
584  //check if returned cell is valid
585  if (id.iCell1 >= 0)
586  return m_topology.encode(id);
587  }
588 
589  //if not valid or out of bounds return a null DetId
590  return DetId();
591 }
592 
595  return dss;
596 }
597 
599  if (m_subdet == HGCEE || m_det == DetId::HGCalEE)
600  return "HGCalEE";
601  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi)
602  return "HGCalHEFront";
603  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc)
604  return "HGCalHEBack";
605  else
606  return "Unknown";
607 }
608 
609 unsigned int HGCalGeometry::indexFor(const DetId& detId) const {
610  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() : m_cellVec.size());
611  if (detId != DetId()) {
612  DetId geomId = getGeometryDetId(detId);
613  cellIndex = m_topology.detId2denseGeomId(geomId);
614 #ifdef EDM_ML_DEBUG
615  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId() << ":" << geomId.rawId() << std::dec
616  << " index " << cellIndex;
617 #endif
618  }
619  return cellIndex;
620 }
621 
623 
625  // Modify the RawPtr class
626  if (m_det == DetId::HGCalHSc) {
627  if (m_cellVec2.size() < index)
628  return nullptr;
629  const CaloCellGeometry* cell(&m_cellVec2[index]);
630  return (nullptr == cell->param() ? nullptr : cell);
631  } else {
632  if (m_cellVec2.size() < index)
633  return nullptr;
634  const CaloCellGeometry* cell(&m_cellVec[index]);
635  return (nullptr == cell->param() ? nullptr : cell);
636  }
637 }
638 
639 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index) const {
640  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
641  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
642  return nullptr;
643  static const auto do_not_delete = [](const void*) {};
644  if (m_det == DetId::HGCalHSc) {
645  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index], do_not_delete);
646  if (nullptr == cell->param())
647  return nullptr;
648  return cell;
649  } else {
650  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index], do_not_delete);
651  if (nullptr == cell->param())
652  return nullptr;
653  return cell;
654  }
655 }
656 
657 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index, const GlobalPoint& pos) const {
658  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
659  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
660  return nullptr;
661  if (pos == GlobalPoint())
662  return cellGeomPtr(index);
663  if (m_det == DetId::HGCalHSc) {
664  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
665  cell->setPosition(pos);
666 #ifdef EDM_ML_DEBUG
667  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
668 #endif
669  if (nullptr == cell->param())
670  return nullptr;
671  return cell;
672  } else {
673  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
674  cell->setPosition(pos);
675 #ifdef EDM_ML_DEBUG
676  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
677 #endif
678  if (nullptr == cell->param())
679  return nullptr;
680  return cell;
681  }
682 }
683 
685  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
686 }
687 
690 }
691 
692 template <class T>
693 unsigned int HGCalGeometry::getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const {
694  float phip = r.phi();
695  float zp = r.z();
696  float dzmin(9999), dphimin(9999), dphi10(0.175);
697  unsigned int cellIndex = vec.size();
698  for (unsigned int k = 0; k < vec.size(); ++k) {
699  float dphi = phip - vec[k].phiPos();
700  while (dphi > M_PI)
701  dphi -= 2 * M_PI;
702  while (dphi <= -M_PI)
703  dphi += 2 * M_PI;
704  if (std::abs(dphi) < dphi10) {
705  float dz = std::abs(zp - vec[k].getPosition().z());
706  if (dz < (dzmin + 0.001)) {
707  dzmin = dz;
708  if (std::abs(dphi) < (dphimin + 0.01)) {
709  cellIndex = k;
710  dphimin = std::abs(dphi);
711  } else {
712  if (cellIndex >= vec.size())
713  cellIndex = k;
714  }
715  }
716  }
717  }
718 #ifdef EDM_ML_DEBUG
719  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":" << phip << " Index " << cellIndex;
720  if (cellIndex < vec.size())
721  edm::LogVerbatim("HGCalGeom") << " Cell z " << vec[cellIndex].getPosition().z() << ":" << dzmin << " phi "
722  << vec[cellIndex].phiPos() << ":" << dphimin;
723 #endif
724  return cellIndex;
725 }
726 
727 // FIXME: Change sorting algorithm if needed
728 namespace {
729  struct rawIdSort {
730  bool operator()(const DetId& a, const DetId& b) { return (a.rawId() < b.rawId()); }
731  };
732 } // namespace
733 
735  m_validIds.shrink_to_fit();
736  std::sort(m_validIds.begin(), m_validIds.end(), rawIdSort());
737 }
738 
742  CaloSubdetectorGeometry::IVec& dinsVector) const {
743  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
744  unsigned int numberOfShapes = k_NumberOfShapes;
745  unsigned int numberOfParametersPerShape = ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd)
746  : (unsigned int)(k_NumberOfParametersPerHex));
747 
748  trVector.reserve(numberOfCells * numberOfTransformParms());
749  iVector.reserve(numberOfCells);
750  dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
751  dinsVector.reserve(numberOfCells);
752 
753  for (unsigned itr = 0; itr < m_topology.dddConstants().getTrFormN(); ++itr) {
755  int layer = mytr.lay;
756 
757  if (m_topology.waferHexagon6()) {
758  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
759  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
760  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
761  ParmVec params(numberOfParametersPerShape, 0);
762  params[FlatHexagon::k_dZ] = vol.dz;
763  params[FlatHexagon::k_r] = vol.cellSize;
764  params[FlatHexagon::k_R] = twoBysqrt3_ * params[FlatHexagon::k_r];
765  dimVector.insert(dimVector.end(), params.begin(), params.end());
766  }
767  }
768  } else if (m_topology.tileTrapezoid()) {
769  int indx = m_topology.dddConstants().layerIndex(layer, true);
770  for (int md = m_topology.dddConstants().getParameter()->firstModule_[indx];
772  ++md) {
774  ParmVec params(numberOfParametersPerShape, 0);
775  params[FlatTrd::k_dZ] = vol.dz;
776  params[FlatTrd::k_Theta] = params[FlatTrd::k_Phi] = 0;
777  params[FlatTrd::k_dY1] = params[FlatTrd::k_dY2] = vol.h;
778  params[FlatTrd::k_dX1] = params[FlatTrd::k_dX3] = vol.bl;
779  params[FlatTrd::k_dX2] = params[FlatTrd::k_dX4] = vol.tl;
780  params[FlatTrd::k_Alp1] = params[FlatTrd::k_Alp2] = vol.alpha;
781  params[FlatTrd::k_Cell] = vol.cellSize;
782  dimVector.insert(dimVector.end(), params.begin(), params.end());
783  }
784  } else {
785  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
786  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
787  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
788  ParmVec params(numberOfParametersPerShape, 0);
789  params[FlatHexagon::k_dZ] = vol.dz;
790  params[FlatHexagon::k_r] = vol.cellSize;
791  params[FlatHexagon::k_R] = twoBysqrt3_ * params[FlatHexagon::k_r];
792  dimVector.insert(dimVector.end(), params.begin(), params.end());
793  }
794  }
795  }
796  }
797 
798  for (unsigned int i(0); i < numberOfCells; ++i) {
799  DetId detId = m_validGeomIds[i];
800  int layer(0);
801  if (m_topology.waferHexagon6()) {
802  layer = HGCalDetId(detId).layer();
803  } else if (m_topology.tileTrapezoid()) {
804  layer = HGCScintillatorDetId(detId).layer();
805  } else if (m_topology.isHFNose()) {
806  layer = HFNoseDetId(detId).layer();
807  } else {
808  layer = HGCSiliconDetId(detId).layer();
809  }
810  dinsVector.emplace_back(m_topology.detId2denseGeomId(detId));
811  iVector.emplace_back(layer);
812 
813  Tr3D tr;
814  auto ptr = cellGeomPtr(i);
815  if (nullptr != ptr) {
816  ptr->getTransform(tr, (Pt3DVec*)nullptr);
817 
818  if (Tr3D() == tr) { // there is no rotation
819  const GlobalPoint& gp(ptr->getPosition());
820  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
821  }
822 
823  const CLHEP::Hep3Vector tt(tr.getTranslation());
824  trVector.emplace_back(tt.x());
825  trVector.emplace_back(tt.y());
826  trVector.emplace_back(tt.z());
827  if (6 == numberOfTransformParms()) {
828  const CLHEP::HepRotation rr(tr.getRotation());
829  const ROOT::Math::Transform3D rtr(
830  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
832  rtr.GetRotation(ea);
833  trVector.emplace_back(ea.Phi());
834  trVector.emplace_back(ea.Theta());
835  trVector.emplace_back(ea.Psi());
836  }
837  }
838  }
839 }
840 
842  DetId geomId;
843  if (m_topology.waferHexagon6()) {
844  geomId = static_cast<DetId>(HGCalDetId(detId).geometryCell());
845  } else if (m_topology.tileTrapezoid()) {
846  geomId = static_cast<DetId>(HGCScintillatorDetId(detId).geometryCell());
847  } else if (m_topology.isHFNose()) {
848  geomId = static_cast<DetId>(HFNoseDetId(detId).geometryCell());
849  } else {
850  geomId = static_cast<DetId>(HGCSiliconDetId(detId).geometryCell());
851  }
852  return geomId;
853 }
854 
856 
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
std::vector< DetId > m_validGeomIds
Log< level::Info, true > LogVerbatim
std::pair< double, double > cellSizeTrap(int type, int irad) const
DetId getClosestCellHex(const GlobalPoint &r, bool extend) const
A base class to handle the particular shape of HGCal volumes.
Definition: FlatTrd.h:19
int getLayer(double z, bool reco) const
std::vector< CCGFloat > DimVec
T perp() const
Definition: PV3DBase.h:69
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:31
virtual unsigned int numberOfParametersPerShape() const
std::string cellElement() const
unsigned int sizeForDenseIndex() const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
int lastLayer(bool reco) const
unsigned int getClosestCellIndex(const GlobalPoint &r) const
bool tileTrapezoid() const
DetId neighborZ(const DetId &idin, const GlobalVector &p) const
const HGCalParameters * getParameter() 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
~HGCalGeometry() override
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< unsigned int > IVec
T y() const
Definition: PV3DBase.h:60
static constexpr uint32_t k_Theta
Definition: FlatTrd.h:27
bool present(const DetId &id) const override
is this detid present in the geometry?
GlobalPoint globalPosition() const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
std::vector< float > ParmVec
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:38
std::vector< CCGFloat > TrVec
GlobalPoint getPosition(const DetId &id) const
static constexpr double k_fac2
HepGeom::Transform3D Tr3D
double getArea(const DetId &detid) const
Returns area of a cell.
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:46
static constexpr uint32_t k_Cell
Definition: FlatTrd.h:45
static constexpr uint32_t k_dY1
Definition: FlatTrd.h:31
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
Log< level::Error, false > LogError
__host__ __device__ VT * co
Definition: prefixScan.h:47
CaloCellGeometry::CCGFloat CCGFloat
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
static constexpr double k_half
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatHexagon.cc:154
int layerIndex(int lay, bool reco) 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
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
const double twoBysqrt3_
std::pair< double, double > rangeR(double z, bool reco) const
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:93
HGCalGeometry(const HGCalTopology &topology)
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:97
std::vector< int > firstModule_
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:34
DetId getClosestCell(const GlobalPoint &r) const override
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
void initializeParms() override
unsigned int getTrFormN() const
HGCSiliconDetId geometryCell() const
const CCGFloat * param() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
int numberCellsHexagon(int wafer) const
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
int layer() const
get the layer #
Definition: HFNoseDetId.h:56
virtual unsigned int numberOfShapes() const
tuple maxSize
&#39;/store/data/Commissioning08/BeamHalo/RECO/StuffAlmostToP5_v1/000/061/642/10A0FE34-A67D-DD11-AD05-000...
DetId encode(const DecodedDetId &id_) const
T sqrt(T t)
Definition: SSEVec.h:19
int layer() const
get the layer #
static constexpr uint32_t k_dX1
Definition: FlatTrd.h:32
std::vector< DetId > m_validIds
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
T z() const
Definition: PV3DBase.h:61
const HGCalTopology & topology() const
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
std::pair< float, float > localToGlobal8(int lay, int waferU, int waferV, double localX, double localY, bool reco, bool debug) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static constexpr unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:43
unsigned int indexFor(const DetId &id) const override
A base class to handle the hexagonal shape of HGCal silicon volumes.
Definition: FlatHexagon.h:20
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
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
HGCScintillatorDetId geometryCell() const
int ring() const
get the eta index
CornersVec get8Corners(const DetId &id) const
T min(T a, T b)
Definition: MathUtil.h:58
CellVec2 m_cellVec2
static constexpr uint32_t k_dX4
Definition: FlatTrd.h:41
bool waferHexagon6() const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatTrd.cc:153
double waferZ(int layer, bool reco) const
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
#define M_PI
bool isHFNose() const
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
DecodedDetId decode(const DetId &id) const
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
Basic2DVector< T > xy() const
Definition: DetId.h:17
GlobalPoint getWaferPosition(const DetId &id) const
std::vector< int > lastModule_
AlgebraicVector EulerAngles
Definition: Definitions.h:34
ForwardSubdetector m_subdet
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:32
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
static constexpr uint32_t k_Phi
Definition: FlatTrd.h:29
CaloCellGeometry::CornersMgr * cornersMgr()
CornersVec getNewCorners(const DetId &id) const
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.
double b
Definition: hdecay.h:118
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco, bool extend=false, bool debug=false) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
unsigned int totalModules() const
Definition: HGCalTopology.h:92
CaloCellGeometry::Tr3D Tr3D
int layer() const
get the layer #
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:34
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
double a
Definition: hdecay.h:119
static constexpr uint32_t k_dZ
Definition: FlatTrd.h:26
virtual void fillNamedParams(DDFilteredView fv)
bool waferHexagon8() const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
DetId::Detector m_det
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
int firstLayer() const
static constexpr uint32_t k_Alp1
Definition: FlatTrd.h:36
void addValidID(const DetId &id)
virtual unsigned int numberOfTransformParms() const
static constexpr uint32_t k_dX3
Definition: FlatTrd.h:39
Log< level::Warning, false > LogWarning
DetId::Detector detector() const
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
std::pair< int, int > tileType(int layer, int ring, int phi) const
T x() const
Definition: PV3DBase.h:59
int waferTypeT(int wafer) const
int layer() const
get the layer #
Definition: HGCalDetId.h:46
static constexpr uint32_t k_dX2
Definition: FlatTrd.h:34
CellVec m_cellVec
bool waferInLayer(int wafer, int lay, bool reco) const
DetId getGeometryDetId(DetId detId) const
static constexpr uint32_t k_Alp2
Definition: FlatTrd.h:43