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)
 
CornersVec get8Corners (const DetId &id) const
 
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
 
DetId getGeometryDetId (DetId detId) 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 28 of file HGCalGeometry.h.

Member Typedef Documentation

Definition at line 41 of file HGCalGeometry.h.

Definition at line 34 of file HGCalGeometry.h.

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

Definition at line 32 of file HGCalGeometry.h.

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

Definition at line 33 of file HGCalGeometry.h.

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

Definition at line 39 of file HGCalGeometry.h.

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

Definition at line 38 of file HGCalGeometry.h.

Definition at line 42 of file HGCalGeometry.h.

Definition at line 35 of file HGCalGeometry.h.

Definition at line 36 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:32
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:33
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 493 of file HGCalGeometry.cc.

Referenced by topology().

493  {
494  edm::LogError("HGCalGeom") << "HGCalGeometry::addValidID is not implemented";
495 }
std::string HGCalGeometry::cellElement ( ) const

Definition at line 414 of file HGCalGeometry.cc.

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

Referenced by producerTag().

414  {
415  if (m_subdet == HGCEE || m_det == DetId::HGCalEE) return "HGCalEE";
416  else if (m_subdet == HGCHEF || m_det == DetId::HGCalHSi) return "HGCalHEFront";
417  else if (m_subdet == HGCHEB || m_det == DetId::HGCalHSc) return "HGCalHEBack";
418  else return "Unknown";
419 }
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 453 of file HGCalGeometry.cc.

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

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

453  {
454  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
455  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) ||
456  (m_validGeomIds[index].rawId() == 0)) return nullptr;
457  static const auto do_not_delete = [](const void*){};
458  if (m_det == DetId::HGCalHSc) {
459  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec2[index],do_not_delete);
460  if (nullptr == cell->param()) return nullptr;
461  return cell;
462  } else {
463  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index],do_not_delete);
464  if (nullptr == cell->param()) return nullptr;
465  return cell;
466  }
467 }
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 469 of file HGCalGeometry.cc.

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

469  {
470  if ((index >= m_cellVec.size() && m_det != DetId::HGCalHSc) ||
471  (index >= m_cellVec2.size() && m_det == DetId::HGCalHSc) ||
472  (m_validGeomIds[index].rawId() == 0)) return nullptr;
473  if (pos == GlobalPoint()) return cellGeomPtr(index);
474  if (m_det == DetId::HGCalHSc) {
475  auto cell = std::make_shared<FlatTrd>(m_cellVec2[index]);
476  cell->setPosition(pos);
477 #ifdef EDM_ML_DEBUG
478  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
479 #endif
480  if (nullptr == cell->param()) return nullptr;
481  return cell;
482  } else {
483  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
484  cell->setPosition(pos);
485 #ifdef EDM_ML_DEBUG
486  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
487 #endif
488  if (nullptr == cell->param()) return nullptr;
489  return cell;
490  }
491 }
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::CornersVec HGCalGeometry::get8Corners ( const DetId id) const

Definition at line 318 of file HGCalGeometry.cc.

References HGCalTopology::dddConstants(), HGCalTopology::decode(), PVValHelper::dx, PVValHelper::dz, getPosition(), 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_, HGCalGeometryMode::Trapezoid, and geometryCSVtoXML::xy.

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

318  {
319 
320  unsigned int ncorner = FlatTrd::ncorner_;
321  HGCalGeometry::CornersVec co (ncorner, GlobalPoint(0,0,0));
322  unsigned int cellIndex = indexFor(id);
323  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
324  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
326  std::pair<float,float> xy;
329  xy = m_topology.dddConstants().locateCellHex(id_.iCell1,id_.iSec1,true);
330  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
332  id_.iCell1,true);
333  } else {
334  xy = m_topology.dddConstants().locateCell(id_.iLay,id_.iSec1,id_.iSec2,
335  id_.iCell1,id_.iCell2,true,false);
336  }
337  float dx = ((m_det == DetId::HGCalHSc) ? 0.5*m_cellVec2[cellIndex].param()[11] :
338  m_cellVec[cellIndex].param()[1]);
339  float dz = ((m_det == DetId::HGCalHSc) ? m_cellVec2[cellIndex].param()[0] :
340  m_cellVec[cellIndex].param()[0]);
341  static const int signx[] = {-1,-1,1,1,-1,-1,1,1};
342  static const int signy[] = {-1,1,1,-1,-1,1,1,-1};
343  static const int signz[] = {-1,-1,-1,-1,1,1,1,1};
344  for (unsigned int i = 0; i < ncorner; ++i) {
345  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,
346  xy.second+signy[i]*dx,signz[i]*dz);
347  co[i] = ((m_det == DetId::HGCalHSc) ?
348  (m_cellVec2[cellIndex].getPosition(lcoord)) :
349  (m_cellVec[cellIndex].getPosition(lcoord)));
350  }
351  }
352  return co;
353 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:39
GlobalPoint getPosition(const DetId &id) const
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
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
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 409 of file HGCalGeometry.cc.

