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
 
bool maskCell (const DetId &id, int corners=3) const
 
std::vector< DetIdneighbors (const DetId &id) 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

void addHGCSCintillatorId (std::vector< DetId > &ids, int zside, int type, int lay, int iradius, int iphi) const
 add DetId of Scintillator and Silicon type if valid More...
 
void addHGCSiliconId (std::vector< DetId > &ids, int det, int zside, int type, int lay, int waferU, int waferV, int cellU, int cellV) const
 
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().

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

virtual destructor

Definition at line 18 of file HGCalTopology.h.

18 {}

Member Function Documentation

void HGCalTopology::addHGCSCintillatorId ( std::vector< DetId > &  ids,
int  zside,
int  type,
int  lay,
int  iradius,
int  iphi 
) const
private

add DetId of Scintillator and Silicon type if valid

Definition at line 539 of file HGCalTopology.cc.

References hdcons_, triggerObjects_cff::id, and HGCalDDDConstants::isValidTrap().

Referenced by isHFNose(), and neighbors().

540  {
541 #ifdef EDM_ML_DEBUG
542  edm::LogVerbatim("HGCalGeom") << "addHGCSCintillatorId " << zside << ":" << type << ":" << lay << ":" << iradius
543  << ":" << iphi << " ==> Validity " << hdcons_.isValidTrap(lay, iradius, iphi);
544 #endif
545  if (hdcons_.isValidTrap(lay, iradius, iphi)) {
546  HGCScintillatorDetId id(type, lay, zside * iradius, iphi);
547  ids.emplace_back(DetId(id));
548  }
549 }
type
Definition: HCALResponse.h:21
bool isValidTrap(int lay, int ieta, int iphi) const
int zside(DetId const &)
const HGCalDDDConstants & hdcons_
Definition: DetId.h:17
void HGCalTopology::addHGCSiliconId ( std::vector< DetId > &  ids,
int  det,
int  zside,
int  type,
int  lay,
int  waferU,
int  waferV,
int  cellU,
int  cellV 
) const
private

Definition at line 551 of file HGCalTopology.cc.

References hdcons_, triggerObjects_cff::id, and HGCalDDDConstants::isValidHex8().

Referenced by isHFNose(), and neighbors().

552  {
553 #ifdef EDM_ML_DEBUG
554  edm::LogVerbatim("HGCalGeom") << "addHGCSiliconId " << det << ":" << zside << ":" << type << ":" << lay << ":"
555  << waferU << ":" << waferV << ":" << cellU << ":" << cellV << " ==> Validity "
556  << hdcons_.isValidHex8(lay, waferU, waferV, cellU, cellV);
557 #endif
558  if (hdcons_.isValidHex8(lay, waferU, waferV, cellU, cellV)) {
559  HGCSiliconDetId id((DetId::Detector)(det), zside, type, lay, waferU, waferV, cellU, cellV);
560  ids.emplace_back(DetId(id));
561  }
562 }
type
Definition: HCALResponse.h:21
int zside(DetId const &)
bool isValidHex8(int lay, int modU, int modV, int cellU, int cellV) const
const HGCalDDDConstants & hdcons_
Definition: DetId.h:17
Detector
Definition: DetId.h:24
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) ? (unsigned int)(2 * hdcons_.numberCells(true))
53  : (unsigned int)(2 * hdcons_.wafers()));
54 }
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 628 of file HGCalTopology.cc.

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

628 { return DetId(); }
Definition: DetId.h:17
DetId HGCalTopology::changeZ ( const DetId id,
int  nrStepsZ 
) const
private

move the nagivator along z

Definition at line 630 of file HGCalTopology.cc.

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

630 { return DetId(); }
Definition: DetId.h:17
const HGCalDDDConstants& HGCalTopology::dddConstants ( ) const
inline

Definition at line 96 of file HGCalTopology.h.

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

