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
 
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, ForwardSubdetector subdet, bool halfChamber)
 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 cells_
 
bool half_
 
const HGCalDDDConstantshdcons_
 
int kHGeomHalf_
 
int kHGhalf_
 
unsigned int kSizeForDenseIndexing
 
int layers_
 
std::vector< int > maxcells_
 
HGCalGeometryMode::GeometryMode mode_
 
int sectors_
 
ForwardSubdetector subdet_
 

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 14 of file HGCalTopology.h.

Constructor & Destructor Documentation

HGCalTopology::HGCalTopology ( const HGCalDDDConstants hdcons,
ForwardSubdetector  subdet,
bool  halfChamber 
)

create a new Topology

Definition at line 6 of file HGCalTopology.cc.

References cells_, gather_cfg::cout, HGCalDDDConstants::geomMode(), half_, hdcons_, createfilelist::int, kHGeomHalf_, kHGhalf_, kSizeForDenseIndexing, HGCalDDDConstants::layers(), layers_, HGCalDDDConstants::maxCells(), mode_, HGCalDDDConstants::sectors(), sectors_, HGCalGeometryMode::Square, subdet_, and subSectors_.

8  : hdcons_(hdcons), subdet_(subdet),
9  half_(half) {
11  layers_ = hdcons_.layers(true);
12  cells_ = hdcons_.maxCells(true);
17  } else {
20  }
21  kSizeForDenseIndexing = (unsigned int)(2*kHGhalf_);
22 #ifdef EDM_ML_DEBUG
23  std::cout << "HGCalTopology initialized for subdetector " << subdet_
24  << " having half-chamber flag " << half_ << " with " << sectors_
25  << " Sectors " << layers_ << " Layers " << cells_
26  << " cells and total channels " << kSizeForDenseIndexing << ":"
27  << (2*kHGeomHalf_) << std::endl;
28 #endif
29 }
HGCalGeometryMode::GeometryMode mode_
unsigned int layers(bool reco) const
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
HGCalGeometryMode::GeometryMode geomMode() const
int sectors() const
ForwardSubdetector subdet_
const HGCalDDDConstants & hdcons_
unsigned int kSizeForDenseIndexing
int maxCells(bool reco) const
HGCalTopology::~HGCalTopology ( )
inlineoverride

virtual destructor

Definition at line 21 of file HGCalTopology.h.

21 { }

Member Function Documentation

unsigned int HGCalTopology::allGeomModules ( ) const

Definition at line 31 of file HGCalTopology.cc.

References hdcons_, kHGeomHalf_, mode_, gen::n, HGCalGeometryMode::Square, and HGCalDDDConstants::wafers().

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

31  {
32  int n = (mode_ == HGCalGeometryMode::Square) ?
33  (2*kHGeomHalf_) : (2*hdcons_.wafers());
34  return (unsigned int)(n);
35 }
HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hdcons_
DetId HGCalTopology::changeXY ( const DetId id,
int  nrStepsX,
int  nrStepsY 
) const
private

move the nagivator along x, y

Definition at line 198 of file HGCalTopology.cc.

References decode(), encode(), half_, hdcons_, HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, HGCalDDDConstants::newCell(), and valid().

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

199  {
200 
202  std::pair<int,int> kcell= hdcons_.newCell(id_.iCell,id_.iLay,id_.iSec,
203  id_.iSubSec,nrStepsX,nrStepsY,
204  half_);
205  id_.iSubSec= kcell.second;
206  id_.iSec = (kcell.second > 0) ? kcell.second : -kcell.second;
207  id_.iCell = kcell.first;
208  DetId nextPoint = encode(id_);
209  if (valid(nextPoint)) return nextPoint;
210  else return DetId(0);
211 }
DetId encode(const DecodedDetId &id_) const
const HGCalDDDConstants & hdcons_
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
std::pair< int, int > newCell(int cell, int layer, int sector, int subsector, int incrx, int incry, bool half) const
bool valid(const DetId &id) const override
Is this a valid cell id.
DetId HGCalTopology::changeZ ( const DetId id,
int  nrStepsZ 
) const
private

move the nagivator along z

Definition at line 214 of file HGCalTopology.cc.

References decode(), encode(), half_, hdcons_, HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSubSec, HGCalDDDConstants::newCell(), and valid().

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

214  {
215 
217  std::pair<int,int> kcell = hdcons_.newCell(id_.iCell,id_.iLay,
218  id_.iSubSec,nrStepsZ,half_);
219  id_.iLay = kcell.second;
220  id_.iCell = kcell.first;
221  DetId nextPoint = encode(id_);
222  if (valid(nextPoint)) return nextPoint;
223  else return DetId(0);
224 }
DetId encode(const DecodedDetId &id_) const
const HGCalDDDConstants & hdcons_
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
std::pair< int, int > newCell(int cell, int layer, int sector, int subsector, int incrx, int incry, bool half) const
bool valid(const DetId &id) const override
Is this a valid cell id.
const HGCalDDDConstants& HGCalTopology::dddConstants ( ) const
inline
HGCalTopology::DecodedDetId HGCalTopology::decode ( const DetId id) const