Referenced by getValidGeomDetIds().

409  {
411  return dss;
412 }
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:38
DetId HGCalGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

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

355  {
356  unsigned int cellIndex = getClosestCellIndex(r);
357  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
358  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
360  HepGeom::Point3D<float> local;
361  if (r.z() > 0) {
362  local = HepGeom::Point3D<float>(r.x(),r.y(),0);
363  id_.zSide = 1;
364  } else {
365  local = HepGeom::Point3D<float>(-r.x(),r.y(),0);
366  id_.zSide =-1;
367  }
370  const auto & kxy =
371  m_topology.dddConstants().assignCell(local.x(),local.y(),id_.iLay,
372  id_.iType,true);
373  id_.iCell1 = kxy.second;
374  id_.iSec1 = kxy.first;
375  id_.iType = m_topology.dddConstants().waferTypeT(kxy.first);
376  if (id_.iType != 1) id_.iType = -1;
377  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
378  id_.iLay = m_topology.dddConstants().getLayer(r.z(),true);
379  const auto & kxy =
380  m_topology.dddConstants().assignCellTrap(r.x(),r.y(),r.z(),
381  id_.iLay,true);
382  id_.iSec1 = kxy[0];
383  id_.iCell1 = kxy[1];
384  id_.iType = kxy[2];
385  } else {
386  id_.iLay = m_topology.dddConstants().getLayer(r.z(),true);
387  const auto & kxy =
388  m_topology.dddConstants().assignCellHex(local.x(),local.y(),id_.iLay,
389  true);
390  id_.iSec1 = kxy[0]; id_.iSec2 = kxy[1]; id_.iType = kxy[2];
391  id_.iCell1 = kxy[3]; id_.iCell2 = kxy[4];
392  }
393 #ifdef EDM_ML_DEBUG
394  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local
395  << " Id " << id_.zSide << ":" << id_.iLay
396  << ":" << id_.iSec1 << ":" << id_.iSec2
397  << ":" << id_.iType << ":" << id_.iCell1
398  << ":" << id_.iCell2;
399 #endif
400 
401  //check if returned cell is valid
402  if (id_.iCell1>=0) return m_topology.encode(id_);
403  }
404 
405  //if not valid or out of bounds return a null DetId
406  return DetId();
407 }
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 497 of file HGCalGeometry.cc.

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

Referenced by getClosestCell(), and topology().

497  {
498 
500 }
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 503 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().

504  {
505 
506  float phip = r.phi();
507  float zp = r.z();
508  float dzmin(9999), dphimin(9999), dphi10(0.175);
509  unsigned int cellIndex = vec.size();
510  for (unsigned int k=0; k<vec.size(); ++k) {
511  float dphi = phip-vec[k].phiPos();
512  while (dphi > M_PI) dphi -= 2*M_PI;
513  while (dphi <= -M_PI) dphi += 2*M_PI;
514  if (std::abs(dphi) < dphi10) {
515  float dz = std::abs(zp - vec[k].getPosition().z());
516  if (dz < (dzmin+0.001)) {
517  dzmin = dz;
518  if (std::abs(dphi) < (dphimin+0.01)) {
519  cellIndex = k;
520  dphimin = std::abs(dphi);
521  } else {
522  if (cellIndex >= vec.size()) cellIndex = k;
523  }
524  }
525  }
526  }
527 #ifdef EDM_ML_DEBUG
528  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":"
529  << phip << " Index " << cellIndex;
530  if (cellIndex < vec.size())
531  edm::LogVerbatim("HGCalGeom") << " Cell z "
532  << vec[cellIndex].getPosition().z()
533  << ":" << dzmin << " phi "
534  << vec[cellIndex].phiPos() << ":" << dphimin;
535 #endif
536  return cellIndex;
537 }
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 272 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 dbString().

