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

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
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

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 651 of file HGCalTopology.cc.

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

Referenced by isHFNose(), and neighbors().

653  {
654 #ifdef EDM_ML_DEBUG
655  edm::LogVerbatim("HGCalGeom") << "addHGCSCintillatorId " << zside << ":"
656  << type << ":" << lay << ":" << iradius << ":"
657  << iphi << " ==> Validity "
658  << hdcons_.isValidTrap(lay,iradius,iphi);
659 #endif
660  if (hdcons_.isValidTrap(lay,iradius,iphi)) {
661  HGCScintillatorDetId id(type,lay,zside*iradius,iphi);
662  ids.emplace_back(DetId(id));
663  }
664 }
type
Definition: HCALResponse.h:21
bool isValidTrap(int lay, int ieta, int iphi) const
int zside(DetId const &)
const HGCalDDDConstants & hdcons_
Definition: DetId.h:18
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 666 of file HGCalTopology.cc.

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

Referenced by isHFNose(), and neighbors().

668  {
669 #ifdef EDM_ML_DEBUG
670  edm::LogVerbatim("HGCalGeom") << "addHGCSiliconId " << det << ":" << zside
671  << ":" << type << ":" << lay << ":" << waferU
672  << ":" << waferV << ":" << cellU << ":"
673  << cellV << " ==> Validity "
674  << hdcons_.isValidHex8(lay,waferU,waferV,cellU,cellV);
675 #endif
676  if (hdcons_.isValidHex8(lay,waferU,waferV,cellU,cellV)) {
677  HGCSiliconDetId id((DetId::Detector)(det),zside,type,lay,waferU,waferV,
678  cellU,cellV);
679  ids.emplace_back(DetId(id));
680  }
681 }
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:18
Detector
Definition: DetId.h:26
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 747 of file HGCalTopology.cc.

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

748  {
749 
750  return DetId();
751 }
Definition: DetId.h:18
DetId HGCalTopology::changeZ ( const DetId id,
int  nrStepsZ 
) const
private

move the nagivator along z

Definition at line 754 of file HGCalTopology.cc.

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

754  {
755 
756  return DetId();
757 }
Definition: DetId.h:18
const HGCalDDDConstants& HGCalTopology::dddConstants ( ) const
inline

Definition at line 107 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(), HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell(), HGCalGeometry::getNewCorners(), HGCalGeometry::getPosition(), HGCalGeometry::getSummary(), HGCalTriggerGeometryHexLayerBasedImp1::initialize(), HGCalTriggerGeometryV9Imp1::initialize(), HGCalTriggerGeometryV9Imp2::initialize(), hgcal::RecHitTools::maskCell(), maskCell(), HGCalGeometry::neighborZ(), HGCalGeometry::newCell(), HGCalTriggerTools::sensorCellThicknessV8(), HGCalRecHitWorkerSimple::set(), HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::setGeometry(), and HGCalTriggerTools::simToReco().

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

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

683  {
684 
686  if ((mode_ == HGCalGeometryMode::Hexagon) ||
688  HGCalDetId id(startId);
689  idx.iCell1 = id.cell();
690  idx.iCell2 = 0;
691  idx.iLay = id.layer();
692  idx.iSec1 = id.wafer();
693  idx.iSec2 = 0;
694  idx.iType = id.waferType();
695  idx.zSide = id.zside();
696  idx.det = id.subdetId();
697  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
698  HGCScintillatorDetId id(startId);
699  idx.iCell1 = id.iphi();
700  idx.iCell2 = 0;
701  idx.iLay = id.layer();
702  idx.iSec1 = id.ietaAbs();
703  idx.iSec2 = 0;
704  idx.iType = id.type();
705  idx.zSide = id.zside();
706  idx.det = (int)(id.subdet());
708  HFNoseDetId id(startId);
709  idx.iCell1 = id.cellU();
710  idx.iCell2 = id.cellV();
711  idx.iLay = id.layer();
712  idx.iSec1 = id.waferU();
713  idx.iSec2 = id.waferV();
714  idx.iType = id.type();
715  idx.zSide = id.zside();
716  idx.det = (int)(id.subdet());
717  } else {
718  HGCSiliconDetId id(startId);
719  idx.iCell1 = id.cellU();
720  idx.iCell2 = id.cellV();
721  idx.iLay = id.layer();
722  idx.iSec1 = id.waferU();
723  idx.iSec2 = id.waferV();
724  idx.iType = id.type();
725  idx.zSide = id.zside();
726  idx.det = (int)(id.subdet());
727  }
728  return idx;
729 }
HGCalGeometryMode::GeometryMode mode_
DetId::Detector det_
ForwardSubdetector subdet_
DetId HGCalTopology::denseId2detId ( uint32_t  denseId) const
override

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

