CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
virtual DetId denseId2detId (uint32_t denseId) const
 
bool detectorType () const
 
virtual uint32_t detId2denseGeomId (const DetId &id) const
 
virtual uint32_t detId2denseId (const DetId &id) const
 Dense indexing. More...
 
virtual std::vector< DetIddown (const DetId &id) const
 
virtual std::vector< DetIdeast (const DetId &id) const
 
DetId encode (const DecodedDetId &id_) const
 
DecodedDetId geomDenseId2decId (const uint32_t &hi) const
 
HGCalGeometryMode geomMode () const
 Geometry mode. More...
 
virtual DetId goEast (const DetId &id) const
 move the Topology east (positive ix) More...
 
virtual DetId goNorth (const DetId &id) const
 move the Topology north (increment iy) More...
 
virtual DetId goSouth (const DetId &id) const
 move the Topology south (decrement iy) More...
 
virtual DetId goWest (const DetId &id) const
 move the Topology west (negative ix) More...
 
 HGCalTopology (const HGCalDDDConstants &hdcons, ForwardSubdetector subdet, bool halfChamber)
 create a new Topology More...
 
virtual std::vector< DetIdnorth (const DetId &id) const
 
DetId offsetBy (const DetId startId, int nrStepsX, int nrStepsY) const
 
virtual std::vector< DetIdsouth (const DetId &id) const
 
ForwardSubdetector subDetector () const
 
DetId switchZSide (const DetId startId) const
 
unsigned int totalGeomModules () const
 
unsigned int totalModules () const
 
virtual std::vector< DetIdup (const DetId &id) const
 
virtual bool valid (const DetId &id) const
 Is this a valid cell id. More...
 
bool validHashIndex (uint32_t ix) const
 
virtual std::vector< DetIdwest (const DetId &id) const
 
virtual ~HGCalTopology ()
 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 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_, kHGeomHalf_, kHGhalf_, kSizeForDenseIndexing, HGCalDDDConstants::layers(), layers_, HGCalDDDConstants::maxCells(), mode_, HGCalDDDConstants::sectors(), sectors_, 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 DebugLog
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 }
unsigned int layers(bool reco) const
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
HGCalGeometryMode geomMode() const
int sectors() const
ForwardSubdetector subdet_
const HGCalDDDConstants & hdcons_
HGCalGeometryMode
HGCalGeometryMode mode_
unsigned int kSizeForDenseIndexing
tuple cout
Definition: gather_cfg.py:145
int maxCells(bool reco) const
virtual HGCalTopology::~HGCalTopology ( )
inlinevirtual

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, Square, and HGCalDDDConstants::wafers().

Referenced by HGCalGeometryLoader::build().

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

move the nagivator along x, y

Definition at line 191 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 goEast(), goNorth(), goSouth(), goWest(), and offsetBy().

192  {
193 
195  std::pair<int,int> kcell= hdcons_.newCell(id_.iCell,id_.iLay,id_.iSec,
196  id_.iSubSec,nrStepsX,nrStepsY,
197  half_);
198  id_.iSubSec= kcell.second;
199  id_.iSec = (kcell.second > 0) ? kcell.second : -kcell.second;
200  id_.iCell = kcell.first;
201  DetId nextPoint = encode(id_);
202  if (valid(nextPoint)) return nextPoint;
203  else return DetId(0);
204 }
DetId encode(const DecodedDetId &id_) const
virtual bool valid(const DetId &id) const
Is this a valid cell id.
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
DetId HGCalTopology::changeZ ( const DetId id,
int  nrStepsZ 
) const
private

move the nagivator along z

Definition at line 207 of file HGCalTopology.cc.

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

Referenced by down(), and up().

207  {
208 
210  std::pair<int,int> kcell = hdcons_.newCell(id_.iCell,id_.iLay,
211  id_.iSubSec,nrStepsZ,half_);
212  id_.iLay = kcell.second;
213  id_.iCell = kcell.first;
214  DetId nextPoint = encode(id_);
215  if (valid(nextPoint)) return nextPoint;
216  else return DetId(0);
217 }
DetId encode(const DecodedDetId &id_) const
virtual bool valid(const DetId &id) const
Is this a valid cell id.
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
const HGCalDDDConstants& HGCalTopology::dddConstants ( ) const
inline
HGCalTopology::DecodedDetId HGCalTopology::decode ( const DetId id) const