272  {
273 
274  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ :
276  HGCalGeometry::CornersVec co (ncorner, GlobalPoint(0,0,0));
277  unsigned int cellIndex = indexFor(id);
278  if ((cellIndex < m_cellVec.size() && m_det != DetId::HGCalHSc) ||
279  (cellIndex < m_cellVec2.size() && m_det == DetId::HGCalHSc)) {
281  std::pair<float,float> xy;
284  xy = m_topology.dddConstants().locateCellHex(id_.iCell1,id_.iSec1,true);
285  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
287  id_.iCell1,true);
288  } else {
289  xy = m_topology.dddConstants().locateCell(id_.iLay,id_.iSec1,id_.iSec2,
290  id_.iCell1,id_.iCell2,true,false);
291  }
292  if (m_det == DetId::HGCalHSc) {
293  float dx = 0.5*m_cellVec2[cellIndex].param()[11];
294  float dz = m_cellVec2[cellIndex].param()[0];
295  static const int signx[] = {-1,-1,1,1,-1,-1,1,1};
296  static const int signy[] = {-1,1,1,-1,-1,1,1,-1};
297  static const int signz[] = {-1,-1,-1,-1,1,1,1,1};
298  for (unsigned int i = 0; i < ncorner; ++i) {
299  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,xy.second+signy[i]*dx,signz[i]*dz);
300  co[i] = m_cellVec2[cellIndex].getPosition(lcoord);
301  }
302  } else {
303  float dx = m_cellVec[cellIndex].param()[1];
304  float dy = m_cellVec[cellIndex].param()[2];
305  float dz = m_cellVec[cellIndex].param()[0];
306  static const int signx[] = {0,-1,-1,0,1,1,0,-1,-1,0,1,1};
307  static const int signy[] = {-2,-1,1,2,1,-1,-2,-1,1,2,1,-1};
308  static const int signz[] = {-1,-1,-1,-1,-1,-1,1,1,1,1,1,1};
309  for (unsigned int i = 0; i < ncorner; ++i) {
310  const HepGeom::Point3D<float> lcoord(xy.first+signx[i]*dx,xy.second+signy[i]*dy,signz[i]*dz);
311  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
312  }
313  }
314  }
315  return co;
316 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:39
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 208 of file HGCalGeometry.cc.

References cellGeomPtr(), HGCalTopology::detId2denseGeomId(), getGeometryDetId(), getPosition(), and m_topology.

Referenced by dbString().

208  {
209  if (detId == DetId()) return nullptr; // nothing to get
210  DetId geomId = getGeometryDetId(detId);
211  const uint32_t cellIndex (m_topology.detId2denseGeomId(geomId));
212  const GlobalPoint pos = (detId != geomId) ? getPosition(detId) : GlobalPoint();
213  return cellGeomPtr (cellIndex, pos);
214 
215 }
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
virtual uint32_t detId2denseGeomId(const DetId &id) const
Definition: DetId.h:18
DetId getGeometryDetId(DetId detId) const
DetId HGCalGeometry::getGeometryDetId ( DetId  detId) const
private

Definition at line 660 of file HGCalGeometry.cc.

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

Referenced by getGeometry(), indexFor(), newCell(), present(), and topology().

660  {
661  DetId geomId;
662  if ((mode_ == HGCalGeometryMode::Hexagon) ||
664  geomId = static_cast<DetId>(HGCalDetId(detId).geometryCell());
665  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
666  geomId = static_cast<DetId>(HGCScintillatorDetId(detId).geometryCell());
667  } else if (m_topology.isHFNose()) {
668  geomId = static_cast<DetId>(HFNoseDetId(detId).geometryCell());
669  } else {
670  geomId = static_cast<DetId>(HGCSiliconDetId(detId).geometryCell());
671  }
672  return geomId;
673 }
HGCalGeometryMode::GeometryMode mode_
const HGCalTopology & m_topology
HFNoseDetId geometryCell() const
Definition: HFNoseDetId.h:49
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:36
HGCSiliconDetId geometryCell() const
HGCScintillatorDetId geometryCell() const
bool isHFNose() const
Definition: DetId.h:18
const CaloCellGeometry * HGCalGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 440 of file HGCalGeometry.cc.

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

Referenced by present(), and topology().

