CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
HGCalGeometry Class Referencefinal

#include <HGCalGeometry.h>

Inheritance diagram for HGCalGeometry:
CaloSubdetectorGeometry

Public Types

typedef HGCalGeometryRecord AlignedRecord
 
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< FlatHexagonCellVec
 
typedef std::vector< FlatTrdCellVec2
 
typedef std::vector< GlobalPointCornersVec
 
typedef std::set< DetIdDetIdSet
 
typedef PHGCalRcd PGeometryRecord
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
- Public Types inherited from CaloSubdetectorGeometry
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< std::shared_ptr< const CaloCellGeometry > > CellSet
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< CCGFloatDimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< CCGFloatTrVec
 

Public Member Functions

std::string cellElement () const
 
virtual void fillNamedParams (DDFilteredView fv)
 
DetIdSet getCells (const GlobalPoint &r, double dR) const override
 Get a list of all cells within a dR of the given cell. More...
 
DetId getClosestCell (const GlobalPoint &r) const override
 
CornersVec getCorners (const DetId &id) const
 Returns the corner points of this cell's volume. More...
 
std::shared_ptr< const CaloCellGeometrygetGeometry (const DetId &id) const override
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
GlobalPoint getPosition (const DetId &id) const
 
void getSummary (CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
 
const std::vector< DetId > & getValidDetIds (DetId::Detector det=DetId::Detector(0), int subdet=0) const override
 Get a list of valid detector ids (for the given subdetector) More...
 
const std::vector< DetId > & getValidGeomDetIds (void) const
 
 HGCalGeometry (const HGCalTopology &topology)
 
void initializeParms () override
 
void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
 
void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
 
bool present (const DetId &id) const override
 is this detid present in the geometry? More...
 
void sortDetIds ()
 
const HGCalTopologytopology () const
 
 ~HGCalGeometry () override
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
 CaloSubdetectorGeometry (const CaloSubdetectorGeometry &)=delete
 avoid copies More...
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
CCGFloat deltaEta (const DetId &detId) const
 
CCGFloat deltaPhi (const DetId &detId) const
 
virtual void fillDefaultNamedParameters () const
 
virtual CellSet getCellSet (const GlobalPoint &r, double dR) const
 
virtual unsigned int numberOfParametersPerShape () const
 
virtual unsigned int numberOfShapes () const
 
virtual unsigned int numberOfTransformParms () const
 
CaloSubdetectorGeometryoperator= (const CaloSubdetectorGeometry &)=delete
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects. More...
 

Static Public Member Functions

static std::string dbString ()
 
static std::string producerTag ()
 

Static Public Attributes

static unsigned int k_NumberOfParametersPerHex = 3
 
static unsigned int k_NumberOfParametersPerShape = 3
 
static unsigned int k_NumberOfParametersPerTrd = 12
 
static unsigned int k_NumberOfShapes = 100
 
static unsigned int k_NumberOfShapesTrd = 1000
 

Protected Member Functions

void addValidID (const DetId &id)
 
std::shared_ptr< const CaloCellGeometrycellGeomPtr (uint32_t index) const override
 
unsigned int getClosestCellIndex (const GlobalPoint &r) const
 
const CaloCellGeometrygetGeometryRawPtr (uint32_t index) const override
 
unsigned int indexFor (const DetId &id) const override
 
unsigned int sizeForDenseIndex () const
 
- Protected Member Functions inherited from CaloSubdetectorGeometry
void addValidID (const DetId &id)
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 

Private Member Functions

std::shared_ptr< const CaloCellGeometrycellGeomPtr (uint32_t index, const GlobalPoint &p) const
 
template<class T >
unsigned int getClosestCellIndex (const GlobalPoint &r, const std::vector< T > &vec) const
 

Private Attributes

CellVec m_cellVec
 
CellVec2 m_cellVec2
 
DetId::Detector m_det
 
ForwardSubdetector m_subdet
 
const HGCalTopologym_topology
 
std::vector< DetIdm_validGeomIds
 
HGCalGeometryMode::GeometryMode mode_
 
const double twoBysqrt3_
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static CCGFloat deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 
std::vector< DetIdm_validIds
 

Detailed Description

Definition at line 27 of file HGCalGeometry.h.

Member Typedef Documentation

Definition at line 40 of file HGCalGeometry.h.

Definition at line 33 of file HGCalGeometry.h.

typedef std::vector<FlatHexagon> HGCalGeometry::CellVec

Definition at line 31 of file HGCalGeometry.h.

typedef std::vector<FlatTrd> HGCalGeometry::CellVec2

Definition at line 32 of file HGCalGeometry.h.

typedef std::vector<GlobalPoint> HGCalGeometry::CornersVec

Definition at line 38 of file HGCalGeometry.h.

typedef std::set<DetId> HGCalGeometry::DetIdSet

Definition at line 37 of file HGCalGeometry.h.

Definition at line 41 of file HGCalGeometry.h.

Definition at line 34 of file HGCalGeometry.h.

Definition at line 35 of file HGCalGeometry.h.

Constructor & Destructor Documentation

HGCalGeometry::HGCalGeometry ( const HGCalTopology topology)

Definition at line 23 of file HGCalGeometry.cc.

References DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, m_topology, CaloSubdetectorGeometry::m_validIds, HGCalTopology::totalGeomModules(), and HGCalTopology::totalModules().

Referenced by dbString().

24  : m_topology( topology_ ),
25  m_validGeomIds( topology_.totalGeomModules()),
26  mode_( topology_.geomMode()),
27  m_det( topology_.detector()),
28  m_subdet( topology_.subDetector()),
29  twoBysqrt3_(2.0/std::sqrt(3.0)) {
30 
31  if (m_det == DetId::HGCalHSc) {
32  m_cellVec2 = CellVec2(topology_.totalGeomModules());
33  } else {
34  m_cellVec = CellVec(topology_.totalGeomModules());
35  }
37 #ifdef EDM_ML_DEBUG
38  edm::LogVerbatim("HGCalGeom") << "Expected total # of Geometry Modules "
40 #endif
41 }
std::vector< DetId > m_validGeomIds
HGCalGeometryMode::GeometryMode mode_
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:31
const HGCalTopology & m_topology
const double twoBysqrt3_
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< DetId > m_validIds
CellVec2 m_cellVec2
ForwardSubdetector m_subdet
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:32
unsigned int totalModules() const
Definition: HGCalTopology.h:97
DetId::Detector m_det
CellVec m_cellVec
HGCalGeometry::~HGCalGeometry ( )
override

Definition at line 43 of file HGCalGeometry.cc.

Referenced by dbString().

43 { }

Member Function Documentation

void HGCalGeometry::addValidID ( const DetId id)
protected

Definition at line 479 of file HGCalGeometry.cc.

Referenced by topology().

479  {
480  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
481 }
std::string HGCalGeometry::cellElement ( ) const

Definition at line 392 of file HGCalGeometry.cc.

References DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCEE, HGCHEB, HGCHEF, m_det, and m_subdet.

Referenced by producerTag().

392  {
393  if (m_subdet == HGCEE || m_det == DetId::HGCalEE) return "HGCalEE";
394  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi) return "HGCalHEFront";
395  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc) return "HGCalHEBack";
396  else return "Unknown";
397 }
ForwardSubdetector m_subdet
DetId::Detector m_det
std::shared_ptr< const CaloCellGeometry > HGCalGeometry::cellGeomPtr ( uint32_t  index) const
overrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 439 of file HGCalGeometry.cc.

References DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, and m_validGeomIds.

Referenced by cellGeomPtr(), getGeometry(), getSummary(), and topology().

439  {
440  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
441  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) ||
442  (m_validGeomIds[index].rawId() == 0)) return nullptr;
443  static const auto do_not_delete = [](const void*){};
444  if (m_det == DetId::HGCalHSc) {
445  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index],do_not_delete);
446  if (nullptr == cell->param()) return nullptr;
447  return cell;
448  } else {
449  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index],do_not_delete);
450  if (nullptr == cell->param()) return nullptr;
451  return cell;
452  }
453 }
std::vector< DetId > m_validGeomIds
CellVec2 m_cellVec2
DetId::Detector m_det
CellVec m_cellVec
std::shared_ptr< const CaloCellGeometry > HGCalGeometry::cellGeomPtr ( uint32_t  index,
const GlobalPoint p 
) const
private

Definition at line 455 of file HGCalGeometry.cc.

References cellGeomPtr(), DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, and m_validGeomIds.

455  {
456  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
457  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) ||
458  (m_validGeomIds[index].rawId() == 0)) return nullptr;
459  if (pos == GlobalPoint()) return cellGeomPtr(index);
460  if (m_det == DetId::HGCalHSc) {
461  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
462  cell->setPosition(pos);
463 #ifdef EDM_ML_DEBUG
464  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
465 #endif
466  if (nullptr == cell->param()) return nullptr;
467  return cell;
468  } else {
469  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
470  cell->setPosition(pos);
471 #ifdef EDM_ML_DEBUG
472  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
473 #endif
474  if (nullptr == cell->param()) return nullptr;
475  return cell;
476  }
477 }
std::vector< DetId > m_validGeomIds
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
CellVec2 m_cellVec2
DetId::Detector m_det
CellVec m_cellVec
static std::string HGCalGeometry::dbString ( )
inlinestatic
void HGCalGeometry::fillNamedParams ( DDFilteredView  fv)
virtual

Definition at line 45 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

45 {}
HGCalGeometry::DetIdSet HGCalGeometry::getCells ( const GlobalPoint r,
double  dR 
) const
overridevirtual

Get a list of all cells within a dR of the given cell.

The default implementation makes a loop over all cell geometries. Cleverer implementations are suggested to use rough conversions between eta/phi and ieta/iphi and test on the boundaries.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 387 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

387  {
389  return dss;
390 }
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:37
DetId HGCalGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 333 of file HGCalGeometry.cc.

