CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< IdealObliquePrism
HBCellVec
 
typedef std::vector
< IdealObliquePrism
HECellVec
 
typedef std::vector< IdealZPrismHFCellVec
 
typedef std::vector
< IdealObliquePrism
HOCellVec
 
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
CaloCellGeometry
getGeometry (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 ~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
CaloCellGeometry
cellGeomPtr (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
CaloCellGeometry
getGeometryBase (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

Definition at line 34 of file HcalGeometry.h.

Definition at line 33 of file HcalGeometry.h.

Definition at line 29 of file HcalGeometry.h.

Definition at line 36 of file HcalGeometry.h.

Definition at line 24 of file HcalGeometry.h.

Definition at line 25 of file HcalGeometry.h.

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

Definition at line 27 of file HcalGeometry.h.

Definition at line 26 of file HcalGeometry.h.

Definition at line 35 of file HcalGeometry.h.

Definition at line 30 of file HcalGeometry.h.

Definition at line 31 of file HcalGeometry.h.

Member Enumeration Documentation

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 38 of file HcalGeometry.h.

Constructor & Destructor Documentation

HcalGeometry::HcalGeometry ( const HcalTopology topology)
explicit

Definition at line 17 of file HcalGeometry.cc.

References init().

18  : m_topology(topology), m_mergePosition(topology.getMergePositionFlag()) {
19  init();
20 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
bool getMergePositionFlag() const
Definition: HcalTopology.h:167
HcalGeometry::~HcalGeometry ( )
override

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

Definition at line 22 of file HcalGeometry.cc.

22 {}

Member Function Documentation

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

Definition at line 381 of file HcalGeometry.cc.

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

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

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

Definition at line 390 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfBarrelAlignments().

Referenced by alignmentTransformIndexLocal().

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

Definition at line 394 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfEndcapAlignments().

Referenced by alignmentTransformIndexLocal().

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

Definition at line 398 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfForwardAlignments().

Referenced by alignmentTransformIndexLocal().

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

Definition at line 402 of file HcalGeometry.cc.

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

Referenced by alignmentTransformIndexLocal().

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

Definition at line 436 of file HcalGeometry.cc.

References DetId::Hcal.

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

436 { return (unsigned int)DetId::Hcal - 1; }
unsigned int HcalGeometry::alignmentTransformIndexLocal ( const DetId id)
static

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

413  {
414  assert(id.det() == DetId::Hcal);
415 
416  const HcalDetId hid(id);
417  bool isHB = (hid.subdet() == HcalBarrel);
418  bool isHE = (hid.subdet() == HcalEndcap);
419  bool isHF = (hid.subdet() == HcalForward);
420  // bool isHO = (hid.subdet() == HcalOuter);
421 
422  const unsigned int nB(numberOfBarrelAlignments());
423  const unsigned int nE(numberOfEndcapAlignments());
424  const unsigned int nF(numberOfForwardAlignments());
425  // const unsigned int nO ( numberOfOuterAlignments() ) ;
426 
427  const unsigned int index(isHB ? alignmentBarrelIndexLocal(id)
428  : isHE ? alignmentEndcapIndexLocal(id) + nB
429  : isHF ? alignmentForwardIndexLocal(id) + nB + nE
430  : alignmentOuterIndexLocal(id) + nB + nE + nF);
431 
433  return index;
434 }
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
DetId HcalGeometry::correctId ( const DetId id) const
private

Definition at line 580 of file HcalGeometry.cc.

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

Referenced by getClosestCell().

580  {
581  if (m_mergePosition) {
582  HcalDetId hid(id);
583  return ((DetId)(m_topology.mergedDepthDetId(hid)));
584  } else {
585  return id;
586  }
587 }
uint16_t *__restrict__ id
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:166
Definition: DetId.h:17
static std::string HcalGeometry::dbString ( )
inlinestatic

Definition at line 40 of file HcalGeometry.h.

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

40 { return "PHcalRcd"; }
DetId HcalGeometry::detIdFromBarrelAlignmentIndex ( unsigned int  i)
static

Definition at line 338 of file HcalGeometry.cc.

References cms::cuda::assert(), HcalBarrel, and numberOfBarrelAlignments().

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

338  {
340  const int ieta(i < numberOfBarrelAlignments() / 2 ? -1 : 1);
341  const int iphi(1 + (4 * i) % 72);
342  return HcalDetId(HcalBarrel, ieta, iphi, 1);
343 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:67
assert(be >=bs)
DetId HcalGeometry::detIdFromEndcapAlignmentIndex ( unsigned int  i)
static

Definition at line 345 of file HcalGeometry.cc.

References cms::cuda::assert(), HcalEndcap, and numberOfEndcapAlignments().

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

345  {
347  const int ieta(i < numberOfEndcapAlignments() / 2 ? -16 : 16);
348  const int iphi(1 + (4 * i) % 72);
349  return HcalDetId(HcalEndcap, ieta, iphi, 1);
350 }
assert(be >=bs)
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:69
DetId HcalGeometry::detIdFromForwardAlignmentIndex ( unsigned int  i)
static

Definition at line 352 of file HcalGeometry.cc.

References cms::cuda::assert(), HcalForward, and numberOfForwardAlignments().

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

352  {
354  const int ieta(i < numberOfForwardAlignments() / 2 ? -29 : 29);
355  const int iphi(1 + (4 * i) % 72);
356  return HcalDetId(HcalForward, ieta, iphi, 1);
357 }
assert(be >=bs)
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:71
DetId HcalGeometry::detIdFromLocalAlignmentIndex ( unsigned int  i)
static

Definition at line 367 of file HcalGeometry.cc.

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

367  {
369 
370  const unsigned int nB(numberOfBarrelAlignments());
371  const unsigned int nE(numberOfEndcapAlignments());
372  const unsigned int nF(numberOfForwardAlignments());
373  // const unsigned int nO ( numberOfOuterAlignments() ) ;
374 
375  return (i < nB ? detIdFromBarrelAlignmentIndex(i)
376  : i < nB + nE ? detIdFromEndcapAlignmentIndex(i - nB)
377  : i < nB + nE + nF ? detIdFromForwardAlignmentIndex(i - nB - nE)
378  : detIdFromOuterAlignmentIndex(i - nB - nE - nF));
379 }
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
DetId HcalGeometry::detIdFromOuterAlignmentIndex ( unsigned int  i)
static

Definition at line 359 of file HcalGeometry.cc.

References cms::cuda::assert(), HcalOuter, numberOfOuterAlignments(), and relativeConstraints::ring.

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

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

helper methods for getClosestCell

Definition at line 256 of file HcalGeometry.cc.

References HcalTopology::etaRing(), and m_topology.

Referenced by getCells(), and getClosestCell().

256 { 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
void HcalGeometry::fillDetIds ( ) const
private

Definition at line 40 of file HcalGeometry.cc.

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

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
uint16_t *__restrict__ id
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:153
bool isSet() const
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)
def move
Definition: eostools.py:511
Definition: DetId.h:17
bool set(std::unique_ptr< T > iNewValue) const
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
GlobalPoint HcalGeometry::getBackPosition ( const DetId id) const

Definition at line 208 of file HcalGeometry.cc.

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

Referenced by getBackPosition().

208  {
209  if (!m_mergePosition) {
210  return (getGeometryBase(id)->getBackPoint());
211  } else {
212  std::vector<HcalDetId> ids;
214  return (getGeometryBase(ids.back())->getBackPoint());
215  }
216 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:168
GlobalPoint HcalGeometry::getBackPosition ( uint32_t  id,
bool  type 
) const

Definition at line 218 of file HcalGeometry.cc.

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

218  {
219  if (test) {
220  int subdet, z, depth, eta, phi, lay;
221  HcalTestNumbering::unpackHcalIndex(idx, subdet, z, depth, eta, phi, lay);
222  int sign = (z == 0) ? (-1) : (1);
223  auto id = m_topology.dddConstants()->getHCID(subdet, (sign * eta), phi, lay, depth);
224  auto hcId = ((id.subdet == static_cast<int>(HcalBarrel))
225  ? HcalDetId(HcalBarrel, sign * id.eta, id.phi, id.depth)
226  : ((id.subdet == static_cast<int>(HcalEndcap))
227  ? HcalDetId(HcalEndcap, sign * id.eta, id.phi, id.depth)
228  : ((id.subdet == static_cast<int>(HcalOuter))
229  ? HcalDetId(HcalOuter, sign * id.eta, id.phi, id.depth)
230  : ((id.subdet == static_cast<int>(HcalForward))
231  ? HcalDetId(HcalForward, sign * id.eta, id.phi, id.depth)
232  : HcalDetId()))));
233  return getBackPosition(DetId(hcId));
234  } else {
235  return getBackPosition(DetId(idx));
236  }
237 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:164
uint16_t *__restrict__ id
double sign(double x)
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 getBackPosition(const DetId &id) const
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 262 of file HcalGeometry.cc.

References reco::deltaR2(), PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), HcalTopology::etaMax(), etaRing(), CaloSubdetectorGeometry::getCells(), getGeometryBase(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, M_PI, m_topology, HcalTopology::maxDepth(), AlCaHLTBitMon_ParallelJobs::p, phi, PV3DBase< T, PVType, FrameType >::phi(), phiBin(), jetcorrextractor::sign(), and HcalTopology::valid().

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

Reimplemented from CaloSubdetectorGeometry.

Definition at line 107 of file HcalGeometry.cc.

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

107 { return getClosestCell(r, false); }
DetId getClosestCell(const GlobalPoint &r) const override
DetId HcalGeometry::getClosestCell ( const GlobalPoint r,
bool  ignoreCorrect 
) const

Definition at line 109 of file HcalGeometry.cc.

References funct::abs(), cms::cuda::assert(), correctId(), gather_cfg::cout, HcalTopology::dddConstants(), PV3DBase< T, PVType, FrameType >::eta(), HcalTopology::etaMax(), etaRing(), getGeometry(), HcalDDDRecConstants::getMinDepth(), HcalBarrel, HcalEmpty, HcalEndcap, HcalForward, HcalTopology::incrementDepth(), m_topology, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::phi(), phiBin(), PV3DBase< T, PVType, FrameType >::z(), and ecaldqm::zside().

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

Definition at line 239 of file HcalGeometry.cc.

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

239  {
240  if (!m_mergePosition) {
241  return (getGeometryBase(id)->getCorners());
242  } else {
243  std::vector<HcalDetId> ids;
248  for (unsigned int k = 0; k < 4; ++k) {
249  mcorners[k] = mcf[k];
250  mcorners[k + 4] = mcb[k + 4];
251  }
252  return mcorners;
253  }
254 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
bool m_mergePosition
Definition: HcalGeometry.h:147
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:168
CaloCellGeometry::CornersVec getCorners(const DetId &id) const
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 gather_cfg::cout, HcalTopology::detId2denseId(), getGeometryBase(), HcalTopology::idFront(), m_mergePosition, and m_topology.

Referenced by getClosestCell().

89  {
90 #ifdef EDM_ML_DEBUG
91  std::cout << "HcalGeometry::getGeometry for " << HcalDetId(id) << " " << m_mergePosition << " ";
92 #endif
93  if (!m_mergePosition) {
94 #ifdef EDM_ML_DEBUG
95  std::cout << m_topology.detId2denseId(id) << " " << getGeometryBase(id) << "\n";
96 #endif
97  return getGeometryBase(id);
98  } else {
99 #ifdef EDM_ML_DEBUG
101  << "\n";
102 #endif
103  return getGeometryBase(m_topology.idFront(id));
104  }
105 }
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
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:122
tuple cout
Definition: gather_cfg.py:144
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
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
const CaloCellGeometry * HcalGeometry::getGeometryRawPtr ( uint32_t  index) const
overrideprotectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 493 of file HcalGeometry.cc.

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

493  {
494  // Modify the RawPtr class
495  const CaloCellGeometry* cell(nullptr);
496  if (m_hbCellVec.size() > din) {
497  cell = (&m_hbCellVec[din]);
498  } else if (m_hbCellVec.size() + m_heCellVec.size() > din) {
499  const unsigned int ind(din - m_hbCellVec.size());
500  cell = (&m_heCellVec[ind]);
501  } else if (m_hbCellVec.size() + m_heCellVec.size() + m_hoCellVec.size() > din) {
502  const unsigned int ind(din - m_hbCellVec.size() - m_heCellVec.size());
503  cell = (&m_hoCellVec[ind]);
504  } else if (m_hbCellVec.size() + m_heCellVec.size() + m_hoCellVec.size() + m_hfCellVec.size() > din) {
505  const unsigned int ind(din - m_hbCellVec.size() - m_heCellVec.size() - m_hoCellVec.size());
506  cell = (&m_hfCellVec[ind]);
507  }
508 
509  return ((nullptr == cell || nullptr == cell->param()) ? nullptr : cell);
510 }
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
unsigned int HcalGeometry::getHxSize ( const int  type) const

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

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

Definition at line 187 of file HcalGeometry.cc.

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

187  {
188  if (test) {
189  int subdet, z, depth, eta, phi, lay;
190  HcalTestNumbering::unpackHcalIndex(idx, subdet, z, depth, eta, phi, lay);
191  int sign = (z == 0) ? (-1) : (1);
192  auto id = m_topology.dddConstants()->getHCID(subdet, (sign * eta), phi, lay, depth);
193  auto hcId = ((id.subdet == static_cast<int>(HcalBarrel))
194  ? HcalDetId(HcalBarrel, sign * id.eta, id.phi, id.depth)
195  : ((id.subdet == static_cast<int>(HcalEndcap))
196  ? HcalDetId(HcalEndcap, sign * id.eta, id.phi, id.depth)
197  : ((id.subdet == static_cast<int>(HcalOuter))
198  ? HcalDetId(HcalOuter, sign * id.eta, id.phi, id.depth)
199  : ((id.subdet == static_cast<int>(HcalForward))
200  ? HcalDetId(HcalForward, sign * id.eta, id.phi, id.depth)
201  : HcalDetId()))));
202  return getPosition(DetId(hcId));
203  } else {
204  return getPosition(DetId(idx));
205  }
206 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:164
uint16_t *__restrict__ id
double sign(double x)
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)
GlobalPoint getPosition(const DetId &id) const
Definition: DetId.h:17
void HcalGeometry::getSummary ( CaloSubdetectorGeometry::TrVec trVector,
CaloSubdetectorGeometry::IVec iVector,
CaloSubdetectorGeometry::DimVec dimVector,
CaloSubdetectorGeometry::IVec dinsVector 
) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 512 of file HcalGeometry.cc.

References cms::cuda::assert(), SplitLinear::begin, CaloSubdetectorGeometry::cellGeomPtr(), runTauDisplay::gp, mps_fire::i, gpuVertexFinder::iv, isotrackApplyRegressor::k, m_dins, m_topology, HcalTopology::ncells(), gpuVertexFinder::nn, numberOfParametersPerShape(), numberOfShapes(), CaloSubdetectorGeometry::numberOfTransformParms(), convertSQLiteXML::ok, CaloSubdetectorGeometry::parVecVec(), MetAnalyzer::pv(), findQualityFiles::rr, and groupFilesInBlocks::tt.

515  {
516  tVec.reserve(m_topology.ncells() * numberOfTransformParms());
517  iVec.reserve(numberOfShapes() == 1 ? 1 : m_topology.ncells());
518  dVec.reserve(numberOfShapes() * numberOfParametersPerShape());
519  dinsVec.reserve(m_topology.ncells());
520 
521  for (const auto& pv : parVecVec()) {
522  for (float iv : pv) {
523  dVec.emplace_back(iv);
524  }
525  }
526 
527  for (auto i : m_dins) {
528  Tr3D tr;
529  auto ptr = cellGeomPtr(i);
530 
531  if (nullptr != ptr) {
532  dinsVec.emplace_back(i);
533 
534  const CCGFloat* par(ptr->param());
535 
536  unsigned int ishape(9999);
537 
538  for (unsigned int ivv(0); ivv != parVecVec().size(); ++ivv) {
539  bool ok(true);
540  const CCGFloat* pv(&(*parVecVec()[ivv].begin()));
541  for (unsigned int k(0); k != numberOfParametersPerShape(); ++k) {
542  ok = ok && (fabs(par[k] - pv[k]) < 1.e-6);
543  }
544  if (ok) {
545  ishape = ivv;
546  break;
547  }
548  }
549  assert(9999 != ishape);
550 
551  const unsigned int nn((numberOfShapes() == 1) ? (unsigned int)1 : m_dins.size());
552  if (iVec.size() < nn)
553  iVec.emplace_back(ishape);
554 
555  ptr->getTransform(tr, (Pt3DVec*)nullptr);
556 
557  if (Tr3D() == tr) { // for preshower there is no rotation
558  const GlobalPoint& gp(ptr->getPosition());
559  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
560  }
561 
562  const CLHEP::Hep3Vector tt(tr.getTranslation());
563  tVec.emplace_back(tt.x());
564  tVec.emplace_back(tt.y());
565  tVec.emplace_back(tt.z());
566  if (6 == numberOfTransformParms()) {
567  const CLHEP::HepRotation rr(tr.getRotation());
568  const ROOT::Math::Transform3D rtr(
569  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
571  rtr.GetRotation(ea);
572  tVec.emplace_back(ea.Phi());
573  tVec.emplace_back(ea.Theta());
574  tVec.emplace_back(ea.Psi());
575  }
576  }
577  }
578 }
int32_t *__restrict__ iv
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
assert(be >=bs)
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
unsigned int numberOfParametersPerShape() const override
Definition: HcalGeometry.h:43
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
int32_t *__restrict__ nn
virtual unsigned int numberOfTransformParms() const
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
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
void fillDetIds() const
Definition: HcalGeometry.cc:40
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:151
T const * load() const
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:149
void HcalGeometry::increaseReserve ( unsigned int  extra)
private
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
void HcalGeometry::init ( void  )
private

Definition at line 24 of file HcalGeometry.cc.

References gather_cfg::cout, 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().

24  {
26  m_mergePosition = false;
27 #ifdef EDM_ML_DEBUG
28  std::cout << "HcalGeometry: "
29  << "HcalGeometry::init() "
30  << " HBSize " << m_topology.getHBSize() << " HESize " << m_topology.getHESize() << " HOSize "
31  << m_topology.getHOSize() << " HFSize " << m_topology.getHFSize() << std::endl;
32 #endif
33 
38 }
unsigned int getHFSize() const
Definition: HcalTopology.h:135
unsigned int getHOSize() const
Definition: HcalTopology.h:134
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
std::vector< IdealObliquePrism > HECellVec
Definition: HcalGeometry.h:25
bool m_mergePosition
Definition: HcalGeometry.h:147
bool getMergePositionFlag() const
Definition: HcalTopology.h:167
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
std::vector< IdealZPrism > HFCellVec
Definition: HcalGeometry.h:27
std::vector< IdealObliquePrism > HBCellVec
Definition: HcalGeometry.h:24
unsigned int getHESize() const
Definition: HcalTopology.h:133
HECellVec m_heCellVec
Definition: HcalGeometry.h:157
tuple cout
Definition: gather_cfg.py:144
unsigned int getHBSize() const
Definition: HcalTopology.h:132
void HcalGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)

Definition at line 438 of file HcalGeometry.cc.

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

438  {
440 
441  if (hid.subdet() == HcalForward) {
442  IdealZPrism::localCorners(lc, pv, ref);
443  } else {
445  }
446 }
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
void HcalGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 477 of file HcalGeometry.cc.

References CaloSubdetectorGeometry::addValidID(), cropTnPTrees::din, m_dins, and newCellImpl().

478  {
479  unsigned int din = newCellImpl(f1, f2, f3, parm, detId);
480 
481  addValidID(detId);
482  m_dins.emplace_back(din);
483 }
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)
void HcalGeometry::newCellFast ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
private

Definition at line 485 of file HcalGeometry.cc.

References cropTnPTrees::din, m_dins, CaloSubdetectorGeometry::m_validIds, and newCellImpl().

Referenced by HcalHardcodeGeometryLoader::fillHBHO(), HcalFlexiHardcodeGeometryLoader::fillHBHO(), HcalHardcodeGeometryLoader::fillHE(), HcalFlexiHardcodeGeometryLoader::fillHE(), HcalHardcodeGeometryLoader::fillHF(), and HcalFlexiHardcodeGeometryLoader::fillHF().

486  {
487  unsigned int din = newCellImpl(f1, f2, f3, parm, detId);
488 
489  m_validIds.emplace_back(detId);
490  m_dins.emplace_back(din);
491 }
std::vector< DetId > m_validIds
CaloSubdetectorGeometry::IVec m_dins
Definition: HcalGeometry.h:154
unsigned int newCellImpl(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
unsigned int HcalGeometry::newCellImpl ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
private

Definition at line 448 of file HcalGeometry.cc.

References cms::cuda::assert(), CaloSubdetectorGeometry::cornersMgr(), gather_cfg::cout, DetId::det(), HcalTopology::detId2denseId(), cropTnPTrees::din, IdealZPrism::EM, IdealZPrism::HADR, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, m_topology, DetId::rawId(), and DetId::subdetId().

Referenced by newCell(), and newCellFast().

449  {
450  assert(detId.det() == DetId::Hcal);
451 
452  const HcalDetId hid(detId);
453  unsigned int din = m_topology.detId2denseId(detId);
454 
455 #ifdef EDM_ML_DEBUG
456  std::cout << "HcalGeometry: "
457  << " newCell subdet " << detId.subdetId() << ", raw ID " << detId.rawId() << ", hid " << hid << ", din "
458  << din << ", index " << std::endl;
459 #endif
460 
461  if (hid.subdet() == HcalBarrel) {
462  m_hbCellVec.at(din) = IdealObliquePrism(f1, cornersMgr(), parm);
463  } else if (hid.subdet() == HcalEndcap) {
464  const unsigned int index(din - m_hbCellVec.size());
465  m_heCellVec.at(index) = IdealObliquePrism(f1, cornersMgr(), parm);
466  } else if (hid.subdet() == HcalOuter) {
467  const unsigned int index(din - m_hbCellVec.size() - m_heCellVec.size());
468  m_hoCellVec.at(index) = IdealObliquePrism(f1, cornersMgr(), parm);
469  } else {
470  const unsigned int index(din - m_hbCellVec.size() - m_heCellVec.size() - m_hoCellVec.size());
471  m_hfCellVec.at(index) = IdealZPrism(f1, cornersMgr(), parm, hid.depth() == 1 ? IdealZPrism::EM : IdealZPrism::HADR);
472  }
473 
474  return din;
475 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
CaloCellGeometry::CornersMgr * cornersMgr()
HECellVec m_heCellVec
Definition: HcalGeometry.h:157
tuple cout
Definition: gather_cfg.py:144
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
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
static unsigned int HcalGeometry::numberOfBarrelAlignments ( )
inlinestatic
static unsigned int HcalGeometry::numberOfEndcapAlignments ( )
inlinestatic
static unsigned int HcalGeometry::numberOfForwardAlignments ( )
inlinestatic
static unsigned int HcalGeometry::numberOfOuterAlignments ( )
inlinestatic
unsigned int HcalGeometry::numberOfParametersPerShape ( ) const
inlineoverridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 43 of file HcalGeometry.h.

References k_NumberOfParametersPerShape.

Referenced by getSummary().

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:161
int HcalGeometry::phiBin ( HcalSubdetector  bc,
int  etaring,
double  phi 
) const
private

Definition at line 258 of file HcalGeometry.cc.

References m_topology, and HcalTopology::phiBin().

Referenced by getCells(), and getClosestCell().

258  {
259  return m_topology.phiBin(bc, etaring, phi);
260 }
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
const HcalTopology & m_topology
Definition: HcalGeometry.h:146
static std::string HcalGeometry::producerTag ( )
inlinestatic
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)
void HcalGeometry::sortValidIds ( )
private

Definition at line 591 of file HcalGeometry.cc.

References CaloSubdetectorGeometry::m_validIds.

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

591 { std::sort(m_validIds.begin(), m_validIds.end()); }
std::vector< DetId > m_validIds
const HcalTopology& HcalGeometry::topology ( ) const
inline

Definition at line 111 of file HcalGeometry.h.

References m_topology.

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

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

Friends And Related Function Documentation

friend class HcalFlexiHardcodeGeometryLoader
friend

Definition at line 21 of file HcalGeometry.h.

friend class HcalGeometryPlan1Tester
friend

Definition at line 18 of file HcalGeometry.h.

friend class HcalHardcodeGeometryLoader
friend

Definition at line 22 of file HcalGeometry.h.

Member Data Documentation

CaloSubdetectorGeometry::IVec HcalGeometry::m_dins
private

Definition at line 154 of file HcalGeometry.h.

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

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

Definition at line 153 of file HcalGeometry.h.

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

HBCellVec HcalGeometry::m_hbCellVec
private

Definition at line 156 of file HcalGeometry.h.

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

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

Definition at line 149 of file HcalGeometry.h.

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

HECellVec HcalGeometry::m_heCellVec
private

Definition at line 157 of file HcalGeometry.h.

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

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

Definition at line 150 of file HcalGeometry.h.

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

HFCellVec HcalGeometry::m_hfCellVec
private

Definition at line 159 of file HcalGeometry.h.

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

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

Definition at line 152 of file HcalGeometry.h.

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

HOCellVec HcalGeometry::m_hoCellVec
private

Definition at line 158 of file HcalGeometry.h.

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

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

Definition at line 151 of file HcalGeometry.h.

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

bool HcalGeometry::m_mergePosition
private

Definition at line 147 of file HcalGeometry.h.

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

const HcalTopology& HcalGeometry::m_topology
private