440  {
441  // Modify the RawPtr class
442  if (m_det == DetId::HGCalHSc) {
443  if (m_cellVec2.size() < index) return nullptr;
444  const CaloCellGeometry* cell(&m_cellVec2[index]);
445  return (nullptr == cell->param() ? nullptr : cell);
446  } else {
447  if (m_cellVec2.size() < index) return nullptr;
448  const CaloCellGeometry* cell(&m_cellVec[index]);
449  return (nullptr == cell->param() ? nullptr : cell);
450  }
451 }
CellVec2 m_cellVec2
DetId::Detector m_det
CellVec m_cellVec
GlobalPoint HGCalGeometry::getPosition ( const DetId id) const

Definition at line 224 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(), HGCalTriggerGeometryImp1::buildMaps(), HGCalTriggerGeometryHexImp1::buildTriggerCellsAndModules(), HGCDigitizer::checkPosition(), dbString(), HGCalTriggerNtupleHGCDigis::fill(), get8Corners(), getClosestCellIndex(), getGeometry(), HGCalTriggerGeometryHexImp2::getModulePosition(), HGCalTriggerGeometryV9Imp1::getModulePosition(), HGCalTriggerGeometryHexLayerBasedImp1::getModulePosition(), hgcal::RecHitTools::getPosition(), HGCalTriggerGeometryHexImp2::getTriggerCellPosition(), HGCalTriggerGeometryV9Imp1::getTriggerCellPosition(), and HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellPosition().

224  {
225 
226  unsigned int cellIndex = indexFor(id);
227  GlobalPoint glob;
228  unsigned int maxSize = ((mode_ == HGCalGeometryMode::Trapezoid) ?
229  m_cellVec2.size() : m_cellVec.size());
230  if (cellIndex < maxSize) {
232  std::pair<float,float> xy;
235  xy = m_topology.dddConstants().locateCellHex(id_.iCell1,id_.iSec1,true);
236  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
237  glob = m_cellVec[cellIndex].getPosition(lcoord);
238 #ifdef EDM_ML_DEBUG
239  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex
240  << " Local " << lcoord.x() << ":"
241  << lcoord.y() << " ID " << id_.iCell1
242  << ":" << id_.iSec1 << " Global " << glob;
243 #endif
244  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
245  const HepGeom::Point3D<float> lcoord(0,0,0);
246  glob = m_cellVec2[cellIndex].getPosition(lcoord);
247 #ifdef EDM_ML_DEBUG
248  edm::LogVerbatim("HGCalGeom") << "getPositionTrap:: index " << cellIndex
249  << " Local " << lcoord.x() << ":"
250  << lcoord.y() << " ID " << id_.iLay << ":"
251  << id_.iSec1 << ":" << id_.iCell1
252  << " Global " << glob;
253 #endif
254  } else {
255  xy = m_topology.dddConstants().locateCell(id_.iLay,id_.iSec1,id_.iSec2,
256  id_.iCell1,id_.iCell2,true,false);
257  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
258  glob = m_cellVec[cellIndex].getPosition(lcoord);
259 #ifdef EDM_ML_DEBUG
260  edm::LogVerbatim("HGCalGeom") << "getPositionWafer:: index " << cellIndex
261  << " Local " << lcoord.x() << ":"
262  << lcoord.y() << " ID " << id_.iLay << ":"
263  << id_.iSec1 << ":" << id_.iSec2 << ":"
264  << id_.iCell1 << ":" << id_.iCell2
265  << " Global " << glob;
266 #endif
267  }
268  }
269  return glob;
270 }
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 554 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, HGCalTopology::isHFNose(), k_NumberOfParametersPerHex, k_NumberOfParametersPerTrd, k_NumberOfShapes, HGCalParameters::lastModule_, HGCalParameters::hgtrform::lay, HGCScintillatorDetId::layer(), HGCalDetId::layer(), HGCSiliconDetId::layer(), HFNoseDetId::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().

