CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
HcalGeometry Class Reference

#include <HcalGeometry.h>

Inheritance diagram for HcalGeometry:
CaloSubdetectorGeometry

Public Types

enum  { k_NumberOfParametersPerShape = 5 }
 
typedef HcalGeometryRecord AlignedRecord
 
typedef HcalAlignmentRcd AlignmentRecord
 
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef HcalDetId DetIdType
 
typedef std::vector< IdealObliquePrismHBCellVec
 
typedef std::vector< IdealObliquePrismHECellVec
 
typedef std::vector< IdealZPrismHFCellVec
 
typedef std::vector< IdealObliquePrismHOCellVec
 
typedef PHcalRcd 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

GlobalPoint getBackPosition (const DetId &id) const
 
GlobalPoint getBackPosition (uint32_t id, bool type) const
 
CaloSubdetectorGeometry::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
 
DetId getClosestCell (const GlobalPoint &r, bool ignoreCorrect) const
 
CaloCellGeometry::CornersVec getCorners (const DetId &id) const
 
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...
 
unsigned int getHxSize (const int type) const
 
GlobalPoint getPosition (const DetId &id) const
 
GlobalPoint getPosition (uint32_t id, bool type) 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...
 
 HcalGeometry (const HcalTopology &topology)
 
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
 
unsigned int numberOfParametersPerShape () const override
 
unsigned int numberOfShapes () const override
 
const HcalTopologytopology () const
 
 ~HcalGeometry () override
 The HcalGeometry will delete all its cell geometries at destruction time. More...
 
- 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 void initializeParms ()
 
virtual unsigned int numberOfTransformParms () const
 
CaloSubdetectorGeometryoperator= (const CaloSubdetectorGeometry &)=delete
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual bool present (const DetId &id) const
 is this detid present in the geometry? More...
 
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 unsigned int alignmentBarEndForIndexLocal (const DetId &id, unsigned int nD)
 
static unsigned int alignmentBarrelIndexLocal (const DetId &id)
 
static unsigned int alignmentEndcapIndexLocal (const DetId &id)
 
static unsigned int alignmentForwardIndexLocal (const DetId &id)
 
static unsigned int alignmentOuterIndexLocal (const DetId &id)
 
static unsigned int alignmentTransformIndexGlobal (const DetId &id)
 
static unsigned int alignmentTransformIndexLocal (const DetId &id)
 
static std::string dbString ()
 
static DetId detIdFromBarrelAlignmentIndex (unsigned int i)
 
static DetId detIdFromEndcapAlignmentIndex (unsigned int i)
 
static DetId detIdFromForwardAlignmentIndex (unsigned int i)
 
static DetId detIdFromLocalAlignmentIndex (unsigned int i)
 
static DetId detIdFromOuterAlignmentIndex (unsigned int i)
 
static unsigned int numberOfAlignments ()
 
static unsigned int numberOfBarrelAlignments ()
 
static unsigned int numberOfEndcapAlignments ()
 
static unsigned int numberOfForwardAlignments ()
 
static unsigned int numberOfOuterAlignments ()
 
static std::string producerTag ()
 

Protected Member Functions

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

Private Member Functions

DetId correctId (const DetId &id) const
 
int etaRing (HcalSubdetector bc, double abseta) const
 helper methods for getClosestCell More...
 
void fillDetIds () const
 
std::shared_ptr< const CaloCellGeometrygetGeometryBase (const DetId &id) const
 
void increaseReserve (unsigned int extra)
 
void init ()
 
void newCellFast (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
 
unsigned int newCellImpl (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
 
int phiBin (HcalSubdetector bc, int etaring, double phi) const
 
void sortValidIds ()
 

Private Attributes

CaloSubdetectorGeometry::IVec m_dins
 
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
 
HBCellVec m_hbCellVec
 
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
 
HECellVec m_heCellVec
 
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
 
HFCellVec m_hfCellVec
 
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
 
HOCellVec m_hoCellVec
 
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
 
bool m_mergePosition
 
const HcalTopologym_topology
 

Friends

class HcalFlexiHardcodeGeometryLoader
 
class HcalGeometryPlan1Tester
 
class HcalHardcodeGeometryLoader
 

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 17 of file HcalGeometry.h.

Member Typedef Documentation

◆ AlignedRecord

Definition at line 34 of file HcalGeometry.h.

◆ AlignmentRecord

Definition at line 33 of file HcalGeometry.h.

◆ CCGFloat

Definition at line 29 of file HcalGeometry.h.

◆ DetIdType

Definition at line 36 of file HcalGeometry.h.

◆ HBCellVec

Definition at line 24 of file HcalGeometry.h.

◆ HECellVec

Definition at line 25 of file HcalGeometry.h.

◆ HFCellVec

typedef std::vector<IdealZPrism> HcalGeometry::HFCellVec

Definition at line 27 of file HcalGeometry.h.

◆ HOCellVec

Definition at line 26 of file HcalGeometry.h.

◆ PGeometryRecord

Definition at line 35 of file HcalGeometry.h.

◆ Pt3D

Definition at line 30 of file HcalGeometry.h.

◆ Pt3DVec

Definition at line 31 of file HcalGeometry.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 38 of file HcalGeometry.h.

Constructor & Destructor Documentation

◆ HcalGeometry()

HcalGeometry::HcalGeometry ( const HcalTopology topology)
explicit

Definition at line 18 of file HcalGeometry.cc.

References init().

20  init();
21 }
bool getMergePositionFlag() const
Definition: HcalTopology.h:164
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
const HcalTopology & topology() const
Definition: HcalGeometry.h:111

◆ ~HcalGeometry()

HcalGeometry::~HcalGeometry ( )
override

The HcalGeometry will delete all its cell geometries at destruction time.

Definition at line 23 of file HcalGeometry.cc.

23 {}

Member Function Documentation

◆ alignmentBarEndForIndexLocal()

unsigned int HcalGeometry::alignmentBarEndForIndexLocal ( const DetId id,
unsigned int  nD 
)
static

Definition at line 383 of file HcalGeometry.cc.

References cms::cuda::assert(), hcalRecHitTable_cff::ieta, HcalDetId::ieta(), hcalRecHitTable_cff::iphi, and HcalDetId::iphi().

Referenced by alignmentBarrelIndexLocal(), alignmentEndcapIndexLocal(), and alignmentForwardIndexLocal().

383  {
384  const HcalDetId hid(id);
385  const unsigned int iphi(hid.iphi());
386  const int ieta(hid.ieta());
387  const unsigned int index((0 < ieta ? nD / 2 : 0) + (iphi + 1) % 72 / 4);
388  assert(index < nD);
389  return index;
390 }
assert(be >=bs)

◆ alignmentBarrelIndexLocal()

unsigned int HcalGeometry::alignmentBarrelIndexLocal ( const DetId id)
static

Definition at line 392 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfBarrelAlignments().

Referenced by alignmentTransformIndexLocal().

392  {
394 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:67
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)

◆ alignmentEndcapIndexLocal()

unsigned int HcalGeometry::alignmentEndcapIndexLocal ( const DetId id)
static

Definition at line 396 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfEndcapAlignments().

Referenced by alignmentTransformIndexLocal().

396  {
398 }
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:69
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)

