CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
HGCalTopology Class Reference

#include <HGCalTopology.h>

Inheritance diagram for HGCalTopology:
CaloSubdetectorTopology

Classes

struct  DecodedDetId
 

Public Member Functions

unsigned int allGeomModules () const
 
const HGCalDDDConstantsdddConstants () const
 
DecodedDetId decode (const DetId &id) const
 
DetId denseId2detId (uint32_t denseId) const override
 
DetId::Detector detector () const
 
bool detectorType () const
 
virtual uint32_t detId2denseGeomId (const DetId &id) const
 
uint32_t detId2denseId (const DetId &id) const override
 Dense indexing. More...
 
std::vector< DetIddown (const DetId &id) const override
 
std::vector< DetIdeast (const DetId &id) const override
 
DetId encode (const DecodedDetId &id_) const
 
DecodedDetId geomDenseId2decId (const uint32_t &hi) const
 
HGCalGeometryMode::GeometryMode geomMode () const
 Geometry mode. More...
 
DetId goEast (const DetId &id) const override
 move the Topology east (positive ix) More...
 
DetId goNorth (const DetId &id) const override
 move the Topology north (increment iy) More...
 
DetId goSouth (const DetId &id) const override
 move the Topology south (decrement iy) More...
 
DetId goWest (const DetId &id) const override
 move the Topology west (negative ix) More...
 
 HGCalTopology (const HGCalDDDConstants &hdcons, int subdet)
 create a new Topology More...
 
std::vector< DetIdnorth (const DetId &id) const override
 
DetId offsetBy (const DetId startId, int nrStepsX, int nrStepsY) const
 
std::vector< DetIdsouth (const DetId &id) const override
 
ForwardSubdetector subDetector () const
 
DetId switchZSide (const DetId startId) const
 
unsigned int totalGeomModules () const
 
unsigned int totalModules () const
 
std::vector< DetIdup (const DetId &id) const override
 
bool valid (const DetId &id) const override
 Is this a valid cell id. More...
 
bool validHashIndex (uint32_t ix) const
 
std::vector< DetIdwest (const DetId &id) const override
 
 ~HGCalTopology () override
 virtual destructor More...
 
- Public Member Functions inherited from CaloSubdetectorTopology
 CaloSubdetectorTopology ()
 standard constructor More...
 
virtual DetId denseId2detId (unsigned int) const
 return a linear packed id More...
 
virtual bool denseIdConsistent (int topoVer) const
 return whether this topology is consistent with the numbering in the given topology More...
 
virtual std::vector< DetIdgetAllNeighbours (const DetId &id) const
 
virtual std::vector< DetIdgetNeighbours (const DetId &id, const CaloDirection &dir) const
 
virtual std::vector< DetIdgetWindow (const DetId &id, const int &northSouthSize, const int &eastWestSize) const
 
virtual DetId goDown (const DetId &id) const
 
virtual DetId goUp (const DetId &id) const
 
virtual unsigned int ncells () const
 return a count of valid cells (for dense indexing use) More...
 
virtual int topoVersion () const
 return a version which identifies the given topology More...
 
virtual ~CaloSubdetectorTopology ()
 virtual destructor More...
 

Static Public Attributes

static const int subSectors_ = 2
 Use subSector in square mode as wafer type in hexagon mode. More...
 

Private Member Functions

DetId changeXY (const DetId &id, int nrStepsX, int nrStepsY) const
 move the nagivator along x, y More...
 
DetId changeZ (const DetId &id, int nrStepsZ) const
 move the nagivator along z More...
 

Private Attributes

int cellMax_
 
int cells_
 
DetId::Detector det_
 
int firstLay_
 
const HGCalDDDConstantshdcons_
 
int kHGeomHalf_
 
int kHGhalf_
 
unsigned int kSizeForDenseIndexing
 
int layers_
 
HGCalGeometryMode::GeometryMode mode_
 
int sectors_
 
ForwardSubdetector subdet_
 
int types_
 
int waferMax_
 
int waferOff_
 

Additional Inherited Members

- Protected Types inherited from CaloSubdetectorTopology
typedef std::pair< int, int > Coordinate
 