557  {
558 
559  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
560  unsigned int numberOfShapes = k_NumberOfShapes;
561  unsigned int numberOfParametersPerShape =
562  ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd) :
563  (unsigned int)(k_NumberOfParametersPerHex));
564 
565  trVector.reserve( numberOfCells * numberOfTransformParms());
566  iVector.reserve( numberOfCells );
567  dimVector.reserve( numberOfShapes * numberOfParametersPerShape );
568  dinsVector.reserve( numberOfCells );
569 
570  for (unsigned itr=0; itr<m_topology.dddConstants().getTrFormN(); ++itr) {
572  int layer = mytr.lay;
573 
576  for (int wafer=0; wafer<m_topology.dddConstants().sectors(); ++wafer) {
577  if (m_topology.dddConstants().waferInLayer(wafer,layer,true)) {
578  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
579  ParmVec params( numberOfParametersPerShape, 0 );
580  params[0] = vol.dz;
581  params[1] = vol.cellSize;
582  params[2] = twoBysqrt3_*params[1];
583  dimVector.insert( dimVector.end(), params.begin(), params.end());
584  }
585  }
586  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
587  int indx = m_topology.dddConstants().layerIndex(layer,true);
588  for (int md=m_topology.dddConstants().getParameter()->firstModule_[indx];
590  ++md) {
592  ParmVec params( numberOfParametersPerShape, 0 );
593  params[1] = params[2] = 0;
594  params[3] = params[7] = vol.h;
595  params[4] = params[8] = vol.bl;
596  params[5] = params[9] = vol.tl;
597  params[6] = params[10]= vol.alpha;
598  params[11]= vol.cellSize;
599  dimVector.insert( dimVector.end(), params.begin(), params.end());
600  }
601  } else {
602  for (int wafer=0; wafer<m_topology.dddConstants().sectors(); ++wafer) {
603  if (m_topology.dddConstants().waferInLayer(wafer,layer,true)) {
604  HGCalParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
605  ParmVec params( numberOfParametersPerShape, 0 );
606  params[0] = vol.dz;
607  params[1] = vol.cellSize;
608  params[2] = twoBysqrt3_*params[1];
609  dimVector.insert( dimVector.end(), params.begin(), params.end());
610  }
611  }
612  }
613  }
614 
615  for (unsigned int i( 0 ); i < numberOfCells; ++i) {
616  DetId detId = m_validGeomIds[i];
617  int layer(0);
620  layer = HGCalDetId(detId).layer();
621  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
622  layer = HGCScintillatorDetId(detId).layer();
623  } else if (m_topology.isHFNose()) {
624  layer = HFNoseDetId(detId).layer();
625  } else {
626  layer = HGCSiliconDetId(detId).layer();
627  }
628  dinsVector.emplace_back(m_topology.detId2denseGeomId( detId ));
629  iVector.emplace_back( layer );
630 
631  Tr3D tr;
632  auto ptr = cellGeomPtr( i );
633  if ( nullptr != ptr ) {
634  ptr->getTransform( tr, ( Pt3DVec* ) nullptr );
635 
636  if( Tr3D() == tr ) { // there is no rotation
637  const GlobalPoint& gp( ptr->getPosition());
638  tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z());
639  }
640 
641  const CLHEP::Hep3Vector tt( tr.getTranslation());
642  trVector.emplace_back( tt.x());
643  trVector.emplace_back( tt.y());
644  trVector.emplace_back( tt.z());
645  if (6 == numberOfTransformParms()) {
646  const CLHEP::HepRotation rr( tr.getRotation());
647  const ROOT::Math::Transform3D rtr( rr.xx(), rr.xy(), rr.xz(), tt.x(),
648  rr.yx(), rr.yy(), rr.yz(), tt.y(),
649  rr.zx(), rr.zy(), rr.zz(), tt.z());
651  rtr.GetRotation( ea );
652  trVector.emplace_back( ea.Phi());
653  trVector.emplace_back( ea.Theta());
654  trVector.emplace_back( ea.Psi());
655  }
656  }
657  }
658 }
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:47
unsigned int getTrFormN() const
static unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:45
virtual uint32_t detId2denseGeomId(const DetId &id) const
int layer() const
get the layer #
Definition: HFNoseDetId.h:58
virtual unsigned int numberOfShapes() const
int layer() const
get the layer #
int sectors() const
static unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:44
bool isHFNose() const
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 84 of file HGCalGeometry.h.

References CaloSubdetectorGeometry::m_validIds.