◆ alignmentForwardIndexLocal()

unsigned int HcalGeometry::alignmentForwardIndexLocal ( const DetId id)
static

Definition at line 400 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfForwardAlignments().

Referenced by alignmentTransformIndexLocal().

400  {
402 }
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:71
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)

◆ alignmentOuterIndexLocal()

unsigned int HcalGeometry::alignmentOuterIndexLocal ( const DetId id)
static

Definition at line 404 of file HcalGeometry.cc.

References cms::cuda::assert(), hcalRecHitTable_cff::ieta, HcalDetId::ieta(), hcalRecHitTable_cff::iphi, HcalDetId::iphi(), numberOfOuterAlignments(), and relativeConstraints::ring.

Referenced by alignmentTransformIndexLocal().

404  {
405  const HcalDetId hid(id);
406  const int ieta(hid.ieta());
407  const int iphi(hid.iphi());
408  const int ring(ieta < -10 ? 0 : (ieta < -4 ? 1 : (ieta < 5 ? 2 : (ieta < 11 ? 3 : 4))));
409 
410  const unsigned int index(12 * ring + (iphi - 1) / 6);
412  return index;
413 }
assert(be >=bs)
static unsigned int numberOfOuterAlignments()
Definition: HcalGeometry.h:73

◆ alignmentTransformIndexGlobal()

unsigned int HcalGeometry::alignmentTransformIndexGlobal ( const DetId id)
static

Definition at line 438 of file HcalGeometry.cc.

References DetId::Hcal.

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

438 { return (unsigned int)DetId::Hcal - 1; }

◆ alignmentTransformIndexLocal()

unsigned int HcalGeometry::alignmentTransformIndexLocal ( const DetId id)
static

Definition at line 415 of file HcalGeometry.cc.