468  {
469 
471  if (validHashIndex(hi)) {
472  id.zSide = ((int)(hi)<kHGhalf_ ? -1 : 1);
473  int di = ((int)(hi)%kHGhalf_);
474  if ((mode_ == HGCalGeometryMode::Hexagon) ||
476  int type = (di%types_);
477  id.iType = (type == 0 ? -1 : 1);
478  id.iSec1 = (((di-type)/types_)%sectors_);
479  id.iLay = (((((di-type)/types_)-id.iSec1+1)/sectors_)%layers_+1);
480  id.iCell1= (((((di-type)/types_)-id.iSec1+1)/sectors_-id.iLay+1)/layers_+1);
481 #ifdef EDM_ML_DEBUG
482  edm::LogVerbatim("HGCalGeom") << "Input Hex " << hi << " o/p " << id.zSide
483  << ":" << id.iLay << ":" << id.iType
484  << ":" << id.iSec1 << ":" << id.iCell1;
485 #endif
486  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
487  int type = (di%types_);
488  id.iType = type;
489  id.iSec1 = (((di-type)/types_)%sectors_)+1;
490  id.iLay = (((((di-type)/types_)-id.iSec1+1)/sectors_)%layers_+firstLay_);
491  id.iCell1= (((((di-type)/types_)-id.iSec1+1)/sectors_-id.iLay+firstLay_)/layers_+1);
492 #ifdef EDM_ML_DEBUG
493  edm::LogVerbatim("HGCalGeom") << "Input Trap " << hi << " o/p " << id.zSide
494  << ":" << id.iLay << ":" << id.iType
495  << ":" << id.iSec1 << ":" << id.iCell1;
496 #endif
497  } else {
498  int type = (di%types_);
499  id.iType = type;
500  di = (di-type)/types_;
501  id.iSec2 = (di%waferMax_)-waferOff_;
502  di = (di-id.iSec2-waferOff_)/waferMax_;
503  id.iSec1 = (di%waferMax_)-waferOff_;
504  di = (di-id.iSec1-waferOff_)/waferMax_;
505  id.iLay = (di%layers_)+1;
506  di = (di-id.iLay+1)/layers_;
507  id.iCell2 = (di%cellMax_);
508  id.iCell1 = (di-id.iCell2)/cellMax_;
509 #ifdef EDM_ML_DEBUG
510  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << hi << " o/p " << id.zSide
511  << ":" << id.iLay << ":" << id.iType
512  << ":" << id.iSec1 << ":" << id.iSec2
513  << ":" << id.iCell1 << ":" << id.iCell2;
514 #endif
515  }
516  }
517  return encode(id);
518 }
type
Definition: HCALResponse.h:21
bool validHashIndex(uint32_t ix) const
Definition: HGCalTopology.h:97
HGCalGeometryMode::GeometryMode mode_
DetId encode(const DecodedDetId &id_) const
DetId::Detector HGCalTopology::detector ( ) const
inline

Definition at line 127 of file HGCalTopology.h.

References det_.

Referenced by HGCalGeometryLoader::build().

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

Definition at line 129 of file HGCalTopology.h.

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

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

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

