CMS 3D CMS Logo

HGCalTBTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_CaloTopology_HGCalTBTopology_h
2 #define Geometry_CaloTopology_HGCalTBTopology_h 1
3 
9 #include <vector>
10 #include <iostream>
11 
13 public:
15  HGCalTBTopology(const HGCalTBDDDConstants* hdcons, int subdet);
16 
18  ~HGCalTBTopology() override;
19 
21  DetId goNorth(const DetId& id) const override { return changeXY(id, 0, +1); }
22  std::vector<DetId> north(const DetId& id) const override {
23  DetId nextId = goNorth(id);
24  std::vector<DetId> vNeighborsDetId;
25  if (!(nextId == DetId(0)))
26  vNeighborsDetId.emplace_back(nextId);
27  return vNeighborsDetId;
28  }
29 
31  DetId goSouth(const DetId& id) const override { return changeXY(id, 0, -1); }
32  std::vector<DetId> south(const DetId& id) const override {
33  DetId nextId = goSouth(id);
34  std::vector<DetId> vNeighborsDetId;
35  if (!(nextId == DetId(0)))
36  vNeighborsDetId.emplace_back(nextId);
37  return vNeighborsDetId;
38  }
39 
41  DetId goEast(const DetId& id) const override { return changeXY(id, +1, 0); }
42  std::vector<DetId> east(const DetId& id) const override {
43  DetId nextId = goEast(id);
44  std::vector<DetId> vNeighborsDetId;
45  if (!(nextId == DetId(0)))
46  vNeighborsDetId.emplace_back(nextId);
47  return vNeighborsDetId;
48  }
49 
51  DetId goWest(const DetId& id) const override { return changeXY(id, -1, 0); }
52  std::vector<DetId> west(const DetId& id) const override {
53  DetId nextId = goWest(id);
54  std::vector<DetId> vNeighborsDetId;
55  if (!(nextId == DetId(0)))
56  vNeighborsDetId.emplace_back(nextId);
57  return vNeighborsDetId;
58  }
59 
60  std::vector<DetId> up(const DetId& id) const override {
61  DetId nextId = changeZ(id, +1);
62  std::vector<DetId> vNeighborsDetId;
63  if (!(nextId == DetId(0)))
64  vNeighborsDetId.emplace_back(nextId);
65  return vNeighborsDetId;
66  }
67 
68  std::vector<DetId> down(const DetId& id) const override {
69  DetId nextId = changeZ(id, -1);
70  std::vector<DetId> vNeighborsDetId;
71  if (!(nextId == DetId(0)))
72  vNeighborsDetId.emplace_back(nextId);
73  return vNeighborsDetId;
74  }
75 
76  std::vector<DetId> neighbors(DetId id) const;
77 
80 
81  unsigned int totalModules() const { return kSizeForDenseIndexing; }
82  unsigned int totalGeomModules() const { return (unsigned int)(2 * kHGeomHalf_); }
83  unsigned int allGeomModules() const;
84 
86  DetId denseId2detId(uint32_t denseId) const override;
87  uint32_t detId2denseId(const DetId& id) const override;
88  virtual uint32_t detId2denseGeomId(const DetId& id) const;
89 
91  bool valid(const DetId& id) const override;
92  bool validHashIndex(uint32_t ix) const { return (ix < kSizeForDenseIndexing); }
93 
94  const HGCalTBDDDConstants& dddConstants() const { return *hdcons_; }
95 
98  DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const;
99  DetId switchZSide(const DetId startId) const;
100 
102  static const int subSectors_ = 2;
103 
104  struct DecodedDetId {
105  DecodedDetId() : iCell1(0), iCell2(0), iLay(0), iSec1(0), iSec2(0), iType(0), zSide(0), det(0) {}
107  };
108 
109  DecodedDetId geomDenseId2decId(const uint32_t& hi) const;
110  DecodedDetId decode(const DetId& id) const;
111  DetId encode(const DecodedDetId& id_) const;
112 
113  DetId::Detector detector() const { return det_; }
115  bool detectorType() const { return false; }
116 
117 private:
119  DetId changeXY(const DetId& id, int nrStepsX, int nrStepsY) const;
120 
122  DetId changeZ(const DetId& id, int nrStepsZ) const;
123 
126 
131  unsigned int kSizeForDenseIndexing;
132 };
133 
134 #endif
unsigned int totalGeomModules() const
std::vector< DetId > up(const DetId &id) const override
unsigned int kSizeForDenseIndexing
DetId::Detector det_
ForwardSubdetector subDetector() const
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
HGCalTBTopology(const HGCalTBDDDConstants *hdcons, int subdet)
create a new Topology
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
DetId encode(const DecodedDetId &id_) const
std::vector< DetId > north(const DetId &id) const override
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
ForwardSubdetector
std::vector< DetId > neighbors(DetId id) const
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
DecodedDetId geomDenseId2decId(const uint32_t &hi) const
Definition: EPCuts.h:4
bool detectorType() const
std::vector< DetId > west(const DetId &id) const override
uint32_t detId2denseId(const DetId &id) const override
return a linear packed id
~HGCalTBTopology() override
default destructor
DetId switchZSide(const DetId startId) const
DetId denseId2detId(uint32_t denseId) const override
Dense indexing.
bool validHashIndex(uint32_t ix) const
std::vector< DetId > east(const DetId &id) const override
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
const HGCalTBDDDConstants * hdcons_
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
Definition: DetId.h:17
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
HGCalGeometryMode::GeometryMode geomMode() const
Geometry mode.
ForwardSubdetector subdet_
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Detector
Definition: DetId.h:24
bool valid(const DetId &id) const override
Is this a valid cell id.
virtual uint32_t detId2denseGeomId(const DetId &id) const
std::vector< DetId > south(const DetId &id) const override
unsigned int totalModules() const
unsigned int allGeomModules() const
std::vector< DetId > down(const DetId &id) const override
HGCalGeometryMode::GeometryMode mode_
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
DetId::Detector detector() const
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)