Referenced by hgc_digi_utils::addCellMetadata(), PFRecHitQTestThresholdInThicknessNormalizedMIPs::beginEvent(), CaloTruthAccumulator::beginLuminosityBlock(), HGCalGeometryLoader::build(), HGCDigitizer::checkPosition(), HGCalTriggerGeometryV9Imp2::detIdWaferType(), HGCalTriggerGeometryHexImp2::detIdWaferType(), HGCalTriggerGeometryHexLayerBasedImp1::detIdWaferType(), HGCalTriggerGeometryV9Imp1::detIdWaferType(), HGCalTriggerTools::eventSetup(), HGCalTriggerGeometryHexImp2::fillInvalidTriggerCells(), HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells(), HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells(), HGCalTriggerGeometryHexImp1::fillMaps(), CaloParticleDebugger::fillSimHits(), HGCalGeometry::get8Corners(), HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell(), HGCalGeometry::getClosestCell(), HGCalGeometry::getCorners(), HGCalTriggerTools::getLayerZ(), HGCalTriggerGeometryV9Imp2::getModuleFromTriggerCell(), HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell(), HGCalGeometry::getNewCorners(), HGCalGeometry::getPosition(), HGCalGeometry::getSummary(), HGCalTriggerGeometryV9Imp2::getTriggerCellsFromModule(), HGCalTriggerGeometryHexLayerBasedImp1::initialize(), HGCalTriggerGeometryV9Imp1::initialize(), HGCalTriggerGeometryV9Imp2::initialize(), HGCalTriggerGeometryHexImp2::lastTriggerLayer(), HGCalTriggerGeometryGenericMapping::lastTriggerLayer(), hgcal::RecHitTools::maskCell(), maskCell(), HGCalGeometry::neighborZ(), HGCalGeometry::newCell(), HGCalTriggerTools::sensorCellThicknessV8(), HGCalRecHitWorkerSimple::set(), HGCalRadiationMap::setGeometry(), HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::setGeometry(), and HGCalTriggerTools::simToReco().

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

Definition at line 564 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::getNewCorners(), HGCalGeometry::getPosition(), neighbors(), HGCalGeometry::neighborZ(), HGCalGeometry::newCell(), switchZSide(), and valid().

564  {
567  HGCalDetId id(startId);
568  idx.iCell1 = id.cell();
569  idx.iCell2 = 0;
570  idx.iLay = id.layer();
571  idx.iSec1 = id.wafer();
572  idx.iSec2 = 0;
573  idx.iType = id.waferType();
574  idx.zSide = id.zside();
575  idx.det = id.subdetId();
576  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
577  HGCScintillatorDetId id(startId);
578  idx.iCell1 = id.iphi();
579  idx.iCell2 = 0;
580  idx.iLay = id.layer();
581  idx.iSec1 = id.ietaAbs();
582  idx.iSec2 = 0;
583  idx.iType = id.type();
584  idx.zSide = id.zside();
585  idx.det = (int)(id.subdet());
587  HFNoseDetId id(startId);
588  idx.iCell1 = id.cellU();
589  idx.iCell2 = id.cellV();
590  idx.iLay = id.layer();
591  idx.iSec1 = id.waferU();
592  idx.iSec2 = id.waferV();
593  idx.iType = id.type();
594  idx.zSide = id.zside();
595  idx.det = (int)(id.subdet());
596  } else {
597  HGCSiliconDetId id(startId);
598  idx.iCell1 = id.cellU();
599  idx.iCell2 = id.cellV();
600  idx.iLay = id.layer();
601  idx.iSec1 = id.waferU();
602  idx.iSec2 = id.waferV();
603  idx.iType = id.type();
604  idx.zSide = id.zside();
605  idx.det = (int)(id.subdet());
606  }
607  return idx;
608 }
HGCalGeometryMode::GeometryMode mode_
DetId::Detector det_
ForwardSubdetector subdet_
DetId HGCalTopology::denseId2detId ( uint32_t  denseId) const
override

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

387  {
389  if (validHashIndex(hi)) {
390  id.zSide = ((int)(hi) < kHGhalf_ ? -1 : 1);
391  int di = ((int)(hi) % kHGhalf_);
393  int type = (di % types_);
394  id.iType = (type == 0 ? -1 : 1);
395  id.iSec1 = (((di - type) / types_) % sectors_);
396  id.iLay = (((((di - type) / types_) - id.iSec1 + 1) / sectors_) % layers_ + 1);
397  id.iCell1 = (((((di - type) / types_) - id.iSec1 + 1) / sectors_ - id.iLay + 1) / layers_ + 1);
398 #ifdef EDM_ML_DEBUG
399  edm::LogVerbatim("HGCalGeom") << "Input Hex " << hi << " o/p " << id.zSide << ":" << id.iLay << ":" << id.iType
400  << ":" << id.iSec1 << ":" << id.iCell1;
401 #endif
402  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
403  int type = (di % types_);
404  id.iType = type;
405  id.iSec1 = (((di - type) / types_) % sectors_) + 1;
406  id.iLay = (((((di - type) / types_) - id.iSec1 + 1) / sectors_) % layers_ + firstLay_);
407  id.iCell1 = (((((di - type) / types_) - id.iSec1 + 1) / sectors_ - id.iLay + firstLay_) / layers_ + 1);
408 #ifdef EDM_ML_DEBUG
409  edm::LogVerbatim("HGCalGeom") << "Input Trap " << hi << " o/p " << id.zSide << ":" << id.iLay << ":" << id.iType
410  << ":" << id.iSec1 << ":" << id.iCell1;
411 #endif
412  } else {
413  int type = (di % types_);
414  id.iType = type;
415  di = (di - type) / types_;
416  id.iSec2 = (di % waferMax_) - waferOff_;
417  di = (di - id.iSec2 - waferOff_) / waferMax_;
418  id.iSec1 = (di % waferMax_) - waferOff_;
419  di = (di - id.iSec1 - waferOff_) / waferMax_;
420  id.iLay = (di % layers_) + 1;
421  di = (di - id.iLay + 1) / layers_;
422  id.iCell2 = (di % cellMax_);
423  id.iCell1 = (di - id.iCell2) / cellMax_;
424 #ifdef EDM_ML_DEBUG
425  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << hi << " o/p " << id.zSide << ":" << id.iLay << ":" << id.iType
426  << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iCell1 << ":" << id.iCell2;
427 #endif
428  }
429  }
430  return encode(id);
431 }
type
Definition: HCALResponse.h:21
bool validHashIndex(uint32_t ix) const
Definition: HGCalTopology.h:88
HGCalGeometryMode::GeometryMode mode_
DetId encode(const DecodedDetId &id_) const
DetId::Detector HGCalTopology::detector ( ) const
inline