- Protected Member Functions inherited from CaloSubdetectorTopology
Coordinate getNeighbourIndex (const Coordinate &coord, const CaloDirection &dir) const
 

Detailed Description

Definition at line 12 of file HGCalTopology.h.

Constructor & Destructor Documentation

HGCalTopology::HGCalTopology ( const HGCalDDDConstants hdcons,
int  subdet 
)

create a new Topology

Definition at line 10 of file HGCalTopology.cc.

References cellMax_, cells_, det_, firstLay_, HGCalDDDConstants::firstLayer(), DetId::Forward, ForwardEmpty, HGCalDDDConstants::geomMode(), hdcons_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, createfilelist::int, kHGeomHalf_, kHGhalf_, kSizeForDenseIndexing, HGCalDDDConstants::layers(), layers_, HGCalDDDConstants::maxCells(), HGCalDDDConstants::maxCellUV(), mode_, HGCalDDDConstants::sectors(), sectors_, subdet_, HGCalGeometryMode::Trapezoid, types_, waferMax_, waferOff_, and HGCalDDDConstants::waferUVMax().

11  : hdcons_(hdcons) {
12 
14  layers_ = hdcons_.layers(true);
15  cells_ = hdcons_.maxCells(true);
19  waferMax_ = 2*waferOff_ + 1;
25  subdet_ = (ForwardSubdetector)(det);
27  types_ = 2;
28  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
29  det_ = (DetId::Detector)(det);
32  types_ = 2;
33  } else {
34  det_ = (DetId::Detector)(det);
37  types_ = 3;
38  }
39  kSizeForDenseIndexing = (unsigned int)(2*kHGhalf_);
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HGCalGeom") << "HGCalTopology initialized for detector "
42  << det_ << ":" << subdet_ << " having "
43  << sectors_ << " Sectors, " << layers_
44  << " Layers from " << firstLay_ << ", "
45  << cells_ << " cells and total channels "
46  << kSizeForDenseIndexing << ":"
47  << (2*kHGeomHalf_) << std::endl;
48 #endif
49 }
HGCalGeometryMode::GeometryMode mode_
ForwardSubdetector
DetId::Detector det_
unsigned int layers(bool reco) const
HGCalGeometryMode::GeometryMode geomMode() const
int sectors() const
ForwardSubdetector subdet_
int maxCellUV() const
const HGCalDDDConstants & hdcons_
Detector
Definition: DetId.h:26
int waferUVMax() const
unsigned int kSizeForDenseIndexing
int firstLayer() const
int maxCells(bool reco) const
HGCalTopology::~HGCalTopology ( )
inlineoverride

virtual destructor

Definition at line 19 of file HGCalTopology.h.

19 { }

Member Function Documentation

unsigned int HGCalTopology::allGeomModules ( ) const

Definition at line 51 of file HGCalTopology.cc.

References hdcons_, mode_, HGCalDDDConstants::numberCells(), HGCalGeometryMode::Trapezoid, and HGCalDDDConstants::wafers().

Referenced by HGCalGeometryLoader::build(), and totalGeomModules().

51  {
52  return ((mode_ == HGCalGeometryMode::Trapezoid) ?
53  (unsigned int)(2*hdcons_.numberCells(true)) :
54  (unsigned int)(2*hdcons_.wafers()));
55 }
HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hdcons_
int numberCells(bool reco) const
DetId HGCalTopology::changeXY ( const DetId id,
int  nrStepsX,
int  nrStepsY 
) const
private

move the nagivator along x, y

Definition at line 339 of file HGCalTopology.cc.

Referenced by detectorType(), goEast(), goNorth(), goSouth(), goWest(), and offsetBy().

340  {
341 
342  return DetId();
343 }
Definition: DetId.h:18
DetId HGCalTopology::changeZ ( const DetId id,
int  nrStepsZ 
) const
private

move the nagivator along z

Definition at line 346 of file HGCalTopology.cc.

Referenced by detectorType(), down(), and up().

346  {
347 
348  return DetId();
349 }
Definition: DetId.h:18
const HGCalDDDConstants& HGCalTopology::dddConstants ( ) const
inline
HGCalTopology::DecodedDetId HGCalTopology::decode ( const DetId id) const

