CMS 3D CMS Logo

HGCalTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_CaloTopology_HGCalTopology_h
2 #define Geometry_CaloTopology_HGCalTopology_h 1
3 
9 #include <vector>
10 #include <iostream>
11 
13 
14 public:
16  HGCalTopology(const HGCalDDDConstants& hdcons, int subdet);
17 
19  ~HGCalTopology() override { }
20 
22  DetId goNorth(const DetId& id) const override {
23  return changeXY(id,0,+1);
24  }
25  std::vector<DetId> north(const DetId& id) const override {
26  DetId nextId= goNorth(id);
27  std::vector<DetId> vNeighborsDetId;
28  if (! (nextId==DetId(0)))
29  vNeighborsDetId.emplace_back(nextId);
30  return vNeighborsDetId;
31  }
32 
34  DetId goSouth(const DetId& id) const override {
35  return changeXY(id,0,-1);
36  }
37  std::vector<DetId> south(const DetId& id) const override {
38  DetId nextId= goSouth(id);
39  std::vector<DetId> vNeighborsDetId;
40  if (! (nextId==DetId(0)))
41  vNeighborsDetId.emplace_back(nextId);
42  return vNeighborsDetId;
43  }
44 
46  DetId goEast(const DetId& id) const override {
47  return changeXY(id,+1,0);
48  }
49  std::vector<DetId> east(const DetId& id) const override {
50  DetId nextId=goEast(id);
51  std::vector<DetId> vNeighborsDetId;
52  if (! (nextId==DetId(0)))
53  vNeighborsDetId.emplace_back(nextId);
54  return vNeighborsDetId;
55  }
56 
58  DetId goWest(const DetId& id) const override {
59  return changeXY(id,-1,0);
60  }
61  std::vector<DetId> west(const DetId& id) const override {
62  DetId nextId=goWest(id);
63  std::vector<DetId> vNeighborsDetId;
64  if (! (nextId==DetId(0)))
65  vNeighborsDetId.emplace_back(nextId);
66  return vNeighborsDetId;
67  }
68 
69  std::vector<DetId> up(const DetId& id) const override {
70  DetId nextId=changeZ(id,+1);
71  std::vector<DetId> vNeighborsDetId;
72  if (! (nextId==DetId(0)))
73  vNeighborsDetId.emplace_back(nextId);
74  return vNeighborsDetId;
75  }
76 
77  std::vector<DetId> down(const DetId& id) const override {
78  DetId nextId=changeZ(id,-1);
79  std::vector<DetId> vNeighborsDetId;
80  if (! (nextId==DetId(0)))
81  vNeighborsDetId.emplace_back(nextId);
82  return vNeighborsDetId;
83  }
84 
85  std::vector<DetId> neighbors(const DetId& id) const;
86 
89 
91  uint32_t detId2denseId(const DetId& id) const override;
92  DetId denseId2detId(uint32_t denseId) const override;
93  virtual uint32_t detId2denseGeomId(const DetId& id) const;
94 
96  bool valid(const DetId& id) const override;
97  bool validHashIndex(uint32_t ix) const {return (ix < kSizeForDenseIndexing);}
98 
99  unsigned int totalModules() const {return kSizeForDenseIndexing;}
100  unsigned int totalGeomModules() const {return (unsigned int)(2*kHGeomHalf_);}
101  unsigned int allGeomModules() const;
102 
103  bool maskCell(const DetId& id, int corners=3) const {
104  return dddConstants().maskCell(id, corners);
105  }
106 
107  const HGCalDDDConstants& dddConstants () const {return hdcons_;}
108 
111  DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const;
112  DetId switchZSide(const DetId startId) const;
113 
115  static const int subSectors_ = 2;
116 
117  struct DecodedDetId {
118  DecodedDetId() : iCell1(0), iCell2(0), iLay(0), iSec1(0), iSec2(0),
119  iType(0), zSide(0), det(0) {}
121  };
122 
123  DecodedDetId geomDenseId2decId(const uint32_t& hi) const;
124  DecodedDetId decode(const DetId& id) const ;
125  DetId encode(const DecodedDetId& id_) const ;
126 
127  DetId::Detector detector() const { return det_;}
129  bool detectorType() const { return false;}
130  bool isHFNose() const {
131  return (((det_ == DetId::Forward) &&
132  (subdet_ == ForwardSubdetector::HFNose)) ? true : false);
133  }
134 private:
136  void addHGCSCintillatorId(std::vector<DetId>& ids, int zside, int type,
137  int lay, int iradius, int iphi) const;
138  void addHGCSiliconId(std::vector<DetId>& ids, int det, int zside,
139  int type, int lay, int waferU, int waferV,
140  int cellU, int cellV) const;
141 
143  DetId changeXY(const DetId& id, int nrStepsX, int nrStepsY) const ;
144 
146  DetId changeZ(const DetId& id, int nrStepsZ) const ;
147 
150 
156  unsigned int kSizeForDenseIndexing;
157 };
158 
159 #endif
HGCalGeometryMode::GeometryMode geomMode() const
Geometry mode.
Definition: HGCalTopology.h:88
type
Definition: HCALResponse.h:21
bool validHashIndex(uint32_t ix) const
Definition: HGCalTopology.h:97
unsigned int allGeomModules() const
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
HGCalGeometryMode::GeometryMode mode_
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: HGCalTopology.h:22
bool detectorType() const
std::vector< DetId > west(const DetId &id) const override
Definition: HGCalTopology.h:61
int zside(DetId const &)
DetId denseId2detId(uint32_t denseId) const override
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
Definition: HGCalTopology.h:46
ForwardSubdetector
DetId::Detector det_
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
unsigned int totalGeomModules() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
void addHGCSCintillatorId(std::vector< DetId > &ids, int zside, int type, int lay, int iradius, int iphi) const
add DetId of Scintillator and Silicon type if valid
~HGCalTopology() override
virtual destructor
Definition: HGCalTopology.h:19
std::vector< DetId > east(const DetId &id) const override
Definition: HGCalTopology.h:49
DetId encode(const DecodedDetId &id_) const
std::vector< DetId > north(const DetId &id) const override
Definition: HGCalTopology.h:25
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
uint32_t detId2denseId(const DetId &id) const override
Dense indexing.
DecodedDetId geomDenseId2decId(const uint32_t &hi) const
ForwardSubdetector subdet_
const HGCalDDDConstants & hdcons_
bool isHFNose() const
bool maskCell(const DetId &id, int corners=3) const
DecodedDetId decode(const DetId &id) const
std::vector< DetId > up(const DetId &id) const override
Definition: HGCalTopology.h:69
Definition: DetId.h:18
const HGCalDDDConstants & dddConstants() const
Detector
Definition: DetId.h:26
bool maskCell(const DetId &id, int corners) const
ForwardSubdetector subDetector() const
std::vector< DetId > south(const DetId &id) const override
Definition: HGCalTopology.h:37
unsigned int totalModules() const
Definition: HGCalTopology.h:99
DetId switchZSide(const DetId startId) const
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
Definition: HGCalTopology.h:34
std::vector< DetId > down(const DetId &id) const override
Definition: HGCalTopology.h:77
void addHGCSiliconId(std::vector< DetId > &ids, int det, int zside, int type, int lay, int waferU, int waferV, int cellU, int cellV) const
std::vector< DetId > neighbors(const DetId &id) const
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Definition: HGCalTopology.h:58
unsigned int kSizeForDenseIndexing
bool valid(const DetId &id) const override
Is this a valid cell id.
DetId::Detector detector() const
HGCalTopology(const HGCalDDDConstants &hdcons, int subdet)
create a new Topology