84 { 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 421 of file HGCalGeometry.cc.

References TauDecayModes::dec, HGCalTopology::detId2denseGeomId(), getGeometryDetId(), DetId::HGCalHSc, m_cellVec, m_cellVec2, m_det, m_topology, and DetId::rawId().

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

421  {
422  unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() :
423  m_cellVec.size());
424  if (detId != DetId()) {
425  DetId geomId = getGeometryDetId(detId);
426  cellIndex = m_topology.detId2denseGeomId(geomId);
427 #ifdef EDM_ML_DEBUG
428  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId()
429  << ":" << geomId.rawId() << std::dec
430  << " index " << cellIndex;
431 #endif
432  }
433  return cellIndex;
434 }
const HGCalTopology & m_topology
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
virtual uint32_t detId2denseGeomId(const DetId &id) const
CellVec2 m_cellVec2
Definition: DetId.h:18
DetId::Detector m_det
CellVec m_cellVec
DetId getGeometryDetId(DetId detId) const
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:7
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(), getGeometryDetId(), HGCalGeometryMode::Hexagon, HGCalGeometryMode::HexagonFull, DetId::HGCalHSc, HGCalTopology::isHFNose(), 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 = getGeometryDetId(detId);
68  int cells (0);
72  cells = m_topology.dddConstants().numberCellsHexagon(id.iSec1);
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCalDetId(detId)
75  << " GEOM " << HGCalDetId(geomId);
76 #endif
77  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
78  cells = 1;
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCScintillatorDetId(detId)
81  << " GEOM " << HGCScintillatorDetId(geomId);
82 #endif
83  } else {
84  cells = m_topology.dddConstants().numberCellsHexagon(id.iLay,id.iSec1,
85  id.iSec2,false);
86 #ifdef EDM_ML_DEBUG
87  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCSiliconDetId(detId)
88  << " GEOM " << HGCSiliconDetId(geomId);
89 #endif
90  }
91  const uint32_t cellIndex (m_topology.detId2denseGeomId(geomId));
92 
93  if (m_det == DetId::HGCalHSc) {
94  m_cellVec2.at( cellIndex ) = FlatTrd( cornersMgr(), f1, f2, f3, parm ) ;
95  } else {
96  m_cellVec.at( cellIndex ) = FlatHexagon( cornersMgr(), f1, f2, f3, parm ) ;
97  }
98  m_validGeomIds.at( cellIndex ) = geomId ;
99 
100 #ifdef EDM_ML_DEBUG
101  edm::LogVerbatim("HGCalGeom") << "Store for DetId " << std::hex
102  << detId.rawId() << " GeomId "
103  << geomId.rawId() << std::dec << " Index "
104  << cellIndex << " cells " << cells;
105  unsigned int nOld = m_validIds.size();
106 #endif
107  if ((mode_ == HGCalGeometryMode::Hexagon) ||
109  for (int cell = 0; cell < cells; ++cell) {
110  id.iCell1 = cell;
111  DetId idc = m_topology.encode(id);
112  if (m_topology.valid(idc)) {
113  m_validIds.emplace_back(idc);
114 #ifdef EDM_ML_DEBUG
115  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << cell << "] "
116  << HGCalDetId(idc);
117 #endif
118  }
119  }
120  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
121  DetId idc = m_topology.encode(id);
122  if (m_topology.valid(idc)) {
123  m_validIds.emplace_back(idc);
124 #ifdef EDM_ML_DEBUG
125  edm::LogVerbatim("HGCalGeom") << "Valid Id [0] "
126  << HGCScintillatorDetId(idc);
127 #endif
128  } else {
129  edm::LogWarning("HGCalGeom") << "Check " << HGCScintillatorDetId(idc)
130  << " from " << HGCScintillatorDetId(detId)
131  << " ERROR ???";
132  }
133  } else {
134 #ifdef EDM_ML_DEBUG
135  unsigned int cellAll(0), cellSelect(0);
136 #endif
137  for (int u=0; u<2*cells; ++u) {
138  for (int v=0; v<2*cells; ++v) {
139  if (((v-u) < cells) && (u-v) <= cells) {
140  id.iCell1 = u; id.iCell2 = v;
141  DetId idc = m_topology.encode(id);
142 #ifdef EDM_ML_DEBUG
143  ++cellAll;
144 #endif
145  if (m_topology.dddConstants().cellInLayer(id.iSec1,id.iSec2,u,v,
146  id.iLay,true)) {
147  m_validIds.emplace_back(idc);
148 #ifdef EDM_ML_DEBUG
149  ++cellSelect;
150  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << u << ", " << v
151  << "] " << HGCSiliconDetId(idc);
152 #endif
153  }
154  }
155  }
156  }
157 #ifdef EDM_ML_DEBUG
158  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry keeps " << cellSelect
159  << " out of " << cellAll << " for wafer "
160  << id.iSec1 << ":" << id.iSec2 << " in "
161  << " layer " << id.iLay;
162 #endif
163  }
164 #ifdef EDM_ML_DEBUG
165  if (m_det == DetId::HGCalHSc) {
166  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex
167  << "]" << " front:" << f1.x() << '/'
168  << f1.y() << '/' << f1.z() << " back:"
169  << f2.x() << '/' << f2.y() << '/' << f2.z()
170  << " eta|phi "
171  << m_cellVec2[cellIndex].etaPos() << ":"
172  << m_cellVec2[cellIndex].phiPos();
173  } else {
174  edm::LogVerbatim("HGCalGeom") << "HGCalGeometry::newCell-> [" << cellIndex
175  << "]" << " front:" << f1.x() << '/'
176  << f1.y() << '/' << f1.z() << " back:"
177  << f2.x() << '/' << f2.y() << '/' << f2.z()
178  << " eta|phi "
179  << m_cellVec[cellIndex].etaPos() << ":"
180  << m_cellVec[cellIndex].phiPos();
181  }
182  unsigned int nNew = m_validIds.size();
183  if ((mode_ == HGCalGeometryMode::Hexagon) ||
185  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCalDetId(detId)
186  << " with valid DetId from " << nOld
187  << " to " << nNew;
188  } else if (mode_ == HGCalGeometryMode::Trapezoid) {
189  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCScintillatorDetId(detId)
190  << " with valid DetId from " << nOld
191  << " to " << nNew;
192  } else if (m_topology.isHFNose()) {
193  edm::LogVerbatim("HGCalGeom") << "ID: " << HFNoseDetId(detId)
194  << " with valid DetId from " << nOld
195  << " to " << nNew;
196  } else {
197  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCSiliconDetId(detId)
198  << " with valid DetId from " << nOld
199  << " to " << nNew;
200  }
201  edm::LogVerbatim("HGCalGeom") << "Cell[" << cellIndex << "] " << std::hex
202  << geomId.rawId() << ":"
203  << m_validGeomIds[cellIndex].rawId()
204  << std::dec;
205 #endif
206 }
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
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
CellVec2 m_cellVec2
bool isHFNose() const
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
DetId getGeometryDetId(DetId detId) const
bool HGCalGeometry::present ( const DetId id) const
overridevirtual