Definition at line 287 of file HGCalTopology.cc.

References HGCalTopology::DecodedDetId::det, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCalTopology::DecodedDetId::iCell1, HGCalTopology::DecodedDetId::iCell2, triggerObjects_cff::id, training_settings::idx, HGCalTopology::DecodedDetId::iLay, createfilelist::int, HGCalTopology::DecodedDetId::iSec1, HGCalTopology::DecodedDetId::iSec2, HGCalTopology::DecodedDetId::iType, mode_, HGCalGeometryMode::Trapezoid, and HGCalTopology::DecodedDetId::zSide.

Referenced by detId2denseGeomId(), detId2denseId(), HGCalGeometry::getClosestCell(), HGCalGeometry::getCorners(), HGCalGeometry::getPosition(), HGCalGeometry::newCell(), switchZSide(), and valid().

287  {
288 
290  if ((mode_ == HGCalGeometryMode::Hexagon) ||
292  HGCalDetId id(startId);
293  idx.iCell1 = id.cell();
294  idx.iCell2 = 0;
295  idx.iLay = id.layer();
296  idx.iSec1 = id.wafer();
297  idx.iSec2 = 0;
298  idx.iType = id.waferType();
299  idx.zSide = id.zside();
300  idx.det = id.subdetId();
301  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
302  HGCScintillatorDetId id(startId);
303  idx.iCell1 = id.iphi();
304  idx.iCell2 = 0;
305  idx.iLay = id.layer();
306  idx.iSec1 = id.ietaAbs();
307  idx.iSec2 = 0;
308  idx.iType = id.type();
309  idx.zSide = id.zside();
310  idx.det = (int)(id.subdet());
311  } else {
312  HGCSiliconDetId id(startId);
313  idx.iCell1 = id.cellU();
314  idx.iCell2 = id.cellV();
315  idx.iLay = id.layer();
316  idx.iSec1 = id.waferU();
317  idx.iSec2 = id.waferV();
318  idx.iType = id.type();
319  idx.zSide = id.zside();
320  idx.det = (int)(id.subdet());
321  }
322  return idx;
323 }
HGCalGeometryMode::GeometryMode mode_
DetId HGCalTopology::denseId2detId ( uint32_t  denseId) const
override

Definition at line 105 of file HGCalTopology.cc.

References cellMax_, encode(), firstLay_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, triggerObjects_cff::id, createfilelist::int, kHGhalf_, layers_, mode_, sectors_, HGCalGeometryMode::Trapezoid, types_, validHashIndex(), waferMax_, and waferOff_.

Referenced by geomMode().

105  {
106 
108  if (validHashIndex(hi)) {
109  id.zSide = ((int)(hi)<kHGhalf_ ? -1 : 1);
110  int di = ((int)(hi)%kHGhalf_);
111  if ((mode_ == HGCalGeometryMode::Hexagon) ||
113  int type = (di%types_);
114  id.iType = (type == 0 ? -1 : 1);
115  id.iSec1 = (((di-type)/types_)%sectors_);
116  id.iLay = (((((di-type)/types_)-id.iSec1+1)/sectors_)%layers_+1);
117  id.iCell1= (((((di-type)/types_)-id.iSec1+1)/sectors_-id.iLay+1)/layers_+1);
118 #ifdef EDM_ML_DEBUG
119  edm::LogVerbatim("HGCalGeom") << "Input Hex " << hi << " o/p " << id.zSide
120  << ":" << id.iLay << ":" << id.iType
121  << ":" << id.iSec1 << ":" << id.iCell1;
122 #endif
123  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
124  int type = (di%types_);
125  id.iType = type;
126  id.iSec1 = (((di-type)/types_)%sectors_)+1;
127  id.iLay = (((((di-type)/types_)-id.iSec1+1)/sectors_)%layers_+firstLay_);
128  id.iCell1= (((((di-type)/types_)-id.iSec1+1)/sectors_-id.iLay+firstLay_)/layers_+1);
129 #ifdef EDM_ML_DEBUG
130  edm::LogVerbatim("HGCalGeom") << "Input Trap " << hi << " o/p " << id.zSide
131  << ":" << id.iLay << ":" << id.iType
132  << ":" << id.iSec1 << ":" << id.iCell1;
133 #endif
134  } else {
135  int type = (di%types_);
136  id.iType = type;
137  di = (di-type)/types_;
138  id.iSec2 = (di%waferMax_)-waferOff_;
139  di = (di-id.iSec2-waferOff_)/waferMax_;
140  id.iSec1 = (di%waferMax_)-waferOff_;
141  di = (di-id.iSec1-waferOff_)/waferMax_;
142  id.iLay = (di%layers_)+1;
143  di = (di-id.iLay+1)/layers_;
144  id.iCell2 = (di%cellMax_);
145  id.iCell1 = (di-id.iCell2)/cellMax_;
146 #ifdef EDM_ML_DEBUG
147  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << hi << " o/p " << id.zSide
148  << ":" << id.iLay << ":" << id.iType
149  << ":" << id.iSec1 << ":" << id.iSec2
150  << ":" << id.iCell1 << ":" << id.iCell2;
151 #endif
152  }
153  }
154  return encode(id);
155 }
type
Definition: HCALResponse.h:21
bool validHashIndex(uint32_t ix) const
Definition: HGCalTopology.h:95
HGCalGeometryMode::GeometryMode mode_
DetId encode(const DecodedDetId &id_) const
DetId::Detector HGCalTopology::detector ( ) const
inline

