CMS 3D CMS Logo

FastTimeTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_CaloTopology_FastTimeTopology_h
2 #define Geometry_CaloTopology_FastTimeTopology_h 1
3 
8 #include <vector>
9 #include <iostream>
10 
12 public:
15 
17  ~FastTimeTopology() override {}
18 
20  DetId goNorth(const DetId& id) const override { return offsetBy(id, 0, +1); }
21  std::vector<DetId> north(const DetId& id) const override {
22  DetId nextId = goNorth(id);
23  std::vector<DetId> vNeighborsDetId;
24  if (!(nextId == DetId(0)))
25  vNeighborsDetId.emplace_back(nextId);
26  return vNeighborsDetId;
27  }
28 
30  DetId goSouth(const DetId& id) const override { return offsetBy(id, 0, -1); }
31  std::vector<DetId> south(const DetId& id) const override {
32  DetId nextId = goSouth(id);
33  std::vector<DetId> vNeighborsDetId;
34  if (!(nextId == DetId(0)))
35  vNeighborsDetId.emplace_back(nextId);
36  return vNeighborsDetId;
37  }
38 
40  DetId goEast(const DetId& id) const override { return offsetBy(id, +1, 0); }
41  std::vector<DetId> east(const DetId& id) const override {
42  DetId nextId = goEast(id);
43  std::vector<DetId> vNeighborsDetId;
44  if (!(nextId == DetId(0)))
45  vNeighborsDetId.emplace_back(nextId);
46  return vNeighborsDetId;
47  }
48 
50  DetId goWest(const DetId& id) const override { return offsetBy(id, -1, 0); }
51  std::vector<DetId> west(const DetId& id) const override {
52  DetId nextId = goWest(id);
53  std::vector<DetId> vNeighborsDetId;
54  if (!(nextId == DetId(0)))
55  vNeighborsDetId.emplace_back(nextId);
56  return vNeighborsDetId;
57  }
58 
59  std::vector<DetId> up(const DetId& id) const override {
60  std::vector<DetId> vNeighborsDetId;
61  return vNeighborsDetId;
62  }
63 
64  std::vector<DetId> down(const DetId& id) const override {
65  std::vector<DetId> vNeighborsDetId;
66  return vNeighborsDetId;
67  }
68 
70  uint32_t detId2denseId(const DetId& id) const override;
71  DetId denseId2detId(uint32_t denseId) const override;
72  virtual uint32_t detId2denseGeomId(const DetId& id) const;
73 
75  bool valid(const DetId& id) const override;
76  bool validHashIndex(uint32_t ix) const { return (ix < kSizeForDenseIndexing); }
77 
78  unsigned int totalModules() const { return kSizeForDenseIndexing; }
79  unsigned int totalGeomModules() const { return (unsigned int)(2 * kHGeomHalf_); }
80  int numberCells() const { return kHGeomHalf_; }
81 
82  const FastTimeDDDConstants& dddConstants() const { return hdcons_; }
83 
84  DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const;
85  DetId switchZSide(const DetId startId) const;
86 
87  struct DecodedDetId {
88  DecodedDetId() : iPhi(0), iEtaZ(0), zside(0), iType(0), subdet(0) {}
90  };
91 
92  DecodedDetId geomDenseId2decId(const uint32_t& hi) const;
93  DecodedDetId decode(const DetId& id) const;
94  DetId encode(const DecodedDetId& id_) const;
95 
97  int detectorType() const { return type_; }
98 
99 private:
101  DetId changeXY(const DetId& id, int nrStepsX, int nrStepsY) const;
102 
106  unsigned int kSizeForDenseIndexing;
107 };
108 
109 #endif
std::vector< DetId > down(const DetId &id) const override
int detectorType() const
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
unsigned int totalGeomModules() const
ForwardSubdetector subdet_
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
bool valid(const DetId &id) const override
Is this a valid cell id.
uint32_t detId2denseId(const DetId &id) const override
Dense indexing.
std::vector< DetId > west(const DetId &id) const override
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
ForwardSubdetector
bool validHashIndex(uint32_t ix) const
DetId denseId2detId(uint32_t denseId) const override
int numberCells() const
unsigned int totalModules() const
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
unsigned int kSizeForDenseIndexing
Definition: EPCuts.h:4
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
ForwardSubdetector subDetector() const
const FastTimeDDDConstants & hdcons_
const FastTimeDDDConstants & dddConstants() const
std::vector< DetId > south(const DetId &id) const override
Definition: DetId.h:17
FastTimeTopology(const FastTimeDDDConstants &hdcons, ForwardSubdetector subdet, int type)
create a new Topology
DecodedDetId decode(const DetId &id) const
DecodedDetId geomDenseId2decId(const uint32_t &hi) const
virtual uint32_t detId2denseGeomId(const DetId &id) const
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
~FastTimeTopology() override
virtual destructor
DetId switchZSide(const DetId startId) const
std::vector< DetId > up(const DetId &id) const override
std::vector< DetId > east(const DetId &id) const override
std::vector< DetId > north(const DetId &id) const override
DetId encode(const DecodedDetId &id_) const