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...
 
bool isHFNose () const
 
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 11 of file HGCalTopology.cc.

References cellMax_, cells_, det_, firstLay_, HGCalDDDConstants::firstLayer(), DetId::Forward, ForwardEmpty, HGCalDDDConstants::geomMode(), hdcons_, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HFNose, 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().

12  : hdcons_(hdcons) {
13 
15  layers_ = hdcons_.layers(true);
16  cells_ = hdcons_.maxCells(true);
20  waferMax_ = 2*waferOff_ + 1;
26  subdet_ = (ForwardSubdetector)(det);
28  types_ = 2;
29  } else if (det == (int)(DetId::Forward)) {
31  subdet_ = HFNose;
33  types_ = 3;
34  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
35  det_ = (DetId::Detector)(det);
38  types_ = 2;
39  } else {
40  det_ = (DetId::Detector)(det);
43  types_ = 3;
44  }
45  kSizeForDenseIndexing = (unsigned int)(2*kHGhalf_);
46 #ifdef EDM_ML_DEBUG
47  edm::LogVerbatim("HGCalGeom") << "HGCalTopology initialized for detector "
48  << det_ << ":" << subdet_ << " having "
49  << sectors_ << " Sectors, " << layers_
50  << " Layers from " << firstLay_ << ", "
51  << cells_ << " cells and total channels "
52  << kSizeForDenseIndexing << ":"
53  << (2*kHGeomHalf_) << std::endl;
54 #endif
55 }
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 57 of file HGCalTopology.cc.

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

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

57  {
58  return ((mode_ == HGCalGeometryMode::Trapezoid) ?
59  (unsigned int)(2*hdcons_.numberCells(true)) :
60  (unsigned int)(2*hdcons_.wafers()));
61 }
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 358 of file HGCalTopology.cc.

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

359  {
360 
361  return DetId();
362 }
Definition: DetId.h:18
DetId HGCalTopology::changeZ ( const DetId id,
int  nrStepsZ 
) const
private

move the nagivator along z

Definition at line 365 of file HGCalTopology.cc.

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

365  {
366 
367  return DetId();
368 }
Definition: DetId.h:18
const HGCalDDDConstants& HGCalTopology::dddConstants ( ) const
inline

Definition at line 101 of file HGCalTopology.h.

References hdcons_, offsetBy(), and switchZSide().

Referenced by hgc_digi_utils::addCellMetadata(), PFRecHitQTestThresholdInThicknessNormalizedMIPs::beginEvent(), CaloTruthAccumulator::beginLuminosityBlock(), HGCalGeometryLoader::build(), HGCDigitizer::checkPosition(), HGCalTriggerGeometryHexImp2::detIdWaferType(), HGCalTriggerGeometryHexLayerBasedImp1::detIdWaferType(), HGCalTriggerGeometryV9Imp1::detIdWaferType(), HGCalTriggerTools::eventSetup(), HGCalTriggerNtupleHGCTriggerCells::fill(), HGCalTriggerGeometryHexImp2::fillInvalidTriggerCells(), HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells(), HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells(), HGCalTriggerGeometryHexImp1::fillMaps(), CaloParticleDebugger::fillSimHits(), HGCalGeometry::get8Corners(), HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell(), HGCalGeometry::getClosestCell(), HGCalGeometry::getCorners(), HGCalTriggerTools::getLayerZ(), HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell(), HGCalGeometry::getPosition(), HGCalGeometry::getSummary(), HGCalTriggerGeometryHexLayerBasedImp1::initialize(), HGCalTriggerGeometryV9Imp1::initialize(), HGCalGeometry::newCell(), HGCalTriggerBackend::HGCalTriggerSimCluster< FECODEC, DATA >::run(), HGCalRecHitWorkerSimple::set(), HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::setGeometry(), HGCalTriggerNtupleHGCTriggerCells::simhits(), HGCalTriggerNtupleHGCDigis::simhits(), HGCalTriggerCellBestChoiceCodecImpl::triggerCellSums(), and HGCalTriggerCellThresholdCodecImpl::triggerCellSums().

101 {return hdcons_;}
const HGCalDDDConstants & hdcons_
HGCalTopology::DecodedDetId HGCalTopology::decode ( const DetId id) const

Definition at line 294 of file HGCalTopology.cc.

References HGCalTopology::DecodedDetId::det, det_, DetId::Forward, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HFNose, 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_, subdet_, HGCalGeometryMode::Trapezoid, and HGCalTopology::DecodedDetId::zSide.

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