Definition at line 151 of file HGCalTopology.cc.

References HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCEE, HGCalTopology::DecodedDetId::iCell, triggerObjects_cff::id, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, mode_, HGCalTopology::DecodedDetId::subdet, subdet_, and HGCalTopology::DecodedDetId::zside.

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

151  {
152 
154  if ((mode_ == HGCalGeometryMode::Hexagon) ||
156  HGCalDetId id(startId);
157  id_.iCell = id.cell();
158  id_.iLay = id.layer();
159  id_.iSec = id.wafer();
160  id_.iSubSec= id.waferType();
161  id_.zside = id.zside();
162  id_.subdet = id.subdetId();
163  } else if (subdet_ == HGCEE) {
164  HGCEEDetId id(startId);
165  id_.iCell = id.cell();
166  id_.iLay = id.layer();
167  id_.iSec = id.sector();
168  id_.iSubSec= id.subsector();
169  id_.zside = id.zside();
170  id_.subdet = id.subdetId();
171  } else {
172  HGCHEDetId id(startId);
173  id_.iCell = id.cell();
174  id_.iLay = id.layer();
175  id_.iSec = id.sector();
176  id_.iSubSec= id.subsector();
177  id_.zside = id.zside();
178  id_.subdet = id.subdetId();
179  }
180  return id_;
181 }
HGCalGeometryMode::GeometryMode mode_
ForwardSubdetector subdet_
DetId HGCalTopology::denseId2detId ( uint32_t  denseId) const
override

Definition at line 54 of file HGCalTopology.cc.

References encode(), HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, createfilelist::int, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, kHGhalf_, layers_, mode_, sectors_, HGCalGeometryMode::Square, subSectors_, validHashIndex(), and HGCalTopology::DecodedDetId::zside.

Referenced by geomMode().

54  {
55 
56  if (validHashIndex(hi)) {
58  id_.zside = ((int)(hi)<kHGhalf_ ? -1 : 1);
59  int di = ((int)(hi)%kHGhalf_);
60  int iSubSec= (di%subSectors_);
61  id_.iSubSec= (iSubSec == 0 ? -1 : 1);
63  id_.iSec = (((di-iSubSec)/subSectors_)%sectors_+1);
64  } else {
65  id_.iSec = (((di-iSubSec)/subSectors_)%sectors_);
66  }
67  id_.iLay = (((((di-iSubSec)/subSectors_)-id_.iSec+1)/sectors_)%layers_+1);
68  id_.iCell = (((((di-iSubSec)/subSectors_)-id_.iSec+1)/sectors_-id_.iLay+1)/layers_+1);
69  return encode(id_);
70  } else {
71  return DetId(0);
72  }
73 }
bool validHashIndex(uint32_t ix) const
Definition: HGCalTopology.h:97
HGCalGeometryMode::GeometryMode mode_
DetId encode(const DecodedDetId &id_) const
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
Definition: DetId.h:18
bool HGCalTopology::detectorType ( ) const
inline
uint32_t HGCalTopology::detId2denseGeomId ( const DetId id) const
virtual

Definition at line 75 of file HGCalTopology.cc.

References gather_cfg::cout, decode(), half_, training_settings::idx, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, kHGeomHalf_, layers_, mode_, sectors_, HGCalGeometryMode::Square, and HGCalTopology::DecodedDetId::zside.

Referenced by geomMode(), and HGCalGeometry::indexFor().

75  {
76 
78  int isubsec= (half_ && id_.iSubSec > 0) ? 1 : 0;
79  uint32_t idx;
81  idx = (uint32_t)(((id_.zside > 0) ? kHGeomHalf_ : 0) +
82  ((isubsec*layers_+id_.iLay-1)*sectors_+id_.iSec-1));
83  } else {
84  idx = (uint32_t)(((id_.zside > 0) ? kHGeomHalf_ : 0) +
85  ((isubsec*layers_+id_.iLay-1)*sectors_+id_.iSec));
86 #ifdef EDM_ML_DEBUG
87  std::cout << "I/P " << id_.zside << ":" << id_.iLay << ":" << id_.iSec
88  << ":" << isubsec << " Constants " << kHGeomHalf_ << ":"
89  << layers_ << ":" << sectors_ << " o/p " << idx << std::endl;
90 #endif
91  }
92  return idx;
93 }
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 37 of file HGCalTopology.cc.