Definition at line 115 of file HGCalTopology.h.

References det_.

Referenced by HGCalGeometryLoader::build().

115 { return det_; }
DetId::Detector det_
bool HGCalTopology::detectorType ( ) const
inline

Definition at line 117 of file HGCalTopology.h.

Referenced by HGCalHitValidation::analyzeHGCalSimHit(), and HGCalTriggerTools::simToReco().

117 { return false; }
uint32_t HGCalTopology::detId2denseGeomId ( const DetId id) const
virtual

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

433  {
435  uint32_t idx;
437  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) + (id.iLay - 1) * sectors_ + id.iSec1);
438 #ifdef EDM_ML_DEBUG
439  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << id.zSide << ":" << id.iLay << ":" << id.iSec1 << ":" << id.iType
440  << " Constants " << kHGeomHalf_ << ":" << layers_ << ":" << sectors_ << " o/p "
441  << idx;
442 #endif
443  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
444  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
445  (((id.iLay - firstLay_) * sectors_ + id.iSec1 - 1) * cellMax_ + id.iCell1 - 1));
446 #ifdef EDM_ML_DEBUG
447  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << id.zSide << ":" << id.iLay << ":" << id.iSec1 << ":"
448  << id.iCell1 << ":" << id.iType << " Constants " << kHGeomHalf_ << ":" << layers_
449  << ":" << firstLay_ << ":" << sectors_ << ":" << cellMax_ << " o/p " << idx;
450 #endif
451  } else {
452  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
453  (((id.iLay - 1) * waferMax_ + id.iSec1 + waferOff_) * waferMax_ + id.iSec2 + waferOff_));
454 #ifdef EDM_ML_DEBUG
455  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << id.zSide << ":" << id.iLay << ":" << id.iSec1 << ":"
456  << id.iSec2 << ":" << id.iType << " Constants " << kHGeomHalf_ << ":" << layers_
457  << ":" << waferMax_ << ":" << waferOff_ << " o/p " << idx;
458 #endif
459  }
460  return idx;
461 }
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 348 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().

348  {
350  uint32_t idx;
352  int type = (id.iType > 0) ? 1 : 0;
353  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
354  ((((id.iCell1 - 1) * layers_ + id.iLay - 1) * sectors_ + id.iSec1) * types_ + type));
355 #ifdef EDM_ML_DEBUG
356  edm::LogVerbatim("HGCalGeom") << "Input Hex " << id.zSide << ":" << id.iLay << ":" << id.iSec1 << ":" << id.iCell1
357  << ":" << id.iType << " Constants " << kHGeomHalf_ << ":" << layers_ << ":"
358  << sectors_ << ":" << types_ << " o/p " << idx;
359 #endif
360  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
361  idx =
362  (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
363  ((((id.iCell1 - 1) * layers_ + id.iLay - firstLay_) * sectors_ + id.iSec1 - 1) * types_ + id.iType));
364 #ifdef EDM_ML_DEBUG
365  edm::LogVerbatim("HGCalGeom") << "Input Trap " << id.zSide << ":" << id.iLay << ":" << id.iSec1 << ":" << id.iCell1
366  << ":" << id.iType << " Constants " << kHGeomHalf_ << ":" << layers_ << ":"
367  << sectors_ << ":" << types_ << " o/p " << idx;
368 #endif
369  } else {
370  idx =
371  (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
372  (((((id.iCell1 * cellMax_ + id.iCell2) * layers_ + id.iLay - 1) * waferMax_ + id.iSec1 + waferOff_) *
373  waferMax_ +
374  id.iSec2 + waferOff_) *
375  types_ +
376  id.iType));
377 #ifdef EDM_ML_DEBUG
378  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << id.zSide << ":" << id.iLay << ":" << id.iSec1 << ":" << id.iSec2
379  << ":" << id.iCell1 << ":" << id.iCell2 << ":" << id.iType << " Constants "
380  << kHGeomHalf_ << ":" << cellMax_ << ":" << layers_ << ":" << waferMax_ << ":"
381  << waferOff_ << ":" << types_ << " o/p " << idx;
382 #endif
383  }
384  return idx;
385 }
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 68 of file HGCalTopology.h.