References HGCalDDDConstants::assignCell(), HGCalDDDConstants::assignCellHex(), HGCalDDDConstants::assignCellTrap(), HGCalTopology::dddConstants(), HGCalTopology::decode(), HGCalTopology::encode(), getClosestCellIndex(), HGCalDDDConstants::getLayer(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, DetId::HGCalHSc, HGCalTopology::DecodedDetId::iCell1, HGCalTopology::DecodedDetId::iCell2, HGCalTopology::DecodedDetId::iLay, HGCalTopology::DecodedDetId::iSec1, HGCalTopology::DecodedDetId::iSec2, HGCalTopology::DecodedDetId::iType, DTRecHitClients_cfi::local, m_cellVec, m_cellVec2, m_det, m_topology, m_validGeomIds, mode_, HGCalGeometryMode::Trapezoid, HGCalDDDConstants::waferTypeT(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and HGCalTopology::DecodedDetId::zSide.

Referenced by getValidGeomDetIds().

333  {
334  unsigned int cellIndex = getClosestCellIndex(r);
335  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
336  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
338  HepGeom::Point3D<float> local;
339  if (r.z() > 0) {
340  local = HepGeom::Point3D<float>(r.x(),r.y(),0);
341  id_.zSide = 1;
342  } else {
343  local = HepGeom::Point3D<float>(-r.x(),r.y(),0);
344  id_.zSide =-1;
345  }
348  const auto & kxy =
349  m_topology.dddConstants().assignCell(local.x(),local.y(),id_.iLay,
350  id_.iType,true);
351  id_.iCell1 = kxy.second;
352  id_.iSec1 = kxy.first;
353  id_.iType = m_topology.dddConstants().waferTypeT(kxy.first);
354  if (id_.iType != 1) id_.iType = -1;
355  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
356  id_.iLay = m_topology.dddConstants().getLayer(r.z(),true);
357  const auto & kxy =
358  m_topology.dddConstants().assignCellTrap(r.x(),r.y(),r.z(),
359  id_.iLay,true);
360  id_.iSec1 = kxy[0];
361  id_.iCell1 = kxy[1];
362  id_.iType = kxy[2];
363  } else {
364  id_.iLay = m_topology.dddConstants().getLayer(r.z(),true);
365  const auto & kxy =
366  m_topology.dddConstants().assignCellHex(local.x(),local.y(),id_.iLay,
367  true);
368  id_.iSec1 = kxy[0]; id_.iSec2 = kxy[1]; id_.iType = kxy[2];
369  id_.iCell1 = kxy[3]; id_.iCell2 = kxy[4];
370  }
371 #ifdef EDM_ML_DEBUG
372  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local
373  << " Id " << id_.zSide << ":" << id_.iLay
374  << ":" << id_.iSec1 << ":" << id_.iSec2
375  << ":" << id_.iType << ":" << id_.iCell1
376  << ":" << id_.iCell2;
377 #endif
378 
379  //check if returned cell is valid
380  if (id_.iCell1>=0) return m_topology.encode(id_);
381  }
382 
383  //if not valid or out of bounds return a null DetId
384  return DetId();
385 }
std::vector< DetId > m_validGeomIds
HGCalGeometryMode::GeometryMode mode_
int getLayer(double z, bool reco) const
unsigned int getClosestCellIndex(const GlobalPoint &r) const
const HGCalTopology & m_topology
T y() const
Definition: PV3DBase.h:63
DetId encode(const DecodedDetId &id_) const
T z() const
Definition: PV3DBase.h:64
CellVec2 m_cellVec2
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
const HGCalDDDConstants & dddConstants() const
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco) const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
DetId::Detector m_det
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
T x() const
Definition: PV3DBase.h:62
int waferTypeT(int wafer) const
CellVec m_cellVec
unsigned int HGCalGeometry::getClosestCellIndex ( const GlobalPoint r) const
protected

Definition at line 483 of file HGCalGeometry.cc.

References DetId::HGCalHSc, m_cellVec, m_cellVec2, and m_det.

Referenced by getClosestCell(), and topology().

483  {
484 
486 }
unsigned int getClosestCellIndex(const GlobalPoint &r) const
CellVec2 m_cellVec2
DetId::Detector m_det
CellVec m_cellVec
template<class T >
unsigned int HGCalGeometry::getClosestCellIndex ( const GlobalPoint r,
const std::vector< T > &  vec 
) const
private

Definition at line 489 of file HGCalGeometry.cc.

References a, funct::abs(), b, PVValHelper::dz, getPosition(), gen::k, M_PI, PV3DBase< T, PVType, FrameType >::phi(), DetId::rawId(), z, and PV3DBase< T, PVType, FrameType >::z().

490  {
491 
492  float phip = r.phi();
493  float zp = r.z();
494  float dzmin(9999), dphimin(9999), dphi10(0.175);
495  unsigned int cellIndex = vec.size();
496  for (unsigned int k=0; k<vec.size(); ++k) {
497  float dphi = phip-vec[k].phiPos();
498  while (dphi > M_PI) dphi -= 2*M_PI;
499  while (dphi <= -M_PI) dphi += 2*M_PI;
500  if (std::abs(dphi) < dphi10) {
501  float dz = std::abs(zp - vec[k].getPosition().z());
502  if (dz < (dzmin+0.001)) {
503  dzmin = dz;
504  if (std::abs(dphi) < (dphimin+0.01)) {
505  cellIndex = k;
506  dphimin = std::abs(dphi);
507  } else {
508  if (cellIndex >= vec.size()) cellIndex = k;
509  }
510  }
511  }
512  }
513 #ifdef EDM_ML_DEBUG
514  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":"
515  << phip << " Index " << cellIndex;
516  if (cellIndex < vec.size())
517  edm::LogVerbatim("HGCalGeom") << " Cell z "
518  << vec[cellIndex].getPosition().z()
519  << ":" << dzmin << " phi "
520  << vec[cellIndex].phiPos() << ":" << dphimin;
521 #endif
522  return cellIndex;
523 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint getPosition(const DetId &id) const
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
int k[5][pyjets_maxn]
HGCalGeometry::CornersVec HGCalGeometry::getCorners ( const DetId id) const

Returns the corner points of this cell's volume.

Definition at line 287 of file HGCalGeometry.cc.

References HGCalTopology::dddConstants(), HGCalTopology::decode(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, DetId::HGCalHSc, mps_fire::i, HGCalTopology::DecodedDetId::iCell1, HGCalTopology::DecodedDetId::iCell2, HGCalTopology::DecodedDetId::iLay, indexFor(), HGCalTopology::DecodedDetId::iSec1, HGCalTopology::DecodedDetId::iSec2, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellHex(), HGCalDDDConstants::locateCellTrap(), m_cellVec, m_cellVec2, m_det, m_topology, mode_, FlatTrd::ncorner_, FlatHexagon::ncorner_, HGCalGeometryMode::Trapezoid, and geometryCSVtoXML::xy.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), and dbString().

287  {
288 
289  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ :
291  HGCalGeometry::CornersVec co (ncorner, GlobalPoint(0,0,0));
292  unsigned int cellIndex = indexFor(id);
293  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
294  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
296  std::pair<float,float> xy;
299  xy = m_topology.dddConstants().locateCellHex(id_.iCell1,id_.iSec1,true);
300  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
302  id_.iCell1,true);
303  } else {
304  xy = m_topology.dddConstants().locateCell(id_.iLay,id_.iSec1,id_.iSec2,
305  id_.iCell1,id_.iCell2,true,false);
306  }
307  if (m_det == DetId::HGCalHSc) {
308  float dx = 0.5*m_cellVec2[cellIndex].param()[11];
309  float dz = m_cellVec2[cellIndex].param()[0];
310  static const int signx[] = {-1,-1,1,1,-1,-1,1,1};
311  static const int signy[] = {-1,1,1,-1,-1,1,1,-1};
312  static const int signz[] = {-1,-1,-1,-1,1,1,1,1};
313  for (unsigned int i = 0; i != ncorner; ++i) {
314  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,xy.second+signy[i]*dx,signz[i]*dz);
315  co[i] = m_cellVec2[cellIndex].getPosition(lcoord);
316  }
317  } else {
318  float dx = m_cellVec[cellIndex].param()[1];
319  float dy = m_cellVec[cellIndex].param()[2];
320  float dz = m_cellVec[cellIndex].param()[0];
321  static const int signx[] = {0,-1,-1,0,1,1,0,-1,-1,0,1,1};
322  static const int signy[] = {-2,-1,1,2,1,-1,-2,-1,1,2,1,-1};
323  static const int signz[] = {-1,-1,-1,-1,-1,-1,1,1,1,1,1,1};
324  for (unsigned int i = 0; i != ncorner; ++i) {
325  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,xy.second+signy[i]*dy,signz[i]*dz);
326  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
327  }
328  }
329  }
330  return co;
331 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:38
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:78
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:76
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
CellVec2 m_cellVec2
DecodedDetId decode(const DetId &id) const
const HGCalDDDConstants & dddConstants() const
DetId::Detector m_det
unsigned int indexFor(const DetId &id) const override
CellVec m_cellVec
std::shared_ptr< const CaloCellGeometry > HGCalGeometry::getGeometry ( const DetId id) const
overridevirtual