is this detid present in the geometry?

Reimplemented from CaloSubdetectorGeometry.

Definition at line 217 of file HGCalGeometry.cc.

References HGCalTopology::detId2denseGeomId(), getGeometryDetId(), getGeometryRawPtr(), and m_topology.

Referenced by dbString().

217  {
218  if (detId == DetId()) return false;
219  DetId geomId = getGeometryDetId(detId);
220  const uint32_t index (m_topology.detId2denseGeomId(geomId));
221  return (nullptr != getGeometryRawPtr(index)) ;
222 }
const HGCalTopology & m_topology
virtual uint32_t detId2denseGeomId(const DetId &id) const
Definition: DetId.h:18
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
DetId getGeometryDetId(DetId detId) const
static std::string HGCalGeometry::producerTag ( )
inlinestatic

Definition at line 101 of file HGCalGeometry.h.

References cellElement(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Definition at line 436 of file HGCalGeometry.cc.

References m_topology, and HGCalTopology::totalGeomModules().

Referenced by topology().

436  {
437  return m_topology.totalGeomModules();
438 }
const HGCalTopology & m_topology
unsigned int totalGeomModules() const
Definition: HGCalTopology.h:98
void HGCalGeometry::sortDetIds ( void  )

Definition at line 549 of file HGCalGeometry.cc.

References CaloSubdetectorGeometry::m_validIds.

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

549  {
550  m_validIds.shrink_to_fit();
551  std::sort( m_validIds.begin(), m_validIds.end(), rawIdSort());
552 }
std::vector< DetId > m_validIds
const HGCalTopology& HGCalGeometry::topology ( ) const
inline

Member Data Documentation

unsigned int HGCalGeometry::k_NumberOfParametersPerHex = 3
static

Definition at line 45 of file HGCalGeometry.h.

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

unsigned int HGCalGeometry::k_NumberOfParametersPerShape = 3
static

Definition at line 46 of file HGCalGeometry.h.

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

unsigned int HGCalGeometry::k_NumberOfParametersPerTrd = 12
static

Definition at line 44 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 48 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 134 of file HGCalGeometry.h.

Referenced by cellElement().

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

Definition at line 131 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 135 of file HGCalGeometry.h.

Referenced by getSummary().