References changeZ(), and neighbors().

68  {
69  DetId nextId = changeZ(id, -1);
70  std::vector<DetId> vNeighborsDetId;
71  if (!(nextId == DetId(0)))
72  vNeighborsDetId.emplace_back(nextId);
73  return vNeighborsDetId;
74  }
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
Definition: DetId.h:17
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 42 of file HGCalTopology.h.

References goEast().

42  {
43  DetId nextId = goEast(id);
44  std::vector<DetId> vNeighborsDetId;
45  if (!(nextId == DetId(0)))
46  vNeighborsDetId.emplace_back(nextId);
47  return vNeighborsDetId;
48  }
DetId goEast(const DetId &id) const override
move the Topology east (positive ix)
Definition: HGCalTopology.h:41
Definition: DetId.h:17
DetId HGCalTopology::encode ( const DecodedDetId id_) const

Definition at line 610 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(), and switchZSide().

610  {
611  DetId id;
613  id =
614  HGCalDetId((ForwardSubdetector)(idx.det), idx.zSide, idx.iLay, ((idx.iType > 0) ? 1 : 0), idx.iSec1, idx.iCell1)
615  .rawId();
616  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
617  id = HGCScintillatorDetId(idx.iType, idx.iLay, idx.zSide * idx.iSec1, idx.iCell1).rawId();
619  id = HFNoseDetId(idx.zSide, idx.iType, idx.iLay, idx.iSec1, idx.iSec2, idx.iCell1, idx.iCell2).rawId();
620  } else {
621  id = HGCSiliconDetId(
622  (DetId::Detector)(idx.det), idx.zSide, idx.iType, idx.iLay, idx.iSec1, idx.iSec2, idx.iCell1, idx.iCell2)
623  .rawId();
624  }
625  return id;
626 }
HGCalGeometryMode::GeometryMode mode_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ForwardSubdetector
DetId::Detector det_
ForwardSubdetector subdet_
Definition: DetId.h:17
Detector
Definition: DetId.h:24
HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId ( const uint32_t &  hi) const

Definition at line 498 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_.

498  {
500  if (hi < totalGeomModules()) {
501  id.zSide = ((int)(hi) < kHGeomHalf_ ? -1 : 1);
502  int di = ((int)(hi) % kHGeomHalf_);
504  id.iSec1 = (di % sectors_);
505  di = (di - id.iSec1) / sectors_;
506  id.iLay = (di % layers_) + 1;
507  id.iType = ((di - id.iLay + 1) / layers_ == 0) ? -1 : 1;
508 #ifdef EDM_ML_DEBUG
509  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << hi << " O/P " << id.zSide << ":" << id.iType << ":" << id.iLay
510  << ":" << id.iSec1;
511 #endif
512  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
513  id.iCell1 = (di % cellMax_) + 1;
514  di = (di - id.iCell1 + 1) / cellMax_;
515  id.iSec1 = (di % sectors_) + 1;
516  di = (di - id.iSec1 + 1) / sectors_;
517  id.iLay = (di % layers_) + firstLay_;
518  id.iType = (di - id.iLay + firstLay_) / layers_;
519 #ifdef EDM_ML_DEBUG
520  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << hi << " O/P " << id.zSide << ":" << id.iType << ":"
521  << id.iLay << ":" << id.iSec1 << ":" << id.iCell1;
522 #endif
523  } else {
524  id.iSec2 = (di % waferMax_) - waferOff_;
525  di = (di - id.iSec2 - waferOff_) / waferMax_;
526  id.iSec1 = (di % waferMax_) - waferOff_;
527  di = (di - id.iSec1 - waferOff_) / waferMax_;
528  id.iLay = (di % layers_) + 1;
529  id.iType = (di - id.iLay + 1) / layers_;
530 #ifdef EDM_ML_DEBUG
531  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << hi << " O/P " << id.zSide << ":" << id.iType << ":"
532  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2;
533 #endif
534  }
535  }
536  return id;
537 }
HGCalGeometryMode::GeometryMode mode_
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:91
HGCalGeometryMode::GeometryMode HGCalTopology::geomMode ( ) const
inline