Definition at line 121 of file HGCalTopology.h.

References det_.

Referenced by HGCalGeometryLoader::build().

121 { return det_;}
DetId::Detector det_
bool HGCalTopology::detectorType ( ) const
inline
uint32_t HGCalTopology::detId2denseGeomId ( const DetId id) const
virtual

Definition at line 157 of file HGCalTopology.cc.

References cellMax_, decode(), firstLay_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, training_settings::idx, kHGeomHalf_, layers_, mode_, sectors_, HGCalGeometryMode::Trapezoid, waferMax_, and waferOff_.

Referenced by geomMode(), HGCalGeometry::getGeometry(), HGCalGeometry::getSummary(), HGCalGeometry::indexFor(), HGCalGeometry::newCell(), and HGCalGeometry::present().

157  {
158 
160  uint32_t idx;
161  if ((mode_ == HGCalGeometryMode::Hexagon) ||
163  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
164  (id.iLay-1)*sectors_+id.iSec1);
165 #ifdef EDM_ML_DEBUG
166  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << id.zSide << ":" << id.iLay
167  << ":" << id.iSec1 << ":" << id.iType
168  << " Constants " << kHGeomHalf_ << ":"
169  << layers_ << ":" << sectors_ << " o/p "
170  << idx;
171 #endif
172  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
173  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
174  (((id.iLay-firstLay_)*sectors_+id.iSec1-1)*cellMax_+
175  id.iCell1-1));
176 #ifdef EDM_ML_DEBUG
177  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << id.zSide << ":"
178  << id.iLay << ":" << id.iSec1 << ":"
179  << id.iCell1 << ":" << id.iType << " Constants "
180  << kHGeomHalf_ << ":" << layers_ << ":"
181  << firstLay_ << ":" << sectors_ << ":"
182  << cellMax_ << " o/p " << idx;
183 #endif
184  } else {
185  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
186  (((id.iLay-1)*waferMax_+id.iSec1+waferOff_)*waferMax_+
187  id.iSec2+waferOff_));
188 #ifdef EDM_ML_DEBUG
189  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << id.zSide << ":"
190  << id.iLay << ":" << id.iSec1 << ":"
191  << id.iSec2 << ":" << id.iType << " Constants "
192  << kHGeomHalf_ << ":" << layers_ << ":"
193  << waferMax_ << ":" << waferOff_ << " o/p "
194  << idx;
195 #endif
196  }
197  return idx;
198 }
HGCalGeometryMode::GeometryMode mode_
DecodedDetId decode(const DetId &id) const
uint32_t HGCalTopology::detId2denseId ( const DetId id) const
overridevirtual

Dense indexing.