Get the cell geometry of a given detector id. Should return false if not found.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 207 of file HGCalGeometry.cc.

References cellGeomPtr(), HGCalTopology::detId2denseGeomId(), HGCScintillatorDetId::geometryCell(), HGCalDetId::geometryCell(), HGCSiliconDetId::geometryCell(), getPosition(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, m_topology, mode_, and HGCalGeometryMode::Trapezoid.

Referenced by dbString().

207  {
208  if (id == DetId()) return nullptr; // nothing to get
209  DetId geoId;
210  if ((mode_ == HGCalGeometryMode::Hexagon) ||
212  geoId = (DetId)(HGCalDetId(id).geometryCell());
213  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
214  geoId = (DetId)(HGCScintillatorDetId(id).geometryCell());
215  } else {
216  geoId = (DetId)(HGCSiliconDetId(id).geometryCell());
217  }
218  const uint32_t cellIndex (m_topology.detId2denseGeomId(geoId));
219  const GlobalPoint pos = (id != geoId) ? getPosition(id) : GlobalPoint();
220  return cellGeomPtr (cellIndex, pos);
221 
222 }
HGCalGeometryMode::GeometryMode mode_
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
const HGCalTopology & m_topology
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
HGCSiliconDetId geometryCell() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
HGCScintillatorDetId geometryCell() const
Definition: DetId.h:18
const CaloCellGeometry * HGCalGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 426 of file HGCalGeometry.cc.

References DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, and CaloCellGeometry::param().

Referenced by present(), and topology().

426  {
427  // Modify the RawPtr class
428  if (m_det == DetId::HGCalHSc) {
429  if (m_cellVec2.size() < index) return nullptr;
430  const CaloCellGeometry* cell(&m_cellVec2[index]);
431  return (nullptr == cell->param() ? nullptr : cell);
432  } else {
433  if (m_cellVec2.size() < index) return nullptr;
434  const CaloCellGeometry* cell(&m_cellVec[index]);
435  return (nullptr == cell->param() ? nullptr : cell);
436  }
437 }
CellVec2 m_cellVec2
DetId::Detector m_det
CellVec m_cellVec
GlobalPoint HGCalGeometry::getPosition ( const DetId id) const

Definition at line 239 of file HGCalGeometry.cc.

References HGCalTopology::dddConstants(), HGCalTopology::decode(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, HGCalTopology::DecodedDetId::iCell1, HGCalTopology::DecodedDetId::iCell2, HGCalTopology::DecodedDetId::iLay, indexFor(), HGCalTopology::DecodedDetId::iSec1, HGCalTopology::DecodedDetId::iSec2, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellHex(), m_cellVec, m_cellVec2, m_topology, copyPickMerge_cfg::maxSize, mode_, HGCalGeometryMode::Trapezoid, and geometryCSVtoXML::xy.

Referenced by HGCalTBAnalyzer::analyzeDigi(), HGCalTBAnalyzer::analyzeRecHits(), HGCalTriggerGeometryHexImp1::buildTriggerCellsAndModules(), dbString(), HGCalTriggerNtupleHGCDigis::fill(), getClosestCellIndex(), getGeometry(), HGCalTriggerGeometryHexImp2::getModulePosition(), HGCalTriggerGeometryHexLayerBasedImp1::getModulePosition(), hgcal::RecHitTools::getPosition(), HGCalTriggerGeometryHexImp2::getTriggerCellPosition(), HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellPosition(), and HGCalTriggerGeometryImp1::initialize().

239  {
240 
241  unsigned int cellIndex = indexFor(id);
242  GlobalPoint glob;
243  unsigned int maxSize = ((mode_ == HGCalGeometryMode::Trapezoid) ?
244  m_cellVec2.size() : m_cellVec.size());
245  if (cellIndex < maxSize) {
247  std::pair<float,float> xy;
250  xy = m_topology.dddConstants().locateCellHex(id_.iCell1,id_.iSec1,true);
251  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
252  glob = m_cellVec[cellIndex].getPosition(lcoord);
253 #ifdef EDM_ML_DEBUG
254  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex
255  << " Local " << lcoord.x() << ":"
256  << lcoord.y() << " ID " << id_.iCell1
257  << ":" << id_.iSec1 << " Global " << glob;
258 #endif
259  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
260  const HepGeom::Point3D<float> lcoord(0,0,0);
261  glob = m_cellVec2[cellIndex].getPosition(lcoord);
262 #ifdef EDM_ML_DEBUG
263  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: index " << cellIndex
264  << " Local " << lcoord.x() << ":"
265  << lcoord.y() << " ID " << id_.iLay << ":"
266  << id_.iSec1 << ":" << id_.iCell1
267  << " Global " << glob;
268 #endif
269  } else {
270  xy = m_topology.dddConstants().locateCell(id_.iLay,id_.iSec1,id_.iSec2,
271  id_.iCell1,id_.iCell2,true,false);
272  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
273  glob = m_cellVec[cellIndex].getPosition(lcoord);
274 #ifdef EDM_ML_DEBUG
275  edm::LogVerbatim("HGCalGeom") << "getPositionWafer:: index " << cellIndex
276  << " Local " << lcoord.x() << ":"
277  << lcoord.y() << " ID " << id_.iLay << ":"
278  << id_.iSec1 << ":" << id_.iSec2 << ":"
279  << id_.iCell1 << ":" << id_.iCell2
280  << " Global " << glob;
281 #endif
282  }
283  }
284  return glob;
285 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
CellVec2 m_cellVec2
DecodedDetId decode(const DetId &id) const
const HGCalDDDConstants & dddConstants() const
unsigned int indexFor(const DetId &id) const override
CellVec m_cellVec
void HGCalGeometry::getSummary ( CaloSubdetectorGeometry::TrVec trVector,
CaloSubdetectorGeometry::IVec iVector,
CaloSubdetectorGeometry::DimVec dimVector,
CaloSubdetectorGeometry::IVec dinsVector 
) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 540 of file HGCalGeometry.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, cellGeomPtr(), HGCalParameters::hgtrap::cellSize, HGCalTopology::dddConstants(), HGCalTopology::detId2denseGeomId(), HGCalParameters::hgtrap::dz, HGCalParameters::firstModule_, HGCalDDDConstants::getModule(), HGCalDDDConstants::getParameter(), HGCalDDDConstants::getTrForm(), HGCalDDDConstants::getTrFormN(), runTauDisplay::gp, HGCalParameters::hgtrap::h, HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, DetId::HGCalHSc, mps_fire::i, k_NumberOfParametersPerHex, k_NumberOfParametersPerTrd, k_NumberOfShapes, HGCalParameters::lastModule_, HGCalParameters::hgtrform::lay, HGCScintillatorDetId::layer(), HGCalDetId::layer(), HGCSiliconDetId::layer(), HGCalDDDConstants::layerIndex(), m_det, m_topology, m_validGeomIds, mode_, CaloSubdetectorGeometry::numberOfParametersPerShape(), CaloSubdetectorGeometry::numberOfShapes(), CaloSubdetectorGeometry::numberOfTransformParms(), findQualityFiles::rr, HGCalDDDConstants::sectors(), HGCalParameters::hgtrap::tl, HGCalTopology::totalGeomModules(), HGCalGeometryMode::Trapezoid, groupFilesInBlocks::tt, twoBysqrt3_, and HGCalDDDConstants::waferInLayer().

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

543  {
544 
545  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
546  unsigned int numberOfShapes = k_NumberOfShapes;
547  unsigned int numberOfParametersPerShape =
548  ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd) :
549  (unsigned int)(k_NumberOfParametersPerHex));
550 
551  trVector.reserve( numberOfCells * numberOfTransformParms());
552  iVector.reserve( numberOfCells );
553  dimVector.reserve( numberOfShapes * numberOfParametersPerShape );
554  dinsVector.reserve( numberOfCells );
555 
556  for (unsigned itr=0; itr<m_topology.dddConstants().getTrFormN(); ++itr) {
558  int layer = mytr.lay;
559 
562  for (int wafer=0; wafer<m_topology.dddConstants().sectors(); ++wafer) {
563  if (m_topology.dddConstants().waferInLayer(wafer,layer,true)) {
564  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
565  ParmVec params( numberOfParametersPerShape, 0 );
566  params[0] = vol.dz;
567  params[1] = vol.cellSize;
568  params[2] = twoBysqrt3_*params[1];
569  dimVector.insert( dimVector.end(), params.begin(), params.end());
570  }
571  }
572  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
573  int indx = m_topology.dddConstants().layerIndex(layer,true);
574  for (int md=m_topology.dddConstants().getParameter()->firstModule_[indx];
576  ++md) {
578  ParmVec params( numberOfParametersPerShape, 0 );
579  params[1] = params[2] = 0;
580  params[3] = params[7] = vol.h;
581  params[4] = params[8] = vol.bl;
582  params[5] = params[9] = vol.tl;
583  params[6] = params[10]= vol.alpha;
584  params[11]= vol.cellSize;
585  dimVector.insert( dimVector.end(), params.begin(), params.end());
586  }
587  } else {
588  for (int wafer=0; wafer<m_topology.dddConstants().sectors(); ++wafer) {
589  if (m_topology.dddConstants().waferInLayer(wafer,layer,true)) {
590  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
591  ParmVec params( numberOfParametersPerShape, 0 );
592  params[0] = vol.dz;
593  params[1] = vol.cellSize;
594  params[2] = twoBysqrt3_*params[1];
595  dimVector.insert( dimVector.end(), params.begin(), params.end());
596  }
597  }
598  }
599  }
600 
601  for (unsigned int i( 0 ); i < numberOfCells; ++i) {
602  DetId detId = m_validGeomIds[i];
603  int layer(0);
606  layer = HGCalDetId(detId).layer();
607  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
608  layer = HGCScintillatorDetId(detId).layer();
609  } else {
610  layer = HGCSiliconDetId(detId).layer();
611  }
612  dinsVector.emplace_back(m_topology.detId2denseGeomId( detId ));
613  iVector.emplace_back( layer );
614 
615  Tr3D tr;
616  auto ptr = cellGeomPtr( i );
617  if ( nullptr != ptr ) {
618  ptr->getTransform( tr, ( Pt3DVec* ) nullptr );
619 
620  if( Tr3D() == tr ) { // there is no rotation
621  const GlobalPoint& gp( ptr->getPosition());
622  tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z());
623  }
624 
625  const CLHEP::Hep3Vector tt( tr.getTranslation());
626  trVector.emplace_back( tt.x());
627  trVector.emplace_back( tt.y());
628  trVector.emplace_back( tt.z());
629  if (6 == numberOfTransformParms()) {
630  const CLHEP::HepRotation rr( tr.getRotation());
631  const ROOT::Math::Transform3D rtr( rr.xx(), rr.xy(), rr.xz(), tt.x(),
632  rr.yx(), rr.yy(), rr.yz(), tt.y(),
633  rr.zx(), rr.zy(), rr.zz(), tt.z());
635  rtr.GetRotation( ea );
636  trVector.emplace_back( ea.Phi());
637  trVector.emplace_back( ea.Theta());
638  trVector.emplace_back( ea.Psi());
639  }
640  }
641  }
642 }
std::vector< DetId > m_validGeomIds
HGCalGeometryMode::GeometryMode mode_
virtual unsigned int numberOfParametersPerShape() const
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
HGCalParameters::hgtrform getTrForm(unsigned int k) const
const HGCalParameters * getParameter() const
const HGCalTopology & m_topology
std::vector< float > ParmVec
CaloCellGeometry::Tr3D Tr3D
int layerIndex(int lay, bool reco) const
const double twoBysqrt3_
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
std::vector< int > firstModule_
static unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
unsigned int getTrFormN() const
static unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
virtual uint32_t detId2denseGeomId(const DetId &id) const
virtual unsigned int numberOfShapes() const
int layer() const
get the layer #
int sectors() const
static unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:43
Definition: DetId.h:18
std::vector< int > lastModule_
AlgebraicVector EulerAngles
Definition: Definitions.h:36
const HGCalDDDConstants & dddConstants() const
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
int layer() const
get the layer #
DetId::Detector m_det
virtual unsigned int numberOfTransformParms() const
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
int layer() const
get the layer #
Definition: HGCalDetId.h:48
bool waferInLayer(int wafer, int lay, bool reco) const
const std::vector<DetId>& HGCalGeometry::getValidDetIds ( DetId::Detector  det = DetId::Detector(0),
int  subdet = 0 
) const
inlineoverridevirtual