Geometry mode.

Definition at line 79 of file HGCalTopology.h.

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

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

79 { 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 41 of file HGCalTopology.h.

References changeXY().

Referenced by east().

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

References changeXY().

Referenced by north().

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

References changeXY().

Referenced by south().

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

References changeXY().

Referenced by west().

51 { return changeXY(id, -1, 0); }
DetId changeXY(const DetId &id, int nrStepsX, int nrStepsY) const
move the nagivator along x, y
bool HGCalTopology::isHFNose ( ) const
inline
bool HGCalTopology::maskCell ( const DetId id,
int  corners = 3 
) const
inline

Definition at line 94 of file HGCalTopology.h.

References dddConstants(), and HGCalDDDConstants::maskCell().

94 { return dddConstants().maskCell(id, corners); }
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
bool maskCell(const DetId &id, int corners) const
std::vector< DetId > HGCalTopology::neighbors ( const DetId id) const

Definition at line 56 of file HGCalTopology.cc.

References addHGCSCintillatorId(), addHGCSiliconId(), HGCalDDDConstants::BottomCorner, HGCalDDDConstants::BottomLeftCorner, HGCalDDDConstants::BottomLeftEdge, HGCalDDDConstants::BottomRightCorner, HGCalDDDConstants::BottomRightEdge, HGCalDDDConstants::cellType(), HGCalDDDConstants::CentralType, decode(), HGCalDDDConstants::getTypeHex(), HGCalDDDConstants::getUVMax(), hdcons_, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, photons_cff::ids, HGCalDDDConstants::LeftEdge, mode_, HGCalDDDConstants::modifyUV(), N, HGCalDDDConstants::RightEdge, RandomServiceHelper::t1, RandomServiceHelper::t2, HGCalDDDConstants::TopCorner, HGCalDDDConstants::TopLeftCorner, HGCalDDDConstants::TopLeftEdge, HGCalDDDConstants::TopRightCorner, HGCalDDDConstants::TopRightEdge, HGCalGeometryMode::Trapezoid, testProducerWithPsetDescEmpty_cfi::u1, and MetAnalyzer::u2.

Referenced by down().

56  {
57  std::vector<DetId> ids;
60  HGCalDDDConstants::CellType celltype = hdcons_.cellType(id.iType, id.iCell1, id.iCell2);
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HGCalGeom") << "Type:WaferU:WaferV " << id.iType << ":" << id.iCell1 << ":" << id.iCell2
63  << " CellType "
65 #endif
66  switch (celltype) {
68  // cell within the wafer
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HGCalGeom") << "Cell Type 0";
71 #endif
72  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
73  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
74  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
75  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
76  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
77  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
78  break;
79  }
81  // bottom left edge
82  int wu1(id.iSec1), wv1(id.iSec2 - 1);
83  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
84  int N1 = hdcons_.getUVMax(t1);
85  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("HGCalGeom") << "Cell Type 1 "
88  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1;
89 #endif
90  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
91  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
92  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 2 * N1 - 1, v1 + N1 - 1);
93  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 2 * N1 - 1, v1 + N1);
94  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
95  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
96  break;
97  }
99  // left edege
100  int wu1(id.iSec1 + 1), wv1(id.iSec2);
101  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
102  int N1 = hdcons_.getUVMax(t1);
103  int u1 = hdcons_.modifyUV(id.iCell1, id.iType, t1);
104 #ifdef EDM_ML_DEBUG
105  edm::LogVerbatim("HGCalGeom") << "Cell Type 2 "
106  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << u1;
107 #endif
108  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
109  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 + N1, 2 * N1 - 1);
110  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 + N1 - 1, 2 * N1 - 1);
111  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
112  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
113  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
114  break;
115  }
117  // top left edge
118  int wu1(id.iSec1 + 1), wv1(id.iSec2 + 1);
119  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
120  int N1 = hdcons_.getUVMax(t1);
121  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
122 #ifdef EDM_ML_DEBUG
123  edm::LogVerbatim("HGCalGeom") << "Cell Type 3 "
124  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1;
125 #endif
126  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, v1 + 1, v1 + N1);
127  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, v1, v1 + N1 - 1);
128  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
129  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
130  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
131  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
132  break;
133  }
135  // top right edge
136  int wu1(id.iSec1), wv1(id.iSec2 + 1);
137  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
138  int N1 = hdcons_.getUVMax(t1);
139  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
140 #ifdef EDM_ML_DEBUG
141  edm::LogVerbatim("HGCalGeom") << "Cell Type 4 "
142  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1;
143 #endif
144  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 0, v1 - N1);
145  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
146  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
147  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
148  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
149  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 0, v1 - N1 + 1);
150  break;
151  }
153  // right edge
154  int wu1(id.iSec1 - 1), wv1(id.iSec2);
155  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
156  int N1 = hdcons_.getUVMax(t1);
157  int u1 = hdcons_.modifyUV(id.iCell1, id.iType, t1);
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("HGCalGeom") << "Cell Type 5 "
160  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << u1;
161 #endif
162  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
163  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
164  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
165  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
166  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 - N1, 0);
167  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 - N1 + 1, 0);
168  break;
169  }
171  // bottom right edge
172  int wu1(id.iSec1 - 1), wv1(id.iSec2 - 1);
173  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
174  int N1 = hdcons_.getUVMax(t1);
175  int u1 = hdcons_.modifyUV(id.iCell1, id.iType, t1);
176 #ifdef EDM_ML_DEBUG
177  edm::LogVerbatim("HGCalGeom") << "Cell Type 6 "
178  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << u1;
179 #endif
180  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
181  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
182  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
183  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 + N1 - 1, u1 - 1);
184  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 + N1, u1);
185  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
186  break;
187  }
189  // bottom corner
190  int wu1(id.iSec1), wv1(id.iSec2 - 1);
191  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
192  int N1 = hdcons_.getUVMax(t1);
193  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
194  int wu2(id.iSec1 - 1), wv2(id.iSec2 - 1);
195  int t2 = hdcons_.getTypeHex(id.iLay, wu2, wv2);
196  int N2 = hdcons_.getUVMax(t2);
197  int u2 = hdcons_.modifyUV(id.iCell1, id.iType, t2);
198 #ifdef EDM_ML_DEBUG
199  edm::LogVerbatim("HGCalGeom") << "Cell Type 11 "
200  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1 << ":" << t2
201  << ":" << N2 << ":" << u2;
202 #endif
203  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
204  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
205  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 2 * N1 - 1, v1 + N1 - 1);
206  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 2 * N1 - 1, v1 + N1);
207  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 + N2, u2);
208  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
209  break;
210  }
212  // bottom left corner
213  int wu1(id.iSec1 + 1), wv1(id.iSec2);
214  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
215  int N1 = hdcons_.getUVMax(t1);
216  int u1 = hdcons_.modifyUV(id.iCell1, id.iType, t1);
217  int wu2(id.iSec1), wv2(id.iSec2 - 1);
218  int t2 = hdcons_.getTypeHex(id.iLay, wu2, wv2);
219  int N2 = hdcons_.getUVMax(t2);
220  int v2 = hdcons_.modifyUV(id.iCell2, id.iType, t2);
221 #ifdef EDM_ML_DEBUG
222  edm::LogVerbatim("HGCalGeom") << "Cell Type 12 "
223  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << u1 << ":" << t2
224  << ":" << N2 << ":" << v2;
225 #endif
226  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
227  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 + N1, 2 * N1 - 1);
228  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, 2 * N2 - 1, v2 + N2 - 1);
229  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, 2 * N2 - 1, v2 + N2);
230  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
231  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
232  break;
233  }
235  // top left corner
236  int wu1(id.iSec1 + 1), wv1(id.iSec2 + 1);
237  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
238  int N1 = hdcons_.getUVMax(t1);
239  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
240  int wu2(id.iSec1 + 1), wv2(id.iSec2);
241  int t2 = hdcons_.getTypeHex(id.iLay, wu2, wv2);
242  int N2 = hdcons_.getUVMax(t2);
243  int u2 = hdcons_.modifyUV(id.iCell1, id.iType, t2);
244 #ifdef EDM_ML_DEBUG
245  edm::LogVerbatim("HGCalGeom") << "Cell Type 13 "
246  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1 << ":" << t2
247  << ":" << N2 << ":" << u2;
248 #endif
249  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, v1 + 1, N1 + v1);
250  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, v1, N1 + v1 - 1);
251  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 + N2 - 1, 2 * N2 - 1);
252  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
253  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
254  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
255  break;
256  }
258  // top corner
259  int wu1(id.iSec1 + 1), wv1(id.iSec2 + 1);
260  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
261  int N1 = hdcons_.getUVMax(t1);
262  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
263  int wu2(id.iSec1), wv2(id.iSec2 + 1);
264  int t2 = hdcons_.getTypeHex(id.iLay, wu2, wv2);
265  int N2 = hdcons_.getUVMax(t2);
266  int v2 = hdcons_.modifyUV(id.iCell2, id.iType, t2);
267 #ifdef EDM_ML_DEBUG
268  edm::LogVerbatim("HGCalGeom") << "Cell Type 14 "
269  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1 << ":" << t2
270  << ":" << N2 << ":" << v2;
271 #endif
272  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, v1 + 1, v1 + N1);
273  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, v1, v1 + N1 - 1);
274  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
275  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
276  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 + 1);
277  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, 0, v2 - N2 + 1);
278  break;
279  }
281  // top right corner
282  int wu1(id.iSec1), wv1(id.iSec2 + 1);
283  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
284  int N1 = hdcons_.getUVMax(t1);
285  int v1 = hdcons_.modifyUV(id.iCell2, id.iType, t1);
286  int wu2(id.iSec1 - 1), wv2(id.iSec2);
287  int t2 = hdcons_.getTypeHex(id.iLay, wu2, wv2);
288  int N2 = hdcons_.getUVMax(t2);
289  int u2 = hdcons_.modifyUV(id.iCell1, id.iType, t2);
290 #ifdef EDM_ML_DEBUG
291  edm::LogVerbatim("HGCalGeom") << "Cell Type 15 "
292  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << v1 << ":" << t2
293  << ":" << N2 << ":" << u2;
294 #endif
295  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 0, v1 - N1);
296  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
297  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
298  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2);
299  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 - N2, 0);
300  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 - N2 + 1, 0);
301  break;
302  }
304  // bottom right corner
305  int wu1(id.iSec1 - 1), wv1(id.iSec2 - 1);
306  int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
307  int N1 = hdcons_.getUVMax(t1);
308  int u1 = hdcons_.modifyUV(id.iCell1, id.iType, t1);
309  int wu2(id.iSec1 - 1), wv2(id.iSec2);
310  int t2 = hdcons_.getTypeHex(id.iLay, wu2, wv2);
311  int N2 = hdcons_.getUVMax(t2);
312  int u2 = hdcons_.modifyUV(id.iCell1, id.iType, t2);
313 #ifdef EDM_ML_DEBUG
314  edm::LogVerbatim("HGCalGeom") << "Cell Type 16 "
315  << ":" << wu1 << ":" << wv1 << ":" << t1 << ":" << N1 << ":" << u1 << ":" << t2
316  << ":" << N2 << ":" << u2;
317 #endif
318  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2);
319  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2 - 1);
320  addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 - 1, id.iCell2 - 1);
321  addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 + N1 - 1, u1 - 1);
322  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 - N2, 0);
323  addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 - N2 + 1, 0);
324  break;
325  }
326  default:
327  // Not valid u, v
328  int N = hdcons_.getUVMax(id.iType);
329  edm::LogWarning("HGCalGeom") << "u:v " << id.iCell1 << ":" << id.iCell2 << " Tests " << (id.iCell1 > 2 * N - 1)
330  << ":" << (id.iCell2 > 2 * N - 1) << ":" << (id.iCell2 >= (id.iCell1 + N)) << ":"
331  << (id.iCell1 > (id.iCell2 + N)) << " ERROR";
332  }
333  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
334  int iphi1 = (id.iCell1 > 1) ? id.iCell1 - 1 : hdcons_.getUVMax(id.iType);
335  int iphi2 = (id.iCell1 < hdcons_.getUVMax(id.iType)) ? id.iCell1 + 1 : 1;
336  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1 - 1, id.iCell1);
337  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1 - 1, iphi1);
338  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1, iphi1);
339  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1 + 1, iphi1);
340  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1 + 1, id.iCell1);
341  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1 + 1, iphi2);
342  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1, iphi2);
343  addHGCSCintillatorId(ids, id.zSide, id.iType, id.iLay, id.iSec1 - 1, iphi2);
344  }
345  return ids;
346 }
type
Definition: HCALResponse.h:21
HGCalGeometryMode::GeometryMode mode_
int getTypeHex(int layer, int waferU, int waferV) const
void addHGCSCintillatorId(std::vector< DetId > &ids, int zside, int type, int lay, int iradius, int iphi) const
add DetId of Scintillator and Silicon type if valid
CellType cellType(int type, int waferU, int waferV) const
const HGCalDDDConstants & hdcons_
DecodedDetId decode(const DetId &id) const
#define N
Definition: blowfish.cc:9
void addHGCSiliconId(std::vector< DetId > &ids, int det, int zside, int type, int lay, int waferU, int waferV, int cellU, int cellV) const
int modifyUV(int uv, int type1, int type2) const
int getUVMax(int type) const
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 22 of file HGCalTopology.h.