Definition at line 146 of file HGCalTopology.cc.

References Hexagon, HGCEE, HGCalTopology::DecodedDetId::iCell, 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().

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

Definition at line 54 of file HGCalTopology.cc.

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

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
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
HGCalGeometryMode mode_
bool HGCalTopology::detectorType ( ) const
inline

Definition at line 124 of file HGCalTopology.h.

References half_.

Referenced by HGCDigitizer::accumulate(), and HGCalGeometryLoader::build().

124 { return half_;}
uint32_t HGCalTopology::detId2denseGeomId ( const DetId id) const
virtual

Definition at line 75 of file HGCalTopology.cc.

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

Referenced by 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  }
87  return idx;
88 }
DecodedDetId decode(const DetId &id) const
HGCalGeometryMode mode_
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
uint32_t HGCalTopology::detId2denseId ( const DetId id) const
virtual

Dense indexing.

Reimplemented from CaloSubdetectorTopology.

Definition at line 37 of file HGCalTopology.cc.

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

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 }
static const int subSectors_
Use subSector in square mode as wafer type in hexagon mode.
DecodedDetId decode(const DetId &id) const
HGCalGeometryMode mode_
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
virtual std::vector<DetId> HGCalTopology::down ( const DetId id) const
inlinevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 79 of file HGCalTopology.h.

References changeZ(), and DetId::rawId().

79  {
80  DetId nextId=changeZ(id,-1);
81  std::vector<DetId> vNeighborsDetId;
82  if (! (nextId==DetId(0)))
83  vNeighborsDetId.push_back(DetId(nextId.rawId()));
84  return vNeighborsDetId;
85  }
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: DetId.h:18
virtual std::vector<DetId> HGCalTopology::east ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 51 of file HGCalTopology.h.

References goEast(), and DetId::rawId().

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

Definition at line 177 of file HGCalTopology.cc.

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

Referenced by changeXY(), changeZ(), denseId2detId(), HGCalGeometry::getClosestCell(), and switchZSide().

177  {
178 
179  int isubsec= (id_.iSubSec > 0) ? 1 : 0;
180  DetId id;
182  id = HGCalDetId(subdet_,id_.zside,id_.iLay,isubsec,id_.iSec,id_.iCell).rawId();
183  } else if (subdet_ == HGCEE) {
184  id = HGCEEDetId(subdet_,id_.zside,id_.iLay,id_.iSec,isubsec,id_.iCell).rawId();
185  } else {
186  id = HGCHEDetId(subdet_,id_.zside,id_.iLay,id_.iSec,isubsec,id_.iCell).rawId();
187  }
188  return id;
189 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
ForwardSubdetector subdet_
Definition: DetId.h:18
HGCalGeometryMode mode_
HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 128 of file HGCalTopology.cc.

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

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

Geometry mode.

Definition at line 88 of file HGCalTopology.h.

References mode_.

Referenced by HGCalGeometryLoader::build().

88 {return mode_;}
HGCalGeometryMode mode_
virtual DetId HGCalTopology::goEast ( const DetId id) const
inlinevirtual

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
virtual DetId HGCalTopology::goNorth ( const DetId id) const
inlinevirtual

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
virtual DetId HGCalTopology::goSouth ( const DetId id) const
inlinevirtual

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
virtual DetId HGCalTopology::goWest ( const DetId id) const
inlinevirtual

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
virtual std::vector<DetId> HGCalTopology::north ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 27 of file HGCalTopology.h.

References goNorth(), and DetId::rawId().