References decode(), HGCalTopology::DecodedDetId::iCell, training_settings::idx, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, kHGhalf_, layers_, mode_, sectors_, HGCalGeometryMode::Square, subSectors_, and HGCalTopology::DecodedDetId::zside.

Referenced by geomMode().

37  {
38 
40  int isubsec= (id_.iSubSec > 0) ? 1 : 0;
41  uint32_t idx;
43  idx = (uint32_t)((((id_.zside > 0) ? kHGhalf_ : 0) +
44  ((((id_.iCell-1)*layers_+id_.iLay-1)*sectors_+
45  id_.iSec-1)*subSectors_+isubsec)));
46  } else {
47  idx = (uint32_t)((((id_.zside > 0) ? kHGhalf_ : 0) +
48  ((((id_.iCell-1)*layers_+id_.iLay-1)*sectors_+
49  id_.iSec)*subSectors_+isubsec)));
50  }
51  return idx;
52 }
HGCalGeometryMode::GeometryMode mode_
static const int subSectors_
Use subSector in square mode as wafer type in hexagon 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 79 of file HGCalTopology.h.

References changeZ().

79  {
80  DetId nextId=changeZ(id,-1);
81  std::vector<DetId> vNeighborsDetId;
82  if (! (nextId==DetId(0)))
83  vNeighborsDetId.emplace_back(nextId);
84  return vNeighborsDetId;
85  }
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 51 of file HGCalTopology.h.

References goEast().

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

Definition at line 183 of file HGCalTopology.cc.

References HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCEE, HGCalTopology::DecodedDetId::iCell, triggerObjects_cff::id, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, mode_, DetId::rawId(), subdet_, and HGCalTopology::DecodedDetId::zside.

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

183  {
184 
185  int isubsec= (id_.iSubSec > 0) ? 1 : 0;
186  DetId id;
189  id = HGCalDetId(subdet_,id_.zside,id_.iLay,isubsec,id_.iSec,id_.iCell).rawId();
190  } else if (subdet_ == HGCEE) {
191  id = HGCEEDetId(subdet_,id_.zside,id_.iLay,id_.iSec,isubsec,id_.iCell).rawId();
192  } else {
193  id = HGCHEDetId(subdet_,id_.zside,id_.iLay,id_.iSec,isubsec,id_.iCell).rawId();
194  }
195  return id;
196 }
HGCalGeometryMode::GeometryMode mode_
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
ForwardSubdetector subdet_
Definition: DetId.h:18
HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 133 of file HGCalTopology.cc.

References HGCalTopology::DecodedDetId::iLay, createfilelist::int, HGCalTopology::DecodedDetId::iSec, HGCalTopology::DecodedDetId::iSubSec, kHGeomHalf_, layers_, mode_, sectors_, HGCalGeometryMode::Square, subSectors_, totalGeomModules(), and HGCalTopology::DecodedDetId::zside.

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

133  {
134 
136  if (hi < totalGeomModules()) {
137  id_.zside = ((int)(hi)<kHGeomHalf_ ? -1 : 1);
138  int di = ((int)(hi)%kHGeomHalf_);
139  int iSubSec= (di%subSectors_);
140  id_.iSubSec= (iSubSec == 0 ? -1 : 1);
142  id_.iSec = (((di-iSubSec)/subSectors_)%sectors_+1);
143  } else {
144  id_.iSec = (((di-iSubSec)/subSectors_)%sectors_);
145  }
146  id_.iLay = (((((di-iSubSec)/subSectors_)-id_.iSec+1)/sectors_)%layers_+1);
147  }
148  return id_;
149 }
HGCalGeometryMode::GeometryMode mode_
unsigned int totalGeomModules() const
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
HGCalGeometryMode::GeometryMode HGCalTopology::geomMode ( ) const
inline

Geometry mode.

Definition at line 88 of file HGCalTopology.h.

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

Referenced by HGCalGeometryLoader::build().

88 {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 48 of file HGCalTopology.h.

References changeXY().

Referenced by east().

48  {
49  return changeXY(id,+1,0);
50  }
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 24 of file HGCalTopology.h.

References changeXY().

Referenced by north().

24  {
25  return changeXY(id,0,+1);
26  }
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 36 of file HGCalTopology.h.

References changeXY().

Referenced by south().

36  {
37  return changeXY(id,0,-1);
38  }
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 60 of file HGCalTopology.h.

References changeXY().

Referenced by west().

60  {
61  return changeXY(id,-1,0);
62  }
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 27 of file HGCalTopology.h.

References goNorth().

27  {
28  DetId nextId= goNorth(id);
29  std::vector<DetId> vNeighborsDetId;
30  if (! (nextId==DetId(0)))
31  vNeighborsDetId.emplace_back(nextId);
32  return vNeighborsDetId;
33  }
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: HGCalTopology.h:24
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 112 of file HGCalTopology.cc.

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

Referenced by dddConstants().

113  {
114 
115  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
116  DetId id = changeXY(startId,nrStepsX,nrStepsY);
117  if (valid(id)) return id;
118  }
119  return DetId(0);
120 }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
ForwardSubdetector subdet_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
bool valid(const DetId &id) const override
Is this a valid cell id.
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
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 39 of file HGCalTopology.h.

