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, id.zSide, 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.zSide, 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.zSide, 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.zSide, 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.zSide, 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.zSide, 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.zSide, 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 =
441  m_topology.dddConstants().localToGlobal8(id.zSide, id.iLay, id.iSec1, id.iSec2, xloc, yloc, true, debug);
442  double xx = id.zSide * xyglob.first;
443  co[i] = GlobalPoint(xx, xyglob.second, id.zSide * (zz + dz));
444  }
445  }
446  // Used to pass downstream the thickness of this cell
447  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
448  }
449  return co;
450 }
451 
452 DetId HGCalGeometry::neighborZ(const DetId& idin, const GlobalVector& momentum) const {
453  DetId idnew;
455  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
456 #ifdef EDM_ML_DEBUG
457  edm::LogVerbatim("HGCalGeom") << "neighborz1:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
458  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
459  << m_topology.dddConstants().firstLayer() << ":"
460  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
461 #endif
462  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
463  (momentum.z() != 0.0)) {
464  GlobalPoint v = getPosition(idin, false);
465  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
466  double grad = (z - v.z()) / momentum.z();
467  GlobalPoint p(v.x() + grad * momentum.x(), v.y() + grad * momentum.y(), z);
468  double r = p.perp();
469  auto rlimit = topology().dddConstants().rangeR(z, true);
470  if (r >= rlimit.first && r <= rlimit.second)
471  idnew = getClosestCell(p);
472 #ifdef EDM_ML_DEBUG
473  edm::LogVerbatim("HGCalGeom") << "neighborz1:: Position " << v << " New Z " << z << ":" << grad << " new position "
474  << p << " r-limit " << rlimit.first << ":" << rlimit.second;
475 #endif
476  }
477  return idnew;
478 }
479 
481  const MagneticField* bField,
482  int charge,
483  const GlobalVector& momentum) const {
484  DetId idnew;
486  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
487 #ifdef EDM_ML_DEBUG
488  edm::LogVerbatim("HGCalGeom") << "neighborz2:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
489  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
490  << m_topology.dddConstants().firstLayer() << ":"
491  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
492 #endif
493  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
494  (momentum.z() != 0.0)) {
495  GlobalPoint v = getPosition(idin, false);
496  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
497  FreeTrajectoryState fts(v, momentum, charge, bField);
500  TrajectoryStateOnSurface tsos = myAP.propagate(fts, *nPlane);
501  GlobalPoint p;
502  auto rlimit = topology().dddConstants().rangeR(z, true);
503  if (tsos.isValid()) {
504  p = tsos.globalPosition();
505  double r = p.perp();
506  if (r >= rlimit.first && r <= rlimit.second)
507  idnew = getClosestCell(p);
508  }
509 #ifdef EDM_ML_DEBUG
510  edm::LogVerbatim("HGCalGeom") << "neighborz2:: Position " << v << " New Z " << z << ":" << charge << ":"
511  << tsos.isValid() << " new position " << p << " r limits " << rlimit.first << ":"
512  << rlimit.second;
513 #endif
514  }
515  return idnew;
516 }
517 
519  unsigned int cellIndex = getClosestCellIndex(r);
520  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
521  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
523  if (id.det == 0)
524  id.det = static_cast<int>(m_topology.detector());
525  HepGeom::Point3D<float> local;
526  if (r.z() > 0) {
527  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
528  id.zSide = 1;
529  } else {
530  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
531  id.zSide = -1;
532  }
533  if (m_topology.waferHexagon6()) {
534  const auto& kxy = m_topology.dddConstants().assignCell(local.x(), local.y(), id.iLay, id.iType, true);
535  id.iCell1 = kxy.second;
536  id.iSec1 = kxy.first;
537  id.iType = m_topology.dddConstants().waferTypeT(kxy.first);
538  if (id.iType != 1)
539  id.iType = -1;
540  } else if (m_topology.tileTrapezoid()) {
541  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
542  const auto& kxy = m_topology.dddConstants().assignCellTrap(r.x(), r.y(), r.z(), id.iLay, true);
543  id.iSec1 = kxy[0];
544  id.iCell1 = kxy[1];
545  id.iType = kxy[2];
546  } else {
547  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
548  int zside = (r.z() > 0) ? 1 : -1;
549 #ifdef EDM_ML_DEBUG
550  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << ":" << zside << " Layer " << id.iLay << " Global " << r
551  << " Local " << local;
552 #endif
553  const auto& kxy =
554  m_topology.dddConstants().assignCellHex(local.x(), local.y(), zside, id.iLay, true, false, true);
555  id.iSec1 = kxy[0];
556  id.iSec2 = kxy[1];
557  id.iType = kxy[2];
558  id.iCell1 = kxy[3];
559  id.iCell2 = kxy[4];
560  }
561 #ifdef EDM_ML_DEBUG
562  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
563  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
564  << id.iCell1 << ":" << id.iCell2;
565 #endif
566 
567  //check if returned cell is valid
568  if (id.iCell1 >= 0)
569  return m_topology.encode(id);
570  }
571 
572  //if not valid or out of bounds return a null DetId
573  return DetId();
574 }
575 
577  unsigned int cellIndex = getClosestCellIndex(r);
578  if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
580  if (id.det == 0)
581  id.det = static_cast<int>(m_topology.detector());
582  HepGeom::Point3D<float> local;
583  if (r.z() > 0) {
584  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
585  id.zSide = 1;
586  } else {
587  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
588  id.zSide = -1;
589  }
590  if (m_topology.waferHexagon8()) {
591  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
592  int zside = (r.z() > 0) ? 1 : -1;
593 #ifdef EDM_ML_DEBUG
594  edm::LogVerbatim("HGCalGeom") << "ZZ " << r.z() << ":" << zside << " Layer " << id.iLay << " Global " << r
595  << " Local " << local;
596 #endif
597  const auto& kxy =
598  m_topology.dddConstants().assignCellHex(local.x(), local.y(), zside, id.iLay, true, extend, true);
599  id.iSec1 = kxy[0];
600  id.iSec2 = kxy[1];
601  id.iType = kxy[2];
602  id.iCell1 = kxy[3];
603  id.iCell2 = kxy[4];
604  }
605 #ifdef EDM_ML_DEBUG
606  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
607  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
608  << id.iCell1 << ":" << id.iCell2;
609 #endif
610 
611  //check if returned cell is valid
612  if (id.iCell1 >= 0)
613  return m_topology.encode(id);
614  }
615 
616  //if not valid or out of bounds return a null DetId
617  return DetId();
618 }
619 
622  return dss;
623 }
624 
626  if (m_subdet == HGCEE || m_det == DetId::HGCalEE)
627  return "HGCalEE";
628  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi)
629  return "HGCalHEFront";
630  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc)
631  return "HGCalHEBack";
632  else
633  return "Unknown";
634 }
635 
636 unsigned int HGCalGeometry::indexFor(const DetId& detId) const {
637  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() : m_cellVec.size());
638  if (detId != DetId()) {
639  DetId geomId = getGeometryDetId(detId);
640  cellIndex = m_topology.detId2denseGeomId(geomId);
641 #ifdef EDM_ML_DEBUG
642  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId() << ":" << geomId.rawId() << std::dec
643  << " index " << cellIndex;
644 #endif
645  }
646  return cellIndex;
647 }
648 
650 
652  // Modify the RawPtr class
653  if (m_det == DetId::HGCalHSc) {
654  if (m_cellVec2.size() < index)
655  return nullptr;
656  const CaloCellGeometry* cell(&m_cellVec2[index]);
657  return (nullptr == cell->param() ? nullptr : cell);
658  } else {
659  if (m_cellVec.size() < index)
660  return nullptr;
661  const CaloCellGeometry* cell(&m_cellVec[index]);
662  return (nullptr == cell->param() ? nullptr : cell);
663  }
664 }
665 
666 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index) const {
667  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
668  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
669  return nullptr;
670  static const auto do_not_delete = [](const void*) {};
671  if (m_det == DetId::HGCalHSc) {
672  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index], do_not_delete);
673  if (nullptr == cell->param())
674  return nullptr;
675  return cell;
676  } else {
677  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index], do_not_delete);
678  if (nullptr == cell->param())
679  return nullptr;
680  return cell;
681  }
682 }
683 
684 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index, const GlobalPoint& pos) const {
685  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
686  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
687  return nullptr;
688  if (pos == GlobalPoint())
689  return cellGeomPtr(index);
690  if (m_det == DetId::HGCalHSc) {
691  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
692  cell->setPosition(pos);
693 #ifdef EDM_ML_DEBUG
694  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
695 #endif
696  if (nullptr == cell->param())
697  return nullptr;
698  return cell;
699  } else {
700  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
701  cell->setPosition(pos);
702 #ifdef EDM_ML_DEBUG
703  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
704 #endif
705  if (nullptr == cell->param())
706  return nullptr;
707  return cell;
708  }
709 }
710 
712  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
713 }
714 
717 }
718 
719 template <class T>
720 unsigned int HGCalGeometry::getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const {
721  float phip = r.phi();
722  float zp = r.z();
723  float dzmin(9999), dphimin(9999), dphi10(0.175);
724  unsigned int cellIndex = vec.size();
725  for (unsigned int k = 0; k < vec.size(); ++k) {
726  float dphi = phip - vec[k].phiPos();
727  while (dphi > M_PI)
728  dphi -= 2 * M_PI;
729  while (dphi <= -M_PI)
730  dphi += 2 * M_PI;
731  if (std::abs(dphi) < dphi10) {
732  float dz = std::abs(zp - vec[k].getPosition().z());
733  if (dz < (dzmin + 0.001)) {
734  dzmin = dz;
735  if (std::abs(dphi) < (dphimin + 0.01)) {
736  cellIndex = k;
737  dphimin = std::abs(dphi);
738  } else {
739  if (cellIndex >= vec.size())
740  cellIndex = k;
741  }
742  }
743  }
744  }
745 #ifdef EDM_ML_DEBUG
746  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":" << phip << " Index " << cellIndex;
747  if (cellIndex < vec.size())
748  edm::LogVerbatim("HGCalGeom") << " Cell z " << vec[cellIndex].getPosition().z() << ":" << dzmin << " phi "
749  << vec[cellIndex].phiPos() << ":" << dphimin;
750 #endif
751  return cellIndex;
752 }
753 
754 // FIXME: Change sorting algorithm if needed
755 namespace {
756  struct rawIdSort {
757  bool operator()(const DetId& a, const DetId& b) { return (a.rawId() < b.rawId()); }
758  };
759 } // namespace
760 
762  m_validIds.shrink_to_fit();
763  std::sort(m_validIds.begin(), m_validIds.end(), rawIdSort());
764 }
765 
769  CaloSubdetectorGeometry::IVec& dinsVector) const {
770  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
771  unsigned int numberOfShapes = k_NumberOfShapes;
772  unsigned int numberOfParametersPerShape = ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd)
773  : (unsigned int)(k_NumberOfParametersPerHex));
774 
775  trVector.reserve(numberOfCells * numberOfTransformParms());
776  iVector.reserve(numberOfCells);
777  dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
778  dinsVector.reserve(numberOfCells);
779 
780  for (unsigned itr = 0; itr < m_topology.dddConstants().getTrFormN(); ++itr) {
782  int layer = mytr.lay;
783 
784  if (m_topology.waferHexagon6()) {
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);
789  params[FlatHexagon::k_dZ] = vol.dz;
792  dimVector.insert(dimVector.end(), params.begin(), params.end());
793  }
794  }
795  } else if (m_topology.tileTrapezoid()) {
796  int indx = m_topology.dddConstants().layerIndex(layer, true);
797  for (int md = m_topology.dddConstants().getParameter()->firstModule_[indx];
799  ++md) {
802  params[FlatTrd::k_dZ] = vol.dz;
809  dimVector.insert(dimVector.end(), params.begin(), params.end());
810  }
811  } else {
812  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
813  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
814  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
816  params[FlatHexagon::k_dZ] = vol.dz;
819  dimVector.insert(dimVector.end(), params.begin(), params.end());
820  }
821  }
822  }
823  }
824 
825  for (unsigned int i(0); i < numberOfCells; ++i) {
827  int layer(0);
828  if (m_topology.waferHexagon6()) {
830  } else if (m_topology.tileTrapezoid()) {
832  } else if (m_topology.isHFNose()) {
834  } else {
836  }
837  dinsVector.emplace_back(m_topology.detId2denseGeomId(detId));
838  iVector.emplace_back(layer);
839 
840  Tr3D tr;
841  auto ptr = cellGeomPtr(i);
842  if (nullptr != ptr) {
843  ptr->getTransform(tr, (Pt3DVec*)nullptr);
844 
845  if (Tr3D() == tr) { // there is no rotation
846  const GlobalPoint& gp(ptr->getPosition());
847  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
848  }
849 
850  const CLHEP::Hep3Vector tt(tr.getTranslation());
851  trVector.emplace_back(tt.x());
852  trVector.emplace_back(tt.y());
853  trVector.emplace_back(tt.z());
854  if (6 == numberOfTransformParms()) {
855  const CLHEP::HepRotation rr(tr.getRotation());
856  const ROOT::Math::Transform3D rtr(
857  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
859  rtr.GetRotation(ea);
860  trVector.emplace_back(ea.Phi());
861  trVector.emplace_back(ea.Theta());
862  trVector.emplace_back(ea.Psi());
863  }
864  }
865  }
866 }
867 
869  DetId geomId;
870  if (m_topology.waferHexagon6()) {
871  geomId = static_cast<DetId>(HGCalDetId(detId).geometryCell());
872  } else if (m_topology.tileTrapezoid()) {
873  geomId = static_cast<DetId>(HGCScintillatorDetId(detId).geometryCell());
874  } else if (m_topology.isHFNose()) {
875  geomId = static_cast<DetId>(HFNoseDetId(detId).geometryCell());
876  } else {
877  geomId = static_cast<DetId>(HGCSiliconDetId(detId).geometryCell());
878  }
879  return geomId;
880 }
881 
883 
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
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_
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
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
int layer() const
get the layer #
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
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
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.
HGCScintillatorDetId geometryCell() const
double b
Definition: hdecay.h:120
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
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:121
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
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