294  {
295 
297  if ((mode_ == HGCalGeometryMode::Hexagon) ||
299  HGCalDetId id(startId);
300  idx.iCell1 = id.cell();
301  idx.iCell2 = 0;
302  idx.iLay = id.layer();
303  idx.iSec1 = id.wafer();
304  idx.iSec2 = 0;
305  idx.iType = id.waferType();
306  idx.zSide = id.zside();
307  idx.det = id.subdetId();
308  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
309  HGCScintillatorDetId id(startId);
310  idx.iCell1 = id.iphi();
311  idx.iCell2 = 0;
312  idx.iLay = id.layer();
313  idx.iSec1 = id.ietaAbs();
314  idx.iSec2 = 0;
315  idx.iType = id.type();
316  idx.zSide = id.zside();
317  idx.det = (int)(id.subdet());
319  HFNoseDetId id(startId);
320  idx.iCell1 = id.cellU();
321  idx.iCell2 = id.cellV();
322  idx.iLay = id.layer();
323  idx.iSec1 = id.waferU();
324  idx.iSec2 = id.waferV();
325  idx.iType = id.type();
326  idx.zSide = id.zside();
327  idx.det = (int)(id.subdet());
328  } else {
329  HGCSiliconDetId id(startId);
330  idx.iCell1 = id.cellU();
331  idx.iCell2 = id.cellV();
332  idx.iLay = id.layer();
333  idx.iSec1 = id.waferU();
334  idx.iSec2 = id.waferV();
335  idx.iType = id.type();
336  idx.zSide = id.zside();
337  idx.det = (int)(id.subdet());
338  }
339  return idx;
340 }
HGCalGeometryMode::GeometryMode mode_
DetId::Detector det_
ForwardSubdetector subdet_
DetId HGCalTopology::denseId2detId ( uint32_t  denseId) const
override

Definition at line 111 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().

111  {
112 
114  if (validHashIndex(hi)) {
115  id.zSide = ((int)(hi)<kHGhalf_ ? -1 : 1);
116  int di = ((int)(hi)%kHGhalf_);
117  if ((mode_ == HGCalGeometryMode::Hexagon) ||
119  int type = (di%types_);
120  id.iType = (type == 0 ? -1 : 1);
121  id.iSec1 = (((di-type)/types_)%sectors_);
122  id.iLay = (((((di-type)/types_)-id.iSec1+1)/sectors_)%layers_+1);
123  id.iCell1= (((((di-type)/types_)-id.iSec1+1)/sectors_-id.iLay+1)/layers_+1);
124 #ifdef EDM_ML_DEBUG
125  edm::LogVerbatim("HGCalGeom") << "Input Hex " << hi << " o/p " << id.zSide
126  << ":" << id.iLay << ":" << id.iType
127  << ":" << id.iSec1 << ":" << id.iCell1;
128 #endif
129  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
130  int type = (di%types_);
131  id.iType = type;
132  id.iSec1 = (((di-type)/types_)%sectors_)+1;
133  id.iLay = (((((di-type)/types_)-id.iSec1+1)/sectors_)%layers_+firstLay_);
134  id.iCell1= (((((di-type)/types_)-id.iSec1+1)/sectors_-id.iLay+firstLay_)/layers_+1);
135 #ifdef EDM_ML_DEBUG
136  edm::LogVerbatim("HGCalGeom") << "Input Trap " << hi << " o/p " << id.zSide
137  << ":" << id.iLay << ":" << id.iType
138  << ":" << id.iSec1 << ":" << id.iCell1;
139 #endif
140  } else {
141  int type = (di%types_);
142  id.iType = type;
143  di = (di-type)/types_;
144  id.iSec2 = (di%waferMax_)-waferOff_;
145  di = (di-id.iSec2-waferOff_)/waferMax_;
146  id.iSec1 = (di%waferMax_)-waferOff_;
147  di = (di-id.iSec1-waferOff_)/waferMax_;
148  id.iLay = (di%layers_)+1;
149  di = (di-id.iLay+1)/layers_;
150  id.iCell2 = (di%cellMax_);
151  id.iCell1 = (di-id.iCell2)/cellMax_;
152 #ifdef EDM_ML_DEBUG
153  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << hi << " o/p " << id.zSide
154  << ":" << id.iLay << ":" << id.iType
155  << ":" << id.iSec1 << ":" << id.iSec2
156  << ":" << id.iCell1 << ":" << id.iCell2;
157 #endif
158  }
159  }
160  return encode(id);
161 }
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 163 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().

