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
FastTimeTopology::validHashIndex
bool validHashIndex(uint32_t ix) const
Definition: FastTimeTopology.h:76
FastTimeTopology::DecodedDetId::iPhi
int iPhi
Definition: FastTimeTopology.h:89
FastTimeTopology::offsetBy
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
Definition: FastTimeTopology.cc:53
FastTimeTopology::nPhi_
int nPhi_
Definition: FastTimeTopology.h:105
FastTimeTopology::DecodedDetId::subdet
int subdet
Definition: FastTimeTopology.h:89
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
FastTimeDetId.h
FastTimeTopology::subDetector
ForwardSubdetector subDetector() const
Definition: FastTimeTopology.h:96
FastTimeTopology::goNorth
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: FastTimeTopology.h:20
FastTimeDDDConstants
Definition: FastTimeDDDConstants.h:19
FastTimeTopology::east
std::vector< DetId > east(const DetId &id) const override
Definition: FastTimeTopology.h:41
FastTimeTopology::south
std::vector< DetId > south(const DetId &id) const override
Definition: FastTimeTopology.h:31
ForwardSubdetector.h
FastTimeTopology::dddConstants
const FastTimeDDDConstants & dddConstants() const
Definition: FastTimeTopology.h:82
DetId
Definition: DetId.h:17
FastTimeTopology::decode
DecodedDetId decode(const DetId &id) const
Definition: FastTimeTopology.cc:81
FastTimeTopology::detectorType
int detectorType() const
Definition: FastTimeTopology.h:97
FastTimeTopology::kHGhalf_
int kHGhalf_
Definition: FastTimeTopology.h:105
FastTimeTopology::kHGeomHalf_
int kHGeomHalf_
Definition: FastTimeTopology.h:105
FastTimeTopology::FastTimeTopology
FastTimeTopology(const FastTimeDDDConstants &hdcons, ForwardSubdetector subdet, int type)
create a new Topology
Definition: FastTimeTopology.cc:6
FastTimeTopology::goWest
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Definition: FastTimeTopology.h:50
FastTimeTopology::DecodedDetId::zside
int zside
Definition: FastTimeTopology.h:89
FastTimeTopology::~FastTimeTopology
~FastTimeTopology() override
virtual destructor
Definition: FastTimeTopology.h:17
FastTimeTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: FastTimeTopology.cc:47
FastTimeTopology::geomDenseId2decId
DecodedDetId geomDenseId2decId(const uint32_t &hi) const
Definition: FastTimeTopology.cc:73
FastTimeTopology::detId2denseGeomId
virtual uint32_t detId2denseGeomId(const DetId &id) const
Definition: FastTimeTopology.cc:41
FastTimeTopology::totalGeomModules
unsigned int totalGeomModules() const
Definition: FastTimeTopology.h:79
FastTimeTopology::subdet_
ForwardSubdetector subdet_
Definition: FastTimeTopology.h:104
FastTimeTopology::goEast
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
Definition: FastTimeTopology.h:40
FastTimeTopology::up
std::vector< DetId > up(const DetId &id) const override
Definition: FastTimeTopology.h:59
FastTimeDDDConstants.h
FastTimeTopology::switchZSide
DetId switchZSide(const DetId startId) const
Definition: FastTimeTopology.cc:62
FastTimeTopology::numberCells
int numberCells() const
Definition: FastTimeTopology.h:80
FastTimeTopology::west
std::vector< DetId > west(const DetId &id) const override
Definition: FastTimeTopology.h:51
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
FastTimeTopology::totalModules
unsigned int totalModules() const
Definition: FastTimeTopology.h:78
FastTimeTopology::goSouth
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
Definition: FastTimeTopology.h:30
FastTimeTopology::DecodedDetId
Definition: FastTimeTopology.h:87
FastTimeTopology::kSizeForDenseIndexing
unsigned int kSizeForDenseIndexing
Definition: FastTimeTopology.h:106
FastTimeTopology::nEtaZ_
int nEtaZ_
Definition: FastTimeTopology.h:105
FastTimeTopology::north
std::vector< DetId > north(const DetId &id) const override
Definition: FastTimeTopology.h:21
FastTimeTopology::DecodedDetId::iEtaZ
int iEtaZ
Definition: FastTimeTopology.h:89
CaloSubdetectorTopology.h
hi
Definition: HiEvtPlaneList.h:38
FastTimeTopology::encode
DetId encode(const DecodedDetId &id_) const
Definition: FastTimeTopology.cc:92
type
type
Definition: HCALResponse.h:21
FastTimeTopology
Definition: FastTimeTopology.h:11
FastTimeTopology::changeXY
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
Definition: FastTimeTopology.cc:97
FastTimeTopology::down
std::vector< DetId > down(const DetId &id) const override
Definition: FastTimeTopology.h:64
FastTimeTopology::detId2denseId
uint32_t detId2denseId(const DetId &id) const override
Dense indexing.
Definition: FastTimeTopology.cc:20
FastTimeTopology::DecodedDetId::DecodedDetId
DecodedDetId()
Definition: FastTimeTopology.h:88
FastTimeTopology::hdcons_
const FastTimeDDDConstants & hdcons_
Definition: FastTimeTopology.h:103
FastTimeTopology::DecodedDetId::iType
int iType
Definition: FastTimeTopology.h:89
FastTimeTopology::type_
int type_
Definition: FastTimeTopology.h:105
FastTimeTopology::denseId2detId
DetId denseId2detId(uint32_t denseId) const override
Definition: FastTimeTopology.cc:26