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 public:
15  HGCalTopology(const HGCalDDDConstants& hdcons, int subdet);
16 
18  ~HGCalTopology() 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(const DetId& id) const;
77 
80 
82  uint32_t detId2denseId(const DetId& id) const override;
83  DetId denseId2detId(uint32_t denseId) const override;
84  virtual uint32_t detId2denseGeomId(const DetId& id) const;
85 
87  bool valid(const DetId& id) const override;
88  bool valid(const DetId& id, int cornerMin) const;
89  bool validHashIndex(uint32_t ix) const { return (ix < kSizeForDenseIndexing); }
90  bool validModule(const DetId& id, int cornerMin) const;
91 
92  unsigned int totalModules() const { return kSizeForDenseIndexing; }
93  unsigned int totalGeomModules() const { return (unsigned int)(2 * kHGeomHalf_); }
94  unsigned int allGeomModules() const;
95 
96  bool maskCell(const DetId& id, int corners = 3) const { return dddConstants().maskCell(id, corners); }
97 
98  const HGCalDDDConstants& dddConstants() const { return hdcons_; }
99 
102  DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const;
103  DetId switchZSide(const DetId startId) const;
104 
106  static const int subSectors_ = 2;
107 
108  struct DecodedDetId {
109  DecodedDetId() : iCell1(0), iCell2(0), iLay(0), iSec1(0), iSec2(0), iType(0), zSide(0), det(0) {}
111  };
112 
113  DecodedDetId geomDenseId2decId(const uint32_t& hi) const;
114  DecodedDetId decode(const DetId& id) const;
115  DetId encode(const DecodedDetId& id_) const;
116 
117  DetId::Detector detector() const { return det_; }
119  bool detectorType() const { return false; }
120  bool isHFNose() const {
121  return (((det_ == DetId::Forward) && (subdet_ == ForwardSubdetector::HFNose)) ? true : false);
122  }
123 
124  bool tileTrapezoid() const {
126  }
127  bool waferHexagon6() const {
129  }
130  bool waferHexagon8() const {
133  }
134 
135 private:
137  void addHGCSCintillatorId(std::vector<DetId>& ids, int zside, int type, int lay, int iradius, int iphi) const;
138  void addHGCSiliconId(
139  std::vector<DetId>& ids, int det, int zside, int type, int lay, int waferU, int waferV, int cellU, int cellV)
140  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
HGCalTopology::layers_
int layers_
Definition: HGCalTopology.h:153
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
HGCalGeometryMode::TrapezoidFile
Definition: HGCalGeometryMode.h:33
HGCalTopology::neighbors
std::vector< DetId > neighbors(const DetId &id) const
Definition: HGCalTopology.cc:56
HGCalTopology::goSouth
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
Definition: HGCalTopology.h:31
HGCalTopology::maskCell
bool maskCell(const DetId &id, int corners=3) const
Definition: HGCalTopology.h:96
HGCalTopology::west
std::vector< DetId > west(const DetId &id) const override
Definition: HGCalTopology.h:52
HGCalTopology::allGeomModules
unsigned int allGeomModules() const
Definition: HGCalTopology.cc:52
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCalTopology::addHGCSCintillatorId
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
Definition: HGCalTopology.cc:563
HGCalTopology::waferOff_
int waferOff_
Definition: HGCalTopology.h:154
HGCalTopology::types_
int types_
Definition: HGCalTopology.h:153
HGCalGeometryMode.h
HGCalTopology::HGCalTopology
HGCalTopology(const HGCalDDDConstants &hdcons, int subdet)
create a new Topology
Definition: HGCalTopology.cc:12
HGCalTopology::switchZSide
DetId switchZSide(const DetId startId) const
Definition: HGCalTopology.cc:512
HGCalTopology::kSizeForDenseIndexing
unsigned int kSizeForDenseIndexing
Definition: HGCalTopology.h:156
HGCalTopology::detector
DetId::Detector detector() const
Definition: HGCalTopology.h:117
HGCalTopology::denseId2detId
DetId denseId2detId(uint32_t denseId) const override
Definition: HGCalTopology.cc:387
HGCalTopology::det_
DetId::Detector det_
Definition: HGCalTopology.h:151
HGCalTopology::decode
DecodedDetId decode(const DetId &id) const
Definition: HGCalTopology.cc:588
HGCalTopology::DecodedDetId::iSec1
int iSec1
Definition: HGCalTopology.h:110
HGCalTopology::DecodedDetId
Definition: HGCalTopology.h:108
HGCalTopology::mode_
HGCalGeometryMode::GeometryMode mode_
Definition: HGCalTopology.h:149
HGCalTopology::totalGeomModules
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:93
HGCalTopology::tileTrapezoid
bool tileTrapezoid() const
Definition: HGCalTopology.h:124
HGCalTopology::kHGeomHalf_
int kHGeomHalf_
Definition: HGCalTopology.h:155
HGCalTopology::DecodedDetId::zSide
int zSide
Definition: HGCalTopology.h:110
HGCalDDDConstants
Definition: HGCalDDDConstants.h:26
ForwardSubdetector.h
HGCalTopology::waferMax_
int waferMax_
Definition: HGCalTopology.h:154
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
DetId
Definition: DetId.h:17
HGCalTopology::kHGhalf_
int kHGhalf_
Definition: HGCalTopology.h:155
HGCalTopology::goEast
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
Definition: HGCalTopology.h:41
HGCalTopology::hdcons_
const HGCalDDDConstants & hdcons_
Definition: HGCalTopology.h:148
HGCalTopology::subDetector
ForwardSubdetector subDetector() const
Definition: HGCalTopology.h:118
HGCalGeometryMode::Trapezoid
Definition: HGCalGeometryMode.h:31
HFNose
Definition: ForwardSubdetector.h:11
HGCalTopology::detectorType
bool detectorType() const
Definition: HGCalTopology.h:119
HGCalTopology::subdet_
ForwardSubdetector subdet_
Definition: HGCalTopology.h:152
HGCalTopology::DecodedDetId::iSec2
int iSec2
Definition: HGCalTopology.h:110
HGCalTopology::waferHexagon6
bool waferHexagon6() const
Definition: HGCalTopology.h:127
HGCalTopology::firstLay_
int firstLay_
Definition: HGCalTopology.h:154
HGCalTopology::geomDenseId2decId
DecodedDetId geomDenseId2decId(const uint32_t &hi) const
Definition: HGCalTopology.cc:522
HGCalTopology::waferHexagon8
bool waferHexagon8() const
Definition: HGCalTopology.h:130
HGCalTopology::subSectors_
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
Definition: HGCalTopology.h:106
HGCalTopology::~HGCalTopology
~HGCalTopology() override
virtual destructor
Definition: HGCalTopology.h:18
HGCalTopology::down
std::vector< DetId > down(const DetId &id) const override
Definition: HGCalTopology.h:68
HGCalTopology::totalModules
unsigned int totalModules() const
Definition: HGCalTopology.h:92
HGCalTopology::up
std::vector< DetId > up(const DetId &id) const override
Definition: HGCalTopology.h:60
HGCalTopology::geomMode
HGCalGeometryMode::GeometryMode geomMode() const
Geometry mode.
Definition: HGCalTopology.h:79
HGCalTopology::DecodedDetId::iCell2
int iCell2
Definition: HGCalTopology.h:110
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HGCalGeometryMode::Hexagon8Full
Definition: HGCalGeometryMode.h:30
HGCalGeometryMode::GeometryMode
GeometryMode
Definition: HGCalGeometryMode.h:25
HGCalTopology::cellMax_
int cellMax_
Definition: HGCalTopology.h:154
HGCalTopology::DecodedDetId::iType
int iType
Definition: HGCalTopology.h:110
HGCalTopology::goWest
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Definition: HGCalTopology.h:51
HGCalTopology::detId2denseGeomId
virtual uint32_t detId2denseGeomId(const DetId &id) const
Definition: HGCalTopology.cc:433
HGCalTopology::changeZ
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
Definition: HGCalTopology.cc:658
HGCalTopology::DecodedDetId::iLay
int iLay
Definition: HGCalTopology.h:110
DetId::Detector
Detector
Definition: DetId.h:24
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
HGCalTopology::DecodedDetId::det
int det
Definition: HGCalTopology.h:110
HGCalTopology::changeXY
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
Definition: HGCalTopology.cc:656
HGCalTopology
Definition: HGCalTopology.h:12
HGCalGeometryMode::Hexagon
Definition: HGCalGeometryMode.h:27
HGCalTopology::DecodedDetId::iCell1
int iCell1
Definition: HGCalTopology.h:110
CaloSubdetectorTopology.h
hi
Definition: EPCuts.h:4
HGCalGeometryMode::HexagonFull
Definition: HGCalGeometryMode.h:28
HGCalTopology::north
std::vector< DetId > north(const DetId &id) const override
Definition: HGCalTopology.h:22
HGCalTopology::encode
DetId encode(const DecodedDetId &id_) const
Definition: HGCalTopology.cc:634
HGCalTopology::validModule
bool validModule(const DetId &id, int cornerMin) const
Definition: HGCalTopology.cc:492
DetId.h
HGCalTopology::sectors_
int sectors_
Definition: HGCalTopology.h:153
HGCalTopology::cells_
int cells_
Definition: HGCalTopology.h:153
HGCalGeometryMode::Hexagon8File
Definition: HGCalGeometryMode.h:32
HGCalGeometryMode::Hexagon8
Definition: HGCalGeometryMode.h:29
HGCalTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: HGCalTopology.cc:463
HGCalTopology::detId2denseId
uint32_t detId2denseId(const DetId &id) const override
Dense indexing.
Definition: HGCalTopology.cc:348
HGCalDDDConstants.h
HGCalTopology::addHGCSiliconId
void addHGCSiliconId(std::vector< DetId > &ids, int det, int zside, int type, int lay, int waferU, int waferV, int cellU, int cellV) const
Definition: HGCalTopology.cc:575
DetId::Forward
Definition: DetId.h:30
HGCalTopology::isHFNose
bool isHFNose() const
Definition: HGCalTopology.h:120
HGCalTopology::offsetBy
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const
Definition: HGCalTopology.cc:503
HGCalTopology::south
std::vector< DetId > south(const DetId &id) const override
Definition: HGCalTopology.h:32
HGCalDDDConstants::maskCell
bool maskCell(const DetId &id, int corners) const
Definition: HGCalDDDConstants.cc:745
HGCalTopology::validHashIndex
bool validHashIndex(uint32_t ix) const
Definition: HGCalTopology.h:89
HGCalTopology::east
std::vector< DetId > east(const DetId &id) const override
Definition: HGCalTopology.h:42
HGCalTopology::DecodedDetId::DecodedDetId
DecodedDetId()
Definition: HGCalTopology.h:109
HGCalTopology::goNorth
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: HGCalTopology.h:21