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 
27  : m_topology(topology_),
28  m_validGeomIds(topology_.totalGeomModules()),
29  mode_(topology_.geomMode()),
30  m_det(topology_.detector()),
31  m_subdet(topology_.subDetector()),
32  twoBysqrt3_(2.0 / std::sqrt(3.0)) {
33  if (m_det == DetId::HGCalHSc) {
34  m_cellVec2 = CellVec2(topology_.totalGeomModules());
35  } else {
36  m_cellVec = CellVec(topology_.totalGeomModules());
37  }
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HGCalGeom") << "Expected total # of Geometry Modules " << m_topology.totalGeomModules();
41 #endif
42 }
43 
45 
47 
49 
50 void HGCalGeometry::localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref) {
51  if (m_det == DetId::HGCalHSc) {
52  FlatTrd::localCorners(lc, pv, ref);
53  } else {
54  FlatHexagon::localCorners(lc, pv, ref);
55  }
56 }
57 
59  const GlobalPoint& f1, const GlobalPoint& f2, const GlobalPoint& f3, const CCGFloat* parm, const DetId& detId) {
60  DetId geomId = getGeometryDetId(detId);
61  int cells(0);
65 #ifdef EDM_ML_DEBUG
66  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCalDetId(detId) << " GEOM " << HGCalDetId(geomId);
67 #endif
68  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
69  cells = 1;
70 #ifdef EDM_ML_DEBUG
71  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCScintillatorDetId(detId) << " GEOM "
72  << HGCScintillatorDetId(geomId);
73 #endif
74  } else {
75  cells = m_topology.dddConstants().numberCellsHexagon(id.iLay, id.iSec1, id.iSec2, false);
76 #ifdef EDM_ML_DEBUG
77  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCSiliconDetId(detId) << " GEOM " << HGCSiliconDetId(geomId);
78 #endif
79  }
80  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
81 
82  if (m_det == DetId::HGCalHSc) {
83  m_cellVec2.at(cellIndex) = FlatTrd(cornersMgr(), f1, f2, f3, parm);
84  } else {
85  m_cellVec.at(cellIndex) = FlatHexagon(cornersMgr(), f1, f2, f3, parm);
86  }
87  m_validGeomIds.at(cellIndex) = geomId;
88 
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HGCalGeom") << "Store for DetId " << std::hex << detId.rawId() << " GeomId " << geomId.rawId()
91  << std::dec << " Index " << cellIndex << " cells " << cells;
92  unsigned int nOld = m_validIds.size();
93 #endif
95  for (int cell = 0; cell < cells; ++cell) {
96  id.iCell1 = cell;
97  DetId idc = m_topology.encode(id);
98  if (m_topology.valid(idc)) {
99  m_validIds.emplace_back(idc);
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << cell << "] " << HGCalDetId(idc);
102 #endif
103  }
104  }
105  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
106  DetId idc = m_topology.encode(id);
107  if (m_topology.valid(idc)) {
108  m_validIds.emplace_back(idc);
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("HGCalGeom") << "Valid Id [0] " << HGCScintillatorDetId(idc);
111 #endif
112  } else {
113  edm::LogWarning("HGCalGeom") << "Check " << HGCScintillatorDetId(idc) << " from " << HGCScintillatorDetId(detId)
114  << " ERROR ???";
115  }
116  } else {
117 #ifdef EDM_ML_DEBUG
118  unsigned int cellAll(0), cellSelect(0);
119 #endif
120  for (int u = 0; u < 2 * cells; ++u) {
121  for (int v = 0; v < 2 * cells; ++v) {
122  if (((v - u) < cells) && (u - v) <= cells) {
123  id.iCell1 = u;
124  id.iCell2 = v;
125  DetId idc = m_topology.encode(id);
126 #ifdef EDM_ML_DEBUG
127  ++cellAll;
128 #endif
129  if (m_topology.dddConstants().cellInLayer(id.iSec1, id.iSec2, u, v, id.iLay, true)) {
130  m_validIds.emplace_back(idc);
131 #ifdef EDM_ML_DEBUG
132  ++cellSelect;
133  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << u << ", " << v << "] " << HGCSiliconDetId(idc);
134 #endif
135  }
136  }
137  }
138  }
139 #ifdef EDM_ML_DEBUG
140  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry keeps " << cellSelect << " out of " << cellAll << " for wafer "
141  << id.iSec1 << ":" << id.iSec2 << " in "
142  << " layer " << id.iLay;
143 #endif
144  }
145 #ifdef EDM_ML_DEBUG
146  if (m_det == DetId::HGCalHSc) {
147  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex << "]"
148  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
149  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec2[cellIndex].etaPos() << ":"
150  << m_cellVec2[cellIndex].phiPos();
151  } else {
152  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex << "]"
153  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
154  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec[cellIndex].etaPos() << ":"
155  << m_cellVec[cellIndex].phiPos();
156  }
157  unsigned int nNew = m_validIds.size();
159  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCalDetId(detId) << " with valid DetId from " << nOld << " to " << nNew;
160  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
161  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCScintillatorDetId(detId) << " with valid DetId from " << nOld
162  << " to " << nNew;
163  } else if (m_topology.isHFNose()) {
164  edm::LogVerbatim("HGCalGeom") << "ID: " << HFNoseDetId(detId) << " with valid DetId from " << nOld << " to "
165  << nNew;
166  } else {
167  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCSiliconDetId(detId) << " with valid DetId from " << nOld << " to "
168  << nNew;
169  }
170  edm::LogVerbatim("HGCalGeom") << "Cell[" << cellIndex << "] " << std::hex << geomId.rawId() << ":"
171  << m_validGeomIds[cellIndex].rawId() << std::dec;
172 #endif
173 }
174 
175 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::getGeometry(const DetId& detId) const {
176  if (detId == DetId())
177  return nullptr; // nothing to get
178  DetId geomId = getGeometryDetId(detId);
179  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
180  const GlobalPoint pos = (detId != geomId) ? getPosition(detId) : GlobalPoint();
181  return cellGeomPtr(cellIndex, pos);
182 }
183 
184 bool HGCalGeometry::present(const DetId& detId) const {
185  if (detId == DetId())
186  return false;
187  DetId geomId = getGeometryDetId(detId);
188  const uint32_t index(m_topology.detId2denseGeomId(geomId));
189  return (nullptr != getGeometryRawPtr(index));
190 }
191 
193  unsigned int cellIndex = indexFor(detid);
194  GlobalPoint glob;
195  unsigned int maxSize = ((mode_ == HGCalGeometryMode::Trapezoid) ? m_cellVec2.size() : m_cellVec.size());
196  if (cellIndex < maxSize) {
198  std::pair<float, float> xy;
200  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
201  const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0);
202  glob = m_cellVec[cellIndex].getPosition(lcoord);
203 #ifdef EDM_ML_DEBUG
204  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex << " Local " << lcoord.x() << ":"
205  << lcoord.y() << " ID " << id.iCell1 << ":" << id.iSec1 << " Global " << glob;
206 #endif
207  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
208  const HepGeom::Point3D<float> lcoord(0, 0, 0);
209  glob = m_cellVec2[cellIndex].getPosition(lcoord);
210 #ifdef EDM_ML_DEBUG
211  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: index " << cellIndex << " Local " << lcoord.x() << ":"
212  << lcoord.y() << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iCell1
213  << " Global " << glob;
214 #endif
215  } else {
216  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false, true);
217  const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0);
218  glob = m_cellVec[cellIndex].getPosition(lcoord);
219 #ifdef EDM_ML_DEBUG
220  edm::LogVerbatim("HGCalGeom") << "getPositionWafer:: index " << cellIndex << " Local " << lcoord.x() << ":"
221  << lcoord.y() << " ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
222  << id.iCell1 << ":" << id.iCell2 << " Global " << glob;
223 #endif
224  }
225  }
226  return glob;
227 }
228 
230  unsigned int cellIndex = indexFor(detid);
231  GlobalPoint glob;
232  unsigned int maxSize = ((mode_ == HGCalGeometryMode::Trapezoid) ? m_cellVec2.size() : m_cellVec.size());
233  if (cellIndex < maxSize) {
234  const HepGeom::Point3D<float> lcoord(0, 0, 0);
236  glob = m_cellVec2[cellIndex].getPosition(lcoord);
237  } else {
238  glob = m_cellVec[cellIndex].getPosition(lcoord);
239  }
240 #ifdef EDM_ML_DEBUG
241  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: ID " << std::hex << detid.rawId() << std::dec << " index "
242  << cellIndex << " Global " << glob;
243 #endif
244  }
245  return glob;
246 }
247 
248 double HGCalGeometry::getArea(const DetId& detid) const {
249  HGCalGeometry::CornersVec corners = getNewCorners(detid);
250  double area(0);
251  if (corners.size() > 1) {
252  int n = corners.size() - 1;
253  int j = n - 1;
254  for (int i = 0; i < n; ++i) {
255  area += ((corners[j].x() + corners[i].x()) * (corners[i].y() - corners[j].y()));
256  j = i;
257  }
258  }
259  return (0.5 * area);
260 }
261 
263  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ : FlatHexagon::ncorner_);
264  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
265  unsigned int cellIndex = indexFor(detid);
267  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
268  GlobalPoint v = getPosition(detid);
269  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(id.iType, id.iSec1);
270  float dr = k_half * (rr.second - rr.first);
271  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
272  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
273  float r = v.perp();
274  float fi = v.phi();
275  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
276  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
277  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
278  for (unsigned int i = 0; i < ncorner; ++i) {
279  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
280  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
281  (v.z() + signz[i] * dz));
282  }
283  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
284  std::pair<float, float> xy;
286  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
287  float dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
288  float dy = k_half * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
289  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
290  static const int signx[] = {0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1};
291  static const int signy[] = {-2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1};
292  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
293  for (unsigned int i = 0; i < ncorner; ++i) {
294  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, signz[i] * dz);
295  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
296  }
297  } else {
298  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false);
299  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
300  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
301  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
302  static const int signx[] = {1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2};
303  static const int signy[] = {1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0};
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  }
310  }
311  return co;
312 }
313 
315  unsigned int ncorner = FlatTrd::ncorner_;
316  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
317  unsigned int cellIndex = indexFor(detid);
319  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
320  GlobalPoint v = getPosition(detid);
321  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(id.iType, id.iSec1);
322  float dr = k_half * (rr.second - rr.first);
323  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
324  float dz = id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
325  float r = v.perp();
326  float fi = v.phi();
327  static const int signr[] = {1, 1, -1, -1, 1, 1, -1, -1};
328  static const int signf[] = {-1, 1, 1, -1, -1, 1, 1, -1};
329  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
330  for (unsigned int i = 0; i < ncorner; ++i) {
331  co[i] = GlobalPoint((r + signr[i] * dr) * cos(fi + signf[i] * dfi),
332  (r + signr[i] * dr) * sin(fi + signf[i] * dfi),
333  (v.z() + signz[i] * dz));
334  }
335  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
336  std::pair<float, float> xy;
337  float dx(0);
339  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
340  dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
341  } else {
342  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false);
343  dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
344  }
345  static const int signx[] = {-1, -1, 1, 1, -1, -1, 1, 1};
346  static const int signy[] = {-1, 1, 1, -1, -1, 1, 1, -1};
347  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
348  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
349  for (unsigned int i = 0; i < ncorner; ++i) {
350  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dx, signz[i] * dz);
351  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
352  }
353  }
354  return co;
355 }
356 
358  unsigned int ncorner = (m_det == DetId::HGCalHSc) ? 5 : 7;
359  HGCalGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
360  unsigned int cellIndex = indexFor(detid);
362  if (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc) {
363  GlobalPoint v = getPosition(detid);
364  std::pair<double, double> rr = m_topology.dddConstants().cellSizeTrap(id.iType, id.iSec1);
365  float dr = k_half * (rr.second - rr.first);
366  float dfi = m_cellVec2[cellIndex].param()[FlatTrd::k_Cell];
367  float dz = -id.zSide * m_cellVec2[cellIndex].param()[FlatTrd::k_dZ];
368  float r = v.perp();
369  float fi = v.phi();
370  static const int signr[] = {1, 1, -1, -1};
371  static const int signf[] = {-1, 1, 1, -1};
372  for (unsigned int i = 0; i < ncorner - 1; ++i) {
373  co[i] = GlobalPoint(
374  (r + signr[i] * dr) * cos(fi + signf[i] * dfi), (r + signr[i] * dr) * sin(fi + signf[i] * dfi), (v.z() + dz));
375  }
376  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
377  } else if (cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) {
378  std::pair<float, float> xy;
380  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
381  } else {
382  xy = m_topology.dddConstants().locateCell(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, true, false);
383  }
384  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
385  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
386  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
387  static const int signx[] = {1, -1, -2, -1, 1, 2};
388  static const int signy[] = {1, 1, 0, -1, -1, 0};
389  for (unsigned int i = 0; i < ncorner - 1; ++i) {
390  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, dz);
391  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
392  }
393  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
394  }
395  return co;
396 }
397 
398 DetId HGCalGeometry::neighborZ(const DetId& idin, const GlobalVector& momentum) const {
399  DetId idnew;
401  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
402 #ifdef EDM_ML_DEBUG
403  edm::LogVerbatim("HGCalGeom") << "neighborz1:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
404  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
405  << m_topology.dddConstants().firstLayer() << ":"
406  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
407 #endif
408  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
409  (momentum.z() != 0.0)) {
410  GlobalPoint v = getPosition(idin);
411  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
412  double grad = (z - v.z()) / momentum.z();
413  GlobalPoint p(v.x() + grad * momentum.x(), v.y() + grad * momentum.y(), z);
414  double r = p.perp();
415  auto rlimit = topology().dddConstants().rangeR(z, true);
416  if (r >= rlimit.first && r <= rlimit.second)
417  idnew = getClosestCell(p);
418 #ifdef EDM_ML_DEBUG
419  edm::LogVerbatim("HGCalGeom") << "neighborz1:: Position " << v << " New Z " << z << ":" << grad << " new position "
420  << p << " r-limit " << rlimit.first << ":" << rlimit.second;
421 #endif
422  }
423  return idnew;
424 }
425 
427  const MagneticField* bField,
428  int charge,
429  const GlobalVector& momentum) const {
430  DetId idnew;
432  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
433 #ifdef EDM_ML_DEBUG
434  edm::LogVerbatim("HGCalGeom") << "neighborz2:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
435  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
436  << m_topology.dddConstants().firstLayer() << ":"
437  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
438 #endif
439  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
440  (momentum.z() != 0.0)) {
441  GlobalPoint v = getPosition(idin);
442  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
443  FreeTrajectoryState fts(v, momentum, charge, bField);
446  TrajectoryStateOnSurface tsos = myAP.propagate(fts, *nPlane);
447  GlobalPoint p;
448  auto rlimit = topology().dddConstants().rangeR(z, true);
449  if (tsos.isValid()) {
450  p = tsos.globalPosition();
451  double r = p.perp();
452  if (r >= rlimit.first && r <= rlimit.second)
453  idnew = getClosestCell(p);
454  }
455 #ifdef EDM_ML_DEBUG
456  edm::LogVerbatim("HGCalGeom") << "neighborz2:: Position " << v << " New Z " << z << ":" << charge << ":"
457  << tsos.isValid() << " new position " << p << " r limits " << rlimit.first << ":"
458  << rlimit.second;
459 #endif
460  }
461  return idnew;
462 }
463 
465  unsigned int cellIndex = getClosestCellIndex(r);
466  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
467  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
469  HepGeom::Point3D<float> local;
470  if (r.z() > 0) {
471  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
472  id.zSide = 1;
473  } else {
474  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
475  id.zSide = -1;
476  }
478  const auto& kxy = m_topology.dddConstants().assignCell(local.x(), local.y(), id.iLay, id.iType, true);
479  id.iCell1 = kxy.second;
480  id.iSec1 = kxy.first;
481  id.iType = m_topology.dddConstants().waferTypeT(kxy.first);
482  if (id.iType != 1)
483  id.iType = -1;
484  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
485  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
486  const auto& kxy = m_topology.dddConstants().assignCellTrap(r.x(), r.y(), r.z(), id.iLay, true);
487  id.iSec1 = kxy[0];
488  id.iCell1 = kxy[1];
489  id.iType = kxy[2];
490  } else {
491  id.iLay = m_topology.dddConstants().getLayer(r.z(), true);
492  const auto& kxy = m_topology.dddConstants().assignCellHex(local.x(), local.y(), id.iLay, true);
493  id.iSec1 = kxy[0];
494  id.iSec2 = kxy[1];
495  id.iType = kxy[2];
496  id.iCell1 = kxy[3];
497  id.iCell2 = kxy[4];
498  }
499 #ifdef EDM_ML_DEBUG
500  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.zSide << ":" << id.iLay << ":"
501  << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":" << id.iCell1 << ":"
502  << id.iCell2;
503 #endif
504 
505  //check if returned cell is valid
506  if (id.iCell1 >= 0)
507  return m_topology.encode(id);
508  }
509 
510  //if not valid or out of bounds return a null DetId
511  return DetId();
512 }
513 
516  return dss;
517 }
518 
520  if (m_subdet == HGCEE || m_det == DetId::HGCalEE)
521  return "HGCalEE";
522  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi)
523  return "HGCalHEFront";
524  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc)
525  return "HGCalHEBack";
526  else
527  return "Unknown";
528 }
529 
530 unsigned int HGCalGeometry::indexFor(const DetId& detId) const {
531  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() : m_cellVec.size());
532  if (detId != DetId()) {
533  DetId geomId = getGeometryDetId(detId);
534  cellIndex = m_topology.detId2denseGeomId(geomId);
535 #ifdef EDM_ML_DEBUG
536  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId() << ":" << geomId.rawId() << std::dec
537  << " index " << cellIndex;
538 #endif
539  }
540  return cellIndex;
541 }
542 
544 
546  // Modify the RawPtr class
547  if (m_det == DetId::HGCalHSc) {
548  if (m_cellVec2.size() < index)
549  return nullptr;
550  const CaloCellGeometry* cell(&m_cellVec2[index]);
551  return (nullptr == cell->param() ? nullptr : cell);
552  } else {
553  if (m_cellVec2.size() < index)
554  return nullptr;
555  const CaloCellGeometry* cell(&m_cellVec[index]);
556  return (nullptr == cell->param() ? nullptr : cell);
557  }
558 }
559 
560 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index) const {
561  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
562  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
563  return nullptr;
564  static const auto do_not_delete = [](const void*) {};
565  if (m_det == DetId::HGCalHSc) {
566  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index], do_not_delete);
567  if (nullptr == cell->param())
568  return nullptr;
569  return cell;
570  } else {
571  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index], do_not_delete);
572  if (nullptr == cell->param())
573  return nullptr;
574  return cell;
575  }
576 }
577 
578 std::shared_ptr<const CaloCellGeometry> HGCalGeometry::cellGeomPtr(uint32_t index, const GlobalPoint& pos) const {
579  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
580  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) || (m_validGeomIds[index].rawId() == 0))
581  return nullptr;
582  if (pos == GlobalPoint())
583  return cellGeomPtr(index);
584  if (m_det == DetId::HGCalHSc) {
585  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
586  cell->setPosition(pos);
587 #ifdef EDM_ML_DEBUG
588  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
589 #endif
590  if (nullptr == cell->param())
591  return nullptr;
592  return cell;
593  } else {
594  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
595  cell->setPosition(pos);
596 #ifdef EDM_ML_DEBUG
597  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
598 #endif
599  if (nullptr == cell->param())
600  return nullptr;
601  return cell;
602  }
603 }
604 
606  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
607 }
608 
611 }
612 
613 template <class T>
614 unsigned int HGCalGeometry::getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const {
615  float phip = r.phi();
616  float zp = r.z();
617  float dzmin(9999), dphimin(9999), dphi10(0.175);
618  unsigned int cellIndex = vec.size();
619  for (unsigned int k = 0; k < vec.size(); ++k) {
620  float dphi = phip - vec[k].phiPos();
621  while (dphi > M_PI)
622  dphi -= 2 * M_PI;
623  while (dphi <= -M_PI)
624  dphi += 2 * M_PI;
625  if (std::abs(dphi) < dphi10) {
626  float dz = std::abs(zp - vec[k].getPosition().z());
627  if (dz < (dzmin + 0.001)) {
628  dzmin = dz;
629  if (std::abs(dphi) < (dphimin + 0.01)) {
630  cellIndex = k;
631  dphimin = std::abs(dphi);
632  } else {
633  if (cellIndex >= vec.size())
634  cellIndex = k;
635  }
636  }
637  }
638  }
639 #ifdef EDM_ML_DEBUG
640  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":" << phip << " Index " << cellIndex;
641  if (cellIndex < vec.size())
642  edm::LogVerbatim("HGCalGeom") << " Cell z " << vec[cellIndex].getPosition().z() << ":" << dzmin << " phi "
643  << vec[cellIndex].phiPos() << ":" << dphimin;
644 #endif
645  return cellIndex;
646 }
647 
648 // FIXME: Change sorting algorithm if needed
649 namespace {
650  struct rawIdSort {
651  bool operator()(const DetId& a, const DetId& b) { return (a.rawId() < b.rawId()); }
652  };
653 } // namespace
654 
656  m_validIds.shrink_to_fit();
657  std::sort(m_validIds.begin(), m_validIds.end(), rawIdSort());
658 }
659 
663  CaloSubdetectorGeometry::IVec& dinsVector) const {
664  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
665  unsigned int numberOfShapes = k_NumberOfShapes;
666  unsigned int numberOfParametersPerShape = ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd)
667  : (unsigned int)(k_NumberOfParametersPerHex));
668 
669  trVector.reserve(numberOfCells * numberOfTransformParms());
670  iVector.reserve(numberOfCells);
671  dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
672  dinsVector.reserve(numberOfCells);
673 
674  for (unsigned itr = 0; itr < m_topology.dddConstants().getTrFormN(); ++itr) {
676  int layer = mytr.lay;
677 
679  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
680  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
681  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
683  params[FlatHexagon::k_dZ] = vol.dz;
686  dimVector.insert(dimVector.end(), params.begin(), params.end());
687  }
688  }
689  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
690  int indx = m_topology.dddConstants().layerIndex(layer, true);
691  for (int md = m_topology.dddConstants().getParameter()->firstModule_[indx];
693  ++md) {
696  params[FlatTrd::k_dZ] = vol.dz;
703  dimVector.insert(dimVector.end(), params.begin(), params.end());
704  }
705  } else {
706  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
707  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
708  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
710  params[FlatHexagon::k_dZ] = vol.dz;
713  dimVector.insert(dimVector.end(), params.begin(), params.end());
714  }
715  }
716  }
717  }
718 
719  for (unsigned int i(0); i < numberOfCells; ++i) {
720  DetId detId = m_validGeomIds[i];
721  int layer(0);
723  layer = HGCalDetId(detId).layer();
724  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
725  layer = HGCScintillatorDetId(detId).layer();
726  } else if (m_topology.isHFNose()) {
727  layer = HFNoseDetId(detId).layer();
728  } else {
729  layer = HGCSiliconDetId(detId).layer();
730  }
731  dinsVector.emplace_back(m_topology.detId2denseGeomId(detId));
732  iVector.emplace_back(layer);
733 
734  Tr3D tr;
735  auto ptr = cellGeomPtr(i);
736  if (nullptr != ptr) {
737  ptr->getTransform(tr, (Pt3DVec*)nullptr);
738 
739  if (Tr3D() == tr) { // there is no rotation
740  const GlobalPoint& gp(ptr->getPosition());
741  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
742  }
743 
744  const CLHEP::Hep3Vector tt(tr.getTranslation());
745  trVector.emplace_back(tt.x());
746  trVector.emplace_back(tt.y());
747  trVector.emplace_back(tt.z());
748  if (6 == numberOfTransformParms()) {
749  const CLHEP::HepRotation rr(tr.getRotation());
750  const ROOT::Math::Transform3D rtr(
751  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
753  rtr.GetRotation(ea);
754  trVector.emplace_back(ea.Phi());
755  trVector.emplace_back(ea.Theta());
756  trVector.emplace_back(ea.Psi());
757  }
758  }
759  }
760 }
761 
763  DetId geomId;
765  geomId = static_cast<DetId>(HGCalDetId(detId).geometryCell());
766  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
767  geomId = static_cast<DetId>(HGCScintillatorDetId(detId).geometryCell());
768  } else if (m_topology.isHFNose()) {
769  geomId = static_cast<DetId>(HFNoseDetId(detId).geometryCell());
770  } else {
771  geomId = static_cast<DetId>(HGCSiliconDetId(detId).geometryCell());
772  }
773  return geomId;
774 }
775 
777 
CaloCellGeometry::Tr3D
HepGeom::Transform3D Tr3D
Definition: CaloCellGeometry.h:53
Vector3DBase
Definition: Vector3DBase.h:8
TkRotation< float >
CaloGenericDetId.h
HGCalGeometry::sortDetIds
void sortDetIds()
Definition: HGCalGeometry.cc:655
HGCalDDDConstants::cellSizeTrap
std::pair< double, double > cellSizeTrap(int type, int irad) const
Definition: HGCalDDDConstants.h:36
HGCalParameters::hgtrap::bl
float bl
Definition: HGCalParameters.h:43
DDAxes::y
TrajectoryStateOnSurface.h
HGCalGeometry::localCorners
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: HGCalGeometry.cc:50
CaloSubdetectorGeometry::numberOfParametersPerShape
virtual unsigned int numberOfParametersPerShape() const
Definition: CaloSubdetectorGeometry.h:93
HGCalGeometry::m_det
DetId::Detector m_det
Definition: HGCalGeometry.h:143
mps_fire.i
i
Definition: mps_fire.py:355
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
HGCalGeometry::addValidID
void addValidID(const DetId &id)
Definition: HGCalGeometry.cc:605
HGCalGeometry::m_cellVec
CellVec m_cellVec
Definition: HGCalGeometry.h:139
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HGCalDDDConstants::waferTypeT
int waferTypeT(int wafer) const
Definition: HGCalDDDConstants.h:169
FlatTrd::localCorners
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatTrd.cc:153
HGCalGeometry::~HGCalGeometry
~HGCalGeometry() override
Definition: HGCalGeometry.cc:44
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
HGCalDDDConstants::firstLayer
int firstLayer() const
Definition: HGCalDDDConstants.h:51
HGCalGeometry::CellVec2
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:33
HGCalGeometry::cellGeomPtr
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Definition: HGCalGeometry.cc:560
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
CaloSubdetectorGeometry::DimVec
std::vector< CCGFloat > DimVec
Definition: CaloSubdetectorGeometry.h:35
FlatTrd
A base class to handle the particular shape of HGCal volumes.
Definition: FlatTrd.h:19
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
HGCalGeometry::present
bool present(const DetId &id) const override
is this detid present in the geometry?
Definition: HGCalGeometry.cc:184
FlatTrd::k_Cell
static constexpr uint32_t k_Cell
Definition: FlatTrd.h:45
HGCalParameters::hgtrap::cellSize
float cellSize
Definition: HGCalParameters.h:43
HFNoseDetId::layer
int layer() const
get the layer #
Definition: HFNoseDetId.h:56
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCalGeometry::k_half
static constexpr double k_half
Definition: HGCalGeometry.h:134
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
FlatHexagon::localCorners
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatHexagon.cc:154
pos
Definition: PixelAliasList.h:18
HGCalDDDConstants::waferZ
double waferZ(int layer, bool reco) const
Definition: HGCalDDDConstants.cc:1367
FlatTrd::k_Phi
static constexpr uint32_t k_Phi
Definition: FlatTrd.h:29
HGCalGeometry::getArea
double getArea(const DetId &detid) const
Returns area of a cell.
Definition: HGCalGeometry.cc:248
CaloSubdetectorGeometry::TrVec
std::vector< CCGFloat > TrVec
Definition: CaloSubdetectorGeometry.h:33
typelookup.h
HGCalTopology::decode
DecodedDetId decode(const DetId &id) const
Definition: HGCalTopology.cc:589
HGCalParameters::hgtrap::alpha
float alpha
Definition: HGCalParameters.h:43
HGCalGeometry::m_cellVec2
CellVec2 m_cellVec2
Definition: HGCalGeometry.h:140
CaloSubdetectorGeometry::numberOfTransformParms
virtual unsigned int numberOfTransformParms() const
Definition: CaloSubdetectorGeometry.h:94
HGCalGeometry::k_NumberOfShapes
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:47
HGCalGeometry::getWaferPosition
GlobalPoint getWaferPosition(const DetId &id) const
Definition: HGCalGeometry.cc:229
HGCalTopology::DecodedDetId
Definition: HGCalTopology.h:108
HGCalGeometry::getCells
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
Definition: HGCalGeometry.cc:514
HGCalGeometry::getSummary
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
Definition: HGCalGeometry.cc:660
ReferenceCountingPointer< Plane >
HGCalParameters::hgtrap::dz
float dz
Definition: HGCalParameters.h:43
HGCalDDDConstants::assignCellHex
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:160
HGCalGeometry::Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:35
HGCalGeometry::m_subdet
ForwardSubdetector m_subdet
Definition: HGCalGeometry.h:144
HGCalTopology::totalGeomModules
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:93
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HGCalGeometry::k_NumberOfParametersPerTrd
static constexpr unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:44
CaloSubdetectorGeometry::IVec
std::vector< unsigned int > IVec
Definition: CaloSubdetectorGeometry.h:34
cms::cuda::co
T *__restrict__ co
Definition: prefixScan.h:46
HFNoseDetId
Definition: HFNoseDetId.h:22
FlatTrd::k_Theta
static constexpr uint32_t k_Theta
Definition: FlatTrd.h:27
HGCalDetId::layer
int layer() const
get the layer #
Definition: HGCalDetId.h:46
HGCalDDDConstants::lastLayer
int lastLayer(bool reco) const
Definition: HGCalDDDConstants.cc:556
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
FlatHexagon::k_r
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
ParmVec
std::vector< float > ParmVec
Definition: FastTimeGeometry.cc:13
HGCalGeometry::neighborZ
DetId neighborZ(const DetId &idin, const GlobalVector &p) const
Definition: HGCalGeometry.cc:398
CaloSubdetectorGeometry::numberOfShapes
virtual unsigned int numberOfShapes() const
Definition: CaloSubdetectorGeometry.h:92
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
HGCScintillatorDetId::layer
int layer() const
get the layer #
Definition: HGCScintillatorDetId.h:47
DetId
Definition: DetId.h:17
Plane.h
FlatTrd::k_dX1
static constexpr uint32_t k_dX1
Definition: FlatTrd.h:32
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
CaloSubdetectorGeometry::CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloSubdetectorGeometry.h:25
HGCalGeometry::cellElement
std::string cellElement() const
Definition: HGCalGeometry.cc:519
HGCalGeometryMode::Trapezoid
Definition: HGCalGeometryMode.h:25
HGCalParameters::hgtrap::tl
float tl
Definition: HGCalParameters.h:43
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
FlatTrd::k_Alp1
static constexpr uint32_t k_Alp1
Definition: FlatTrd.h:36
FlatHexagon::ncorner_
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
FlatTrd::k_dY2
static constexpr uint32_t k_dY2
Definition: FlatTrd.h:38
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalDDDConstants::waferInLayer
bool waferInLayer(int wafer, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:1169
CaloSubdetectorGeometry::m_validIds
std::vector< DetId > m_validIds
Definition: CaloSubdetectorGeometry.h:115
DDAxes::z
FlatTrd::k_dX4
static constexpr uint32_t k_dX4
Definition: FlatTrd.h:41
HGCalDDDConstants::layerIndex
int layerIndex(int lay, bool reco) const
Definition: HGCalDDDConstants.cc:560
Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: CaloCellGeometry.cc:7
HGCalGeometry::k_NumberOfParametersPerHex
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:45
FlatHexagon
A base class to handle the hexagonal shape of HGCal silicon volumes.
Definition: FlatHexagon.h:20
HGCalGeometry::getGeometryDetId
DetId getGeometryDetId(DetId detId) const
Definition: HGCalGeometry.cc:762
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
FlatHexagon::k_R
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: HGCalGeometry.cc:21
HGCalGeometry
Definition: HGCalGeometry.h:30
b
double b
Definition: hdecay.h:118
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:112
HGCalDDDConstants::rangeR
std::pair< double, double > rangeR(double z, bool reco) const
Definition: HGCalDDDConstants.cc:934
HGCalDDDConstants::assignCell
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
Definition: HGCalDDDConstants.cc:121
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCEE
Definition: ForwardSubdetector.h:8
edm::LogWarning
Definition: MessageLogger.h:141
HGCalGeometry::mode_
HGCalGeometryMode::GeometryMode mode_
Definition: HGCalGeometry.h:142
Plane::build
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
HGCalDDDConstants::cellInLayer
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:204
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
HGCalParameters::firstModule_
std::vector< int > firstModule_
Definition: HGCalParameters.h:160
HGCalTopology::totalModules
unsigned int totalModules() const
Definition: HGCalTopology.h:92
HGCalGeometry.h
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
FlatTrd::k_dX3
static constexpr uint32_t k_dX3
Definition: FlatTrd.h:39
HGCalGeometry::CellVec
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:32
CaloCellGeometry
Definition: CaloCellGeometry.h:50
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
HGCalGeometry::m_validGeomIds
std::vector< DetId > m_validGeomIds
Definition: HGCalGeometry.h:141
CaloCellGeometry::param
const CCGFloat * param() const
Definition: CaloCellGeometry.h:99
HGCalGeometry::HGCalGeometry
HGCalGeometry(const HGCalTopology &topology)
Definition: HGCalGeometry.cc:26
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
HGCalGeometry::getGeometryRawPtr
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
Definition: HGCalGeometry.cc:545
HGCalGeometry::k_fac1
static constexpr double k_fac1
Definition: HGCalGeometry.h:135
HGCalParameters::hgtrap::h
float h
Definition: HGCalParameters.h:43
ParmVec
std::vector< float > ParmVec
Definition: HGCalGeometry.cc:22
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
edm::LogVerbatim
Definition: MessageLogger.h:297
FlatTrd::k_dX2
static constexpr uint32_t k_dX2
Definition: FlatTrd.h:34
HGCalTopology::detId2denseGeomId
virtual uint32_t detId2denseGeomId(const DetId &id) const
Definition: HGCalTopology.cc:434
PVValHelper::dy
Definition: PVValidationHelpers.h:49
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:192
HGCalGeometry::getClosestCell
DetId getClosestCell(const GlobalPoint &r) const override
Definition: HGCalGeometry.cc:464
HGCalDDDConstants::sectors
int sectors() const
Definition: HGCalDDDConstants.h:108
AnalyticalPropagator.h
HGCalGeometry::twoBysqrt3_
const double twoBysqrt3_
Definition: HGCalGeometry.h:145
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
HGCalParameters::hgtrform::lay
int lay
Definition: HGCalParameters.h:47
HGCalDDDConstants::getTrForm
HGCalParameters::hgtrform getTrForm(unsigned int k) const
Definition: HGCalDDDConstants.h:64
HGCalTopology
Definition: HGCalTopology.h:12
HGCalGeometryMode::Hexagon
Definition: HGCalGeometryMode.h:25
HGCalGeometry::DetIdSet
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:38
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCalDDDConstants::numberCellsHexagon
int numberCellsHexagon(int wafer) const
Definition: HGCalDDDConstants.cc:912
HGCalGeometry::k_fac2
static constexpr double k_fac2
Definition: HGCalGeometry.h:136
HGCalDDDConstants::assignCellTrap
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
Definition: HGCalDDDConstants.cc:171
AnalyticalPropagator
Definition: AnalyticalPropagator.h:22
reco_skim_cfg_mod.maxSize
maxSize
Definition: reco_skim_cfg_mod.py:154
HGCalGeometry::getCorners
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell's volume.
Definition: HGCalGeometry.cc:262
HGCalDetId
Definition: HGCalDetId.h:8
CaloCellGeometry.h
FlatHexagon::k_dZ
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
HGCalGeometryMode::HexagonFull
Definition: HGCalGeometryMode.h:25
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HGCalGeometry::initializeParms
void initializeParms() override
Definition: HGCalGeometry.cc:48
HGCalGeometry::sizeForDenseIndex
unsigned int sizeForDenseIndex() const
Definition: HGCalGeometry.cc:543
CaloSubdetectorGeometry::cornersMgr
CaloCellGeometry::CornersMgr * cornersMgr()
Definition: CaloSubdetectorGeometry.h:82
HGCalDDDConstants::locateCellHex
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
Definition: HGCalDDDConstants.cc:687
HGCalGeometry::Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: HGCalGeometry.h:36
HGCalGeometry::fillNamedParams
virtual void fillNamedParams(DDFilteredView fv)
Definition: HGCalGeometry.cc:46
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
HGCalTopology::encode
DetId encode(const DecodedDetId &id_) const
Definition: HGCalTopology.cc:635
PVValHelper::dz
Definition: PVValidationHelpers.h:50
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:21
DetId::HGCalHSc
Definition: DetId.h:34
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
postprocess-scan-build.cells
cells
Definition: postprocess-scan-build.py:13
HGCalParameters::lastModule_
std::vector< int > lastModule_
Definition: HGCalParameters.h:161
Exception.h
HGCalGeometry::indexFor
unsigned int indexFor(const DetId &id) const override
Definition: HGCalGeometry.cc:530
HGCalDDDConstants::getLayer
int getLayer(double z, bool reco) const
Definition: HGCalDDDConstants.cc:361
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HGCalGeometry::newCell
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
Definition: HGCalGeometry.cc:58
HGCalParameters::hgtrform
Definition: HGCalParameters.h:46
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
FlatTrd::k_Alp2
static constexpr uint32_t k_Alp2
Definition: FlatTrd.h:43
DDFilteredView
Definition: DDFilteredView.h:20
HGCalTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: HGCalTopology.cc:464
HGCHEF
Definition: ForwardSubdetector.h:9
HGCalGeometry::getClosestCellIndex
unsigned int getClosestCellIndex(const GlobalPoint &r) const
Definition: HGCalGeometry.cc:609
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
HGCalDDDConstants::getTrFormN
unsigned int getTrFormN() const
Definition: HGCalDDDConstants.h:65
HGCalDDDConstants::locateCell
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
Definition: HGCalDDDConstants.cc:577
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
FlatTrd::ncorner_
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:97
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
HGCalTopology::isHFNose
bool isHFNose() const
Definition: HGCalTopology.h:120
HGCalParameters::hgtrap
Definition: HGCalParameters.h:41
MagneticField
Definition: MagneticField.h:19
HGCalGeometry::getGeometry
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.
Definition: HGCalGeometry.cc:175
custom_jme_cff.area
area
Definition: custom_jme_cff.py:169
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCalDDDConstants::getParameter
const HGCalParameters * getParameter() const
Definition: HGCalDDDConstants.h:57
PVValHelper::dx
Definition: PVValidationHelpers.h:48
FlatTrd::k_dY1
static constexpr uint32_t k_dY1
Definition: FlatTrd.h:31
alongMomentum
Definition: PropagationDirection.h:4
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
HGCalGeometry::CornersVec
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:39
FlatTrd::k_dZ
static constexpr uint32_t k_dZ
Definition: FlatTrd.h:26
AnalyticalPropagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
HGCalGeometry::getNewCorners
CornersVec getNewCorners(const DetId &id) const
Definition: HGCalGeometry.cc:357
HGCalGeometry::m_topology
const HGCalTopology & m_topology
Definition: HGCalGeometry.h:138
HGCHEB
Definition: ForwardSubdetector.h:10
HGCalGeometry::get8Corners
CornersVec get8Corners(const DetId &id) const
Definition: HGCalGeometry.cc:314
HGCSiliconDetId::layer
int layer() const
get the layer #
Definition: HGCSiliconDetId.h:57
HGCalDDDConstants::getModule
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
Definition: HGCalDDDConstants.cc:381