163  {
164 
166  uint32_t idx;
167  if ((mode_ == HGCalGeometryMode::Hexagon) ||
169  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
170  (id.iLay-1)*sectors_+id.iSec1);
171 #ifdef EDM_ML_DEBUG
172  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << id.zSide << ":"
173  << id.iLay << ":" << id.iSec1 << ":"
174  << id.iType << " Constants " << kHGeomHalf_
175  << ":" << layers_ << ":" << sectors_
176  << " o/p " << idx;
177 #endif
178  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
179  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
180  (((id.iLay-firstLay_)*sectors_+id.iSec1-1)*cellMax_+
181  id.iCell1-1));
182 #ifdef EDM_ML_DEBUG
183  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << id.zSide << ":"
184  << id.iLay << ":" << id.iSec1 << ":"
185  << id.iCell1 << ":" << id.iType
186  << " Constants " << kHGeomHalf_ << ":"
187  << layers_ << ":" << firstLay_ << ":"
188  << sectors_ << ":" << cellMax_
189  << " o/p " << idx;
190 #endif
191  } else {
192  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
193  (((id.iLay-1)*waferMax_+id.iSec1+waferOff_)*waferMax_+
194  id.iSec2+waferOff_));
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << id.zSide << ":"
197  << id.iLay << ":" << id.iSec1 << ":"
198  << id.iSec2 << ":" << id.iType
199  << " Constants " << kHGeomHalf_ << ":"
200  << layers_ << ":" << waferMax_ << ":"
201  << waferOff_ << " o/p " << idx;
202 #endif
203  }
204  return idx;
205 }
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 63 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().

63  {
64 
66  uint32_t idx;
69  int type = (id.iType > 0) ? 1 : 0;
70  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
71  ((((id.iCell1-1)*layers_+id.iLay-1)*sectors_+
72  id.iSec1)*types_+type));
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "Input Hex " << id.zSide << ":" << id.iLay
75  << ":" << id.iSec1 << ":" << id.iCell1
76  << ":" << id.iType << " Constants "
77  << kHGeomHalf_ << ":" << layers_ << ":"
78  << sectors_ << ":" << types_<< " o/p "
79  << idx;
80 #endif
81  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
82  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
83  ((((id.iCell1-1)*layers_+id.iLay-firstLay_)*sectors_+
84  id.iSec1-1)*types_+id.iType));
85 #ifdef EDM_ML_DEBUG
86  edm::LogVerbatim("HGCalGeom") << "Input Trap " << id.zSide << ":" << id.iLay
87  << ":" << id.iSec1 << ":" << id.iCell1
88  << ":" << id.iType << " Constants "
89  << kHGeomHalf_ << ":" << layers_ << ":"
90  << sectors_ << ":" << types_<< " o/p "
91  << idx;
92 #endif
93  } else {
94  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
95  (((((id.iCell1*cellMax_+id.iCell2)*layers_+
96  id.iLay-1)*waferMax_+id.iSec1+waferOff_)*
97  waferMax_+id.iSec2+waferOff_)*types_+id.iType));
98 #ifdef EDM_ML_DEBUG
99  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << id.zSide << ":" << id.iLay
100  << ":" << id.iSec1 << ":" << id.iSec2 << ":"
101  << id.iCell1 << ":" << id.iCell2 << ":"
102  << id.iType << " Constants " << kHGeomHalf_
103  << ":" << cellMax_ << ":" << layers_ << ":"
104  << waferMax_ << ":" << waferOff_ << ":"
105  << types_<< " o/p " << idx;
106 #endif
107  }
108  return idx;
109 }
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 342 of file HGCalTopology.cc.

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

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

342  {
343 
344  DetId id;
347  id = HGCalDetId((ForwardSubdetector)(idx.det),idx.zSide,idx.iLay,((idx.iType > 0) ? 1 : 0),idx.iSec1,idx.iCell1).rawId();
348  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
349  id = HGCScintillatorDetId(idx.iType,idx.iLay,idx.zSide*idx.iSec1,idx.iCell1).rawId();
351  id = HFNoseDetId(idx.zSide,idx.iType,idx.iLay,idx.iSec1,idx.iSec2,idx.iCell1,idx.iCell2).rawId();
352  } else {
353  id = HGCSiliconDetId((DetId::Detector)(idx.det),idx.zSide,idx.iType,idx.iLay,idx.iSec1,idx.iSec2,idx.iCell1,idx.iCell2).rawId();
354  }
355  return id;
356 }
HGCalGeometryMode::GeometryMode mode_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
ForwardSubdetector
DetId::Detector det_
ForwardSubdetector subdet_
Definition: DetId.h:18
Detector
Definition: DetId.h:26
HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 246 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().