Get a list of valid detector ids (for the given subdetector)

Note
The implementation in this class is relevant for SubdetectorGeometries which handle only a single subdetector at a time. It does not look at the det and subdet arguments.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 82 of file HGCalGeometry.h.

References CaloSubdetectorGeometry::m_validIds.

82 { return m_validIds; }
std::vector< DetId > m_validIds
const std::vector<DetId>& HGCalGeometry::getValidGeomDetIds ( void  ) const
inline
unsigned int HGCalGeometry::indexFor ( const DetId id) const
overrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 399 of file HGCalGeometry.cc.

References TauDecayModes::dec, HGCalTopology::detId2denseGeomId(), HGCScintillatorDetId::geometryCell(), HGCalDetId::geometryCell(), HGCSiliconDetId::geometryCell(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, m_topology, mode_, DetId::rawId(), and HGCalGeometryMode::Trapezoid.

Referenced by getCorners(), getPosition(), and topology().

399  {
400  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() :
401  m_cellVec.size());
402  if (id != DetId()) {
403  DetId geoId;
406  geoId = (DetId)(HGCalDetId(id).geometryCell());
407  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
408  geoId = (DetId)(HGCScintillatorDetId(id).geometryCell());
409  } else {
410  geoId = (DetId)(HGCSiliconDetId(id).geometryCell());
411  }
412  cellIndex = m_topology.detId2denseGeomId(geoId);
413 #ifdef EDM_ML_DEBUG
414  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << id.rawId()
415  << ":" << geoId.rawId() << std::dec
416  << " index " << cellIndex;
417 #endif
418  }
419  return cellIndex;
420 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
HGCSiliconDetId geometryCell() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
HGCScintillatorDetId geometryCell() const
CellVec2 m_cellVec2
Definition: DetId.h:18
DetId::Detector m_det
CellVec m_cellVec
void HGCalGeometry::initializeParms ( )
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 47 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