27  {
28  DetId nextId= goNorth(id);
29  std::vector<DetId> vNeighborsDetId;
30  if (! (nextId==DetId(0)))
31  vNeighborsDetId.push_back(DetId(nextId.rawId()));
32  return vNeighborsDetId;
33  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual DetId goNorth(const DetId &id) const
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 107 of file HGCalTopology.cc.

References changeXY(), DetId::det(), DetId::Forward, subdet_, DetId::subdetId(), and valid().

108  {
109 
110  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
111  DetId id = changeXY(startId,nrStepsX,nrStepsY);
112  if (valid(id)) return id.rawId();
113  }
114  return DetId(0);
115 }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
virtual bool valid(const DetId &id) const
Is this a valid cell id.
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
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
virtual std::vector<DetId> HGCalTopology::south ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 39 of file HGCalTopology.h.

References goSouth(), and DetId::rawId().

39  {
40  DetId nextId= goSouth(id);
41  std::vector<DetId> vNeighborsDetId;
42  if (! (nextId==DetId(0)))
43  vNeighborsDetId.push_back(DetId(nextId.rawId()));
44  return vNeighborsDetId;
45  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual DetId goSouth(const DetId &id) const
move the Topology south (decrement iy)
Definition: HGCalTopology.h:36
Definition: DetId.h:18
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 117 of file HGCalTopology.cc.

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

117  {
118 
119  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
120  HGCalTopology::DecodedDetId id_ = decode(startId);
121  id_.zside =-id_.zside;
122  DetId id = encode(id_);
123  if (valid(id)) return id.rawId();
124  }
125  return DetId(0);
126 }
DetId encode(const DecodedDetId &id_) const
virtual bool valid(const DetId &id) const
Is this a valid cell id.
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
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
virtual std::vector<DetId> HGCalTopology::up ( const DetId id) const
inlinevirtual

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

Implements CaloSubdetectorTopology.

Definition at line 71 of file HGCalTopology.h.

References changeZ(), and DetId::rawId().

71  {
72  DetId nextId=changeZ(id,+1);
73  std::vector<DetId> vNeighborsDetId;
74  if (! (nextId==DetId(0)))
75  vNeighborsDetId.push_back(DetId(nextId.rawId()));
76  return vNeighborsDetId;
77  }
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: DetId.h:18
bool HGCalTopology::valid ( const DetId id) const
virtual

Is this a valid cell id.

Reimplemented from CaloSubdetectorTopology.

Definition at line 90 of file HGCalTopology.cc.

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

Referenced by changeXY(), changeZ(), offsetBy(), and switchZSide().

90  {
91 
93  bool flag;
95  flag = (id.det() == DetId::Forward && id.subdetId() == (int)(subdet_) &&
96  id_.iCell >= 0 && id_.iCell < cells_ && id_.iLay > 0 &&
97  id_.iLay <= layers_ && id_.iSec > 0 && id_.iSec <= sectors_);
98  } else {
99  flag = (id.det() == DetId::Forward && id.subdetId() == (int)(subdet_) &&
100  id_.iCell >= 0 && id_.iCell < cells_ && id_.iLay > 0 &&
101  id_.iLay <= layers_ && id_.iSec >= 0 && id_.iSec <= sectors_);
102  if (flag) flag = hdcons_.isValid(id_.iLay,id_.iSec,id_.iCell,true);
103  }
104  return flag;
105 }
bool isValid(int lay, int mod, int cell, bool reco) const
ForwardSubdetector subdet_
const HGCalDDDConstants & hdcons_
DecodedDetId decode(const DetId &id) const
HGCalGeometryMode mode_
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
virtual std::vector<DetId> HGCalTopology::west ( const DetId id) const
inlinevirtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 63 of file HGCalTopology.h.

References goWest(), and DetId::rawId().

63  {
64  DetId nextId=goWest(id);
65  std::vector<DetId> vNeighborsDetId;
66  if (! (nextId==DetId(0)))
67  vNeighborsDetId.push_back(DetId(nextId.rawId()));
68  return vNeighborsDetId;
69  }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: DetId.h:18
virtual DetId goWest(const DetId &id) const
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 138 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
std::vector<int> HGCalTopology::maxcells_
private

Definition at line 139 of file HGCalTopology.h.

HGCalGeometryMode 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().