References alignmentBarrelIndexLocal(), alignmentEndcapIndexLocal(), alignmentForwardIndexLocal(), alignmentOuterIndexLocal(), cms::cuda::assert(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalObjRepresent::isHB(), HcalObjRepresent::isHE(), HcalObjRepresent::isHF(), numberOfAlignments(), numberOfBarrelAlignments(), numberOfEndcapAlignments(), numberOfForwardAlignments(), and HcalDetId::subdet().

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

415  {
416  assert(id.det() == DetId::Hcal);
417 
418  const HcalDetId hid(id);
419  bool isHB = (hid.subdet() == HcalBarrel);
420  bool isHE = (hid.subdet() == HcalEndcap);
421  bool isHF = (hid.subdet() == HcalForward);
422  // bool isHO = (hid.subdet() == HcalOuter);
423 
424  const unsigned int nB(numberOfBarrelAlignments());
425  const unsigned int nE(numberOfEndcapAlignments());
426  const unsigned int nF(numberOfForwardAlignments());
427  // const unsigned int nO ( numberOfOuterAlignments() ) ;
428 
429  const unsigned int index(isHB ? alignmentBarrelIndexLocal(id)
430  : isHE ? alignmentEndcapIndexLocal(id) + nB
431  : isHF ? alignmentForwardIndexLocal(id) + nB + nE
432  : alignmentOuterIndexLocal(id) + nB + nE + nF);
433 
435  return index;
436 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:67
static unsigned int alignmentEndcapIndexLocal(const DetId &id)
bool isHE(int etabin, int depth)
assert(be >=bs)
bool isHB(int etabin, int depth)
static unsigned int alignmentBarrelIndexLocal(const DetId &id)
static unsigned int alignmentOuterIndexLocal(const DetId &id)
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:69
bool isHF(int etabin, int depth)
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:71
static unsigned int alignmentForwardIndexLocal(const DetId &id)
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:77

◆ correctId()

DetId HcalGeometry::correctId ( const DetId id) const
private

Definition at line 581 of file HcalGeometry.cc.

References l1ctLayer2EG_cff::id, m_mergePosition, m_topology, and HcalTopology::mergedDepthDetId().

Referenced by getClosestCell().

581  {
582  if (m_mergePosition) {
583  HcalDetId hid(id);
584  return ((DetId)(m_topology.mergedDepthDetId(hid)));
585  } else {
586  return id;
587  }
588 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
Definition: DetId.h:17
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:163

◆ dbString()

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

Definition at line 40 of file HcalGeometry.h.

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

40 { return "PHcalRcd"; }

◆ detIdFromBarrelAlignmentIndex()

DetId HcalGeometry::detIdFromBarrelAlignmentIndex ( unsigned int  i)
static

◆ detIdFromEndcapAlignmentIndex()

DetId HcalGeometry::detIdFromEndcapAlignmentIndex ( unsigned int  i)
static

◆ detIdFromForwardAlignmentIndex()

DetId HcalGeometry::detIdFromForwardAlignmentIndex ( unsigned int  i)
static

◆ detIdFromLocalAlignmentIndex()

DetId HcalGeometry::detIdFromLocalAlignmentIndex ( unsigned int  i)
static

Definition at line 369 of file HcalGeometry.cc.

References cms::cuda::assert(), detIdFromBarrelAlignmentIndex(), detIdFromEndcapAlignmentIndex(), detIdFromForwardAlignmentIndex(), detIdFromOuterAlignmentIndex(), mps_fire::i, numberOfAlignments(), numberOfBarrelAlignments(), numberOfEndcapAlignments(), and numberOfForwardAlignments().

369  {
371 
372  const unsigned int nB(numberOfBarrelAlignments());
373  const unsigned int nE(numberOfEndcapAlignments());
374  const unsigned int nF(numberOfForwardAlignments());
375  // const unsigned int nO ( numberOfOuterAlignments() ) ;
376 
377  return (i < nB ? detIdFromBarrelAlignmentIndex(i)
378  : i < nB + nE ? detIdFromEndcapAlignmentIndex(i - nB)
379  : i < nB + nE + nF ? detIdFromForwardAlignmentIndex(i - nB - nE)
380  : detIdFromOuterAlignmentIndex(i - nB - nE - nF));
381 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:67
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
assert(be >=bs)
static DetId detIdFromForwardAlignmentIndex(unsigned int i)
static DetId detIdFromBarrelAlignmentIndex(unsigned int i)
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:69
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:71
static DetId detIdFromEndcapAlignmentIndex(unsigned int i)
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:77

◆ detIdFromOuterAlignmentIndex()

DetId HcalGeometry::detIdFromOuterAlignmentIndex ( unsigned int  i)
static

Definition at line 361 of file HcalGeometry.cc.

References cms::cuda::assert(), HcalOuter, mps_fire::i, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, numberOfOuterAlignments(), and relativeConstraints::ring.

Referenced by detIdFromLocalAlignmentIndex(), FakeCaloAlignmentEP::produceHOAli(), and TestCaloAlignmentEP::produceHOAli().

361  {
363  const int ring(i / 12);
364  const int ieta(0 == ring ? -11 : 1 == ring ? -5 : 2 == ring ? 1 : 3 == ring ? 5 : 11);
365  const int iphi(1 + (i - ring * 12) * 6);
366  return HcalDetId(HcalOuter, ieta, iphi, 4);
367 }
assert(be >=bs)
static unsigned int numberOfOuterAlignments()
Definition: HcalGeometry.h:73

◆ etaRing()

int HcalGeometry::etaRing ( HcalSubdetector  bc,
double  abseta 
) const
private

helper methods for getClosestCell

Definition at line 258 of file HcalGeometry.cc.

References HcalTopology::etaRing(), and m_topology.

Referenced by getCells(), and getClosestCell().

258 { return m_topology.etaRing(bc, abseta); }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values

◆ fillDetIds()

void HcalGeometry::fillDetIds ( ) const
private

Definition at line 40 of file HcalGeometry.cc.

References CaloSubdetectorGeometry::getValidDetIds(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, mps_fire::i, l1ctLayer2EG_cff::id, edm::AtomicPtrCache< T >::isSet(), m_emptyIds, m_hbIds, m_heIds, m_hfIds, m_hoIds, eostools::move(), edm::AtomicPtrCache< T >::set(), and jetUpdater_cfi::sort.

Referenced by getHxSize(), and getValidDetIds().

40  {
41  // this must test the last record filled to avoid a race condition
42  if (!m_emptyIds.isSet()) {
43  std::unique_ptr<std::vector<DetId>> p_hbIds{new std::vector<DetId>};
44  std::unique_ptr<std::vector<DetId>> p_heIds{new std::vector<DetId>};
45  std::unique_ptr<std::vector<DetId>> p_hoIds{new std::vector<DetId>};
46  std::unique_ptr<std::vector<DetId>> p_hfIds{new std::vector<DetId>};
47  std::unique_ptr<std::vector<DetId>> p_emptyIds{new std::vector<DetId>};
48 
49  const std::vector<DetId>& baseIds(CaloSubdetectorGeometry::getValidDetIds());
50  for (unsigned int i(0); i != baseIds.size(); ++i) {
51  const DetId id(baseIds[i]);
52  if (id.subdetId() == HcalBarrel) {
53  p_hbIds->emplace_back(id);
54  } else if (id.subdetId() == HcalEndcap) {
55  p_heIds->emplace_back(id);
56  } else if (id.subdetId() == HcalOuter) {
57  p_hoIds->emplace_back(id);
58  } else if (id.subdetId() == HcalForward) {
59  p_hfIds->emplace_back(id);
60  }
61  }
62  std::sort(p_hbIds->begin(), p_hbIds->end());
63  std::sort(p_heIds->begin(), p_heIds->end());
64  std::sort(p_hoIds->begin(), p_hoIds->end());
65  std::sort(p_hfIds->begin(), p_hfIds->end());
66  p_emptyIds->resize(0);
67 
68  m_hbIds.set(std::move(p_hbIds));
69  m_heIds.set(std::move(p_heIds));
70  m_hoIds.set(std::move(p_hoIds));
71  m_hfIds.set(std::move(p_hfIds));
72  m_emptyIds.set(std::move(p_emptyIds));
73  }
74 }
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
Definition: HcalGeometry.h:150
bool set(std::unique_ptr< T > iNewValue) const
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:153
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
Definition: DetId.h:17
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
Definition: HcalGeometry.h:152
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:151
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:149
def move(src, dest)
Definition: eostools.py:511

◆ getBackPosition() [1/2]

GlobalPoint HcalGeometry::getBackPosition ( const DetId id) const

Definition at line 210 of file HcalGeometry.cc.

References getGeometryBase(), m_mergePosition, m_topology, and HcalTopology::unmergeDepthDetId().

Referenced by getBackPosition().

210  {
211  if (!m_mergePosition) {
212  return (getGeometryBase(id)->getBackPoint());
213  } else {
214  std::vector<HcalDetId> ids;
216  return (getGeometryBase(ids.back())->getBackPoint());
217  }
218 }
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:165

◆ getBackPosition() [2/2]

GlobalPoint HcalGeometry::getBackPosition ( uint32_t  id,
bool  type 
) const

Definition at line 220 of file HcalGeometry.cc.

References HcalTopology::dddConstants(), hcalRecHitTable_cff::depth, PVValHelper::eta, getBackPosition(), HcalDDDRecConstants::getHCID(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, heavyIonCSV_trainingSettings::idx, m_topology, phi, Validation_hcalonly_cfi::sign, HcalTestNumbering::unpackHcalIndex(), and z.

220  {
221  if (test) {
222  int subdet, z, depth, eta, phi, lay;
224  int sign = (z == 0) ? (-1) : (1);
225  auto id = m_topology.dddConstants()->getHCID(subdet, (sign * eta), phi, lay, depth);
226  auto hcId = ((id.subdet == static_cast<int>(HcalBarrel))
227  ? HcalDetId(HcalBarrel, sign * id.eta, id.phi, id.depth)
228  : ((id.subdet == static_cast<int>(HcalEndcap))
230  : ((id.subdet == static_cast<int>(HcalOuter))
232  : ((id.subdet == static_cast<int>(HcalForward))
234  : HcalDetId()))));
235  return getBackPosition(DetId(hcId));
236  } else {
237  return getBackPosition(DetId(idx));
238  }
239 }
GlobalPoint getBackPosition(const DetId &id) const
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
Definition: DetId.h:17
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161

◆ getCells()

CaloSubdetectorGeometry::DetIdSet HcalGeometry::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 264 of file HcalGeometry.cc.

References reco::deltaR2(), HGC3DClusterGenMatchSelector_cfi::dR, ALPAKA_ACCELERATOR_NAMESPACE::dR2(), PVValHelper::eta, HcalTopology::etaMax(), etaRing(), CaloSubdetectorGeometry::getCells(), getGeometryBase(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, M_PI, m_topology, HcalTopology::maxDepth(), AlCaHLTBitMon_ParallelJobs::p, phi, phiBin(), alignCSCRings::r, Validation_hcalonly_cfi::sign, and HcalTopology::valid().

264  {
265  CaloSubdetectorGeometry::DetIdSet dis; // this is the return object
266 
267  if (0.000001 < dR) {
268  if (dR > M_PI / 2.) { // this version needs "small" dR
269  dis = CaloSubdetectorGeometry::getCells(r, dR); // base class version
270  } else {
271  const double dR2(dR * dR);
272  const double reta(r.eta());
273  const double rphi(r.phi());
274  const double lowEta(reta - dR);
275  const double highEta(reta + dR);
276  const double lowPhi(rphi - dR);
277  const double highPhi(rphi + dR);
278 
279  const double hfEtaHi(m_topology.etaMax(HcalForward));
280 
281  if (highEta > -hfEtaHi && lowEta < hfEtaHi) { // in hcal
283 
284  for (unsigned int is(0); is != 4; ++is) {
285  const int sign(reta > 0 ? 1 : -1);
286  const int ieta_center(sign * etaRing(hs[is], fabs(reta)));
287  const int ieta_lo((0 < lowEta * sign ? sign : -sign) * etaRing(hs[is], fabs(lowEta)));
288  const int ieta_hi((0 < highEta * sign ? sign : -sign) * etaRing(hs[is], fabs(highEta)));
289  const int iphi_lo(phiBin(hs[is], ieta_center, lowPhi));
290  const int iphi_hi(phiBin(hs[is], ieta_center, highPhi));
291  const int jphi_lo(iphi_lo > iphi_hi ? iphi_lo - 72 : iphi_lo);
292  const int jphi_hi(iphi_hi);
293 
294  const int idep_lo(1 == is ? 4 : 1);
295  const int idep_hi(m_topology.maxDepth(hs[is]));
296  for (int ieta(ieta_lo); ieta <= ieta_hi; ++ieta) { // over eta limits
297  if (ieta != 0) {
298  for (int jphi(jphi_lo); jphi <= jphi_hi; ++jphi) { // over phi limits
299  const int iphi(1 > jphi ? jphi + 72 : jphi);
300  for (int idep(idep_lo); idep <= idep_hi; ++idep) {
301  const HcalDetId did(hs[is], ieta, iphi, idep);
302  if (m_topology.valid(did)) {
303  std::shared_ptr<const CaloCellGeometry> cell(getGeometryBase(did));
304  if (nullptr != cell) {
305  const GlobalPoint& p(cell->getPosition());
306  const double eta(p.eta());
307  const double phi(p.phi());
308  if (reco::deltaR2(eta, phi, reta, rphi) < dR2)
309  dis.insert(did);
310  }
311  }
312  }
313  }
314  }
315  }
316  }
317  }
318  }
319  }
320  return dis;
321 }
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
bool valid(const DetId &id) const override
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
int phiBin(HcalSubdetector bc, int etaring, double phi) const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
int maxDepth(void) const
HcalSubdetector
Definition: HcalAssistant.h:31
#define M_PI
int etaRing(HcalSubdetector bc, double abseta) const
helper methods for getClosestCell
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
double etaMax(HcalSubdetector subdet) const

◆ getClosestCell() [1/2]

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 109 of file HcalGeometry.cc.

References alignCSCRings::r.

Referenced by ValidIsoTrkCalib::analyze(), and PFCandidateRecalibrator::produce().

109 { return getClosestCell(r, false); }
DetId getClosestCell(const GlobalPoint &r) const override

◆ getClosestCell() [2/2]

DetId HcalGeometry::getClosestCell ( const GlobalPoint r,
bool  ignoreCorrect 
) const

Definition at line 111 of file HcalGeometry.cc.

References funct::abs(), cms::cuda::assert(), correctId(), HcalTopology::dddConstants(), HcalTopology::etaMax(), etaRing(), getGeometry(), HcalDDDRecConstants::getMinDepth(), HcalBarrel, HcalEmpty, HcalEndcap, HcalForward, HcalTopology::incrementDepth(), m_topology, phiBin(), alignCSCRings::r, and ecaldqm::zside().

111  {
112  // Now find the closest eta_bin, eta value of a bin i is average
113  // of eta[i] and eta[i-1]
114  static const double z_long = 1100.0;
115  double abseta = fabs(r.eta());
116  double absz = fabs(r.z());
117 
118  // figure out subdetector, giving preference to HE in HE/HF overlap region
120  if (abseta <= m_topology.etaMax(HcalBarrel)) {
121  bc = HcalBarrel;
122  } else if (absz >= z_long) {
123  bc = HcalForward;
124  } else if (abseta <= m_topology.etaMax(HcalEndcap)) {
125  bc = HcalEndcap;
126  } else {
127  bc = HcalForward;
128  }
129 
130  // find eta bin
131  int etaring = etaRing(bc, abseta);
132 
133  int phibin = phiBin(bc, etaring, r.phi());
134 
135  // add a sign to the etaring
136  int etabin = (r.z() > 0) ? etaring : -etaring;
137 
138  if (bc == HcalForward) {
139  static const double z_short = 1137.0;
140  // Next line is premature depth 1 and 2 can coexist for large z-extent
141  // HcalDetId bestId(bc,etabin,phibin,((fabs(r.z())>=z_short)?(2):(1)));
142  // above line is no good with finite precision
143  HcalDetId bestId(bc, etabin, phibin, ((fabs(r.z()) - z_short > -0.1) ? (2) : (1)));
144  return correctId(bestId);
145  } else {
146  //Now do depth if required
147  int zside = (r.z() > 0) ? 1 : -1;
148  int dbin = m_topology.dddConstants()->getMinDepth(((int)(bc)-1), etaring, phibin, zside);
149  double pointrz(0), drz(99999.);
150  HcalDetId currentId(bc, etabin, phibin, dbin);
151  if (bc == HcalBarrel)
152  pointrz = r.mag();
153  else
154  pointrz = std::abs(r.z());
155  HcalDetId bestId;
156  for (; currentId != HcalDetId(); m_topology.incrementDepth(currentId)) {
157  std::shared_ptr<const CaloCellGeometry> cell = getGeometry(currentId);
158  if (cell == nullptr) {
159  assert(bestId != HcalDetId());
160  break;
161  } else {
162  double rz;
163  if (bc == HcalEndcap)
164  rz = std::abs(cell->getPosition().z());
165  else
166  rz = cell->getPosition().mag();
167  if (std::abs(pointrz - rz) < drz) {
168  bestId = currentId;
169  drz = std::abs(pointrz - rz);
170  }
171  }
172  }
173 #ifdef EDM_ML_DEBUG
174  edm::LogVerbatim("HCalGeom") << bestId << " Corrected to " << HcalDetId(correctId(bestId));
175 #endif
176 
177  return (ignoreCorrect ? bestId : correctId(bestId));
178  }
179 }
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
Log< level::Info, true > LogVerbatim
DetId correctId(const DetId &id) const
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const override
Get the cell geometry of a given detector id. Should return false if not found.
Definition: HcalGeometry.cc:89
int zside(DetId const &)
int phiBin(HcalSubdetector bc, int etaring, double phi) const
assert(be >=bs)
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int etaRing(HcalSubdetector bc, double abseta) const
helper methods for getClosestCell
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
bool incrementDepth(HcalDetId &id) const
double etaMax(HcalSubdetector subdet) const

◆ getCorners()

CaloCellGeometry::CornersVec HcalGeometry::getCorners ( const DetId id) const

Definition at line 241 of file HcalGeometry.cc.

References getGeometryBase(), dqmdumpme::k, m_mergePosition, m_topology, and HcalTopology::unmergeDepthDetId().

241  {
242  if (!m_mergePosition) {
243  return (getGeometryBase(id)->getCorners());
244  } else {
245  std::vector<HcalDetId> ids;
250  for (unsigned int k = 0; k < 4; ++k) {
251  mcorners[k] = mcf[k];
252  mcorners[k + 4] = mcb[k + 4];
253  }
254  return mcorners;
255  }
256 }
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
CaloCellGeometry::CornersVec getCorners(const DetId &id) const
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:165

◆ getGeometry()

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

References HcalTopology::detId2denseId(), getGeometryBase(), HcalTopology::idFront(), m_mergePosition, and m_topology.

Referenced by getClosestCell().

89  {
90 #ifdef EDM_ML_DEBUG
91  std::ostringstream st1;
92  st1 << "HcalGeometry::getGeometry for " << HcalDetId(id) << " " << m_mergePosition << " ";
93 #endif
94  if (!m_mergePosition) {
95 #ifdef EDM_ML_DEBUG
96  st1 << m_topology.detId2denseId(id) << " " << getGeometryBase(id) << "\n";
97  edm::LogVerbatim("HCalGeom") << st1.str();
98 #endif
99  return getGeometryBase(id);
100  } else {
101 #ifdef EDM_ML_DEBUG
103  edm::LogVerbatim("HCalGeom") << st1.str();
104 #endif
105  return getGeometryBase(m_topology.idFront(id));
106  }
107 }
Log< level::Info, true > LogVerbatim
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
bool m_mergePosition
Definition: HcalGeometry.h:147
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:167

◆ getGeometryBase()

std::shared_ptr<const CaloCellGeometry> HcalGeometry::getGeometryBase ( const DetId id) const
inlineprivate

Definition at line 122 of file HcalGeometry.h.

References CaloSubdetectorGeometry::cellGeomPtr(), HcalTopology::detId2denseId(), and m_topology.

Referenced by getBackPosition(), getCells(), getCorners(), getGeometry(), and getPosition().

122  {
124  }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const

◆ getGeometryRawPtr()

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

Implements CaloSubdetectorGeometry.

Definition at line 494 of file HcalGeometry.cc.

References cropTnPTrees::din, m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, and CaloCellGeometry::param().

494  {
495  // Modify the RawPtr class
496  const CaloCellGeometry* cell(nullptr);
497  if (m_hbCellVec.size() > din) {
498  cell = (&m_hbCellVec[din]);
499  } else if (m_hbCellVec.size() + m_heCellVec.size() > din) {
500  const unsigned int ind(din - m_hbCellVec.size());
501  cell = (&m_heCellVec[ind]);
502  } else if (m_hbCellVec.size() + m_heCellVec.size() + m_hoCellVec.size() > din) {
503  const unsigned int ind(din - m_hbCellVec.size() - m_heCellVec.size());
504  cell = (&m_hoCellVec[ind]);
505  } else if (m_hbCellVec.size() + m_heCellVec.size() + m_hoCellVec.size() + m_hfCellVec.size() > din) {
506  const unsigned int ind(din - m_hbCellVec.size() - m_heCellVec.size() - m_hoCellVec.size());
507  cell = (&m_hfCellVec[ind]);
508  }
509 
510  return ((nullptr == cell || nullptr == cell->param()) ? nullptr : cell);
511 }
HBCellVec m_hbCellVec
Definition: HcalGeometry.h:156
HOCellVec m_hoCellVec
Definition: HcalGeometry.h:158
HFCellVec m_hfCellVec
Definition: HcalGeometry.h:159
HECellVec m_heCellVec
Definition: HcalGeometry.h:157

◆ getHxSize()

unsigned int HcalGeometry::getHxSize ( const int  type) const

Definition at line 323 of file HcalGeometry.cc.

References fillDetIds(), edm::AtomicPtrCache< T >::isSet(), m_emptyIds, m_hbIds, m_heIds, m_hfIds, and m_hoIds.

Referenced by HcalDigisValidation::dqmBeginRun(), and HcalRecHitsAnalyzer::dqmBeginRun().

323  {
324  unsigned int hxsize(0);
325  if (!m_hbIds.isSet())
326  fillDetIds();
327  if (type == 1)
328  hxsize = (m_hbIds.isSet()) ? m_hbIds->size() : 0;
329  else if (type == 2)
330  hxsize = (m_heIds.isSet()) ? m_heIds->size() : 0;
331  else if (type == 3)
332  hxsize = (m_hoIds.isSet()) ? m_hoIds->size() : 0;
333  else if (type == 4)
334  hxsize = (m_hfIds.isSet()) ? m_hfIds->size() : 0;
335  else if (type == 0)
336  hxsize = (m_emptyIds.isSet()) ? m_emptyIds->size() : 0;
337  return hxsize;
338 }
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
Definition: HcalGeometry.h:150
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:153
void fillDetIds() const
Definition: HcalGeometry.cc:40
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
Definition: HcalGeometry.h:152
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:151
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:149

◆ getPosition() [1/2]

GlobalPoint HcalGeometry::getPosition ( const DetId id) const

◆ getPosition() [2/2]

GlobalPoint HcalGeometry::getPosition ( uint32_t  id,
bool  type 
) const

Definition at line 189 of file HcalGeometry.cc.

References HcalTopology::dddConstants(), hcalRecHitTable_cff::depth, PVValHelper::eta, HcalDDDRecConstants::getHCID(), getPosition(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, heavyIonCSV_trainingSettings::idx, m_topology, phi, Validation_hcalonly_cfi::sign, HcalTestNumbering::unpackHcalIndex(), and z.

189  {
190  if (test) {
191  int subdet, z, depth, eta, phi, lay;
193  int sign = (z == 0) ? (-1) : (1);
194  auto id = m_topology.dddConstants()->getHCID(subdet, (sign * eta), phi, lay, depth);
195  auto hcId = ((id.subdet == static_cast<int>(HcalBarrel))
196  ? HcalDetId(HcalBarrel, sign * id.eta, id.phi, id.depth)
197  : ((id.subdet == static_cast<int>(HcalEndcap))
199  : ((id.subdet == static_cast<int>(HcalOuter))
201  : ((id.subdet == static_cast<int>(HcalForward))
203  : HcalDetId()))));
204  return getPosition(DetId(hcId));
205  } else {
206  return getPosition(DetId(idx));
207  }
208 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
Definition: DetId.h:17
GlobalPoint getPosition(const DetId &id) const
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161

◆ getSummary()

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 513 of file HcalGeometry.cc.

References cms::cuda::assert(), CaloSubdetectorGeometry::cellGeomPtr(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::dVec, runTauDisplay::gp, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, dqmdumpme::k, m_dins, m_topology, HcalTopology::ncells(), groupFilesInBlocks::nn, numberOfParametersPerShape(), numberOfShapes(), CaloSubdetectorGeometry::numberOfTransformParms(), convertSQLiteXML::ok, CaloSubdetectorGeometry::parVecVec(), MetAnalyzer::pv(), findQualityFiles::rr, and groupFilesInBlocks::tt.

516  {
517  tVec.reserve(m_topology.ncells() * numberOfTransformParms());
518  iVec.reserve(numberOfShapes() == 1 ? 1 : m_topology.ncells());
520  dinsVec.reserve(m_topology.ncells());
521 
522  for (const auto& pv : parVecVec()) {
523  for (float iv : pv) {
524  dVec.emplace_back(iv);
525  }
526  }
527 
528  for (auto i : m_dins) {
529  Tr3D tr;
530  auto ptr = cellGeomPtr(i);
531 
532  if (nullptr != ptr) {
533  dinsVec.emplace_back(i);
534 
535  const CCGFloat* par(ptr->param());
536 
537  unsigned int ishape(9999);
538 
539  for (unsigned int ivv(0); ivv != parVecVec().size(); ++ivv) {
540  bool ok(true);
541  const CCGFloat* pv(&(*parVecVec()[ivv].begin()));
542  for (unsigned int k(0); k != numberOfParametersPerShape(); ++k) {
543  ok = ok && (fabs(par[k] - pv[k]) < 1.e-6);
544  }
545  if (ok) {
546  ishape = ivv;
547  break;
548  }
549  }
550  assert(9999 != ishape);
551 
552  const unsigned int nn((numberOfShapes() == 1) ? (unsigned int)1 : m_dins.size());
553  if (iVec.size() < nn)
554  iVec.emplace_back(ishape);
555 
556  ptr->getTransform(tr, (Pt3DVec*)nullptr);
557 
558  if (Tr3D() == tr) { // for preshower there is no rotation
559  const GlobalPoint& gp(ptr->getPosition());
560  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
561  }
562 
563  const CLHEP::Hep3Vector tt(tr.getTranslation());
564  tVec.emplace_back(tt.x());
565  tVec.emplace_back(tt.y());
566  tVec.emplace_back(tt.z());
567  if (6 == numberOfTransformParms()) {
568  const CLHEP::HepRotation rr(tr.getRotation());
569  const ROOT::Math::Transform3D rtr(
570  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
572  rtr.GetRotation(ea);
573  tVec.emplace_back(ea.Phi());
574  tVec.emplace_back(ea.Theta());
575  tVec.emplace_back(ea.Psi());
576  }
577  }
578  }
579 }
virtual unsigned int numberOfTransformParms() const
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
assert(be >=bs)
CaloCellGeometry::Tr3D Tr3D
Definition: HcalGeometry.cc:14
Definition: TTTypes.h:54
unsigned int numberOfParametersPerShape() const override
Definition: HcalGeometry.h:43
def pv(vc)
Definition: MetAnalyzer.py:7
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::IVec m_dins
Definition: HcalGeometry.h:154
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
AlgebraicVector EulerAngles
Definition: Definitions.h:34
unsigned int numberOfShapes() const override
Definition: HcalGeometry.h:42
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const

◆ getValidDetIds()

const std::vector< DetId > & HcalGeometry::getValidDetIds ( DetId::Detector  det = DetId::Detector(0),
int  subdet = 0 
) const
overridevirtual

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 76 of file HcalGeometry.cc.

References fillDetIds(), CaloSubdetectorGeometry::getValidDetIds(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, edm::AtomicPtrCache< T >::load(), m_emptyIds, m_hbIds, m_heIds, m_hfIds, and m_hoIds.

Referenced by PFCandidateRecalibrator::beginRun(), HcalHBHEMuonAnalyzer::beginRun(), HcalHBHEMuonHighEtaAnalyzer::beginRun(), AlCaHcalHBHEMuonProducer::beginRun(), cms::MinBias::endJob(), HCALRecHitAnalyzer::FillGeometry(), and HcalChannelPropertiesEP::produce2().

76  {
77  if (0 != subdet)
78  fillDetIds();
79  return (0 == subdet
81  : (HcalBarrel == subdet
82  ? *m_hbIds.load()
83  : (HcalEndcap == subdet
84  ? *m_heIds.load()
85  : (HcalOuter == subdet ? *m_hoIds.load()
86  : (HcalForward == subdet ? *m_hfIds.load() : *m_emptyIds.load())))));
87 }
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
Definition: HcalGeometry.h:150
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:153
T const * load() const
void fillDetIds() const
Definition: HcalGeometry.cc:40
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
Definition: HcalGeometry.h:152
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:151
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:149

◆ increaseReserve()

void HcalGeometry::increaseReserve ( unsigned int  extra)
private

◆ indexFor()

unsigned int HcalGeometry::indexFor ( const DetId id) const
inlineoverrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 114 of file HcalGeometry.h.

References HcalTopology::detId2denseId(), and m_topology.

114 { return m_topology.detId2denseId(id); }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id

◆ init()

void HcalGeometry::init ( void  )
private

Definition at line 25 of file HcalGeometry.cc.

References HcalTopology::getHBSize(), HcalTopology::getHESize(), HcalTopology::getHFSize(), HcalTopology::getHOSize(), HcalTopology::getMergePositionFlag(), m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, m_mergePosition, and m_topology.

Referenced by HcalGeometry().

25  {
27  m_mergePosition = false;
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("HCalGeom") << "HcalGeometry_init(): HBSize " << m_topology.getHBSize() << " HESize "
30  << m_topology.getHESize() << " HOSize " << m_topology.getHOSize() << " HFSize "
31  << m_topology.getHFSize();
32 #endif
33 
38 }
Log< level::Info, true > LogVerbatim
bool getMergePositionFlag() const
Definition: HcalTopology.h:164
unsigned int getHESize() const
Definition: HcalTopology.h:130
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
std::vector< IdealObliquePrism > HECellVec
Definition: HcalGeometry.h:25
unsigned int getHBSize() const
Definition: HcalTopology.h:129
bool m_mergePosition
Definition: HcalGeometry.h:147
unsigned int getHOSize() const
Definition: HcalTopology.h:131
HBCellVec m_hbCellVec
Definition: HcalGeometry.h:156
HOCellVec m_hoCellVec
Definition: HcalGeometry.h:158
HFCellVec m_hfCellVec
Definition: HcalGeometry.h:159
std::vector< IdealObliquePrism > HOCellVec
Definition: HcalGeometry.h:26
unsigned int getHFSize() const
Definition: HcalTopology.h:132
std::vector< IdealZPrism > HFCellVec
Definition: HcalGeometry.h:27
std::vector< IdealObliquePrism > HBCellVec
Definition: HcalGeometry.h:24
HECellVec m_heCellVec
Definition: HcalGeometry.h:157

◆ localCorners()

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

Definition at line 440 of file HcalGeometry.cc.

References HcalTopology::denseId2detId(), HcalForward, mps_fire::i, IdealObliquePrism::localCorners(), IdealZPrism::localCorners(), m_topology, and HcalDetId::subdet().

440  {
442 
443  if (hid.subdet() == HcalForward) {
444  IdealZPrism::localCorners(lc, pv, ref);
445  } else {
447  }
448 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
DetId denseId2detId(unsigned int) const override
return a linear packed id
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:73

◆ newCell()

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

Implements CaloSubdetectorGeometry.

Definition at line 478 of file HcalGeometry.cc.

References CaloSubdetectorGeometry::addValidID(), hcalRecHitTable_cff::detId, cropTnPTrees::din, DeadROC_duringRun::f1, DeadROC_duringRun::f2, m_dins, and newCellImpl().

479  {
480  unsigned int din = newCellImpl(f1, f2, f3, parm, detId);
481 
482  addValidID(detId);
483  m_dins.emplace_back(din);
484 }
CaloSubdetectorGeometry::IVec m_dins
Definition: HcalGeometry.h:154
void addValidID(const DetId &id)
unsigned int newCellImpl(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)

◆ newCellFast()

void HcalGeometry::newCellFast ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
private

◆ newCellImpl()

unsigned int HcalGeometry::newCellImpl ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
private

Definition at line 450 of file HcalGeometry.cc.

References cms::cuda::assert(), CaloSubdetectorGeometry::cornersMgr(), hcalRecHitTable_cff::detId, HcalTopology::detId2denseId(), cropTnPTrees::din, IdealZPrism::EM, DeadROC_duringRun::f1, IdealZPrism::HADR, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, and m_topology.

Referenced by newCell(), and newCellFast().

451  {
452  assert(detId.det() == DetId::Hcal);
453 
454  const HcalDetId hid(detId);
455  unsigned int din = m_topology.detId2denseId(detId);
456 
457 #ifdef EDM_ML_DEBUG
458  edm::LogVerbatim("HCalGeom") << "HcalGeometry: newCell subdet " << detId.subdetId() << ", raw ID " << detId.rawId()
459  << ", hid " << hid << ", din " << din << ", index ";
460 #endif
461 
462  if (hid.subdet() == HcalBarrel) {
464  } else if (hid.subdet() == HcalEndcap) {
465  const unsigned int index(din - m_hbCellVec.size());
467  } else if (hid.subdet() == HcalOuter) {
468  const unsigned int index(din - m_hbCellVec.size() - m_heCellVec.size());
470  } else {
471  const unsigned int index(din - m_hbCellVec.size() - m_heCellVec.size() - m_hoCellVec.size());
472  m_hfCellVec.at(index) = IdealZPrism(f1, cornersMgr(), parm, hid.depth() == 1 ? IdealZPrism::EM : IdealZPrism::HADR);
473  }
474 
475  return din;
476 }
Log< level::Info, true > LogVerbatim
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
assert(be >=bs)
HBCellVec m_hbCellVec
Definition: HcalGeometry.h:156
HOCellVec m_hoCellVec
Definition: HcalGeometry.h:158
HFCellVec m_hfCellVec
Definition: HcalGeometry.h:159
CaloCellGeometry::CornersMgr * cornersMgr()
HECellVec m_heCellVec
Definition: HcalGeometry.h:157

◆ numberOfAlignments()

static unsigned int HcalGeometry::numberOfAlignments ( )
inlinestatic

Definition at line 77 of file HcalGeometry.h.

References numberOfBarrelAlignments(), numberOfEndcapAlignments(), numberOfForwardAlignments(), and numberOfOuterAlignments().

Referenced by alignmentTransformIndexLocal(), detIdFromLocalAlignmentIndex(), and HcalAlignmentEP::produceHcalAli().

77  {
80  }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:67
static unsigned int numberOfOuterAlignments()
Definition: HcalGeometry.h:73
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:69
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:71

◆ numberOfBarrelAlignments()

static unsigned int HcalGeometry::numberOfBarrelAlignments ( )
inlinestatic

◆ numberOfEndcapAlignments()

static unsigned int HcalGeometry::numberOfEndcapAlignments ( )
inlinestatic

◆ numberOfForwardAlignments()

static unsigned int HcalGeometry::numberOfForwardAlignments ( )
inlinestatic

◆ numberOfOuterAlignments()

static unsigned int HcalGeometry::numberOfOuterAlignments ( )
inlinestatic

◆ numberOfParametersPerShape()

unsigned int HcalGeometry::numberOfParametersPerShape ( ) const
inlineoverridevirtual

◆ numberOfShapes()

unsigned int HcalGeometry::numberOfShapes ( ) const
inlineoverridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 42 of file HcalGeometry.h.

References HcalTopology::getNumberOfShapes(), and m_topology.

Referenced by getSummary(), HcalHardcodeGeometryLoader::load(), and HcalFlexiHardcodeGeometryLoader::load().

42 { return m_topology.getNumberOfShapes(); }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
unsigned int getNumberOfShapes() const
Definition: HcalTopology.h:158

◆ phiBin()

int HcalGeometry::phiBin ( HcalSubdetector  bc,
int  etaring,
double  phi 
) const
private

Definition at line 260 of file HcalGeometry.cc.

References m_topology, phi, and HcalTopology::phiBin().

Referenced by getCells(), and getClosestCell().

260  {
261  return m_topology.phiBin(bc, etaring, phi);
262 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const

◆ producerTag()

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

◆ sizeForDenseIndex()

unsigned int HcalGeometry::sizeForDenseIndex ( const DetId id) const
inlineoverrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 115 of file HcalGeometry.h.

References m_topology, and HcalTopology::ncells().

115 { return m_topology.ncells(); }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)

◆ sortValidIds()

void HcalGeometry::sortValidIds ( )
private

◆ topology()

const HcalTopology& HcalGeometry::topology ( ) const
inline

Definition at line 111 of file HcalGeometry.h.

References m_topology.

Referenced by CaloSimHitStudy::analyzeHits(), CaloParticleDebugger::fillSimHits(), and CaloTruthAccumulator::initializeEvent().

111 { return m_topology; }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146

Friends And Related Function Documentation

◆ HcalFlexiHardcodeGeometryLoader

friend class HcalFlexiHardcodeGeometryLoader
friend

Definition at line 21 of file HcalGeometry.h.

◆ HcalGeometryPlan1Tester

friend class HcalGeometryPlan1Tester
friend

Definition at line 18 of file HcalGeometry.h.

◆ HcalHardcodeGeometryLoader

friend class HcalHardcodeGeometryLoader
friend

Definition at line 22 of file HcalGeometry.h.

Member Data Documentation

◆ m_dins

CaloSubdetectorGeometry::IVec HcalGeometry::m_dins
private

Definition at line 154 of file HcalGeometry.h.

Referenced by getSummary(), newCell(), and newCellFast().

◆ m_emptyIds

edm::AtomicPtrCache<std::vector<DetId> > HcalGeometry::m_emptyIds
mutableprivate

Definition at line 153 of file HcalGeometry.h.

Referenced by fillDetIds(), getHxSize(), and getValidDetIds().

◆ m_hbCellVec

HBCellVec HcalGeometry::m_hbCellVec
private

Definition at line 156 of file HcalGeometry.h.

Referenced by getGeometryRawPtr(), init(), and newCellImpl().

◆ m_hbIds

edm::AtomicPtrCache<std::vector<DetId> > HcalGeometry::m_hbIds
mutableprivate

Definition at line 149 of file HcalGeometry.h.

Referenced by fillDetIds(), getHxSize(), and getValidDetIds().

◆ m_heCellVec

HECellVec HcalGeometry::m_heCellVec
private

Definition at line 157 of file HcalGeometry.h.

Referenced by getGeometryRawPtr(), init(), and newCellImpl().

◆ m_heIds

edm::AtomicPtrCache<std::vector<DetId> > HcalGeometry::m_heIds
mutableprivate

Definition at line 150 of file HcalGeometry.h.

Referenced by fillDetIds(), getHxSize(), and getValidDetIds().

◆ m_hfCellVec

HFCellVec HcalGeometry::m_hfCellVec
private

Definition at line 159 of file HcalGeometry.h.

Referenced by getGeometryRawPtr(), init(), and newCellImpl().

◆ m_hfIds

edm::AtomicPtrCache<std::vector<DetId> > HcalGeometry::m_hfIds
mutableprivate

Definition at line 152 of file HcalGeometry.h.

Referenced by fillDetIds(), getHxSize(), and getValidDetIds().

◆ m_hoCellVec

HOCellVec HcalGeometry::m_hoCellVec
private

Definition at line 158 of file HcalGeometry.h.

Referenced by getGeometryRawPtr(), init(), and newCellImpl().

◆ m_hoIds

edm::AtomicPtrCache<std::vector<DetId> > HcalGeometry::m_hoIds
mutableprivate

Definition at line 151 of file HcalGeometry.h.

Referenced by fillDetIds(), getHxSize(), and getValidDetIds().

◆ m_mergePosition

bool HcalGeometry::m_mergePosition
private

Definition at line 147 of file HcalGeometry.h.

Referenced by correctId(), getBackPosition(), getCorners(), getGeometry(), getPosition(), and init().

◆ m_topology

const HcalTopology& HcalGeometry::m_topology
private