246  {
247 
249  if (hi < totalGeomModules()) {
250  id.zSide = ((int)(hi)<kHGeomHalf_ ? -1 : 1);
251  int di = ((int)(hi)%kHGeomHalf_);
252  if ((mode_ == HGCalGeometryMode::Hexagon) ||
254  id.iSec1 = (di%sectors_);
255  di = (di-id.iSec1)/sectors_;
256  id.iLay = (di%layers_)+1;
257  id.iType = ((di-id.iLay+1)/layers_ == 0) ? -1 : 1;
258 #ifdef EDM_ML_DEBUG
259  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << hi << " O/P "
260  << id.zSide << ":" << id.iType << ":"
261  << id.iLay << ":" << id.iSec1;
262 #endif
263  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
264  id.iCell1 = (di%cellMax_)+1;
265  di = (di-id.iCell1+1)/cellMax_;
266  id.iSec1 = (di%sectors_)+1;
267  di = (di-id.iSec1+1)/sectors_;
268  id.iLay = (di%layers_) + firstLay_;
269  id.iType = (di-id.iLay+firstLay_)/layers_;
270 #ifdef EDM_ML_DEBUG
271  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << hi << " O/P "
272  << id.zSide << ":" << id.iType << ":"
273  << id.iLay << ":" << id.iSec1 << ":"
274  << id.iCell1;
275 #endif
276  } else {
277  id.iSec2 = (di%waferMax_)-waferOff_;
278  di = (di-id.iSec2-waferOff_)/waferMax_;
279  id.iSec1 = (di%waferMax_)-waferOff_;
280  di = (di-id.iSec1-waferOff_)/waferMax_;
281  id.iLay = (di%layers_)+1;
282  id.iType = (di-id.iLay+1)/layers_;
283 #ifdef EDM_ML_DEBUG
284  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << hi << " O/P "
285  << id.zSide << ":" << id.iType << ":"
286  << id.iLay << ":" << id.iSec1 << ":"
287  << id.iSec2;
288 #endif
289  }
290  }
291  return id;
292 }
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
bool HGCalTopology::isHFNose ( ) const
inline

Definition at line 124 of file HGCalTopology.h.

References changeXY(), changeZ(), det_, DetId::Forward, HFNose, and subdet_.

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getGeometryDetId(), HGCalGeometry::getSummary(), and HGCalGeometry::newCell().

124  {
125  return (((det_ == DetId::Forward) &&
126  (subdet_ == ForwardSubdetector::HFNose)) ? true : false);
127  }
DetId::Detector det_
ForwardSubdetector subdet_
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 227 of file HGCalTopology.cc.

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

Referenced by dddConstants().

228  {
229 
230  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
231  DetId id = changeXY(startId,nrStepsX,nrStepsY);
232  if (valid(id)) return id;
233  }
234  return DetId(0);
235 }
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 237 of file HGCalTopology.cc.

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

Referenced by dddConstants().

237  {
238 
239  HGCalTopology::DecodedDetId id_ = decode(startId);
240  id_.zSide =-id_.zSide;
241  DetId id = encode(id_);
242  if (valid(id)) return id;
243  else return DetId(0);
244 }
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 207 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(), HGCalTriggerGeometryHexLayerBasedImp1::validCellId(), and HGCalTriggerGeometryV9Imp1::validCellId().

207  {
208 
210  bool flag;
211  if ((mode_ == HGCalGeometryMode::Hexagon) ||
213  flag = (idin.det() == det_ && idin.subdetId() == (int)(subdet_) &&
214  id.iCell1 >= 0 && id.iCell1 < cells_ && id.iLay > 0 &&
215  id.iLay <= layers_ && id.iSec1 >= 0 && id.iSec1 <= sectors_);
216  if (flag) flag = hdcons_.isValidHex(id.iLay,id.iSec1,id.iCell1,true);
217  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
218  flag = ((idin.det() == det_) &&
219  hdcons_.isValidTrap(id.iLay,id.iSec1,id.iCell1));
220  } else {
221  flag = ((idin.det() == det_) &&
222  hdcons_.isValidHex8(id.iLay,id.iSec1,id.iSec2,id.iCell1,id.iCell2));
223  }
224  return flag;
225 }
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 141 of file HGCalTopology.h.

Referenced by HGCalTopology(), and valid().

DetId::Detector HGCalTopology::det_
private

Definition at line 139 of file HGCalTopology.h.

Referenced by decode(), detector(), encode(), HGCalTopology(), isHFNose(), and valid().

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

Definition at line 136 of file HGCalTopology.h.

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

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

Definition at line 143 of file HGCalTopology.h.

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

unsigned int HGCalTopology::kSizeForDenseIndexing
private

Definition at line 144 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 140 of file HGCalTopology.h.

Referenced by decode(), encode(), HGCalTopology(), isHFNose(), 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 141 of file HGCalTopology.h.

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

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