References goNorth().

22  {
23  DetId nextId = goNorth(id);
24  std::vector<DetId> vNeighborsDetId;
25  if (!(nextId == DetId(0)))
26  vNeighborsDetId.emplace_back(nextId);
27  return vNeighborsDetId;
28  }
DetId goNorth(const DetId &id) const override
move the Topology north (increment iy)
Definition: HGCalTopology.h:21
Definition: DetId.h:17
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 479 of file HGCalTopology.cc.

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

Referenced by dddConstants().

479  {
480  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)) {
481  DetId id = changeXY(startId, nrStepsX, nrStepsY);
482  if (valid(id))
483  return id;
484  }
485  return DetId(0);
486 }
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:48
ForwardSubdetector subdet_
Definition: DetId.h:17
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:46
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 32 of file HGCalTopology.h.

References goSouth().

32  {
33  DetId nextId = goSouth(id);
34  std::vector<DetId> vNeighborsDetId;
35  if (!(nextId == DetId(0)))
36  vNeighborsDetId.emplace_back(nextId);
37  return vNeighborsDetId;
38  }
Definition: DetId.h:17
DetId goSouth(const DetId &id) const override
move the Topology south (decrement iy)
Definition: HGCalTopology.h:31
ForwardSubdetector HGCalTopology::subDetector ( ) const
inline