520  {
521 
523  uint32_t idx;
524  if ((mode_ == HGCalGeometryMode::Hexagon) ||
526  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
527  (id.iLay-1)*sectors_+id.iSec1);
528 #ifdef EDM_ML_DEBUG
529  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << id.zSide << ":"
530  << id.iLay << ":" << id.iSec1 << ":"
531  << id.iType << " Constants " << kHGeomHalf_
532  << ":" << layers_ << ":" << sectors_
533  << " o/p " << idx;
534 #endif
535  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
536  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
537  (((id.iLay-firstLay_)*sectors_+id.iSec1-1)*cellMax_+
538  id.iCell1-1));
539 #ifdef EDM_ML_DEBUG
540  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << id.zSide << ":"
541  << id.iLay << ":" << id.iSec1 << ":"
542  << id.iCell1 << ":" << id.iType
543  << " Constants " << kHGeomHalf_ << ":"
544  << layers_ << ":" << firstLay_ << ":"
545  << sectors_ << ":" << cellMax_
546  << " o/p " << idx;
547 #endif
548  } else {
549  idx = (uint32_t)(((id.zSide > 0) ? kHGeomHalf_ : 0) +
550  (((id.iLay-1)*waferMax_+id.iSec1+waferOff_)*waferMax_+
551  id.iSec2+waferOff_));
552 #ifdef EDM_ML_DEBUG
553  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << id.zSide << ":"
554  << id.iLay << ":" << id.iSec1 << ":"
555  << id.iSec2 << ":" << id.iType
556  << " Constants " << kHGeomHalf_ << ":"
557  << layers_ << ":" << waferMax_ << ":"
558  << waferOff_ << " o/p " << idx;
559 #endif
560  }
561  return idx;
562 }
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 420 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().

420  {
421 
423  uint32_t idx;
424  if ((mode_ == HGCalGeometryMode::Hexagon) ||
426  int type = (id.iType > 0) ? 1 : 0;
427  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
428  ((((id.iCell1-1)*layers_+id.iLay-1)*sectors_+
429  id.iSec1)*types_+type));
430 #ifdef EDM_ML_DEBUG
431  edm::LogVerbatim("HGCalGeom") << "Input Hex " << id.zSide << ":" << id.iLay
432  << ":" << id.iSec1 << ":" << id.iCell1
433  << ":" << id.iType << " Constants "
434  << kHGeomHalf_ << ":" << layers_ << ":"
435  << sectors_ << ":" << types_<< " o/p "
436  << idx;
437 #endif
438  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
439  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
440  ((((id.iCell1-1)*layers_+id.iLay-firstLay_)*sectors_+
441  id.iSec1-1)*types_+id.iType));
442 #ifdef EDM_ML_DEBUG
443  edm::LogVerbatim("HGCalGeom") << "Input Trap " << id.zSide << ":" << id.iLay
444  << ":" << id.iSec1 << ":" << id.iCell1
445  << ":" << id.iType << " Constants "
446  << kHGeomHalf_ << ":" << layers_ << ":"
447  << sectors_ << ":" << types_<< " o/p "
448  << idx;
449 #endif
450  } else {
451  idx = (uint32_t)(((id.zSide > 0) ? kHGhalf_ : 0) +
452  (((((id.iCell1*cellMax_+id.iCell2)*layers_+
453  id.iLay-1)*waferMax_+id.iSec1+waferOff_)*
454  waferMax_+id.iSec2+waferOff_)*types_+id.iType));
455 #ifdef EDM_ML_DEBUG
456  edm::LogVerbatim("HGCalGeom") << "Input Hex8 " << id.zSide << ":" << id.iLay
457  << ":" << id.iSec1 << ":" << id.iSec2 << ":"
458  << id.iCell1 << ":" << id.iCell2 << ":"
459  << id.iType << " Constants " << kHGeomHalf_
460  << ":" << cellMax_ << ":" << layers_ << ":"
461  << waferMax_ << ":" << waferOff_ << ":"
462  << types_<< " o/p " << idx;
463 #endif
464  }
465  return idx;
466 }
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(), and neighbors().

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

731  {
732 
733  DetId id;
736  id = HGCalDetId((ForwardSubdetector)(idx.det),idx.zSide,idx.iLay,((idx.iType > 0) ? 1 : 0),idx.iSec1,idx.iCell1).rawId();
737  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
738  id = HGCScintillatorDetId(idx.iType,idx.iLay,idx.zSide*idx.iSec1,idx.iCell1).rawId();
740  id = HFNoseDetId(idx.zSide,idx.iType,idx.iLay,idx.iSec1,idx.iSec2,idx.iCell1,idx.iCell2).rawId();
741  } else {
742  id = HGCSiliconDetId((DetId::Detector)(idx.det),idx.zSide,idx.iType,idx.iLay,idx.iSec1,idx.iSec2,idx.iCell1,idx.iCell2).rawId();
743  }
744  return id;
745 }
HGCalGeometryMode::GeometryMode mode_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
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 603 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().