Reimplemented from CaloSubdetectorTopology.

Definition at line 57 of file HGCalTopology.cc.

References cellMax_, decode(), firstLay_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, training_settings::idx, kHGeomHalf_, kHGhalf_, layers_, mode_, sectors_, HGCalGeometryMode::Trapezoid, types_, waferMax_, and waferOff_.

Referenced by geomMode().

57  {
58 
60  uint32_t idx;
63  int type = (id.iType > 0) ? 1 : 0;
64  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
65  ((((id.iCell1-1)*layers_+id.iLay-1)*sectors_+
66  id.iSec1)*types_+type));
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "Input Hex " << id.zSide << ":" << id.iLay
69  << ":" << id.iSec1 << ":" << id.iCell1
70  << ":" << id.iType << " Constants "
71  << kHGeomHalf_ << ":" << layers_ << ":"
72  << sectors_ << ":" << types_<< " o/p "
73  << idx;
74 #endif
75  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
76  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
77  ((((id.iCell1-1)*layers_+id.iLay-firstLay_)*sectors_+
78  id.iSec1-1)*types_+id.iType));
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HGCalGeom") << "Input Trap " << id.zSide << ":" << id.iLay
81  << ":" << id.iSec1 << ":" << id.iCell1
82  << ":" << id.iType << " Constants "
83  << kHGeomHalf_ << ":" << layers_ << ":"
84  << sectors_ << ":" << types_<< " o/p "
85  << idx;
86 #endif
87  } else {
88  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
89  (((((id.iCell1*cellMax_+id.iCell2)*layers_+
90  id.iLay-1)*waferMax_+id.iSec1+waferOff_)*
91  waferMax_+id.iSec2+waferOff_)*types_+id.iType));
92 #ifdef EDM_ML_DEBUG
93  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << id.zSide << ":" << id.iLay
94  << ":" << id.iSec1 << ":" << id.iSec2 << ":"
95  << id.iCell1 << ":" << id.iCell2 << ":"
96  << id.iType << " Constants " << kHGeomHalf_
97  << ":" << cellMax_ << ":" << layers_ << ":"
98  << waferMax_ << ":" << waferOff_ << ":"
99  << types_<< " o/p " << idx;
100 #endif
101  }
102  return idx;
103 }
type
Definition: HCALResponse.h:21
HGCalGeometryMode::GeometryMode mode_
DecodedDetId decode(const DetId &id) const
std::vector<DetId> HGCalTopology::down ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in down direction (inward)

Implements CaloSubdetectorTopology.

Definition at line 77 of file HGCalTopology.h.

References changeZ().

77  {
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  }
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
Definition: DetId.h:18
std::vector<DetId> HGCalTopology::east ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 49 of file HGCalTopology.h.

References goEast().

49  {
50  DetId nextId=goEast(id);
51  std::vector<DetId> vNeighborsDetId;
52  if (! (nextId==DetId(0)))
53  vNeighborsDetId.emplace_back(nextId);
54  return vNeighborsDetId;
55  }
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
Definition: HGCalTopology.h:46
Definition: DetId.h:18
DetId HGCalTopology::encode ( const DecodedDetId id_) const

Definition at line 325 of file HGCalTopology.cc.

References HGCalTopology::DecodedDetId::det, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCalTopology::DecodedDetId::iCell1, HGCalTopology::DecodedDetId::iCell2, triggerObjects_cff::id, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec1, HGCalTopology::DecodedDetId::iSec2, HGCalTopology::DecodedDetId::iType, mode_, DetId::rawId(), HGCalGeometryMode::Trapezoid, and HGCalTopology::DecodedDetId::zSide.

Referenced by denseId2detId(), HGCalGeometry::getClosestCell(), HGCalGeometry::newCell(), CaloGeometryDBEP< T, U >::produceAligned(), and switchZSide().

