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 | Static Private Attributes
HGCalTBGeometry Class Referencefinal

#include <HGCalTBGeometry.h>

Inheritance diagram for HGCalTBGeometry:
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
 
double getArea (const DetId &detid) const
 Returns area of a cell. More...
 
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...
 
CornersVec getNewCorners (const DetId &id, bool debug=false) const
 
GlobalPoint getPosition (const DetId &id, bool debug=false) 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
 
GlobalPoint getWaferPosition (const DetId &id) const
 
 HGCalTBGeometry (const HGCalTBTopology &topology)
 
void initializeParms () override
 
void localCorners (Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
 
DetId neighborZ (const DetId &idin, const GlobalVector &p) const
 
DetId neighborZ (const DetId &idin, const MagneticField *bField, int charge, const GlobalVector &momentum) const
 
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 HGCalTBTopologytopology () const
 
 ~HGCalTBGeometry () 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 bool valid (const DetId &id) 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 constexpr unsigned int k_NumberOfParametersPerHex = 3
 
static constexpr unsigned int k_NumberOfParametersPerShape = 3
 
static constexpr unsigned int k_NumberOfParametersPerTrd = 12
 
static constexpr unsigned int k_NumberOfShapes = 100
 
static constexpr 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
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 
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
 
DetId::Detector m_det
 
ForwardSubdetector m_subdet
 
const HGCalTBTopologym_topology
 
std::vector< DetIdm_validGeomIds
 
const double twoBysqrt3_
 

Static Private Attributes

static constexpr double k_fac1 = 0.5
 
static constexpr double k_fac2 = 1.0 / 3.0
 
static constexpr double k_half = 0.5
 

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 HGCalTBGeometry.h.

Member Typedef Documentation

◆ AlignedRecord

Definition at line 38 of file HGCalTBGeometry.h.

◆ CCGFloat

Definition at line 31 of file HGCalTBGeometry.h.

◆ CellVec

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

Definition at line 29 of file HGCalTBGeometry.h.

◆ CellVec2

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

Definition at line 30 of file HGCalTBGeometry.h.

◆ CornersVec

Definition at line 36 of file HGCalTBGeometry.h.

◆ DetIdSet

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

Definition at line 35 of file HGCalTBGeometry.h.

◆ PGeometryRecord

Definition at line 39 of file HGCalTBGeometry.h.

◆ Pt3D

Definition at line 32 of file HGCalTBGeometry.h.

◆ Pt3DVec

Definition at line 33 of file HGCalTBGeometry.h.

Constructor & Destructor Documentation

◆ HGCalTBGeometry()

HGCalTBGeometry::HGCalTBGeometry ( const HGCalTBTopology topology)

Definition at line 26 of file HGCalTBGeometry.cc.

References m_cellVec, m_topology, CaloSubdetectorGeometry::m_validIds, HGCalTBTopology::totalGeomModules(), and HGCalTBTopology::totalModules().

27  : m_topology(topology_),
28  m_validGeomIds(topology_.totalGeomModules()),
29  m_det(topology_.detector()),
30  m_subdet(topology_.subDetector()),
31  twoBysqrt3_(2.0 / std::sqrt(3.0)) {
32  m_cellVec = CellVec(topology_.totalGeomModules());
34 #ifdef EDM_ML_DEBUG
35  edm::LogVerbatim("HGCalGeom") << "Expected total # of Geometry Modules " << m_topology.totalGeomModules();
36 #endif
37 }
unsigned int totalGeomModules() const
Log< level::Info, true > LogVerbatim
ForwardSubdetector m_subdet
const double twoBysqrt3_
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< DetId > m_validIds
std::vector< FlatHexagon > CellVec
const HGCalTBTopology & m_topology
unsigned int totalModules() const
std::vector< DetId > m_validGeomIds
DetId::Detector m_det

◆ ~HGCalTBGeometry()

HGCalTBGeometry::~HGCalTBGeometry ( )
override

Definition at line 39 of file HGCalTBGeometry.cc.

39 {}

Member Function Documentation

◆ addValidID()

void HGCalTBGeometry::addValidID ( const DetId id)
protected

Definition at line 388 of file HGCalTBGeometry.cc.

388  {
389  edm::LogError("HGCalGeom") << "HGCalTBGeometry::addValidID is not implemented";
390 }
Log< level::Error, false > LogError

◆ cellElement()

std::string HGCalTBGeometry::cellElement ( ) const

Definition at line 331 of file HGCalTBGeometry.cc.

References HGCEE, HGCHEF, and m_subdet.

331  {
332  if (m_subdet == HGCEE)
333  return "HGCalEE";
334  else if (m_subdet == HGCHEF)
335  return "HGCalHEFront";
336  else
337  return "Unknown";
338 }
ForwardSubdetector m_subdet

◆ cellGeomPtr() [1/2]

std::shared_ptr< const CaloCellGeometry > HGCalTBGeometry::cellGeomPtr ( uint32_t  index) const
overrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 363 of file HGCalTBGeometry.cc.

References m_cellVec.

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

363  {
364  if (index >= m_cellVec.size())
365  return nullptr;
366  static const auto do_not_delete = [](const void*) {};
367  auto cell = std::shared_ptr<const CaloCellGeometry>(&m_cellVec[index], do_not_delete);
368  if (nullptr == cell->param())
369  return nullptr;
370  return cell;
371 }

◆ cellGeomPtr() [2/2]

std::shared_ptr< const CaloCellGeometry > HGCalTBGeometry::cellGeomPtr ( uint32_t  index,
const GlobalPoint p 
) const
private

Definition at line 373 of file HGCalTBGeometry.cc.

References cellGeomPtr(), m_cellVec, m_validGeomIds, and nano_mu_digi_cff::rawId.

373  {
374  if ((index >= m_cellVec.size()) || (m_validGeomIds[index].rawId() == 0))
375  return nullptr;
376  if (pos == GlobalPoint())
377  return cellGeomPtr(index);
378  auto cell = std::make_shared<FlatHexagon>(m_cellVec[index]);
379  cell->setPosition(pos);
380 #ifdef EDM_ML_DEBUG
381  edm::LogVerbatim("HGCalGeom") << "cellGeomPtr " << index << ":" << cell;
382 #endif
383  if (nullptr == cell->param())
384  return nullptr;
385  return cell;
386 }
Log< level::Info, true > LogVerbatim
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
std::vector< DetId > m_validGeomIds

◆ dbString()

static std::string HGCalTBGeometry::dbString ( )
inlinestatic

Definition at line 47 of file HGCalTBGeometry.h.

47 { return "PHGCalTBRcd"; }

◆ fillNamedParams()

void HGCalTBGeometry::fillNamedParams ( DDFilteredView  fv)
virtual

Definition at line 41 of file HGCalTBGeometry.cc.

41 {}

◆ get8Corners()

HGCalTBGeometry::CornersVec HGCalTBGeometry::get8Corners ( const DetId id) const

Definition at line 173 of file HGCalTBGeometry.cc.

References cms::cuda::co, HGCalTBTopology::dddConstants(), HGCalTBTopology::decode(), PVValHelper::dx, PVValHelper::dz, mps_fire::i, indexFor(), FlatHexagon::k_dZ, FlatHexagon::k_r, HGCalTBDDDConstants::locateCellHex(), m_cellVec, m_topology, FlatTrd::ncorner_, and geometryCSVtoXML::xy.

173  {
174  unsigned int ncorner = FlatTrd::ncorner_;
175  HGCalTBGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
176  unsigned int cellIndex = indexFor(detid);
178  if (cellIndex < m_cellVec.size()) {
179  std::pair<float, float> xy;
180  float dx(0);
181  static const int signx[] = {-1, -1, 1, 1, -1, -1, 1, 1};
182  static const int signy[] = {-1, 1, 1, -1, -1, 1, 1, -1};
183  static const int signz[] = {-1, -1, -1, -1, 1, 1, 1, 1};
184  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
185  dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
186  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
187  for (unsigned int i = 0; i < ncorner; ++i) {
188  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dx, signz[i] * dz);
189  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
190  }
191  }
192  return co;
193 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::vector< GlobalPoint > CornersVec
__host__ __device__ VT * co
Definition: prefixScan.h:47
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:97
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
const HGCalTBTopology & m_topology
unsigned int indexFor(const DetId &id) const override

◆ getArea()

double HGCalTBGeometry::getArea ( const DetId detid) const

Returns area of a cell.

Definition at line 137 of file HGCalTBGeometry.cc.

References funct::abs(), custom_jme_cff::area, getNewCorners(), mps_fire::i, dqmiolumiharvest::j, dqmiodumpmetadata::n, and y.

137  {
139  double area(0);
140  if (corners.size() > 1) {
141  int n = corners.size() - 1;
142  int j = n - 1;
143  for (int i = 0; i < n; ++i) {
144  area += ((corners[j].x() + corners[i].x()) * (corners[i].y() - corners[j].y()));
145  j = i;
146  }
147  }
148  return std::abs(0.5 * area);
149 }
CornersVec getNewCorners(const DetId &id, bool debug=false) const
std::vector< GlobalPoint > CornersVec
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ getCells()

HGCalTBGeometry::DetIdSet HGCalTBGeometry::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 326 of file HGCalTBGeometry.cc.

326  {
328  return dss;
329 }
std::set< DetId > DetIdSet

◆ getClosestCell()

DetId HGCalTBGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 292 of file HGCalTBGeometry.cc.

References HGCalTBDDDConstants::assignCell(), HGCalTBTopology::dddConstants(), HGCalTBTopology::decode(), HGCalTBTopology::DecodedDetId::det, HGCalTBTopology::detector(), HGCalTBTopology::encode(), getClosestCellIndex(), DTRecHitClients_cfi::local, m_cellVec, m_topology, m_validGeomIds, alignCSCRings::r, and HGCalTBDDDConstants::waferTypeT().

Referenced by neighborZ().

292  {
293  unsigned int cellIndex = getClosestCellIndex(r);
294  if (cellIndex < m_cellVec.size()) {
296  if (id.det == 0)
297  id.det = static_cast<int>(m_topology.detector());
298  HepGeom::Point3D<float> local;
299  if (r.z() > 0) {
300  local = HepGeom::Point3D<float>(r.x(), r.y(), 0);
301  id.zSide = 1;
302  } else {
303  local = HepGeom::Point3D<float>(-r.x(), r.y(), 0);
304  id.zSide = -1;
305  }
306  const auto& kxy = m_topology.dddConstants().assignCell(local.x(), local.y(), id.iLay, id.iType, true);
307  id.iCell1 = kxy.second;
308  id.iSec1 = kxy.first;
309  id.iType = m_topology.dddConstants().waferTypeT(kxy.first);
310  if (id.iType != 1)
311  id.iType = -1;
312 #ifdef EDM_ML_DEBUG
313  edm::LogVerbatim("HGCalGeom") << "getClosestCell: local " << local << " Id " << id.det << ":" << id.zSide << ":"
314  << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":" << id.iType << ":"
315  << id.iCell1 << ":" << id.iCell2;
316 #endif
317  //check if returned cell is valid
318  if (id.iCell1 >= 0)
319  return m_topology.encode(id);
320  }
321 
322  //if not valid or out of bounds return a null DetId
323  return DetId();
324 }
Log< level::Info, true > LogVerbatim
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
DetId encode(const DecodedDetId &id_) const
unsigned int getClosestCellIndex(const GlobalPoint &r) const
int waferTypeT(int wafer) const
Definition: DetId.h:17
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
const HGCalTBTopology & m_topology
std::vector< DetId > m_validGeomIds
DetId::Detector detector() const

◆ getClosestCellIndex() [1/2]

unsigned int HGCalTBGeometry::getClosestCellIndex ( const GlobalPoint r) const
protected

Definition at line 392 of file HGCalTBGeometry.cc.

References m_cellVec, and alignCSCRings::r.

Referenced by getClosestCell().

392  {
393  return (getClosestCellIndex(r, m_cellVec));
394 }
unsigned int getClosestCellIndex(const GlobalPoint &r) const

◆ getClosestCellIndex() [2/2]

template<class T >
unsigned int HGCalTBGeometry::getClosestCellIndex ( const GlobalPoint r,
const std::vector< T > &  vec 
) const
private

Definition at line 397 of file HGCalTBGeometry.cc.

References funct::abs(), PVValHelper::dz, getPosition(), dqmdumpme::k, M_PI, alignCSCRings::r, and z.

397  {
398  float phip = r.phi();
399  float zp = r.z();
400  float dzmin(9999), dphimin(9999), dphi10(0.175);
401  unsigned int cellIndex = vec.size();
402  for (unsigned int k = 0; k < vec.size(); ++k) {
403  float dphi = phip - vec[k].phiPos();
404  while (dphi > M_PI)
405  dphi -= 2 * M_PI;
406  while (dphi <= -M_PI)
407  dphi += 2 * M_PI;
408  if (std::abs(dphi) < dphi10) {
409  float dz = std::abs(zp - vec[k].getPosition().z());
410  if (dz < (dzmin + 0.001)) {
411  dzmin = dz;
412  if (std::abs(dphi) < (dphimin + 0.01)) {
413  cellIndex = k;
414  dphimin = std::abs(dphi);
415  } else {
416  if (cellIndex >= vec.size())
417  cellIndex = k;
418  }
419  }
420  }
421  }
422 #ifdef EDM_ML_DEBUG
423  edm::LogVerbatim("HGCalGeom") << "getClosestCellIndex::Input " << zp << ":" << phip << " Index " << cellIndex;
424  if (cellIndex < vec.size())
425  edm::LogVerbatim("HGCalGeom") << " Cell z " << vec[cellIndex].getPosition().z() << ":" << dzmin << " phi "
426  << vec[cellIndex].phiPos() << ":" << dphimin;
427 #endif
428  return cellIndex;
429 }
Log< level::Info, true > LogVerbatim
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
GlobalPoint getPosition(const DetId &id, bool debug=false) const

◆ getCorners()

HGCalTBGeometry::CornersVec HGCalTBGeometry::getCorners ( const DetId id) const

Returns the corner points of this cell's volume.

Definition at line 151 of file HGCalTBGeometry.cc.

References cms::cuda::co, HGCalTBTopology::dddConstants(), HGCalTBTopology::decode(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, DetId::HGCalHSc, mps_fire::i, indexFor(), FlatHexagon::k_dZ, k_half, FlatHexagon::k_r, FlatHexagon::k_R, HGCalTBDDDConstants::locateCellHex(), m_cellVec, m_det, m_topology, FlatHexagon::ncorner_, FlatTrd::ncorner_, and geometryCSVtoXML::xy.

151  {
152  unsigned int ncorner = ((m_det == DetId::HGCalHSc) ? FlatTrd::ncorner_ : FlatHexagon::ncorner_);
153  HGCalTBGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
154  unsigned int cellIndex = indexFor(detid);
156  if (cellIndex < m_cellVec.size()) {
157  std::pair<float, float> xy;
158  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
159  float dx = m_cellVec[cellIndex].param()[FlatHexagon::k_r];
160  float dy = k_half * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
161  float dz = m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
162  static const int signx[] = {0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, 1};
163  static const int signy[] = {-2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1};
164  static const int signz[] = {-1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1};
165  for (unsigned int i = 0; i < ncorner; ++i) {
166  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, signz[i] * dz);
167  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
168  }
169  }
170  return co;
171 }
static constexpr double k_half
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::vector< GlobalPoint > CornersVec
__host__ __device__ VT * co
Definition: prefixScan.h:47
static constexpr unsigned int ncorner_
Definition: FlatHexagon.h:81
static constexpr unsigned int ncorner_
Definition: FlatTrd.h:97
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
const HGCalTBTopology & m_topology
unsigned int indexFor(const DetId &id) const override
DetId::Detector m_det

◆ getGeometry()

std::shared_ptr< const CaloCellGeometry > HGCalTBGeometry::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 88 of file HGCalTBGeometry.cc.

References cellGeomPtr(), hcalRecHitTable_cff::detId, HGCalTBTopology::detId2denseGeomId(), getGeometryDetId(), getPosition(), and m_topology.

88  {
89  if (detId == DetId())
90  return nullptr; // nothing to get
91  DetId geomId = getGeometryDetId(detId);
92  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
93  const GlobalPoint pos = (detId != geomId) ? getPosition(detId, false) : GlobalPoint();
94  return cellGeomPtr(cellIndex, pos);
95 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
DetId getGeometryDetId(DetId detId) const
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Definition: DetId.h:17
virtual uint32_t detId2denseGeomId(const DetId &id) const
const HGCalTBTopology & m_topology
GlobalPoint getPosition(const DetId &id, bool debug=false) const

◆ getGeometryDetId()

DetId HGCalTBGeometry::getGeometryDetId ( DetId  detId) const
private

Definition at line 507 of file HGCalTBGeometry.cc.

References hcalRecHitTable_cff::detId, and HGCalDetId::geometryCell().

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

507  {
508  return static_cast<DetId>(HGCalDetId(detId).geometryCell());
509 }
HGCalDetId geometryCell() const
Definition: HGCalDetId.h:34
Definition: DetId.h:17

◆ getGeometryRawPtr()

const CaloCellGeometry * HGCalTBGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 355 of file HGCalTBGeometry.cc.

References m_cellVec, and CaloCellGeometry::param().

Referenced by present().

355  {
356  // Modify the RawPtr class
357  if (m_cellVec.size() < index)
358  return nullptr;
359  const CaloCellGeometry* cell(&m_cellVec[index]);
360  return (nullptr == cell->param() ? nullptr : cell);
361 }

◆ getNewCorners()

HGCalTBGeometry::CornersVec HGCalTBGeometry::getNewCorners ( const DetId id,
bool  debug = false 
) const

Definition at line 195 of file HGCalTBGeometry.cc.

References cms::cuda::co, HGCalTBTopology::dddConstants(), debug, HGCalTBTopology::decode(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, DetId::HGCalHSc, mps_fire::i, indexFor(), FlatHexagon::k_dZ, k_fac1, k_fac2, FlatHexagon::k_r, FlatHexagon::k_R, HGCalTBDDDConstants::locateCellHex(), m_cellVec, m_det, m_topology, and geometryCSVtoXML::xy.

Referenced by getArea().

195  {
196  unsigned int ncorner = (m_det == DetId::HGCalHSc) ? 5 : 7;
197  HGCalTBGeometry::CornersVec co(ncorner, GlobalPoint(0, 0, 0));
198  unsigned int cellIndex = indexFor(detid);
200  if (debug)
201  edm::LogVerbatim("HGCalGeom") << "NewCorners for Layer " << id.iLay << " Wafer " << id.iSec1 << ":" << id.iSec2
202  << " Cell " << id.iCell1 << ":" << id.iCell2;
203  if (cellIndex < m_cellVec.size()) {
204  std::pair<float, float> xy;
205  float dx = k_fac2 * m_cellVec[cellIndex].param()[FlatHexagon::k_r];
206  float dy = k_fac1 * m_cellVec[cellIndex].param()[FlatHexagon::k_R];
207  float dz = -id.zSide * m_cellVec[cellIndex].param()[FlatHexagon::k_dZ];
208  static const int signx[] = {1, -1, -2, -1, 1, 2};
209  static const int signy[] = {1, 1, 0, -1, -1, 0};
210 #ifdef EDM_ML_DEBUG
211  if (debug)
212  edm::LogVerbatim("HGCalGeom") << "kfac " << k_fac1 << ":" << k_fac2 << " dx:dy:dz " << dx << ":" << dy << ":"
213  << dz;
214 #endif
215  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
216  for (unsigned int i = 0; i < ncorner - 1; ++i) {
217  const HepGeom::Point3D<float> lcoord(xy.first + signx[i] * dx, xy.second + signy[i] * dy, dz);
218  co[i] = m_cellVec[cellIndex].getPosition(lcoord);
219  }
220  // Used to pass downstream the thickness of this cell
221  co[ncorner - 1] = GlobalPoint(0, 0, -2 * dz);
222  }
223  return co;
224 }
Log< level::Info, true > LogVerbatim
static constexpr double k_fac1
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::vector< GlobalPoint > CornersVec
__host__ __device__ VT * co
Definition: prefixScan.h:47
static constexpr double k_fac2
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
#define debug
Definition: HDRShower.cc:19
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
const HGCalTBTopology & m_topology
unsigned int indexFor(const DetId &id) const override
DetId::Detector m_det

◆ getPosition()

GlobalPoint HGCalTBGeometry::getPosition ( const DetId id,
bool  debug = false 
) const

Definition at line 105 of file HGCalTBGeometry.cc.

References HGCalTBTopology::dddConstants(), debug, HGCalTBTopology::decode(), indexFor(), HGCalTBDDDConstants::locateCellHex(), m_cellVec, m_topology, reco_skim_cfg_mod::maxSize, and geometryCSVtoXML::xy.

Referenced by HGCalTBAnalyzer::analyzeDigi(), HGCalTBAnalyzer::analyzeRecHits(), getClosestCellIndex(), getGeometry(), and neighborZ().

105  {
106  unsigned int cellIndex = indexFor(detid);
107  GlobalPoint glob;
108  unsigned int maxSize = m_cellVec.size();
109  if (cellIndex < maxSize) {
111  std::pair<float, float> xy;
112  xy = m_topology.dddConstants().locateCellHex(id.iCell1, id.iSec1, true);
113  const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0);
114  glob = m_cellVec[cellIndex].getPosition(lcoord);
115  if (debug)
116  edm::LogVerbatim("HGCalGeom") << "getPosition:: index " << cellIndex << " Local " << lcoord.x() << ":"
117  << lcoord.y() << " ID " << id.iCell1 << ":" << id.iSec1 << " Global " << glob;
118  }
119  return glob;
120 }
Log< level::Info, true > LogVerbatim
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
#define debug
Definition: HDRShower.cc:19
const HGCalTBTopology & m_topology
unsigned int indexFor(const DetId &id) const override

◆ getSummary()

void HGCalTBGeometry::getSummary ( CaloSubdetectorGeometry::TrVec trVector,
CaloSubdetectorGeometry::IVec iVector,
CaloSubdetectorGeometry::DimVec dimVector,
CaloSubdetectorGeometry::IVec dinsVector 
) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 443 of file HGCalTBGeometry.cc.

References cellGeomPtr(), HGCalTBParameters::hgtrap::cellSize, HGCalTBTopology::dddConstants(), hcalRecHitTable_cff::detId, HGCalTBTopology::detId2denseGeomId(), HGCalTBParameters::hgtrap::dz, HGCalTBDDDConstants::getModule(), HGCalTBDDDConstants::getTrForm(), HGCalTBDDDConstants::getTrFormN(), runTauDisplay::gp, DetId::HGCalHSc, mps_fire::i, FlatHexagon::k_dZ, k_NumberOfParametersPerHex, k_NumberOfParametersPerTrd, k_NumberOfShapes, FlatHexagon::k_r, FlatHexagon::k_R, HGCalTBParameters::hgtrform::lay, nano_mu_digi_cff::layer, HGCalDetId::layer(), m_det, m_topology, m_validGeomIds, CaloSubdetectorGeometry::numberOfParametersPerShape(), CaloSubdetectorGeometry::numberOfShapes(), CaloSubdetectorGeometry::numberOfTransformParms(), submitPVValidationJobs::params, findQualityFiles::rr, HGCalTBDDDConstants::sectors(), HGCalTBTopology::totalGeomModules(), groupFilesInBlocks::tt, twoBysqrt3_, and HGCalTBDDDConstants::waferInLayer().

446  {
447  unsigned int numberOfCells = m_topology.totalGeomModules(); // total Geom Modules both sides
448  unsigned int numberOfShapes = k_NumberOfShapes;
449  unsigned int numberOfParametersPerShape = ((m_det == DetId::HGCalHSc) ? (unsigned int)(k_NumberOfParametersPerTrd)
450  : (unsigned int)(k_NumberOfParametersPerHex));
451 
452  trVector.reserve(numberOfCells * numberOfTransformParms());
453  iVector.reserve(numberOfCells);
454  dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
455  dinsVector.reserve(numberOfCells);
456 
457  for (unsigned itr = 0; itr < m_topology.dddConstants().getTrFormN(); ++itr) {
459  int layer = mytr.lay;
460 
461  for (int wafer = 0; wafer < m_topology.dddConstants().sectors(); ++wafer) {
462  if (m_topology.dddConstants().waferInLayer(wafer, layer, true)) {
463  HGCalTBParameters::hgtrap vol = m_topology.dddConstants().getModule(wafer, true, true);
465  params[FlatHexagon::k_dZ] = vol.dz;
468  dimVector.insert(dimVector.end(), params.begin(), params.end());
469  }
470  }
471  }
472 
473  for (unsigned int i(0); i < numberOfCells; ++i) {
475  int layer = HGCalDetId(detId).layer();
476  dinsVector.emplace_back(m_topology.detId2denseGeomId(detId));
477  iVector.emplace_back(layer);
478 
479  Tr3D tr;
480  auto ptr = cellGeomPtr(i);
481  if (nullptr != ptr) {
482  ptr->getTransform(tr, (Pt3DVec*)nullptr);
483 
484  if (Tr3D() == tr) { // there is no rotation
485  const GlobalPoint& gp(ptr->getPosition());
486  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
487  }
488 
489  const CLHEP::Hep3Vector tt(tr.getTranslation());
490  trVector.emplace_back(tt.x());
491  trVector.emplace_back(tt.y());
492  trVector.emplace_back(tt.z());
493  if (6 == numberOfTransformParms()) {
494  const CLHEP::HepRotation rr(tr.getRotation());
495  const ROOT::Math::Transform3D rtr(
496  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
498  rtr.GetRotation(ea);
499  trVector.emplace_back(ea.Phi());
500  trVector.emplace_back(ea.Theta());
501  trVector.emplace_back(ea.Psi());
502  }
503  }
504  }
505 }
unsigned int totalGeomModules() const
static constexpr unsigned int k_NumberOfParametersPerHex
bool waferInLayer(int wafer, int lay, bool reco) const
virtual unsigned int numberOfTransformParms() const
virtual unsigned int numberOfShapes() const
static constexpr unsigned int k_NumberOfParametersPerTrd
const double twoBysqrt3_
Definition: TTTypes.h:54
static constexpr uint32_t k_R
Definition: FlatHexagon.h:29
static constexpr uint32_t k_r
Definition: FlatHexagon.h:28
std::vector< float > ParmVec
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
unsigned int getTrFormN() const
const HGCalTBDDDConstants & dddConstants() const
HGCalTBParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
static constexpr uint32_t k_dZ
Definition: FlatHexagon.h:27
int layer() const
get the layer #
Definition: HGCalDetId.h:46
virtual uint32_t detId2denseGeomId(const DetId &id) const
CaloCellGeometry::Pt3DVec Pt3DVec
const HGCalTBTopology & m_topology
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
std::vector< DetId > m_validGeomIds
DetId::Detector m_det
static constexpr unsigned int k_NumberOfShapes
HGCalTBParameters::hgtrform getTrForm(unsigned int k) const
virtual unsigned int numberOfParametersPerShape() const

◆ getValidDetIds()

const std::vector<DetId>& HGCalTBGeometry::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 87 of file HGCalTBGeometry.h.

References CaloSubdetectorGeometry::m_validIds.

87  {
88  return m_validIds;
89  }
std::vector< DetId > m_validIds

◆ getValidGeomDetIds()

const std::vector<DetId>& HGCalTBGeometry::getValidGeomDetIds ( void  ) const
inline

Definition at line 90 of file HGCalTBGeometry.h.

References m_validGeomIds.

90 { return m_validGeomIds; }
std::vector< DetId > m_validGeomIds

◆ getWaferPosition()

GlobalPoint HGCalTBGeometry::getWaferPosition ( const DetId id) const

Definition at line 122 of file HGCalTBGeometry.cc.

References TauDecayModes::dec, indexFor(), m_cellVec, reco_skim_cfg_mod::maxSize, and DetId::rawId().

122  {
123  unsigned int cellIndex = indexFor(detid);
124  GlobalPoint glob;
125  unsigned int maxSize = m_cellVec.size();
126  if (cellIndex < maxSize) {
127  const HepGeom::Point3D<float> lcoord(0, 0, 0);
128  glob = m_cellVec[cellIndex].getPosition(lcoord);
129 #ifdef EDM_ML_DEBUG
130  edm::LogVerbatim("HGCalGeom") << "getWaferPosition:: ID " << std::hex << detid.rawId() << std::dec << " index "
131  << cellIndex << " Global " << glob;
132 #endif
133  }
134  return glob;
135 }
Log< level::Info, true > LogVerbatim
unsigned int indexFor(const DetId &id) const override

◆ indexFor()

unsigned int HGCalTBGeometry::indexFor ( const DetId id) const
overrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 340 of file HGCalTBGeometry.cc.

References TauDecayModes::dec, hcalRecHitTable_cff::detId, HGCalTBTopology::detId2denseGeomId(), getGeometryDetId(), m_cellVec, m_topology, and DetId::rawId().

Referenced by get8Corners(), getCorners(), getNewCorners(), getPosition(), and getWaferPosition().

340  {
341  unsigned int cellIndex = m_cellVec.size();
342  if (detId != DetId()) {
343  DetId geomId = getGeometryDetId(detId);
344  cellIndex = m_topology.detId2denseGeomId(geomId);
345 #ifdef EDM_ML_DEBUG
346  edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId() << ":" << geomId.rawId() << std::dec
347  << " index " << cellIndex;
348 #endif
349  }
350  return cellIndex;
351 }
Log< level::Info, true > LogVerbatim
DetId getGeometryDetId(DetId detId) const
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
virtual uint32_t detId2denseGeomId(const DetId &id) const
const HGCalTBTopology & m_topology

◆ initializeParms()

void HGCalTBGeometry::initializeParms ( )
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 43 of file HGCalTBGeometry.cc.

43 {}

◆ localCorners()

void HGCalTBGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)

Definition at line 45 of file HGCalTBGeometry.cc.

References FlatHexagon::localCorners().

45  {
46  FlatHexagon::localCorners(lc, pv, ref);
47 }
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: FlatHexagon.cc:154

◆ neighborZ() [1/2]

DetId HGCalTBGeometry::neighborZ ( const DetId idin,
const GlobalVector p 
) const

Definition at line 226 of file HGCalTBGeometry.cc.

References HGCalTBTopology::dddConstants(), HGCalTBTopology::decode(), HGCalTBDDDConstants::firstLayer(), getClosestCell(), getPosition(), HGCalTBDDDConstants::lastLayer(), m_topology, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, HGCalTBDDDConstants::rangeR(), topology(), findQualityFiles::v, HGCalTBDDDConstants::waferZ(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

226  {
227  DetId idnew;
229  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
230 #ifdef EDM_ML_DEBUG
231  edm::LogVerbatim("HGCalGeom") << "neighborz1:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
232  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
233  << m_topology.dddConstants().firstLayer() << ":"
234  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
235 #endif
236  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
237  (momentum.z() != 0.0)) {
238  GlobalPoint v = getPosition(idin, false);
239  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
240  double grad = (z - v.z()) / momentum.z();
241  GlobalPoint p(v.x() + grad * momentum.x(), v.y() + grad * momentum.y(), z);
242  double r = p.perp();
243  auto rlimit = topology().dddConstants().rangeR(z, true);
244  if (r >= rlimit.first && r <= rlimit.second)
245  idnew = getClosestCell(p);
246 #ifdef EDM_ML_DEBUG
247  edm::LogVerbatim("HGCalGeom") << "neighborz1:: Position " << v << " New Z " << z << ":" << grad << " new position "
248  << p << " r-limit " << rlimit.first << ":" << rlimit.second;
249 #endif
250  }
251  return idnew;
252 }
Log< level::Info, true > LogVerbatim
int lastLayer(bool reco) const
double waferZ(int layer, bool reco) const
std::pair< double, double > rangeR(double z, bool reco) const
DetId getClosestCell(const GlobalPoint &r) const override
Definition: DetId.h:17
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
const HGCalTBTopology & topology() const
const HGCalTBTopology & m_topology
GlobalPoint getPosition(const DetId &id, bool debug=false) const

◆ neighborZ() [2/2]

DetId HGCalTBGeometry::neighborZ ( const DetId idin,
const MagneticField bField,
int  charge,
const GlobalVector momentum 
) const

Definition at line 254 of file HGCalTBGeometry.cc.

References alongMomentum, Calorimetry_cff::bField, Plane::build(), ALCARECOTkAlJpsiMuMu_cff::charge, HGCalTBTopology::dddConstants(), HGCalTBTopology::decode(), HGCalTBDDDConstants::firstLayer(), getClosestCell(), getPosition(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), HGCalTBDDDConstants::lastLayer(), M_PI, m_topology, AlCaHLTBitMon_ParallelJobs::p, AnalyticalPropagator::propagate(), alignCSCRings::r, HGCalTBDDDConstants::rangeR(), topology(), findQualityFiles::v, HGCalTBDDDConstants::waferZ(), z, and PV3DBase< T, PVType, FrameType >::z().

257  {
258  DetId idnew;
260  int lay = ((momentum.z() * id.zSide > 0) ? (id.iLay + 1) : (id.iLay - 1));
261 #ifdef EDM_ML_DEBUG
262  edm::LogVerbatim("HGCalGeom") << "neighborz2:: ID " << id.iLay << ":" << id.iSec1 << ":" << id.iSec2 << ":"
263  << id.iCell1 << ":" << id.iCell2 << " New Layer " << lay << " Range "
264  << m_topology.dddConstants().firstLayer() << ":"
265  << m_topology.dddConstants().lastLayer(true) << " pz " << momentum.z();
266 #endif
267  if ((lay >= m_topology.dddConstants().firstLayer()) && (lay <= m_topology.dddConstants().lastLayer(true)) &&
268  (momentum.z() != 0.0)) {
269  GlobalPoint v = getPosition(idin, false);
270  double z = id.zSide * m_topology.dddConstants().waferZ(lay, true);
271  FreeTrajectoryState fts(v, momentum, charge, bField);
274  TrajectoryStateOnSurface tsos = myAP.propagate(fts, *nPlane);
275  GlobalPoint p;
276  auto rlimit = topology().dddConstants().rangeR(z, true);
277  if (tsos.isValid()) {
278  p = tsos.globalPosition();
279  double r = p.perp();
280  if (r >= rlimit.first && r <= rlimit.second)
281  idnew = getClosestCell(p);
282  }
283 #ifdef EDM_ML_DEBUG
284  edm::LogVerbatim("HGCalGeom") << "neighborz2:: Position " << v << " New Z " << z << ":" << charge << ":"
285  << tsos.isValid() << " new position " << p << " r limits " << rlimit.first << ":"
286  << rlimit.second;
287 #endif
288  }
289  return idnew;
290 }
Log< level::Info, true > LogVerbatim
int lastLayer(bool reco) const
T z() const
Definition: PV3DBase.h:61
double waferZ(int layer, bool reco) const
std::pair< double, double > rangeR(double z, bool reco) const
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
DetId getClosestCell(const GlobalPoint &r) const override
GlobalPoint globalPosition() const
#define M_PI
Definition: DetId.h:17
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
const HGCalTBTopology & topology() const
const HGCalTBTopology & m_topology
GlobalPoint getPosition(const DetId &id, bool debug=false) const

◆ newCell()

void HGCalTBGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 49 of file HGCalTBGeometry.cc.

References hgcalTBTopologyTester_cfi::cells, CaloSubdetectorGeometry::cornersMgr(), HGCalTBTopology::dddConstants(), TauDecayModes::dec, HGCalTBTopology::decode(), hcalRecHitTable_cff::detId, HGCalTBTopology::detId2denseGeomId(), HGCalTBTopology::encode(), DeadROC_duringRun::f1, DeadROC_duringRun::f2, getGeometryDetId(), m_cellVec, m_topology, m_validGeomIds, CaloSubdetectorGeometry::m_validIds, HGCalTBDDDConstants::numberCellsHexagon(), DetId::rawId(), and HGCalTBTopology::valid().

50  {
51  DetId geomId = getGeometryDetId(detId);
52  int cells(0);
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("HGCalGeom") << "NewCell " << HGCalDetId(detId) << " GEOM " << HGCalDetId(geomId);
57 #endif
58  const uint32_t cellIndex(m_topology.detId2denseGeomId(geomId));
59 
60  m_cellVec.at(cellIndex) = FlatHexagon(cornersMgr(), f1, f2, f3, parm);
61  m_validGeomIds.at(cellIndex) = geomId;
62 
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("HGCalGeom") << "Store for DetId " << std::hex << detId.rawId() << " GeomId " << geomId.rawId()
65  << std::dec << " Index " << cellIndex << " cells " << cells;
66  unsigned int nOld = m_validIds.size();
67 #endif
68  for (int cell = 0; cell < cells; ++cell) {
69  id.iCell1 = cell;
70  DetId idc = m_topology.encode(id);
71  if (m_topology.valid(idc)) {
72  m_validIds.emplace_back(idc);
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "Valid Id [" << cell << "] " << HGCalDetId(idc);
75 #endif
76  }
77  }
78 #ifdef EDM_ML_DEBUG
79  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeometry::newCell-> [" << cellIndex << "]"
80  << " front:" << f1.x() << '/' << f1.y() << '/' << f1.z() << " back:" << f2.x() << '/'
81  << f2.y() << '/' << f2.z() << " eta|phi " << m_cellVec[cellIndex].etaPos() << ":"
82  << m_cellVec[cellIndex].phiPos();
83  unsigned int nNew = m_validIds.size();
84  edm::LogVerbatim("HGCalGeom") << "ID: " << HGCalDetId(detId) << " with valid DetId from " << nOld << " to " << nNew;
85 #endif
86 }
Log< level::Info, true > LogVerbatim
DetId encode(const DecodedDetId &id_) const
int numberCellsHexagon(int wafer) const
std::vector< DetId > m_validIds
A base class to handle the hexagonal shape of HGCal silicon volumes.
Definition: FlatHexagon.h:20
DetId getGeometryDetId(DetId detId) const
Definition: DetId.h:17
DecodedDetId decode(const DetId &id) const
const HGCalTBDDDConstants & dddConstants() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CaloCellGeometry::CornersMgr * cornersMgr()
bool valid(const DetId &id) const override
Is this a valid cell id.
virtual uint32_t detId2denseGeomId(const DetId &id) const
const HGCalTBTopology & m_topology
std::vector< DetId > m_validGeomIds

◆ present()

bool HGCalTBGeometry::present ( const DetId id) const
overridevirtual

is this detid present in the geometry?

Reimplemented from CaloSubdetectorGeometry.

Definition at line 97 of file HGCalTBGeometry.cc.

References hcalRecHitTable_cff::detId, HGCalTBTopology::detId2denseGeomId(), getGeometryDetId(), getGeometryRawPtr(), and m_topology.

97  {
98  if (detId == DetId())
99  return false;
100  DetId geomId = getGeometryDetId(detId);
101  const uint32_t index(m_topology.detId2denseGeomId(geomId));
102  return (nullptr != getGeometryRawPtr(index));
103 }
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
DetId getGeometryDetId(DetId detId) const
Definition: DetId.h:17
virtual uint32_t detId2denseGeomId(const DetId &id) const
const HGCalTBTopology & m_topology

◆ producerTag()

static std::string HGCalTBGeometry::producerTag ( )
inlinestatic

Definition at line 106 of file HGCalTBGeometry.h.

106 { return "HGCalTB"; }

◆ sizeForDenseIndex() [1/2]

unsigned int CaloSubdetectorGeometry::sizeForDenseIndex
protected

Definition at line 256 of file CaloSubdetectorGeometry.cc.

256  {
258 }
uint32_t sizeForDenseIndexing() const

◆ sizeForDenseIndex() [2/2]

unsigned int HGCalTBGeometry::sizeForDenseIndex ( ) const
protected

Definition at line 353 of file HGCalTBGeometry.cc.

References m_topology, and HGCalTBTopology::totalGeomModules().

353 { return m_topology.totalGeomModules(); }
unsigned int totalGeomModules() const
const HGCalTBTopology & m_topology

◆ sortDetIds()

void HGCalTBGeometry::sortDetIds ( void  )

Definition at line 438 of file HGCalTBGeometry.cc.

References CaloSubdetectorGeometry::m_validIds, and jetUpdater_cfi::sort.

438  {
439  m_validIds.shrink_to_fit();
440  std::sort(m_validIds.begin(), m_validIds.end(), rawIdSort());
441 }
std::vector< DetId > m_validIds

◆ topology()

const HGCalTBTopology& HGCalTBGeometry::topology ( ) const
inline

Definition at line 109 of file HGCalTBGeometry.h.

References m_topology.

Referenced by neighborZ().

109 { return m_topology; }
const HGCalTBTopology & m_topology

Member Data Documentation

◆ k_fac1

constexpr double HGCalTBGeometry::k_fac1 = 0.5
staticprivate

Definition at line 132 of file HGCalTBGeometry.h.

Referenced by getNewCorners().

◆ k_fac2

constexpr double HGCalTBGeometry::k_fac2 = 1.0 / 3.0
staticprivate

Definition at line 133 of file HGCalTBGeometry.h.

Referenced by getNewCorners().

◆ k_half

constexpr double HGCalTBGeometry::k_half = 0.5
staticprivate

Definition at line 131 of file HGCalTBGeometry.h.

Referenced by getCorners().

◆ k_NumberOfParametersPerHex

constexpr unsigned int HGCalTBGeometry::k_NumberOfParametersPerHex = 3
static

Definition at line 42 of file HGCalTBGeometry.h.

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

◆ k_NumberOfParametersPerShape

constexpr unsigned int HGCalTBGeometry::k_NumberOfParametersPerShape = 3
static

Definition at line 43 of file HGCalTBGeometry.h.

◆ k_NumberOfParametersPerTrd

constexpr unsigned int HGCalTBGeometry::k_NumberOfParametersPerTrd = 12
static

Definition at line 41 of file HGCalTBGeometry.h.

Referenced by getSummary().

◆ k_NumberOfShapes

constexpr unsigned int HGCalTBGeometry::k_NumberOfShapes = 100
static

Definition at line 44 of file HGCalTBGeometry.h.

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

◆ k_NumberOfShapesTrd

constexpr unsigned int HGCalTBGeometry::k_NumberOfShapesTrd = 1000
static

Definition at line 45 of file HGCalTBGeometry.h.

◆ m_cellVec

CellVec HGCalTBGeometry::m_cellVec
private

◆ m_det

DetId::Detector HGCalTBGeometry::m_det
private

Definition at line 138 of file HGCalTBGeometry.h.

Referenced by getCorners(), getNewCorners(), and getSummary().

◆ m_subdet

ForwardSubdetector HGCalTBGeometry::m_subdet
private

Definition at line 139 of file HGCalTBGeometry.h.

Referenced by cellElement().

◆ m_topology

const HGCalTBTopology& HGCalTBGeometry::m_topology
private

◆ m_validGeomIds

std::vector<DetId> HGCalTBGeometry::m_validGeomIds
private

◆ twoBysqrt3_

const double HGCalTBGeometry::twoBysqrt3_
private

Definition at line 140 of file HGCalTBGeometry.h.

Referenced by getSummary().