Definition at line 116 of file HGCalTopology.h.

References subdet_.

Referenced by HGCalGeometryLoader::build().

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

Definition at line 488 of file HGCalTopology.cc.

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

Referenced by dddConstants().

488  {
489  HGCalTopology::DecodedDetId id_ = decode(startId);
490  id_.zSide = -id_.zSide;
491  DetId id = encode(id_);
492  if (valid(id))
493  return id;
494  else
495  return DetId(0);
496 }
DetId encode(const DecodedDetId &id_) const
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:17
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 90 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by HGCalGeometry::HGCalGeometry().

90 { 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 60 of file HGCalTopology.h.

References changeZ().

60  {
61  DetId nextId = changeZ(id, +1);
62  std::vector<DetId> vNeighborsDetId;
63  if (!(nextId == DetId(0)))
64  vNeighborsDetId.emplace_back(nextId);
65  return vNeighborsDetId;
66  }
DetId changeZ(const DetId &id, int nrStepsZ) const
move the nagivator along z
Definition: DetId.h:17
bool HGCalTopology::valid ( const DetId id) const
overridevirtual

Is this a valid cell id.

Reimplemented from CaloSubdetectorTopology.

Definition at line 463 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 HGCDigitizer::checkPosition(), geomMode(), HGCalGeometry::newCell(), offsetBy(), switchZSide(), HGCalTriggerGeometryV9Imp2::validCellId(), HGCalTriggerGeometryHexImp2::validCellId(), HGCalTriggerGeometryHexLayerBasedImp1::validCellId(), and HGCalTriggerGeometryV9Imp1::validCellId().

463  {
465  bool flag;
467  flag = (idin.det() == det_ && idin.subdetId() == (int)(subdet_) && id.iCell1 >= 0 && id.iCell1 < cells_ &&
468  id.iLay > 0 && id.iLay <= layers_ && id.iSec1 >= 0 && id.iSec1 <= sectors_);
469  if (flag)
470  flag = hdcons_.isValidHex(id.iLay, id.iSec1, id.iCell1, true);
471  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
472  flag = ((idin.det() == det_) && hdcons_.isValidTrap(id.iLay, id.iSec1, id.iCell1));
473  } else {
474  flag = ((idin.det() == det_) && hdcons_.isValidHex8(id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2));
475  }
476  return flag;
477 }
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 88 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by denseId2detId().

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

References goWest().

52  {
53  DetId nextId = goWest(id);
54  std::vector<DetId> vNeighborsDetId;
55  if (!(nextId == DetId(0)))
56  vNeighborsDetId.emplace_back(nextId);
57  return vNeighborsDetId;
58  }
Definition: DetId.h:17
DetId goWest(const DetId &id) const override
move the Topology west (negative ix)
Definition: HGCalTopology.h:51

Member Data Documentation

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

Definition at line 140 of file HGCalTopology.h.

Referenced by HGCalTopology(), and valid().

DetId::Detector HGCalTopology::det_
private

Definition at line 138 of file HGCalTopology.h.

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

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

Definition at line 142 of file HGCalTopology.h.

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

unsigned int HGCalTopology::kSizeForDenseIndexing
private

Definition at line 143 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 139 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 104 of file HGCalTopology.h.

int HGCalTopology::types_
private

Definition at line 140 of file HGCalTopology.h.

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

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