603  {
604 
606  if (hi < totalGeomModules()) {
607  id.zSide = ((int)(hi)<kHGeomHalf_ ? -1 : 1);
608  int di = ((int)(hi)%kHGeomHalf_);
609  if ((mode_ == HGCalGeometryMode::Hexagon) ||
611  id.iSec1 = (di%sectors_);
612  di = (di-id.iSec1)/sectors_;
613  id.iLay = (di%layers_)+1;
614  id.iType = ((di-id.iLay+1)/layers_ == 0) ? -1 : 1;
615 #ifdef EDM_ML_DEBUG
616  edm::LogVerbatim("HGCalGeom") << "Geom Hex I/P " << hi << " O/P "
617  << id.zSide << ":" << id.iType << ":"
618  << id.iLay << ":" << id.iSec1;
619 #endif
620  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
621  id.iCell1 = (di%cellMax_)+1;
622  di = (di-id.iCell1+1)/cellMax_;
623  id.iSec1 = (di%sectors_)+1;
624  di = (di-id.iSec1+1)/sectors_;
625  id.iLay = (di%layers_) + firstLay_;
626  id.iType = (di-id.iLay+firstLay_)/layers_;
627 #ifdef EDM_ML_DEBUG
628  edm::LogVerbatim("HGCalGeom") << "Geom Trap I/P " << hi << " O/P "
629  << id.zSide << ":" << id.iType << ":"
630  << id.iLay << ":" << id.iSec1 << ":"
631  << id.iCell1;
632 #endif
633  } else {
634  id.iSec2 = (di%waferMax_)-waferOff_;
635  di = (di-id.iSec2-waferOff_)/waferMax_;
636  id.iSec1 = (di%waferMax_)-waferOff_;
637  di = (di-id.iSec1-waferOff_)/waferMax_;
638  id.iLay = (di%layers_)+1;
639  id.iType = (di-id.iLay+1)/layers_;
640 #ifdef EDM_ML_DEBUG
641  edm::LogVerbatim("HGCalGeom") << "Geom Hex8 I/P " << hi << " O/P "
642  << id.zSide << ":" << id.iType << ":"
643  << id.iLay << ":" << id.iSec1 << ":"
644  << id.iSec2;
645 #endif
646  }
647  }
648  return id;
649 }
HGCalGeometryMode::GeometryMode mode_
unsigned int totalGeomModules() const
HGCalGeometryMode::GeometryMode HGCalTopology::geomMode ( ) const
inline

Geometry mode.

Definition at line 88 of file HGCalTopology.h.

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

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

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

move the Topology east (positive ix)

Reimplemented from CaloSubdetectorTopology.

Definition at line 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
bool HGCalTopology::maskCell ( const DetId id,
int  corners = 3 
) const
inline

Definition at line 103 of file HGCalTopology.h.

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

103  {
104  return dddConstants().maskCell(id, corners);
105  }
const HGCalDDDConstants & dddConstants() const
bool maskCell(const DetId &id, int corners) const
std::vector< DetId > HGCalTopology::neighbors ( const DetId id) const

Definition at line 63 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, HGCalDDDConstants::LeftEdge, mode_, HGCalDDDConstants::modifyUV(), N, HGCalDDDConstants::RightEdge, HGCalDDDConstants::TopCorner, HGCalDDDConstants::TopLeftCorner, HGCalDDDConstants::TopLeftEdge, HGCalDDDConstants::TopRightCorner, HGCalDDDConstants::TopRightEdge, HGCalGeometryMode::Trapezoid, MetAnalyzer::u1, and MetAnalyzer::u2.

Referenced by down().