References goSouth().

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

Definition at line 123 of file HGCalTopology.h.

References subdet_.

Referenced by HGCalGeometryLoader::build().

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

Definition at line 122 of file HGCalTopology.cc.

References decode(), DetId::det(), encode(), DetId::Forward, triggerObjects_cff::id, createfilelist::int, subdet_, DetId::subdetId(), valid(), and HGCalTopology::DecodedDetId::zside.

Referenced by dddConstants().

122  {
123 
124  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
125  HGCalTopology::DecodedDetId id_ = decode(startId);
126  id_.zside =-id_.zside;
127  DetId id = encode(id_);
128  if (valid(id)) return id;
129  }
130  return DetId(0);
131 }
DetId encode(const DecodedDetId &id_) const
ForwardSubdetector subdet_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
bool valid(const DetId &id) const override
Is this a valid cell id.
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
unsigned int HGCalTopology::totalGeomModules ( ) const
inline
unsigned int HGCalTopology::totalModules ( ) const
inline

Definition at line 99 of file HGCalTopology.h.

References kSizeForDenseIndexing.

99 {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 71 of file HGCalTopology.h.

References changeZ().

71  {
72  DetId nextId=changeZ(id,+1);
73  std::vector<DetId> vNeighborsDetId;
74  if (! (nextId==DetId(0)))
75  vNeighborsDetId.emplace_back(nextId);
76  return vNeighborsDetId;
77  }
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 95 of file HGCalTopology.cc.

References cells_, decode(), RemoveAddSevLevel::flag, DetId::Forward, hdcons_, HGCalTopology::DecodedDetId::iCell, HGCalTopology::DecodedDetId::iLay, createfilelist::int, HGCalTopology::DecodedDetId::iSec, HGCalDDDConstants::isValid(), layers_, mode_, sectors_, HGCalGeometryMode::Square, and subdet_.

Referenced by changeXY(), changeZ(), geomMode(), offsetBy(), switchZSide(), HGCalTriggerGeometryHexLayerBasedImp1::validCellId(), and HGCalTriggerGeometryHexImp2::validCellId().

95  {
96 
98  bool flag;
100  flag = (id.det() == DetId::Forward && id.subdetId() == (int)(subdet_) &&
101  id_.iCell >= 0 && id_.iCell < cells_ && id_.iLay > 0 &&
102  id_.iLay <= layers_ && id_.iSec > 0 && id_.iSec <= sectors_);
103  } else {
104  flag = (id.det() == DetId::Forward && id.subdetId() == (int)(subdet_) &&
105  id_.iCell >= 0 && id_.iCell < cells_ && id_.iLay > 0 &&
106  id_.iLay <= layers_ && id_.iSec >= 0 && id_.iSec <= sectors_);
107  if (flag) flag = hdcons_.isValid(id_.iLay,id_.iSec,id_.iCell,true);
108  }
109  return flag;
110 }
bool isValid(int lay, int mod, int cell, bool reco) const
HGCalGeometryMode::GeometryMode mode_
ForwardSubdetector subdet_
const HGCalDDDConstants & hdcons_
DecodedDetId decode(const DetId &id) const
bool HGCalTopology::validHashIndex ( uint32_t  ix) const
inline

Definition at line 97 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by denseId2detId().

97 {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 63 of file HGCalTopology.h.

References goWest().

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

Member Data Documentation

int HGCalTopology::cells_
private

Definition at line 138 of file HGCalTopology.h.

Referenced by HGCalTopology(), and valid().

bool HGCalTopology::half_
private

Definition at line 137 of file HGCalTopology.h.

Referenced by changeXY(), changeZ(), detectorType(), detId2denseGeomId(), and HGCalTopology().

const HGCalDDDConstants& HGCalTopology::hdcons_
private

Definition at line 133 of file HGCalTopology.h.

Referenced by allGeomModules(), changeXY(), changeZ(), 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 141 of file HGCalTopology.h.

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

int HGCalTopology::layers_
private
std::vector<int> HGCalTopology::maxcells_
private

Definition at line 140 of file HGCalTopology.h.

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

Definition at line 136 of file HGCalTopology.h.

Referenced by decode(), encode(), HGCalTopology(), offsetBy(), subDetector(), switchZSide(), and valid().

const int HGCalTopology::subSectors_ = 2
static

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

Definition at line 111 of file HGCalTopology.h.

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