47  {
48 }
void HGCalGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)

Definition at line 50 of file HGCalGeometry.cc.

References DetId::HGCalHSc, FlatTrd::localCorners(), FlatHexagon::localCorners(), and m_det.

Referenced by dbString().

53  {
54  if (m_det == DetId::HGCalHSc) {
55  FlatTrd::localCorners( lc, pv, ref ) ;
56  } else {
57  FlatHexagon::localCorners( lc, pv, ref ) ;
58  }
59 }
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatHexagon.cc:175
def pv(vc)
Definition: MetAnalyzer.py:6
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatTrd.cc:175
DetId::Detector m_det
void HGCalGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 61 of file HGCalGeometry.cc.

References HGCalDDDConstants::cellInLayer(), CaloSubdetectorGeometry::cornersMgr(), HGCalTopology::dddConstants(), TauDecayModes::dec, HGCalTopology::decode(), HGCalTopology::detId2denseGeomId(), HGCalTopology::encode(), HGCScintillatorDetId::geometryCell(), HGCalDetId::geometryCell(), HGCSiliconDetId::geometryCell(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, m_topology, m_validGeomIds, CaloSubdetectorGeometry::m_validIds, mode_, HGCalDDDConstants::numberCellsHexagon(), DetId::rawId(), HGCalGeometryMode::Trapezoid, findQualityFiles::v, HGCalTopology::valid(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by HGCalGeometryLoader::buildGeom(), and dbString().

65  {
66 
67  DetId geomId;
68  int cells (0);
72  geomId = (DetId)(HGCalDetId(detId).geometryCell());
73  cells = m_topology.dddConstants().numberCellsHexagon(id.iSec1);
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCalDetId(detId)
76  << " GEOM " << HGCalDetId(geomId);
77 #endif
78  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
79  geomId = (DetId)(HGCScintillatorDetId(detId).geometryCell());
80  cells = 1;
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCScintillatorDetId(detId)
83  << " GEOM " << HGCScintillatorDetId(geomId);
84 #endif
85  } else {
86  geomId = (DetId)(HGCSiliconDetId(detId).geometryCell());
87  cells = m_topology.dddConstants().numberCellsHexagon(id.iLay,id.iSec1,
88  id.iSec2,false);
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCSiliconDetId(detId)
91  << " GEOM " << HGCSiliconDetId(geomId);
92 #endif
93  }
94  const uint32_t cellIndex (m_topology.detId2denseGeomId(detId));
95 
96  if (m_det == DetId::HGCalHSc) {
97  m_cellVec2.at( cellIndex ) = FlatTrd( cornersMgr(), f1, f2, f3, parm ) ;
98  } else {
99  m_cellVec.at( cellIndex ) = FlatHexagon( cornersMgr(), f1, f2, f3, parm ) ;
100  }
101  m_validGeomIds.at( cellIndex ) = geomId ;
102 
103 #ifdef EDM_ML_DEBUG
104  edm::LogVerbatim("HGCalGeom") << "Store for DetId " << std::hex
105  << detId.rawId() << " GeomId "
106  << geomId.rawId() << std::dec << " Index "
107  << cellIndex << " cells " << cells;
108  unsigned int nOld = m_validIds.size();
109 #endif
110  if ((mode_ == HGCalGeometryMode::Hexagon) ||
112  for (int cell = 0; cell < cells; ++cell) {
113  id.iCell1 = cell;
114  DetId idc = m_topology.encode(id);
115  if (m_topology.valid(idc)) {
116  m_validIds.emplace_back(idc);
117 #ifdef EDM_ML_DEBUG
118  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << cell << "] "
119  << HGCalDetId(idc);
120 #endif
121  }
122  }
123  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
124  DetId idc = m_topology.encode(id);
125  if (m_topology.valid(idc)) {
126  m_validIds.emplace_back(idc);
127 #ifdef EDM_ML_DEBUG
128  edm::LogVerbatim("HGCalGeom") << "Valid Id [0] "
129  << HGCScintillatorDetId(idc);
130 #endif
131  } else {
132  edm::LogWarning("HGCalGeom") << "Check " << HGCScintillatorDetId(idc)
133  << " from " << HGCScintillatorDetId(detId)
134  << " ERROR ???";
135  }
136  } else {
137 #ifdef EDM_ML_DEBUG
138  unsigned int cellAll(0), cellSelect(0);
139 #endif
140  for (int u=0; u<2*cells; ++u) {
141  for (int v=0; v<2*cells; ++v) {
142  if (((v-u) < cells) && (u-v) <= cells) {
143  id.iCell1 = u; id.iCell2 = v;
144  DetId idc = m_topology.encode(id);
145 #ifdef EDM_ML_DEBUG
146  ++cellAll;
147 #endif
148  if (m_topology.dddConstants().cellInLayer(id.iSec1,id.iSec2,u,v,
149  id.iLay,true)) {
150  m_validIds.emplace_back(idc);
151 #ifdef EDM_ML_DEBUG
152  ++cellSelect;
153  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << u << ", " << v
154  << "] " << HGCSiliconDetId(idc);
155 #endif
156  }
157  }
158  }
159  }
160 #ifdef EDM_ML_DEBUG
161  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry keeps " << cellSelect
162  << " out of " << cellAll << " for wafer "
163  << id.iSec1 << ":" << id.iSec2 << " in "
164  << " layer " << id.iLay;
165 #endif
166  }
167 #ifdef EDM_ML_DEBUG
168  if (m_det == DetId::HGCalHSc) {
169  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex
170  << "]" << " front:" << f1.x() << '/'
171  << f1.y() << '/' << f1.z() << " back:"
172  << f2.x() << '/' << f2.y() << '/' << f2.z()
173  << " eta|phi "
174  << m_cellVec2[cellIndex].etaPos() << ":"
175  << m_cellVec2[cellIndex].phiPos();
176  } else {
177  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex
178  << "]" << " front:" << f1.x() << '/'
179  << f1.y() << '/' << f1.z() << " back:"
180  << f2.x() << '/' << f2.y() << '/' << f2.z()
181  << " eta|phi "
182  << m_cellVec[cellIndex].etaPos() << ":"
183  << m_cellVec[cellIndex].phiPos();
184  }
185  unsigned int nNew = m_validIds.size();
186  if ((mode_ == HGCalGeometryMode::Hexagon) ||
188  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCalDetId(detId)
189  << " with valid DetId from " << nOld
190  << " to " << nNew;
191  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
192  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCScintillatorDetId(detId)
193  << " with valid DetId from " << nOld
194  << " to " << nNew;
195  } else {
196  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCSiliconDetId(detId)
197  << " with valid DetId from " << nOld
198  << " to " << nNew;
199  }
200  edm::LogVerbatim("HGCalGeom") << "Cell[" << cellIndex << "] " << std::hex
201  << geomId.rawId() << ":"
202  << m_validGeomIds[cellIndex].rawId()
203  << std::dec;
204 #endif
205 }
std::vector< DetId > m_validGeomIds
HGCalGeometryMode::GeometryMode mode_
A base class to handle the particular shape of HGCal volumes.
Definition: FlatTrd.h:19
const HGCalTopology & m_topology
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
T y() const
Definition: PV3DBase.h:63
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
HGCSiliconDetId geometryCell() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
int numberCellsHexagon(int wafer) const
DetId encode(const DecodedDetId &id_) const
std::vector< DetId > m_validIds
T z() const
Definition: PV3DBase.h:64
A base class to handle the hexagonal shape of HGCal silicon volumes.
Definition: FlatHexagon.h:20
HGCScintillatorDetId geometryCell() const
CellVec2 m_cellVec2
DecodedDetId decode(const DetId &id) const
Definition: DetId.h:18
const HGCalDDDConstants & dddConstants() const
CaloCellGeometry::CornersMgr * cornersMgr()
DetId::Detector m_det
bool valid(const DetId &id) const override
Is this a valid cell id.
T x() const
Definition: PV3DBase.h:62
CellVec m_cellVec
bool HGCalGeometry::present ( const DetId id) const
overridevirtual

is this detid present in the geometry?

Reimplemented from CaloSubdetectorGeometry.

Definition at line 224 of file HGCalGeometry.cc.

References HGCalTopology::detId2denseGeomId(), HGCScintillatorDetId::geometryCell(), HGCalDetId::geometryCell(), HGCSiliconDetId::geometryCell(), getGeometryRawPtr(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, m_topology, mode_, and HGCalGeometryMode::Trapezoid.

Referenced by dbString().

224  {
225  if (id == DetId()) return false;
226  DetId geoId;
227  if ((mode_ == HGCalGeometryMode::Hexagon) ||
229  geoId = (DetId)(HGCalDetId(id).geometryCell());
230  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
231  geoId = (DetId)(HGCScintillatorDetId(id).geometryCell());
232  } else {
233  geoId = (DetId)(HGCSiliconDetId(id).geometryCell());
234  }
235  const uint32_t index (m_topology.detId2denseGeomId(geoId));
236  return (nullptr != getGeometryRawPtr(index)) ;
237 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
HGCSiliconDetId geometryCell() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
HGCScintillatorDetId geometryCell() const
Definition: DetId.h:18
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
static std::string HGCalGeometry::producerTag ( )
inlinestatic

Definition at line 99 of file HGCalGeometry.h.

References cellElement(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PCaloGeometryBuilder::beginRun(), and CaloGeometryBuilder::produceAligned().

99 { return "HGCal" ; }
unsigned int HGCalGeometry::sizeForDenseIndex ( ) const
protected

Definition at line 422 of file HGCalGeometry.cc.

References m_topology, and HGCalTopology::totalGeomModules().

Referenced by topology().

422  {
423  return m_topology.totalGeomModules();
424 }
const HGCalTopology & m_topology
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
void HGCalGeometry::sortDetIds ( void  )

Definition at line 535 of file HGCalGeometry.cc.

References CaloSubdetectorGeometry::m_validIds.

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

535  {
536  m_validIds.shrink_to_fit();
537  std::sort( m_validIds.begin(), m_validIds.end(), rawIdSort());
538 }
std::vector< DetId > m_validIds
const HGCalTopology& HGCalGeometry::topology ( ) const
inline

Member Data Documentation

unsigned int HGCalGeometry::k_NumberOfParametersPerHex = 3
static

Definition at line 44 of file HGCalGeometry.h.

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

unsigned int HGCalGeometry::k_NumberOfParametersPerShape = 3
static

Definition at line 45 of file HGCalGeometry.h.

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

unsigned int HGCalGeometry::k_NumberOfParametersPerTrd = 12
static

Definition at line 43 of file HGCalGeometry.h.

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

unsigned int HGCalGeometry::k_NumberOfShapes = 100
static
unsigned int HGCalGeometry::k_NumberOfShapesTrd = 1000
static

Definition at line 47 of file HGCalGeometry.h.

Referenced by HGCalGeometryLoader::build().

CellVec HGCalGeometry::m_cellVec
private
CellVec2 HGCalGeometry::m_cellVec2
private
DetId::Detector HGCalGeometry::m_det
private
ForwardSubdetector HGCalGeometry::m_subdet
private

Definition at line 131 of file HGCalGeometry.h.

Referenced by cellElement().

const HGCalTopology& HGCalGeometry::m_topology
private
std::vector<DetId> HGCalGeometry::m_validGeomIds
private

Definition at line 128 of file HGCalGeometry.h.

Referenced by cellGeomPtr(), getClosestCell(), getSummary(), getValidGeomDetIds(), and newCell().

HGCalGeometryMode::GeometryMode HGCalGeometry::mode_
private
const double HGCalGeometry::twoBysqrt3_
private

Definition at line 132 of file HGCalGeometry.h.

Referenced by getSummary().