63  {
64  std::vector<DetId> ids;
68  HGCalDDDConstants::CellType celltype = hdcons_.cellType(id.iType,id.iCell1,
69  id.iCell2);
70 #ifdef EDM_ML_DEBUG
71  edm::LogVerbatim("HGCalGeom") << "Type:WaferU:WaferV " << id.iType << ":"
72  << id.iCell1 << ":" << id.iCell2
73  << " CellType " << static_cast<std::underlying_type<HGCalDDDConstants::CellType>::type>(celltype);
74 #endif
75  switch (celltype) {
77  // cell within the wafer
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("HGCalGeom") << "Cell Type 0";
80 #endif
81  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
82  id.iCell1+1,id.iCell2);
83  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
84  id.iCell1,id.iCell2-1);
85  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
86  id.iCell1-1,id.iCell2-1);
87  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
88  id.iCell1-1,id.iCell2);
89  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
90  id.iCell1,id.iCell2+1);
91  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
92  id.iCell1+1,id.iCell2+1);
93  break;
94  }
96  // bottom left edge
97  int wu1(id.iSec1), wv1(id.iSec2-1);
98  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
99  int N1 = hdcons_.getUVMax(t1);
100  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
101 #ifdef EDM_ML_DEBUG
102  edm::LogVerbatim("HGCalGeom") << "Cell Type 1 " << ":" << wu1 << ":"
103  << wv1 << ":" << t1 << ":" << N1 << ":"
104  << v1;
105 #endif
106  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
107  id.iCell1+1,id.iCell2);
108  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
109  id.iCell1,id.iCell2-1);
110  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,2*N1-1,v1+N1-1);
111  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,2*N1-1,v1+N1);
112  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
113  id.iCell1,id.iCell2+1);
114  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
115  id.iCell1+1,id.iCell2+1);
116  break;
117  }
119  // left edege
120  int wu1(id.iSec1+1), wv1(id.iSec2);
121  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
122  int N1 = hdcons_.getUVMax(t1);
123  int u1 = hdcons_.modifyUV(id.iCell1,id.iType,t1);
124 #ifdef EDM_ML_DEBUG
125  edm::LogVerbatim("HGCalGeom") << "Cell Type 2 " << ":" << wu1 << ":"
126  << wv1 << ":" << t1 << ":" << N1 << ":"
127  << u1;
128 #endif
129  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
130  id.iCell1+1,id.iCell2);
131  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1+N1, 2*N1-1);
132  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1+N1-1,2*N1-1);
133  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
134  id.iCell1-1,id.iCell2);
135  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
136  id.iCell1,id.iCell2+1);
137  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
138  id.iCell1+1,id.iCell2+1);
139  break;
140  }
142  // top left edge
143  int wu1(id.iSec1+1), wv1(id.iSec2+1);
144  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
145  int N1 = hdcons_.getUVMax(t1);
146  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
147 #ifdef EDM_ML_DEBUG
148  edm::LogVerbatim("HGCalGeom") << "Cell Type 3 " << ":" << wu1 << ":"
149  << wv1 << ":" << t1 << ":" << N1 << ":"
150  << v1;
151 #endif
152  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,v1+1,v1+N1);
153  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,v1,v1+N1-1);
154  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
155  id.iCell1-1,id.iCell2-1);
156  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
157  id.iCell1-1,id.iCell2);
158  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
159  id.iCell1,id.iCell2+1);
160  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
161  id.iCell1+1,id.iCell2+1);
162  break;
163  }
165  // top right edge
166  int wu1(id.iSec1), wv1(id.iSec2+1);
167  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
168  int N1 = hdcons_.getUVMax(t1);
169  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
170 #ifdef EDM_ML_DEBUG
171  edm::LogVerbatim("HGCalGeom") << "Cell Type 4 " << ":" << wu1 << ":"
172  << wv1 << ":" << t1 << ":" << N1 << ":"
173  << v1;
174 #endif
175  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,0,v1-N1);
176  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
177  id.iCell1,id.iCell2-1);
178  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
179  id.iCell1-1,id.iCell2-1);
180  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
181  id.iCell1-1,id.iCell2);
182  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
183  id.iCell1,id.iCell2+1);
184  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,0,v1-N1+1);
185  break;
186  }
188  // right edge
189  int wu1(id.iSec1-1), wv1(id.iSec2);
190  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
191  int N1 = hdcons_.getUVMax(t1);
192  int u1 = hdcons_.modifyUV(id.iCell1,id.iType,t1);
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("HGCalGeom") << "Cell Type 5 " << ":" << wu1 << ":"
195  << wv1 << ":" << t1 << ":" << N1 << ":"
196  << u1;
197 #endif
198  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
199  id.iCell1+1,id.iCell2);
200  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
201  id.iCell1,id.iCell2-1);
202  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
203  id.iCell1-1,id.iCell2-1);
204  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
205  id.iCell1-1,id.iCell2);
206  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1-N1,0);
207  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1-N1+1,0);
208  break;
209  }
211  // bottom right edge
212  int wu1(id.iSec1-1), wv1(id.iSec2-1);
213  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
214  int N1 = hdcons_.getUVMax(t1);
215  int u1 = hdcons_.modifyUV(id.iCell1,id.iType,t1);
216 #ifdef EDM_ML_DEBUG
217  edm::LogVerbatim("HGCalGeom") << "Cell Type 6 " << ":" << wu1 << ":"
218  << wv1 << ":" << t1 << ":" << N1 << ":"
219  << u1;
220 #endif
221  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
222  id.iCell1+1,id.iCell2);
223  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
224  id.iCell1,id.iCell2-1);
225  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
226  id.iCell1-1,id.iCell2-1);
227  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1+N1-1,u1-1);
228  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1+N1,u1);
229  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
230  id.iCell1+1,id.iCell2+1);
231  break;
232  }
234  // bottom corner
235  int wu1(id.iSec1), wv1(id.iSec2-1);
236  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
237  int N1 = hdcons_.getUVMax(t1);
238  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
239  int wu2(id.iSec1-1), wv2(id.iSec2-1);
240  int t2 = hdcons_.getTypeHex(id.iLay,wu2,wv2);
241  int N2 = hdcons_.getUVMax(t2);
242  int u2 = hdcons_.modifyUV(id.iCell1,id.iType,t2);
243 #ifdef EDM_ML_DEBUG
244  edm::LogVerbatim("HGCalGeom") << "Cell Type 11 " << ":" << wu1 << ":"
245  << wv1 << ":" << t1 << ":" << N1 << ":"
246  << v1 << ":" << t2 << ":" << N2 << ":"
247  << u2;
248 #endif
249  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
250  id.iCell1+1,id.iCell2);
251  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
252  id.iCell1,id.iCell2-1);
253  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,2*N1-1,v1+N1-1);
254  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,2*N1-1,v1+N1);
255  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,u2+N2,u2);
256  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
257  id.iCell1+1,id.iCell2+1);
258  break;
259  }
261  // bottom left corner
262  int wu1(id.iSec1+1), wv1(id.iSec2);
263  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
264  int N1 = hdcons_.getUVMax(t1);
265  int u1 = hdcons_.modifyUV(id.iCell1,id.iType,t1);
266  int wu2(id.iSec1), wv2(id.iSec2-1);
267  int t2 = hdcons_.getTypeHex(id.iLay,wu2,wv2);
268  int N2 = hdcons_.getUVMax(t2);
269  int v2 = hdcons_.modifyUV(id.iCell2,id.iType,t2);
270 #ifdef EDM_ML_DEBUG
271  edm::LogVerbatim("HGCalGeom") << "Cell Type 12 " << ":" << wu1 << ":"
272  << wv1 << ":" << t1 << ":" << N1 << ":"
273  << u1 << ":" << t2 << ":" << N2 << ":"
274  << v2;
275 #endif
276  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
277  id.iCell1+1,id.iCell2);
278  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1+N1,2*N1-1);
279  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,2*N2-1,v2+N2-1);
280  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,2*N2-1,v2+N2);
281  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
282  id.iCell1,id.iCell2+1);
283  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
284  id.iCell1+1,id.iCell2+1);
285  break;
286  }
288  // top left corner
289  int wu1(id.iSec1+1), wv1(id.iSec2+1);
290  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
291  int N1 = hdcons_.getUVMax(t1);
292  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
293  int wu2(id.iSec1+1), wv2(id.iSec2);
294  int t2 = hdcons_.getTypeHex(id.iLay,wu2,wv2);
295  int N2 = hdcons_.getUVMax(t2);
296  int u2 = hdcons_.modifyUV(id.iCell1,id.iType,t2);
297 #ifdef EDM_ML_DEBUG
298  edm::LogVerbatim("HGCalGeom") << "Cell Type 13 " << ":" << wu1 << ":"
299  << wv1 << ":" << t1 << ":" << N1 << ":"
300  << v1 << ":" << t2 << ":" << N2 << ":"
301  << u2;
302 #endif
303  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,v1+1,N1+v1);
304  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,v1,N1+v1-1);
305  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,u2+N2-1,2*N2-1);
306  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
307  id.iCell1-1,id.iCell2);
308  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
309  id.iCell1,id.iCell2+1);
310  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
311  id.iCell1+1,id.iCell2+1);
312  break;
313  }
315  // top corner
316  int wu1(id.iSec1+1), wv1(id.iSec2+1);
317  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
318  int N1 = hdcons_.getUVMax(t1);
319  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
320  int wu2(id.iSec1), wv2(id.iSec2+1);
321  int t2 = hdcons_.getTypeHex(id.iLay,wu2,wv2);
322  int N2 = hdcons_.getUVMax(t2);
323  int v2 = hdcons_.modifyUV(id.iCell2,id.iType,t2);
324 #ifdef EDM_ML_DEBUG
325  edm::LogVerbatim("HGCalGeom") << "Cell Type 14 " << ":" << wu1 << ":"
326  << wv1 << ":" << t1 << ":" << N1 << ":"
327  << v1 << ":" << t2 << ":" << N2 << ":"
328  << v2;
329 #endif
330  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,v1+1,v1+N1);
331  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,v1,v1+N1-1);
332  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
333  id.iCell1-1,id.iCell2-1);
334  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
335  id.iCell1-1,id.iCell2);
336  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
337  id.iCell1,id.iCell2+1);
338  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,0,v2-N2+1);
339  break;
340  }
342  // top right corner
343  int wu1(id.iSec1), wv1(id.iSec2+1);
344  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
345  int N1 = hdcons_.getUVMax(t1);
346  int v1 = hdcons_.modifyUV(id.iCell2,id.iType,t1);
347  int wu2(id.iSec1-1), wv2(id.iSec2);
348  int t2 = hdcons_.getTypeHex(id.iLay,wu2,wv2);
349  int N2 = hdcons_.getUVMax(t2);
350  int u2 = hdcons_.modifyUV(id.iCell1,id.iType,t2);
351 #ifdef EDM_ML_DEBUG
352  edm::LogVerbatim("HGCalGeom") << "Cell Type 15 " << ":" << wu1 << ":"
353  << wv1 << ":" << t1 << ":" << N1 << ":"
354  << v1 << ":" << t2 << ":" << N2 << ":"
355  << u2;
356 #endif
357  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,0,v1-N1);
358  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
359  id.iCell1,id.iCell2-1);
360  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
361  id.iCell1-1,id.iCell2-1);
362  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
363  id.iCell1-1,id.iCell2);
364  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,u2-N2,0);
365  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,u2-N2+1,0);
366  break;
367  }
369  // bottom right corner
370  int wu1(id.iSec1-1), wv1(id.iSec2-1);
371  int t1 = hdcons_.getTypeHex(id.iLay,wu1,wv1);
372  int N1 = hdcons_.getUVMax(t1);
373  int u1 = hdcons_.modifyUV(id.iCell1,id.iType,t1);
374  int wu2(id.iSec1-1), wv2(id.iSec2);
375  int t2 = hdcons_.getTypeHex(id.iLay,wu2,wv2);
376  int N2 = hdcons_.getUVMax(t2);
377  int u2 = hdcons_.modifyUV(id.iCell1,id.iType,t2);
378 #ifdef EDM_ML_DEBUG
379  edm::LogVerbatim("HGCalGeom") << "Cell Type 16 " << ":" << wu1 << ":"
380  << wv1 << ":" << t1 << ":" << N1 << ":"
381  << u1 << ":" << t2 << ":" << N2 << ":"
382  << u2;
383 #endif
384  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
385  id.iCell1+1,id.iCell2);
386  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
387  id.iCell1,id.iCell2-1);
388  addHGCSiliconId(ids,id.det,id.zSide,id.iType,id.iLay,id.iSec1,id.iSec2,
389  id.iCell1-1,id.iCell2-1);
390  addHGCSiliconId(ids,id.det,id.zSide,t1,id.iLay,wu1,wv1,u1+N1-1,u1-1);
391  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,u2-N2,0);
392  addHGCSiliconId(ids,id.det,id.zSide,t2,id.iLay,wu2,wv2,u2-N2+1,0);
393  break;
394  }
395  default:
396  // Not valid u, v
397  int N = hdcons_.getUVMax(id.iType);
398  edm::LogWarning("HGCalGeom") << "u:v " << id.iCell1 << ":" << id.iCell2
399  << " Tests " << (id.iCell1 > 2*N-1) << ":"
400  << (id.iCell2 > 2*N-1) << ":"
401  << (id.iCell2 >= (id.iCell1+N)) << ":"
402  << (id.iCell1 > (id.iCell2+N)) << " ERROR";
403  }
404  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
405  int iphi1 = (id.iCell1 > 1) ? id.iCell1-1 : hdcons_.getUVMax(id.iType);
406  int iphi2 = (id.iCell1 < hdcons_.getUVMax(id.iType)) ? id.iCell1+1 : 1;
407  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1-1,id.iCell1);
408  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1-1,iphi1);
409  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1,iphi1);
410  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1+1,iphi1);
411  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1+1,id.iCell1);
412  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1+1,iphi2);
413  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1,iphi2);
414  addHGCSCintillatorId(ids,id.zSide,id.iType,id.iLay,id.iSec1-1,iphi2);
415  }
416  return ids;
417 }
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 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 584 of file HGCalTopology.cc.

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

