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  if (detId.det() == DetId::Forward)
77  edm::LogVerbatim("HGCalGeom") << "NewCell " << HFNoseDetId(detId) << " GEOM " << HFNoseDetId(geomId);
78  else
79  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCSiliconDetId(detId) << " GEOM " << HGCSiliconDetId(geomId);
80 #endif
81  }
82  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
83 
84  if (m_det == DetId::HGCalHSc) {
85  m_cellVec2.at(cellIndex) = FlatTrd(cornersMgr(), f1, f2, f3, parm);
86  } else {
87  m_cellVec.at(cellIndex) = FlatHexagon(cornersMgr(), f1, f2, f3, parm);
88  }
89  m_validGeomIds.at(cellIndex) = geomId;
90 
91 #ifdef EDM_ML_DEBUG
92  edm::LogVerbatim("HGCalGeom") << "Store for DetId " << std::hex << detId.rawId() << " GeomId " << geomId.rawId()
93  << std::dec << " Index " << cellIndex << " cells " << cells;
94  unsigned int nOld = m_validIds.size();
95 #endif
96  if (m_topology.waferHexagon6()) {
97  for (int cell = 0; cell < cells; ++cell) {
98  id.iCell1 = cell;
99  DetId idc = m_topology.encode(id);
100  if (m_topology.valid(idc)) {
101  m_validIds.emplace_back(idc);
102 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << cell << "] " << HGCalDetId(idc);
104 #endif
105  }
106  }
107  } else if (m_topology.tileTrapezoid()) {
108  DetId idc = m_topology.encode(id);
109  if (m_topology.valid(idc)) {
110  HGCScintillatorDetId hid(idc);
111  std::pair<int, int> typm = m_topology.dddConstants().tileType(hid.layer(), hid.ring(), 0);
112  if (typm.first >= 0) {
113  hid.setType(typm.first);
114  hid.setSiPM(typm.second);
115  idc = static_cast<DetId>(hid);
116  }
117  m_validIds.emplace_back(idc);
118 #ifdef EDM_ML_DEBUG
119  edm::LogVerbatim("HGCalGeom") << "Valid Id [0] " << HGCScintillatorDetId(idc);
120 #endif
121  } else {
122  edm::LogWarning("HGCalGeom") << "Check " << HGCScintillatorDetId(idc) << " from " << HGCScintillatorDetId(detId)
123  << " ERROR ???";
124  }
125  } else {
126 #ifdef EDM_ML_DEBUG
127  unsigned int cellAll(0), cellSelect(0);
128 #endif
129  for (int u = 0; u < 2 * cells; ++u) {
130  for (int v = 0; v < 2 * cells; ++v) {
131  if (((v - u) < cells) && (u - v) <= cells) {
132  id.iCell1 = u;
133  id.iCell2 = v;
134  DetId idc = m_topology.encode(id);
135 #ifdef EDM_ML_DEBUG
136  ++cellAll;
137 #endif
138  if (m_topology.dddConstants().cellInLayer(id.iSec1, id.iSec2, u, v, id.iLay, id.zSide, true)) {
139  m_validIds.emplace_back(idc);
140 #ifdef EDM_ML_DEBUG
141  ++cellSelect;
142  if (idc.det() == DetId::Forward)
143  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << u << ", " << v << "] " << HFNoseDetId(idc);
144  else
145  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << u << ", " << v << "] " << HGCSiliconDetId(idc);
146 #endif
147  }
148  }
149  }
150  }
151 #ifdef EDM_ML_DEBUG
152  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry keeps " << cellSelect << " out of " << cellAll << " for wafer "
153  << id.iSec1 << ":" << id.iSec2 << " in "
154  << " layer " << id.iLay;
155 #endif
156  }
157 #ifdef EDM_ML_DEBUG
158  if (m_det == DetId::HGCalHSc) {
159  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex << "]"
160  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
161  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec2[cellIndex].etaPos() << ":"
162  << m_cellVec2[cellIndex].phiPos();
163  } else {
164  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex << "]"
165  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
166  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec[cellIndex].etaPos() << ":"
167  << m_cellVec[cellIndex].phiPos();
168  }
169  unsigned int nNew = m_validIds.size();
170  if (m_topology.waferHexagon6()) {
171  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCalDetId(detId) << " with valid DetId from " << nOld << " to " << nNew;
172  } else if (m_topology.tileTrapezoid()) {
173  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCScintillatorDetId(detId) << " with valid DetId from " << nOld
174  << " to " << nNew;
175  } else if (m_topology.isHFNose()) {
176  edm::LogVerbatim("HGCalGeom") << "ID: " << HFNoseDetId(detId) << " with valid DetId from " << nOld << " to "
177  << nNew;
178  } else {
179  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCSiliconDetId(detId) << " with valid DetId from " << nOld << " to "
180  << nNew;
181  }
182  edm::LogVerbatim("HGCalGeom") << "Cell[" << cellIndex << "] " << std::hex << geomId.rawId() << ":"
183  << m_validGeomIds[cellIndex].rawId() << std::dec;
184 #endif
185 }
186 
187 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::getGeometry(const DetId& detId) const {
188  if (detId == DetId())
189  return nullptr; // nothing to get
190  DetId geomId = getGeometryDetId(detId);
191  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
192  const GlobalPoint pos = (detId != geomId) ? getPosition(detId, false) : GlobalPoint();
193  return cellGeomPtr(cellIndex, pos);
194 }
195 
196 bool HGCalGeometry::present(const DetId& detId) const {
197  if (detId == DetId())
198  return false;
199  DetId geomId = getGeometryDetId(detId);
200  const uint32_t index(m_topology.detId2denseGeomId(geomId));
201  return (nullptr != getGeometryRawPtr(index));
202 }
203 
205  unsigned int cellIndex = indexFor(detid);
206  GlobalPoint glob;
207  unsigned int maxSize = (m_topology.tileTrapezoid() ? m_cellVec2.size() : m_cellVec.size());
208  if (cellIndex < maxSize) {
210  std::pair<float, float> xy;
211  if (m_topology.waferHexagon6()) {
212  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
213  const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0);
214  glob = m_cellVec[cellIndex].getPosition(lcoord);
215  if (debug)
216  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex << " Local " << lcoord.x() << ":"
217  << lcoord.y() << " ID " << id.iCell1 << ":" << id.iSec1 << " Global " << glob;
218  } else if (m_topology.tileTrapezoid()) {
219  const HepGeom::Point3D<float> lcoord(0, 0, 0);
220  glob = m_cellVec2[cellIndex].getPosition(lcoord);
221  if (debug)
222  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: index " << cellIndex << " Local " << lcoord.x() << ":"
223  << lcoord.y() << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iCell1
224  << " Global " << glob;
225  } else {
226  if (debug) {
227  if (detid.det() == DetId::Forward)
228  edm::LogVerbatim("HGCalGeom") << "getPosition for " << HFNoseDetId(detid) << " Layer " << id.iLay << " Wafer "
229  << id.iSec1 << ":" << id.iSec2 << " Cell " << id.iCell1 << ":" << id.iCell2;
230  else
231  edm::LogVerbatim("HGCalGeom") << "getPosition for " << HGCSiliconDetId(detid) << " Layer " << id.iLay
232  << " Wafer " << id.iSec1 << ":" << id.iSec2 << " Cell " << id.iCell1 << ":"
233  << id.iCell2;
234  }
236  id.zSide, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, true, false, debug);
237  double xx = id.zSide * xy.first;
238  double zz = id.zSide * m_topology.dddConstants().waferZ(id.iLay, true);
239  glob = GlobalPoint(xx, xy.second, zz);
240  if (debug)
241  edm::LogVerbatim("HGCalGeom") << "getPositionWafer:: index " << cellIndex << " Local " << xy.first << ":"
242  << xy.second << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
243  << id.iCell1 << ":" << id.iCell2 << " Global " << glob;
244  }
245  } else {
246  edm::LogVerbatim("HGCalGeom") << "Cannot recognize " << std::hex << detid.rawId() << " cellIndex " << cellIndex
247  << ":" << maxSize << " Type " << m_topology.tileTrapezoid();
248  }
249  return glob;
250 }
251 
253  unsigned int cellIndex = indexFor(detid);
254  GlobalPoint glob;
255  unsigned int maxSize = (m_topology.tileTrapezoid() ? m_cellVec2.size() : m_cellVec.size());
256  if (cellIndex < maxSize) {
257  const HepGeom::Point3D<float> lcoord(0, 0, 0);
258  if (m_topology.tileTrapezoid()) {
259  glob = m_cellVec2[cellIndex].getPosition(lcoord);
260  } else {
261  glob = m_cellVec[cellIndex].getPosition(lcoord);
262  }
263 #ifdef EDM_ML_DEBUG
264  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: ID " << std::hex << detid.rawId() << std::dec << " index "
265  << cellIndex << " Global " << glob;
266 #endif
267  }
268  return glob;
269 }
270 
271 double HGCalGeometry::getArea(const DetId& detid) const {
272  HGCalGeometry::CornersVec corners = getNewCorners(detid);
273  double area(0);
274  if (corners.size() > 1) {
275  int n = corners.size() - 1;
276  int j = n - 1;
277  for (int i = 0; i < n; ++i) {
278  area += ((corners[j].x() + corners[i].x()) * (corners[i].y() - corners[j].y()));
279  j = i;
280  }
281  }
282  return std::abs(0.5 * area);
283 }
284 
286  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ : FlatHexagon::ncorner_);
287  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
288  unsigned int cellIndex = indexFor(detid);
290  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
291  GlobalPoint v = getPosition(detid, false);
292  int type = std::min(id.iType, 1);
293  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
294  float dr = k_half * (rr.second - rr.first);
295  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
296  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
297  float r = v.perp();
298  float fi = v.phi();
299  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
300  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
301  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
302  for (unsigned int i = 0; i < ncorner; ++i) {
303  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
304  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
305  (v.z() + signz[i] * dz));
306  }
307  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
308  std::pair<float, float> xy;
309  if (m_topology.waferHexagon6()) {
310  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
311  float dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
312  float dy = k_half * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
313  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
314  static const int signx[] = {0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1};
315  static const int signy[] = {-2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1};
316  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
317  for (unsigned int i = 0; i < ncorner; ++i) {
318  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, signz[i] * dz);
319  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
320  }
321  } else {
323  id.zSide, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true, debugLocate);
324  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
325  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
326  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
327  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
328  static const int signx[] = {1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2};
329  static const int signy[] = {1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0};
330  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
331  for (unsigned int i = 0; i < ncorner; ++i) {
332  auto xyglob = m_topology.dddConstants().localToGlobal8(
333  id.zSide, id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
334  double xx = id.zSide * xyglob.first;
335  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + signz[i] * dz));
336  }
337  }
338  }
339  return co;
340 }
341 
343  unsigned int ncorner = FlatTrd::ncorner_;
344  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
345  unsigned int cellIndex = indexFor(detid);
347  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
348  GlobalPoint v = getPosition(detid, false);
349  int type = std::min(id.iType, 1);
350  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
351  float dr = k_half * (rr.second - rr.first);
352  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
353  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
354  float r = v.perp();
355  float fi = v.phi();
356  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
357  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
358  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
359  for (unsigned int i = 0; i < ncorner; ++i) {
360  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
361  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
362  (v.z() + signz[i] * dz));
363  }
364  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
365  std::pair<float, float> xy;
366  float dx(0);
367  static const int signx[] = {-1, -1, 1, 1, -1, -1, 1, 1};
368  static const int signy[] = {-1, 1, 1, -1, -1, 1, 1, -1};
369  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
370  if (m_topology.waferHexagon6()) {
371  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
372  dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
373  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
374  for (unsigned int i = 0; i < ncorner; ++i) {
375  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dx, signz[i] * dz);
376  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
377  }
378  } else {
380  id.zSide, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true, debugLocate);
381  dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
382  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
383  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
384  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
385  for (unsigned int i = 0; i < ncorner; ++i) {
386  auto xyglob = m_topology.dddConstants().localToGlobal8(
387  id.zSide, id.iLay, id.iSec1, id.iSec2, (xy.first + signx[i] * dx), (xy.second + signy[i] * dy), true, false);
388  double xx = id.zSide * xyglob.first;
389  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + signz[i] * dz));
390  }
391  }
392  }
393  return co;
394 }
395 
397  unsigned int ncorner = (m_det == DetId::HGCalHSc) ? 5 : 7;
398  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
399  unsigned int cellIndex = indexFor(detid);
401  if (debug)
402  edm::LogVerbatim("HGCalGeom") << "NewCorners for Layer " << id.iLay << " Wafer " << id.iSec1 << ":" << id.iSec2
403  << " Cell " << id.iCell1 << ":" << id.iCell2;
404  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
405  GlobalPoint v = getPosition(detid, false);
406  int type = std::min(id.iType, 1);
407  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(type, id.iSec1);
408  float dr = k_half * (rr.second - rr.first);
409  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
410  float dz = -id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
411  float r = v.perp();
412  float fi = v.phi();
413  static const int signr[] = {1, 1, -1, -1};
414  static const int signf[] = {-1, 1, 1, -1};
415  for (unsigned int i = 0; i < ncorner - 1; ++i) {
416  co[i] = GlobalPoint(
417  (r + signr[i] * dr) * cos(fi + signf[i] * dfi), (r + signr[i] * dr) * sin(fi + signf[i] * dfi), (v.z() + dz));
418  }
419  // Used to pass downstream the thickness of this cell
420  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
421  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
422  std::pair<float, float> xy;
423  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
424  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
425  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
426  static const int signx[] = {1, -1, -2, -1, 1, 2};
427  static const int signy[] = {1, 1, 0, -1, -1, 0};
428 #ifdef EDM_ML_DEBUG
429  if (debug)
430  edm::LogVerbatim("HGCalGeom") << "kfac " << k_fac1 << ":" << k_fac2 << " dx:dy:dz " << dx << ":" << dy << ":"
431  << dz;
432 #endif
433  if (m_topology.waferHexagon6()) {
434  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
435  for (unsigned int i = 0; i < ncorner - 1; ++i) {
436  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, dz);
437  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
438  }
439  } else {
441  id.zSide, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true, debug);
442  float zz = m_topology.dddConstants().waferZ(id.iLay, true);
443  for (unsigned int i = 0; i < ncorner; ++i) {
444  double xloc = xy.first + signx[i] * dx;
445  double yloc = xy.second + signy[i] * dy;
446 #ifdef EDM_ML_DEBUG
447  if (debug)
448  edm::LogVerbatim("HGCalGeom") << "Corner " << i << " x " << xy.first << ":" << xloc << " y " << xy.second
449  << ":" << yloc << " z " << zz << ":" << id.zSide * (zz + dz);
450 #endif
451  auto xyglob =
452  m_topology.dddConstants().localToGlobal8(id.zSide, id.iLay, id.iSec1, id.iSec2, xloc, yloc, true, debug);
453  double xx = id.zSide * xyglob.first;
454  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + dz));
455  }
456  }
457  // Used to pass downstream the thickness of this cell
458  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
459  }
460  return co;
461 }
462 
463 DetId HGCalGeometry::neighborZ(const DetId& idin, const GlobalVector& momentum) const {
464  DetId idnew;
466  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
467 #ifdef EDM_ML_DEBUG
468  edm::LogVerbatim("HGCalGeom") << "neighborz1:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
469  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
470  << m_topology.dddConstants().firstLayer() << ":"
471  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
472 #endif
473  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
474  (momentum.z() != 0.0)) {
475  GlobalPoint v = getPosition(idin, false);
476  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
477  double grad = (z - v.z()) / momentum.z();
478  GlobalPoint p(v.x() + grad * momentum.x(), v.y() + grad * momentum.y(), z);
479  double r = p.perp();
480  auto rlimit = topology().dddConstants().rangeR(z, true);
481  if (r >= rlimit.first && r <= rlimit.second)
482  idnew = getClosestCell(p);
483 #ifdef EDM_ML_DEBUG
484  edm::LogVerbatim("HGCalGeom") << "neighborz1:: Position " << v << " New Z " << z << ":" << grad << " new position "
485  << p << " r-limit " << rlimit.first << ":" << rlimit.second;
486 #endif
487  }
488  return idnew;
489 }
490 
492  const MagneticField* bField,
493  int charge,
494  const GlobalVector& momentum) const {
495  DetId idnew;
497  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
498 #ifdef EDM_ML_DEBUG
499  edm::LogVerbatim("HGCalGeom") << "neighborz2:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
500  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
501  << m_topology.dddConstants().firstLayer() << ":"
502  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
503 #endif
504  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
505  (momentum.z() != 0.0)) {
506  GlobalPoint v = getPosition(idin, false);
507  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
508  FreeTrajectoryState fts(v, momentum, charge, bField);
511  TrajectoryStateOnSurface tsos = myAP.propagate(fts, *nPlane);
512  GlobalPoint p;
513  auto rlimit = topology().dddConstants().rangeR(z, true);
514  if (tsos.isValid()) {
515  p = tsos.globalPosition();
516  double r = p.perp();
517  if (r >= rlimit.first && r <= rlimit.second)
518  idnew = getClosestCell(p);
519  }
520 #ifdef EDM_ML_DEBUG
521  edm::LogVerbatim("HGCalGeom") << "neighborz2:: Position " << v << " New Z " << z << ":" << charge << ":"
522  << tsos.isValid() << " new position " << p << " r limits " << rlimit.first << ":"
523  << rlimit.second;
524 #endif
525  }
526  return idnew;
527 }
528 
530  unsigned int cellIndex = getClosestCellIndex(r);
531  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
532  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
534  if (id.det == 0)
535  id.det = static_cast<int>(m_topology.detector());
536  HepGeom::Point3D<float> local;
537  if (r.z() > 0) {
538  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
539  id.zSide = 1;
540  } else {
541  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
542  id.zSide = -1;
543  }
544  if (m_topology.waferHexagon6()) {
545  const auto& kxy = m_topology.dddConstants().assignCell(local.x(), local.y(), id.iLay, id.iType, true);
546  id.iCell1 = kxy.second;
547  id.iSec1 = kxy.first;
548  id.iType = m_topology.dddConstants().waferTypeT(kxy.first);
549  if (id.iType != 1)
550  id.iType = -1;
551  } else if (m_topology.tileTrapezoid()) {
552  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
553  const auto& kxy = m_topology.dddConstants().assignCellTrap(r.x(), r.y(), r.z(), id.iLay, true);
554  id.iSec1 = kxy[0];
555  id.iCell1 = kxy[1];
556  id.iType = kxy[2];
557  } else {
558  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
559  int zside = (r.z() > 0) ? 1 : -1;
560 #ifdef EDM_ML_DEBUG
561  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << ":" << zside << " Layer " << id.iLay << " Global " << r
562  << " Local " << local;
563 #endif
564  const auto& kxy =
565  m_topology.dddConstants().assignCellHex(local.x(), local.y(), zside, id.iLay, true, false, true);
566  id.iSec1 = kxy[0];
567  id.iSec2 = kxy[1];
568  id.iType = kxy[2];
569  id.iCell1 = kxy[3];
570  id.iCell2 = kxy[4];
571  }
572 #ifdef EDM_ML_DEBUG
573  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
574  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
575  << id.iCell1 << ":" << id.iCell2;
576 #endif
577 
578  //check if returned cell is valid
579  if (id.iCell1 >= 0)
580  return m_topology.encode(id);
581  }
582 
583  //if not valid or out of bounds return a null DetId
584  return DetId();
585 }
586 
588  unsigned int cellIndex = getClosestCellIndex(r);
589  if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
591  if (id.det == 0)
592  id.det = static_cast<int>(m_topology.detector());
593  HepGeom::Point3D<float> local;
594  if (r.z() > 0) {
595  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
596  id.zSide = 1;
597  } else {
598  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
599  id.zSide = -1;
600  }
601  if (m_topology.waferHexagon8()) {
602  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
603  int zside = (r.z() > 0) ? 1 : -1;
604 #ifdef EDM_ML_DEBUG
605  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << ":" << zside << " Layer " << id.iLay << " Global " << r
606  << " Local " << local;
607 #endif
608  const auto& kxy =
609  m_topology.dddConstants().assignCellHex(local.x(), local.y(), zside, id.iLay, true, extend, true);
610  id.iSec1 = kxy[0];
611  id.iSec2 = kxy[1];
612  id.iType = kxy[2];
613  id.iCell1 = kxy[3];
614  id.iCell2 = kxy[4];
615  }
616 #ifdef EDM_ML_DEBUG
617  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
618  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
619  << id.iCell1 << ":" << id.iCell2;
620 #endif
621 
622  //check if returned cell is valid
623  if (id.iCell1 >= 0)
624  return m_topology.encode(id);
625  }
626 
627  //if not valid or out of bounds return a null DetId
628  return DetId();
629 }
630 
633  return dss;
634 }
635 
637  if (m_subdet == HGCEE || m_det == DetId::HGCalEE)
638  return "HGCalEE";
639  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi)
640  return "HGCalHEFront";
641  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc)
642  return "HGCalHEBack";
643  else
644  return "Unknown";
645 }
646 
647 unsigned int HGCalGeometry::indexFor(const DetId& detId) const {
648  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() : m_cellVec.size());
649  if (detId != DetId()) {
650  DetId geomId = getGeometryDetId(detId);
651  cellIndex = m_topology.detId2denseGeomId(geomId);
652 #ifdef EDM_ML_DEBUG
653  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId() << ":" << geomId.rawId() << std::dec
654  << " index " << cellIndex;
655 #endif
656  }
657  return cellIndex;
658 }
659 
661 
663  // Modify the RawPtr class
664  if (m_det == DetId::HGCalHSc) {
665  if (m_cellVec2.size() < index)
666  return nullptr;
667  const CaloCellGeometry* cell(&m_cellVec2[index]);
668  return (nullptr == cell->param() ? nullptr : cell);
669  } else {
670  if (m_cellVec.size() < index)
671  return nullptr;
672  const CaloCellGeometry* cell(&m_cellVec[index]);
673  return (nullptr == cell->param() ? nullptr : cell);
674  }
675 }
676 
677 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index) 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  static const auto do_not_delete = [](const void*) {};
682  if (m_det == DetId::HGCalHSc) {
683  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index], do_not_delete);
684  if (nullptr == cell->param())
685  return nullptr;
686  return cell;
687  } else {
688  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index], do_not_delete);
689  if (nullptr == cell->param())
690  return nullptr;
691  return cell;
692  }
693 }
694 
695 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index, const GlobalPoint& pos) const {
696  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
697  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
698  return nullptr;
699  if (pos == GlobalPoint())
700  return cellGeomPtr(index);
701  if (m_det == DetId::HGCalHSc) {
702  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
703  cell->setPosition(pos);
704 #ifdef EDM_ML_DEBUG
705  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
706 #endif
707  if (nullptr == cell->param())
708  return nullptr;
709  return cell;
710  } else {
711  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
712  cell->setPosition(pos);
713 #ifdef EDM_ML_DEBUG
714  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
715 #endif
716  if (nullptr == cell->param())
717  return nullptr;
718  return cell;
719  }
720 }
721 
723  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
724 }
725 
728 }
729 
730 template <class T>
731 unsigned int HGCalGeometry::getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const {
732  float phip = r.phi();
733  float zp = r.z();
734  float dzmin(9999), dphimin(9999), dphi10(0.175);
735  unsigned int cellIndex = vec.size();
736  for (unsigned int k = 0; k < vec.size(); ++k) {
737  float dphi = phip - vec[k].phiPos();
738  while (dphi > M_PI)
739  dphi -= 2 * M_PI;
740  while (dphi <= -M_PI)
741  dphi += 2 * M_PI;
742  if (std::abs(dphi) < dphi10) {
743  float dz = std::abs(zp - vec[k].getPosition().z());
744  if (dz < (dzmin + 0.001)) {
745  dzmin = dz;
746  if (std::abs(dphi) < (dphimin + 0.01)) {
747  cellIndex = k;
748  dphimin = std::abs(dphi);
749  } else {
750  if (cellIndex >= vec.size())
751  cellIndex = k;
752  }
753  }
754  }
755  }
756 #ifdef EDM_ML_DEBUG
757  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":" << phip << " Index " << cellIndex;
758  if (cellIndex < vec.size())
759  edm::LogVerbatim("HGCalGeom") << " Cell z " << vec[cellIndex].getPosition().z() << ":" << dzmin << " phi "
760  << vec[cellIndex].phiPos() << ":" << dphimin;
761 #endif
762  return cellIndex;
763 }
764 
765 // FIXME: Change sorting algorithm if needed
766 namespace {
767  struct rawIdSort {
768  bool operator()(const DetId& a, const DetId& b) { return (a.rawId() < b.rawId()); }
769  };
770 } // namespace
771 
773  m_validIds.shrink_to_fit();
774  std::sort(m_validIds.begin(), m_validIds.end(), rawIdSort());
775 }
776 
780  CaloSubdetectorGeometry::IVec& dinsVector) const {
781  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
782  unsigned int numberOfShapes = k_NumberOfShapes;
783  unsigned int numberOfParametersPerShape = ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd)
784  : (unsigned int)(k_NumberOfParametersPerHex));
785 
786  trVector.reserve(numberOfCells * numberOfTransformParms());
787  iVector.reserve(numberOfCells);
788  dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
789  dinsVector.reserve(numberOfCells);
790 
791  for (unsigned itr = 0; itr < m_topology.dddConstants().getTrFormN(); ++itr) {
793  int layer = mytr.lay;
794 
795  if (m_topology.waferHexagon6()) {
796  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
797  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
798  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
800  params[FlatHexagon::k_dZ] = vol.dz;
803  dimVector.insert(dimVector.end(), params.begin(), params.end());
804  }
805  }
806  } else if (m_topology.tileTrapezoid()) {
807  int indx = m_topology.dddConstants().layerIndex(layer, true);
808  for (int md = m_topology.dddConstants().getParameter()->firstModule_[indx];
810  ++md) {
813  params[FlatTrd::k_dZ] = vol.dz;
820  dimVector.insert(dimVector.end(), params.begin(), params.end());
821  }
822  } else {
823  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
824  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
825  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
827  params[FlatHexagon::k_dZ] = vol.dz;
830  dimVector.insert(dimVector.end(), params.begin(), params.end());
831  }
832  }
833  }
834  }
835 
836  for (unsigned int i(0); i < numberOfCells; ++i) {
838  int layer(0);
839  if (m_topology.waferHexagon6()) {
841  } else if (m_topology.tileTrapezoid()) {
843  } else if (m_topology.isHFNose()) {
845  } else {
847  }
848  dinsVector.emplace_back(m_topology.detId2denseGeomId(detId));
849  iVector.emplace_back(layer);
850 
851  Tr3D tr;
852  auto ptr = cellGeomPtr(i);
853  if (nullptr != ptr) {
854  ptr->getTransform(tr, (Pt3DVec*)nullptr);
855 
856  if (Tr3D() == tr) { // there is no rotation
857  const GlobalPoint& gp(ptr->getPosition());
858  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
859  }
860 
861  const CLHEP::Hep3Vector tt(tr.getTranslation());
862  trVector.emplace_back(tt.x());
863  trVector.emplace_back(tt.y());
864  trVector.emplace_back(tt.z());
865  if (6 == numberOfTransformParms()) {
866  const CLHEP::HepRotation rr(tr.getRotation());
867  const ROOT::Math::Transform3D rtr(
868  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
870  rtr.GetRotation(ea);
871  trVector.emplace_back(ea.Phi());
872  trVector.emplace_back(ea.Theta());
873  trVector.emplace_back(ea.Psi());
874  }
875  }
876  }
877 }
878 
880  DetId geomId;
881  if (m_topology.waferHexagon6()) {
882  geomId = static_cast<DetId>(HGCalDetId(detId).geometryCell());
883  } else if (m_topology.tileTrapezoid()) {
884  geomId = static_cast<DetId>(HGCScintillatorDetId(detId).geometryCell());
885  } else if (m_topology.isHFNose()) {
886  geomId = static_cast<DetId>(HFNoseDetId(detId).geometryCell());
887  } else {
888  geomId = static_cast<DetId>(HGCSiliconDetId(detId).geometryCell());
889  }
890  return geomId;
891 }
892 
894 
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
int zside(DetId 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
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
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
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_
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
constexpr HGCScintillatorDetId geometryCell() const
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
std::array< int, 5 > assignCellHex(float x, float y, int zside, int lay, bool reco, bool extend, bool debug) const
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
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
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, int zside, bool reco) const
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
constexpr HGCSiliconDetId geometryCell() const
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
bool isHFNose() const
#define M_PI
std::pair< double, double > rangeR(double z, bool reco) const
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
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
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.
double b
Definition: hdecay.h:120
unsigned int getTrFormN() const
constexpr int32_t layer() const
get the layer #
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
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
constexpr void setType(int type)
int getLayer(double z, bool reco) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
constexpr int layer() const
get the layer #
double a
Definition: hdecay.h:121
static constexpr uint32_t k_dZ
Definition: FlatTrd.h:26
virtual void fillNamedParams(DDFilteredView fv)
DetId::Detector m_det
constexpr void setSiPM(int sipm)
constexpr int ring() const
get the eta index
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
std::string cellElement() const
std::pair< float, float > localToGlobal8(int zside, int lay, int waferU, int waferV, double localX, double localY, bool reco, bool debug) 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