325  {
326 
327  DetId id;
330  id = HGCalDetId((ForwardSubdetector)(idx.det),idx.zSide,idx.iLay,((idx.iType > 0) ? 1 : 0),idx.iSec1,idx.iCell1).rawId();
331  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
332  id = HGCScintillatorDetId(idx.iType,idx.iLay,idx.zSide*idx.iSec1,idx.iCell1).rawId();
333  } else {
334  id = HGCSiliconDetId((DetId::Detector)(idx.det),idx.zSide,idx.iType,idx.iLay,idx.iSec1,idx.iSec2,idx.iCell1,idx.iCell2).rawId();
335  }
336  return id;
337 }
HGCalGeometryMode::GeometryMode mode_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
ForwardSubdetector
Definition: DetId.h:18
Detector
Definition: DetId.h:26
HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 239 of file HGCalTopology.cc.

References cellMax_, firstLay_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, triggerObjects_cff::id, createfilelist::int, kHGeomHalf_, layers_, mode_, sectors_, totalGeomModules(), HGCalGeometryMode::Trapezoid, waferMax_, and waferOff_.

Referenced by CaloGeometryDBEP< T, U >::produceAligned().

239  {
240 
242  if (hi < totalGeomModules()) {
243  id.zSide = ((int)(hi)<kHGeomHalf_ ? -1 : 1);
244  int di = ((int)(hi)%kHGeomHalf_);
245  if ((mode_ == HGCalGeometryMode::Hexagon) ||
247  id.iSec1 = (di%sectors_);
248  di = (di-id.iSec1)/sectors_;
249  id.iLay = (di%layers_)+1;
250  id.iType = ((di-id.iLay+1)/layers_ == 0) ? -1 : 1;
251 #ifdef EDM_ML_DEBUG
252  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << hi << " O/P "
253  << id.zSide << ":" << id.iType << ":"
254  << id.iLay << ":" << id.iSec1;
255 #endif
256  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
257  id.iCell1 = (di%cellMax_)+1;
258  di = (di-id.iCell1+1)/cellMax_;
259  id.iSec1 = (di%sectors_)+1;
260  di = (di-id.iSec1+1)/sectors_;
261  id.iLay = (di%layers_) + firstLay_;
262  id.iType = (di-id.iLay+firstLay_)/layers_;
263 #ifdef EDM_ML_DEBUG
264  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << hi << " O/P "
265  << id.zSide << ":" << id.iType << ":"
266  << id.iLay << ":" << id.iSec1 << ":"
267  << id.iCell1;
268 #endif
269  } else {
270  id.iSec2 = (di%waferMax_)-waferOff_;
271  di = (di-id.iSec2-waferOff_)/waferMax_;
272  id.iSec1 = (di%waferMax_)-waferOff_;
273  di = (di-id.iSec1-waferOff_)/waferMax_;
274  id.iLay = (di%layers_)+1;
275  id.iType = (di-id.iLay+1)/layers_;
276 #ifdef EDM_ML_DEBUG
277  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << hi << " O/P "
278  << id.zSide << ":" << id.iType << ":"
279  << id.iLay << ":" << id.iSec1 << ":"
280  << id.iSec2;
281 #endif
282  }
283  }
284  return id;
285 }
HGCalGeometryMode::GeometryMode mode_
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
HGCalGeometryMode::GeometryMode HGCalTopology::geomMode ( ) const
inline

Geometry mode.

Definition at line 86 of file HGCalTopology.h.

References denseId2detId(), detId2denseGeomId(), detId2denseId(), mode_, and valid().

Referenced by HGCalRecHitValidation::analyze(), HGCalDigiValidation::analyze(), and HGCalGeometryLoader::build().

86 {return mode_;}
HGCalGeometryMode::GeometryMode mode_
DetId HGCalTopology::goEast ( const DetId id) const
inlineoverridevirtual