Referenced by dddConstants().

585  {
586 
587  if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)){
588  DetId id = changeXY(startId,nrStepsX,nrStepsY);
589  if (valid(id)) return id;
590  }
591  return DetId(0);
592 }
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 128 of file HGCalTopology.h.

References subdet_.

Referenced by HGCalGeometryLoader::build().

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

Definition at line 594 of file HGCalTopology.cc.

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

Referenced by dddConstants().

594  {
595 
596  HGCalTopology::DecodedDetId id_ = decode(startId);
597  id_.zSide =-id_.zSide;
598  DetId id = encode(id_);
599  if (valid(id)) return id;
600  else return DetId(0);
601 }
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 99 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by HGCalGeometry::HGCalGeometry().

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

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

Implements CaloSubdetectorTopology.

Definition at line 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 564 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(), HGCalTriggerGeometryV9Imp2::validCellId(), HGCalTriggerGeometryHexImp2::validCellId(), HGCalTriggerGeometryHexLayerBasedImp1::validCellId(), and HGCalTriggerGeometryV9Imp1::validCellId().

564  {
565 
567  bool flag;
568  if ((mode_ == HGCalGeometryMode::Hexagon) ||
570  flag = (idin.det() == det_ && idin.subdetId() == (int)(subdet_) &&
571  id.iCell1 >= 0 && id.iCell1 < cells_ && id.iLay > 0 &&
572  id.iLay <= layers_ && id.iSec1 >= 0 && id.iSec1 <= sectors_);
573  if (flag) flag = hdcons_.isValidHex(id.iLay,id.iSec1,id.iCell1,true);
574  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
575  flag = ((idin.det() == det_) &&
576  hdcons_.isValidTrap(id.iLay,id.iSec1,id.iCell1));
577  } else {
578  flag = ((idin.det() == det_) &&
579  hdcons_.isValidHex8(id.iLay,id.iSec1,id.iSec2,id.iCell1,id.iCell2));
580  }
581  return flag;
582 }
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 97 of file HGCalTopology.h.

References kSizeForDenseIndexing.

Referenced by denseId2detId().

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

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

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

Referenced by HGCalTopology(), and valid().

DetId::Detector HGCalTopology::det_
private

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

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

unsigned int HGCalTopology::kSizeForDenseIndexing
private

Definition at line 156 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 152 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 115 of file HGCalTopology.h.

int HGCalTopology::types_
private

Definition at line 153 of file HGCalTopology.h.

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

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