move the Topology east (positive ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 46 of file HGCalTopology.h.

References changeXY().

Referenced by east().

46  {
47  return changeXY(id,+1,0);
48  }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
DetId HGCalTopology::goNorth ( const DetId id) const
inlineoverridevirtual

move the Topology north (increment iy)

Reimplemented from CaloSubdetectorTopology.

Definition at line 22 of file HGCalTopology.h.

References changeXY().

Referenced by north().

22  {
23  return changeXY(id,0,+1);
24  }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
DetId HGCalTopology::goSouth ( const DetId id) const
inlineoverridevirtual

move the Topology south (decrement iy)

Reimplemented from CaloSubdetectorTopology.

Definition at line 34 of file HGCalTopology.h.

References changeXY().

Referenced by south().

34  {
35  return changeXY(id,0,-1);
36  }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
DetId HGCalTopology::goWest ( const DetId id) const
inlineoverridevirtual

move the Topology west (negative ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 58 of file HGCalTopology.h.

References changeXY().

Referenced by west().

58  {
59  return changeXY(id,-1,0);
60  }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
std::vector<DetId> HGCalTopology::north ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 25 of file HGCalTopology.h.

References goNorth().

25  {
26  DetId nextId= goNorth(id);
27  std::vector<DetId> vNeighborsDetId;
28  if (! (nextId==DetId(0)))
29  vNeighborsDetId.emplace_back(nextId);
30  return vNeighborsDetId;
31  }
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: HGCalTopology.h:22
Definition: DetId.h:18
DetId HGCalTopology::offsetBy ( const DetId  startId,
int  nrStepsX,
int  nrStepsY 
) const

returns a new DetId offset by nrStepsX and nrStepsY (can be negative), returns DetId(0) if invalid

Definition at line 220 of file HGCalTopology.cc.

References changeXY(), DetId::det(), DetId::Forward, triggerObjects_cff::id, createfilelist::int, subdet_, DetId::subdetId(), and valid().

Referenced by dddConstants().

221  {
222 
223  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
224  DetId id = changeXY(startId,nrStepsX,nrStepsY);
225  if (valid(id)) return id;
226  }
227  return DetId(0);
228 }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
ForwardSubdetector subdet_
Definition: DetId.h:18
bool valid(const DetId &id) const override
Is this a valid cell id.
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
std::vector<DetId> HGCalTopology::south ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 37 of file HGCalTopology.h.

References goSouth().

37  {
38  DetId nextId= goSouth(id);
39  std::vector<DetId> vNeighborsDetId;
40  if (! (nextId==DetId(0)))
41  vNeighborsDetId.emplace_back(nextId);
42  return vNeighborsDetId;
43  }
Definition: DetId.h:18
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
Definition: HGCalTopology.h:34
ForwardSubdetector HGCalTopology::subDetector ( ) const
inline

Definition at line 122 of file HGCalTopology.h.

References subdet_.

Referenced by HGCalGeometryLoader::build().

122 {return subdet_;}
ForwardSubdetector subdet_
DetId HGCalTopology::switchZSide ( const DetId  startId) const

Definition at line 230 of file HGCalTopology.cc.

References decode(), encode(), triggerObjects_cff::id, valid(), and HGCalTopology::DecodedDetId::zSide.

Referenced by dddConstants().

230  {
231 
232  HGCalTopology::DecodedDetId id_ = decode(startId);
233  id_.zSide =-id_.zSide;
234  DetId id = encode(id_);
235  if (valid(id)) return id;
236  else return DetId(0);
237 }
DetId encode(const DecodedDetId &id_) const
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
bool valid(const DetId &id) const override
Is this a valid cell id.
unsigned int HGCalTopology::totalGeomModules ( ) const
inline
unsigned int HGCalTopology::totalModules ( ) const
inline

Definition at line 97 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by HGCalGeometry::HGCalGeometry().

97 {return kSizeForDenseIndexing;}
unsigned int kSizeForDenseIndexing
std::vector<DetId> HGCalTopology::up ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in up direction (outward)

Implements CaloSubdetectorTopology.

Definition at line 69 of file HGCalTopology.h.

References changeZ().

69  {
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  }
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
Definition: DetId.h:18
bool HGCalTopology::valid ( const DetId id) const
overridevirtual

Is this a valid cell id.

Reimplemented from CaloSubdetectorTopology.

Definition at line 200 of file HGCalTopology.cc.

References cells_, decode(), DetId::det(), det_, RemoveAddSevLevel::flag, hdcons_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, createfilelist::int, HGCalDDDConstants::isValidHex(), HGCalDDDConstants::isValidHex8(), HGCalDDDConstants::isValidTrap(), layers_, mode_, sectors_, subdet_, DetId::subdetId(), and HGCalGeometryMode::Trapezoid.

Referenced by geomMode(), HGCalGeometry::newCell(), offsetBy(), switchZSide(), HGCalTriggerGeometryHexImp2::validCellId(), and HGCalTriggerGeometryHexLayerBasedImp1::validCellId().

200  {
201 
203  bool flag;
204  if ((mode_ == HGCalGeometryMode::Hexagon) ||
206  flag = (idin.det() == det_ && idin.subdetId() == (int)(subdet_) &&
207  id.iCell1 >= 0 && id.iCell1 < cells_ && id.iLay > 0 &&
208  id.iLay <= layers_ && id.iSec1 >= 0 && id.iSec1 <= sectors_);
209  if (flag) flag = hdcons_.isValidHex(id.iLay,id.iSec1,id.iCell1,true);
210  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
211  flag = ((idin.det() == det_) &&
212  hdcons_.isValidTrap(id.iLay,id.iSec1,id.iCell1));
213  } else {
214  flag = ((idin.det() == det_) &&
215  hdcons_.isValidHex8(id.iLay,id.iSec1,id.iSec2,id.iCell1,id.iCell2));
216  }
217  return flag;
218 }
bool isValidTrap(int lay, int ieta, int iphi) const
HGCalGeometryMode::GeometryMode mode_
bool isValidHex(int lay, int mod, int cell, bool reco) const
DetId::Detector det_
bool isValidHex8(int lay, int modU, int modV, int cellU, int cellV) const
ForwardSubdetector subdet_
const HGCalDDDConstants & hdcons_
DecodedDetId decode(const DetId &id) const
bool HGCalTopology::validHashIndex ( uint32_t  ix) const
inline

Definition at line 95 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by denseId2detId().

95 {return (ix < kSizeForDenseIndexing);}
unsigned int kSizeForDenseIndexing
std::vector<DetId> HGCalTopology::west ( const DetId id) const
inlineoverridevirtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 61 of file HGCalTopology.h.

References goWest().

61  {
62  DetId nextId=goWest(id);
63  std::vector<DetId> vNeighborsDetId;
64  if (! (nextId==DetId(0)))
65  vNeighborsDetId.emplace_back(nextId);
66  return vNeighborsDetId;
67  }
Definition: DetId.h:18
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Definition: HGCalTopology.h:58

Member Data Documentation

int HGCalTopology::cellMax_
private
int HGCalTopology::cells_
private

Definition at line 137 of file HGCalTopology.h.

Referenced by HGCalTopology(), and valid().

DetId::Detector HGCalTopology::det_
private

Definition at line 135 of file HGCalTopology.h.

Referenced by detector(), HGCalTopology(), and valid().

int HGCalTopology::firstLay_
private
const HGCalDDDConstants& HGCalTopology::hdcons_
private

Definition at line 132 of file HGCalTopology.h.

Referenced by allGeomModules(), dddConstants(), HGCalTopology(), and valid().

int HGCalTopology::kHGeomHalf_
private
int HGCalTopology::kHGhalf_
private

Definition at line 139 of file HGCalTopology.h.

Referenced by denseId2detId(), detId2denseId(), and HGCalTopology().

unsigned int HGCalTopology::kSizeForDenseIndexing
private

Definition at line 140 of file HGCalTopology.h.

Referenced by HGCalTopology(), totalModules(), and validHashIndex().

int HGCalTopology::layers_
private
HGCalGeometryMode::GeometryMode HGCalTopology::mode_
private
int HGCalTopology::sectors_
private
ForwardSubdetector HGCalTopology::subdet_
private

Definition at line 136 of file HGCalTopology.h.

Referenced by HGCalTopology(), offsetBy(), subDetector(), and valid().

const int HGCalTopology::subSectors_ = 2
static

Use subSector in square mode as wafer type in hexagon mode.

Definition at line 109 of file HGCalTopology.h.

int HGCalTopology::types_
private

Definition at line 137 of file HGCalTopology.h.

Referenced by denseId2detId(), detId2denseId(), and HGCalTopology().

int HGCalTopology::waferMax_
private
int HGCalTopology::waferOff_
private