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
 
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
 
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 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

Definition at line 36 of file HcalGeometry.h.

Definition at line 35 of file HcalGeometry.h.

Definition at line 31 of file HcalGeometry.h.

Definition at line 38 of file HcalGeometry.h.

Definition at line 26 of file HcalGeometry.h.

Definition at line 27 of file HcalGeometry.h.

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

Definition at line 29 of file HcalGeometry.h.

Definition at line 28 of file HcalGeometry.h.

Definition at line 37 of file HcalGeometry.h.

Definition at line 32 of file HcalGeometry.h.

Definition at line 33 of file HcalGeometry.h.

Member Enumeration Documentation

anonymous enum
Enumerator
k_NumberOfParametersPerShape 

Definition at line 41 of file HcalGeometry.h.

Constructor & Destructor Documentation

HcalGeometry::HcalGeometry ( const HcalTopology topology)
explicit

Definition at line 16 of file HcalGeometry.cc.

References init().

Referenced by numberOfParametersPerShape().

16  :
17  m_topology(topology), m_mergePosition(topology.getMergePositionFlag()) {
18  init();
19 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
bool m_mergePosition
Definition: HcalGeometry.h:161
bool getMergePositionFlag() const
Definition: HcalTopology.h:170
HcalGeometry::~HcalGeometry ( )
override

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

Definition at line 21 of file HcalGeometry.cc.

Referenced by numberOfParametersPerShape().

21 {}

Member Function Documentation

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

Definition at line 340 of file HcalGeometry.cc.

References HcalDetId::ieta(), and HcalDetId::iphi().

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

341  {
342  const HcalDetId hid ( id ) ;
343  const unsigned int iphi ( hid.iphi() ) ;
344  const int ieta ( hid.ieta() ) ;
345  const unsigned int index ( ( 0 < ieta ? nD/2 : 0 ) + ( iphi + 1 )%72/4 ) ;
346  assert( index < nD ) ;
347  return index ;
348 }
unsigned int HcalGeometry::alignmentBarrelIndexLocal ( const DetId id)
static

Definition at line 350 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfBarrelAlignments().

Referenced by alignmentTransformIndexLocal(), and numberOfAlignments().

350  {
352 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:69
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)
unsigned int HcalGeometry::alignmentEndcapIndexLocal ( const DetId id)
static

Definition at line 354 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfEndcapAlignments().

Referenced by alignmentTransformIndexLocal(), and numberOfAlignments().

354  {
356 }
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:71
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)
unsigned int HcalGeometry::alignmentForwardIndexLocal ( const DetId id)
static

Definition at line 358 of file HcalGeometry.cc.

References alignmentBarEndForIndexLocal(), and numberOfForwardAlignments().

Referenced by alignmentTransformIndexLocal(), and numberOfAlignments().

358  {
360 }
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:73
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)
unsigned int HcalGeometry::alignmentOuterIndexLocal ( const DetId id)
static

Definition at line 362 of file HcalGeometry.cc.

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

Referenced by alignmentTransformIndexLocal(), and numberOfAlignments().

362  {
363  const HcalDetId hid ( id ) ;
364  const int ieta ( hid.ieta() ) ;
365  const int iphi ( hid.iphi() ) ;
366  const int ring ( ieta < -10 ? 0 :
367  ( ieta < -4 ? 1 :
368  ( ieta < 5 ? 2 :
369  ( ieta < 11 ? 3 : 4 ) ) ) ) ;
370 
371  const unsigned int index ( 12*ring + ( iphi - 1 )/6 ) ;
372  assert( index < numberOfOuterAlignments() ) ;
373  return index ;
374 }
static unsigned int numberOfOuterAlignments()
Definition: HcalGeometry.h:75
unsigned int HcalGeometry::alignmentTransformIndexGlobal ( const DetId id)
static

Definition at line 400 of file HcalGeometry.cc.

References DetId::Hcal.

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

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

Definition at line 376 of file HcalGeometry.cc.

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

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

376  {
377  assert(id.det() == DetId::Hcal) ;
378 
379  const HcalDetId hid ( id ) ;
380  bool isHB = (hid.subdet() == HcalBarrel);
381  bool isHE = (hid.subdet() == HcalEndcap);
382  bool isHF = (hid.subdet() == HcalForward);
383  // bool isHO = (hid.subdet() == HcalOuter);
384 
385  const unsigned int nB ( numberOfBarrelAlignments() ) ;
386  const unsigned int nE ( numberOfEndcapAlignments() ) ;
387  const unsigned int nF ( numberOfForwardAlignments() ) ;
388  // const unsigned int nO ( numberOfOuterAlignments() ) ;
389 
390  const unsigned int index (isHB ? alignmentBarrelIndexLocal(id) :
391  isHE ? alignmentEndcapIndexLocal(id) + nB :
392  isHF ? alignmentForwardIndexLocal( id ) + nB + nE :
393  alignmentOuterIndexLocal(id) + nB + nE + nF
394  );
395 
396  assert( index < numberOfAlignments() ) ;
397  return index ;
398 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:69
static unsigned int alignmentEndcapIndexLocal(const DetId &id)
bool isHE(int etabin, int depth)
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:71
bool isHF(int etabin, int depth)
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:73
static unsigned int alignmentForwardIndexLocal(const DetId &id)
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:79
DetId HcalGeometry::correctId ( const DetId id) const
private

Definition at line 570 of file HcalGeometry.cc.

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

Referenced by getClosestCell(), and getGeometryBase().

570  {
571 
572  if (m_mergePosition) {
573  HcalDetId hid(id);
574  return ((DetId)(m_topology.mergedDepthDetId(hid)));
575  } else {
576  return id;
577  }
578 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
bool m_mergePosition
Definition: HcalGeometry.h:161
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:169
Definition: DetId.h:18
static std::string HcalGeometry::dbString ( )
inlinestatic

Definition at line 43 of file HcalGeometry.h.

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

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

Definition at line 294 of file HcalGeometry.cc.

References HcalBarrel, and numberOfBarrelAlignments().

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

294  {
295  assert( i < numberOfBarrelAlignments() ) ;
296  const int ieta ( i < numberOfBarrelAlignments()/2 ? -1 : 1 ) ;
297  const int iphi ( 1 + (4*i)%72 ) ;
298  return HcalDetId( HcalBarrel, ieta, iphi, 1 ) ;
299 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:69
DetId HcalGeometry::detIdFromEndcapAlignmentIndex ( unsigned int  i)
static

Definition at line 301 of file HcalGeometry.cc.

References HcalEndcap, and numberOfEndcapAlignments().

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

301  {
302  assert( i < numberOfEndcapAlignments() ) ;
303  const int ieta ( i < numberOfEndcapAlignments()/2 ? -16 : 16 ) ;
304  const int iphi ( 1 + (4*i)%72 ) ;
305  return HcalDetId( HcalEndcap, ieta, iphi, 1 ) ;
306 }
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:71
DetId HcalGeometry::detIdFromForwardAlignmentIndex ( unsigned int  i)
static

Definition at line 308 of file HcalGeometry.cc.

References HcalForward, and numberOfForwardAlignments().

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

308  {
309  assert( i < numberOfForwardAlignments() ) ;
310  const int ieta ( i < numberOfForwardAlignments()/2 ? -29 : 29 ) ;
311  const int iphi ( 1 + (4*i)%72 ) ;
312  return HcalDetId( HcalForward, ieta, iphi, 1 ) ;
313 }
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:73
DetId HcalGeometry::detIdFromLocalAlignmentIndex ( unsigned int  i)
static

Definition at line 326 of file HcalGeometry.cc.

References detIdFromBarrelAlignmentIndex(), detIdFromEndcapAlignmentIndex(), detIdFromForwardAlignmentIndex(), detIdFromOuterAlignmentIndex(), numberOfAlignments(), numberOfBarrelAlignments(), numberOfEndcapAlignments(), and numberOfForwardAlignments().

Referenced by numberOfAlignments().

326  {
327  assert( i < numberOfAlignments() ) ;
328 
329  const unsigned int nB ( numberOfBarrelAlignments() ) ;
330  const unsigned int nE ( numberOfEndcapAlignments() ) ;
331  const unsigned int nF ( numberOfForwardAlignments() ) ;
332 // const unsigned int nO ( numberOfOuterAlignments() ) ;
333 
334  return ( i < nB ? detIdFromBarrelAlignmentIndex( i ) :
335  i < nB+nE ? detIdFromEndcapAlignmentIndex( i - nB ) :
336  i < nB+nE+nF ? detIdFromForwardAlignmentIndex( i - nB - nE ) :
337  detIdFromOuterAlignmentIndex( i - nB - nE - nF ) ) ;
338 }
static unsigned int numberOfBarrelAlignments()
Definition: HcalGeometry.h:69
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
static DetId detIdFromForwardAlignmentIndex(unsigned int i)
static DetId detIdFromBarrelAlignmentIndex(unsigned int i)
static unsigned int numberOfEndcapAlignments()
Definition: HcalGeometry.h:71
static unsigned int numberOfForwardAlignments()
Definition: HcalGeometry.h:73
static DetId detIdFromEndcapAlignmentIndex(unsigned int i)
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:79
DetId HcalGeometry::detIdFromOuterAlignmentIndex ( unsigned int  i)
static

Definition at line 315 of file HcalGeometry.cc.

References HcalOuter, numberOfOuterAlignments(), and relativeConstraints::ring.

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

315  {
316  assert( i < numberOfOuterAlignments() ) ;
317  const int ring ( i/12 ) ;
318  const int ieta ( 0 == ring ? -11 :
319  1 == ring ? -5 :
320  2 == ring ? 1 :
321  3 == ring ? 5 : 11 ) ;
322  const int iphi ( 1 + ( i - ring*12 )*6 ) ;
323  return HcalDetId( HcalOuter, ieta, iphi, 4 ) ;
324 }
static unsigned int numberOfOuterAlignments()
Definition: HcalGeometry.h:75
int HcalGeometry::etaRing ( HcalSubdetector  bc,
double  abseta 
) const
private

helper methods for getClosestCell

Definition at line 215 of file HcalGeometry.cc.

References HcalTopology::etaRing(), and m_topology.

Referenced by getCells(), getClosestCell(), and getGeometryBase().

215  {
216  return m_topology.etaRing(bc, abseta);
217 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
void HcalGeometry::fillDetIds ( ) const
private

Definition at line 39 of file HcalGeometry.cc.

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

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

39  {
40  // this must test the last record filled to avoid a race condition
41  if(!m_emptyIds.isSet()) {
42  std::unique_ptr<std::vector<DetId>> p_hbIds{new std::vector<DetId>};
43  std::unique_ptr<std::vector<DetId>> p_heIds{new std::vector<DetId>};
44  std::unique_ptr<std::vector<DetId>> p_hoIds{new std::vector<DetId>};
45  std::unique_ptr<std::vector<DetId>> p_hfIds{new std::vector<DetId>};
46  std::unique_ptr<std::vector<DetId>> p_emptyIds{new std::vector<DetId>};
47 
48  const std::vector<DetId>& baseIds (CaloSubdetectorGeometry::getValidDetIds());
49  for (unsigned int i ( 0 ) ; i != baseIds.size() ; ++i) {
50  const DetId id ( baseIds[i] );
51  if (id.subdetId() == HcalBarrel) {
52  p_hbIds->emplace_back( id ) ;
53  } else if (id.subdetId() == HcalEndcap) {
54  p_heIds->emplace_back( id ) ;
55  } else if (id.subdetId() == HcalOuter) {
56  p_hoIds->emplace_back( id ) ;
57  } else if (id.subdetId() == HcalForward) {
58  p_hfIds->emplace_back( id ) ;
59  }
60  }
61  std::sort( p_hbIds->begin(), p_hbIds->end() ) ;
62  std::sort( p_heIds->begin(), p_heIds->end() ) ;
63  std::sort( p_hoIds->begin(), p_hoIds->end() ) ;
64  std::sort( p_hfIds->begin(), p_hfIds->end() ) ;
65  p_emptyIds->resize( 0 ) ;
66 
67  m_hbIds.set(std::move(p_hbIds));
68  m_heIds.set(std::move(p_heIds));
69  m_hoIds.set(std::move(p_hoIds));
70  m_hfIds.set(std::move(p_hfIds));
71  m_emptyIds.set(std::move(p_emptyIds));
72  }
73 }
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
Definition: HcalGeometry.h:164
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:167
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)
Definition: DetId.h:18
bool set(std::unique_ptr< T > iNewValue) const
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
Definition: HcalGeometry.h:166
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:165
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:163
def move(src, dest)
Definition: eostools.py:511
GlobalPoint HcalGeometry::getBackPosition ( const DetId id) const

Definition at line 188 of file HcalGeometry.cc.

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

Referenced by numberOfParametersPerShape().

188  {
189  if (!m_mergePosition) {
190  return (getGeometryBase(id)->getBackPoint());
191  } else {
192  std::vector<HcalDetId> ids;
194  return (getGeometryBase(ids.back())->getBackPoint());
195  }
196 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
bool m_mergePosition
Definition: HcalGeometry.h:161
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:130
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:171
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 223 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(), Validation_hcalonly_cfi::sign, and HcalTopology::valid().

Referenced by numberOfParametersPerShape().

224  {
225  CaloSubdetectorGeometry::DetIdSet dis; // this is the return object
226 
227  if (0.000001 < dR) {
228  if (dR > M_PI/2.) {// this version needs "small" dR
229  dis = CaloSubdetectorGeometry::getCells(r, dR); // base class version
230  } else {
231  const double dR2 ( dR*dR ) ;
232  const double reta ( r.eta() ) ;
233  const double rphi ( r.phi() ) ;
234  const double lowEta ( reta - dR ) ;
235  const double highEta ( reta + dR ) ;
236  const double lowPhi ( rphi - dR ) ;
237  const double highPhi ( rphi + dR ) ;
238 
239  const double hfEtaHi (m_topology.etaMax(HcalForward));
240 
241  if (highEta > -hfEtaHi &&
242  lowEta < hfEtaHi ) { // in hcal
244 
245  for (unsigned int is ( 0 ) ; is != 4 ; ++is ) {
246  const int sign ( reta>0 ? 1 : -1 ) ;
247  const int ieta_center ( sign*etaRing( hs[is], fabs( reta ) ) ) ;
248  const int ieta_lo ( ( 0 < lowEta*sign ? sign : -sign )*etaRing( hs[is], fabs( lowEta ) ) ) ;
249  const int ieta_hi ( ( 0 < highEta*sign ? sign : -sign )*etaRing( hs[is], fabs( highEta ) ) ) ;
250  const int iphi_lo ( phiBin( hs[is], ieta_center, lowPhi ) ) ;
251  const int iphi_hi ( phiBin( hs[is], ieta_center, highPhi ) ) ;
252  const int jphi_lo ( iphi_lo>iphi_hi ? iphi_lo - 72 : iphi_lo ) ;
253  const int jphi_hi ( iphi_hi ) ;
254 
255  const int idep_lo ( 1 == is ? 4 : 1 ) ;
256  const int idep_hi ( m_topology.maxDepth(hs[is]) );
257  for (int ieta ( ieta_lo ) ; ieta <= ieta_hi ; ++ieta) {// over eta limits
258  if (ieta != 0) {
259  for (int jphi ( jphi_lo ) ; jphi <= jphi_hi ; ++jphi) { // over phi limits
260  const int iphi ( 1 > jphi ? jphi+72 : jphi ) ;
261  for (int idep ( idep_lo ) ; idep <= idep_hi ; ++idep ) {
262  const HcalDetId did ( hs[is], ieta, iphi, idep ) ;
263  if (m_topology.valid(did)) {
264  std::shared_ptr<const CaloCellGeometry> cell ( getGeometryBase( did ) );
265  if (nullptr != cell ) {
266  const GlobalPoint& p ( cell->getPosition() ) ;
267  const double eta ( p.eta() ) ;
268  const double phi ( p.phi() ) ;
269  if (reco::deltaR2(eta, phi, reta, rphi ) < dR2) dis.insert( did ) ;
270  }
271  }
272  }
273  }
274  }
275  }
276  }
277  }
278  }
279  }
280  return dis;
281 }
bool valid(const DetId &id) const override
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:130
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
int maxDepth(HcalSubdetector subdet) const
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:76
double etaMax(HcalSubdetector subdet) const
DetId HcalGeometry::getClosestCell ( const GlobalPoint r) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 106 of file HcalGeometry.cc.

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

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

Definition at line 110 of file HcalGeometry.cc.

References funct::abs(), 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().

111  {
112 
113  // Now find the closest eta_bin, eta value of a bin i is average
114  // of eta[i] and eta[i-1]
115  static const double z_long=1100.0;
116  double abseta = fabs(r.eta());
117  double absz = fabs(r.z());
118 
119  // figure out subdetector, giving preference to HE in HE/HF overlap region
121  if (abseta <= m_topology.etaMax(HcalBarrel) ) {
122  bc = HcalBarrel;
123  } else if (absz >= z_long) {
124  bc = HcalForward;
125  } else if (abseta <= m_topology.etaMax(HcalEndcap) ) {
126  bc = HcalEndcap;
127  } else {
128  bc = HcalForward;
129  }
130 
131  // find eta bin
132  int etaring = etaRing(bc, abseta);
133 
134  int phibin = phiBin(bc, etaring, r.phi());
135 
136  // add a sign to the etaring
137  int etabin = (r.z() > 0) ? etaring : -etaring;
138 
139  if (bc == HcalForward) {
140  static const double z_short=1137.0;
141  // Next line is premature depth 1 and 2 can coexist for large z-extent
142  // HcalDetId bestId(bc,etabin,phibin,((fabs(r.z())>=z_short)?(2):(1)));
143  // above line is no good with finite precision
144  HcalDetId bestId(bc,etabin,phibin,((fabs(r.z()) - z_short >-0.1)?(2):(1)));
145  return correctId(bestId);
146  } else {
147 
148  //Now do depth if required
149  int zside = (r.z() > 0) ? 1 : -1;
150  int dbin = m_topology.dddConstants()->getMinDepth(((int)(bc)-1),etaring,phibin,zside);
151  double pointrz(0), drz(99999.);
152  HcalDetId currentId(bc, etabin, phibin, dbin);
153  if (bc == HcalBarrel) pointrz = r.mag();
154  else 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) rz = std::abs(cell->getPosition().z());
164  else 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))
173  << std::endl;
174 #endif
175 
176  return (ignoreCorrect ? bestId : correctId(bestId));
177  }
178 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
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:86
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
int zside(DetId const &)
T mag() const
Definition: PV3DBase.h:67
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:64
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:76
double etaMax(HcalSubdetector subdet) const
CaloCellGeometry::CornersVec HcalGeometry::getCorners ( const DetId id) const

Definition at line 198 of file HcalGeometry.cc.

References getGeometryBase(), electrons_cff::ids, gen::k, m_mergePosition, m_topology, and HcalTopology::unmergeDepthDetId().

Referenced by numberOfParametersPerShape().

198  {
199  if (!m_mergePosition) {
200  return (getGeometryBase(id)->getCorners());
201  } else {
202  std::vector<HcalDetId> ids;
207  for (unsigned int k=0; k<4; ++k) {
208  mcorners[k] = mcf[k];
209  mcorners[k+4] = mcb[k+4];
210  }
211  return mcorners;
212  }
213 }
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
bool m_mergePosition
Definition: HcalGeometry.h:161
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:130
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:171
int k[5][pyjets_maxn]
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 86 of file HcalGeometry.cc.

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

Referenced by getClosestCell(), and numberOfParametersPerShape().

86  {
87 #ifdef EDM_ML_DEBUG
88  std::cout << "HcalGeometry::getGeometry for " << HcalDetId(id) << " "
89  << m_mergePosition << " ";
90 #endif
91  if (!m_mergePosition) {
92 #ifdef EDM_ML_DEBUG
94  << "\n";
95 #endif
96  return getGeometryBase(id);
97  } else {
98 #ifdef EDM_ML_DEBUG
100  << getGeometryBase(m_topology.idFront(id)) << "\n";
101 #endif
102  return getGeometryBase(m_topology.idFront(id));
103  }
104 }
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
bool m_mergePosition
Definition: HcalGeometry.h:161
std::shared_ptr< const CaloCellGeometry > getGeometryBase(const DetId &id) const
Definition: HcalGeometry.h:130
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:176
std::shared_ptr<const CaloCellGeometry> HcalGeometry::getGeometryBase ( const DetId id) const
inlineprivate

Definition at line 130 of file HcalGeometry.h.

References CaloSubdetectorGeometry::cellGeomPtr(), correctId(), HcalTopology::detId2denseId(), etaRing(), fillDetIds(), increaseReserve(), init(), m_topology, newCellFast(), newCellImpl(), phi, phiBin(), and sortValidIds().

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

130  {
131  return cellGeomPtr( m_topology.detId2denseId( id ) ) ;
132  }
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
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 480 of file HcalGeometry.cc.

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

Referenced by sizeForDenseIndex().

480  {
481  // Modify the RawPtr class
482  const CaloCellGeometry* cell(nullptr);
483  if (m_hbCellVec.size() > din) {
484  cell = (&m_hbCellVec[din]);
485  } else if (m_hbCellVec.size()+m_heCellVec.size() > din) {
486  const unsigned int ind (din - m_hbCellVec.size() ) ;
487  cell = (&m_heCellVec[ind]);
488  } else if (m_hbCellVec.size()+m_heCellVec.size()+m_hoCellVec.size() > din) {
489  const unsigned int ind (din - m_hbCellVec.size() - m_heCellVec.size());
490  cell = (&m_hoCellVec[ind]);
491  } else if (m_hbCellVec.size()+m_heCellVec.size()+m_hoCellVec.size()+
492  m_hfCellVec.size() > din) {
493  const unsigned int ind (din - m_hbCellVec.size() - m_heCellVec.size() -
494  m_hoCellVec.size() ) ;
495  cell = (&m_hfCellVec[ind]);
496  }
497 
498  return (( nullptr == cell || nullptr == cell->param()) ? nullptr : cell ) ;
499 }
HBCellVec m_hbCellVec
Definition: HcalGeometry.h:170
HOCellVec m_hoCellVec
Definition: HcalGeometry.h:172
HFCellVec m_hfCellVec
Definition: HcalGeometry.h:173
HECellVec m_heCellVec
Definition: HcalGeometry.h:171
unsigned int HcalGeometry::getHxSize ( const int  type) const

Definition at line 283 of file HcalGeometry.cc.

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

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

283  {
284  unsigned int hxsize(0);
285  if (!m_hbIds.isSet()) fillDetIds();
286  if (type == 1) hxsize = (m_hbIds.isSet()) ? m_hbIds->size() : 0;
287  else if (type == 2) hxsize = (m_heIds.isSet()) ? m_heIds->size() : 0;
288  else if (type == 3) hxsize = (m_hoIds.isSet()) ? m_hoIds->size() : 0;
289  else if (type == 4) hxsize = (m_hfIds.isSet()) ? m_hfIds->size() : 0;
290  else if (type == 0) hxsize = (m_emptyIds.isSet()) ? m_emptyIds->size() : 0;
291  return hxsize;
292 }
type
Definition: HCALResponse.h:21
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
Definition: HcalGeometry.h:164
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:167
bool isSet() const
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
Definition: HcalGeometry.h:166
void fillDetIds() const
Definition: HcalGeometry.cc:39
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:165
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:163
GlobalPoint HcalGeometry::getPosition ( const DetId id) const
void HcalGeometry::getSummary ( CaloSubdetectorGeometry::TrVec trVector,
CaloSubdetectorGeometry::IVec iVector,
CaloSubdetectorGeometry::DimVec dimVector,
CaloSubdetectorGeometry::IVec dinsVector 
) const
overridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 501 of file HcalGeometry.cc.

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

Referenced by numberOfAlignments().

504  {
505 
506  tVec.reserve( m_topology.ncells()*numberOfTransformParms());
507  iVec.reserve( numberOfShapes()==1 ? 1 : m_topology.ncells());
508  dVec.reserve( numberOfShapes()*numberOfParametersPerShape());
509  dinsVec.reserve( m_topology.ncells());
510 
511  for (const auto & pv : parVecVec()) {
512  for (float iv : pv) {
513  dVec.emplace_back( iv ) ;
514  }
515  }
516 
517  for( auto i : m_dins ) {
518  Tr3D tr ;
519  auto ptr = cellGeomPtr( i );
520 
521  if (nullptr != ptr) {
522  dinsVec.emplace_back( i );
523 
524  const CCGFloat* par ( ptr->param() ) ;
525 
526  unsigned int ishape ( 9999 ) ;
527 
528  for( unsigned int ivv ( 0 ) ; ivv != parVecVec().size() ; ++ivv ) {
529  bool ok ( true ) ;
530  const CCGFloat* pv ( &(*parVecVec()[ivv].begin() ) ) ;
531  for( unsigned int k ( 0 ) ; k != numberOfParametersPerShape() ; ++k ) {
532  ok = ok && ( fabs( par[k] - pv[k] ) < 1.e-6 ) ;
533  }
534  if( ok ) {
535  ishape = ivv;
536  break ;
537  }
538  }
539  assert( 9999 != ishape ) ;
540 
541  const unsigned int nn (( numberOfShapes()==1) ? (unsigned int)1 : m_dins.size() ) ;
542  if( iVec.size() < nn ) iVec.emplace_back( ishape ) ;
543 
544  ptr->getTransform( tr, ( Pt3DVec* ) nullptr ) ;
545 
546  if( Tr3D() == tr ) { // for preshower there is no rotation
547  const GlobalPoint& gp ( ptr->getPosition() ) ;
548  tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z() ) ;
549  }
550 
551  const CLHEP::Hep3Vector tt ( tr.getTranslation() ) ;
552  tVec.emplace_back( tt.x() ) ;
553  tVec.emplace_back( tt.y() ) ;
554  tVec.emplace_back( tt.z() ) ;
555  if (6 == numberOfTransformParms()) {
556  const CLHEP::HepRotation rr ( tr.getRotation() ) ;
557  const ROOT::Math::Transform3D rtr (rr.xx(), rr.xy(), rr.xz(), tt.x(),
558  rr.yx(), rr.yy(), rr.yz(), tt.y(),
559  rr.zx(), rr.zy(), rr.zz(), tt.z());
561  rtr.GetRotation( ea ) ;
562  tVec.emplace_back( ea.Phi() ) ;
563  tVec.emplace_back( ea.Theta() ) ;
564  tVec.emplace_back( ea.Psi() ) ;
565  }
566  }
567  }
568 }
unsigned int numberOfShapes() const override
Definition: HcalGeometry.h:45
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
CaloCellGeometry::Tr3D Tr3D
Definition: HcalGeometry.cc:12
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
unsigned int numberOfParametersPerShape() const override
Definition: HcalGeometry.h:46
def pv(vc)
Definition: MetAnalyzer.py:7
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::IVec m_dins
Definition: HcalGeometry.h:168
int k[5][pyjets_maxn]
AlgebraicVector EulerAngles
Definition: Definitions.h:36
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
#define begin
Definition: vmac.h:32
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
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(), cms::MinBias::endJob(), HCALRecHitAnalyzer::FillGeometry(), and numberOfParametersPerShape().

77  {
78  if( 0 != subdet ) fillDetIds() ;
79  return ( 0 == subdet ? CaloSubdetectorGeometry::getValidDetIds() :
80  ( HcalBarrel == subdet ? *m_hbIds.load() :
81  ( HcalEndcap == subdet ? *m_heIds.load() :
82  ( HcalOuter == subdet ? *m_hoIds.load() :
83  ( HcalForward == subdet ? *m_hfIds.load() : *m_emptyIds.load() ) ) ) ) ) ;
84 }
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
Definition: HcalGeometry.h:164
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
Definition: HcalGeometry.h:167
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:166
void fillDetIds() const
Definition: HcalGeometry.cc:39
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
Definition: HcalGeometry.h:165
T const * load() const
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
Definition: HcalGeometry.h:163
void HcalGeometry::increaseReserve ( unsigned int  extra)
private
unsigned int HcalGeometry::indexFor ( const DetId id) const
inlineoverrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 121 of file HcalGeometry.h.

References HcalTopology::detId2denseId(), and m_topology.

121 { return m_topology.detId2denseId(id); }
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
void HcalGeometry::init ( void  )
private

Definition at line 23 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 getGeometryBase(), and HcalGeometry().

23  {
25 #ifdef EDM_ML_DEBUG
26  std::cout << "HcalGeometry: " << "HcalGeometry::init() "
27  << " HBSize " << m_topology.getHBSize()
28  << " HESize " << m_topology.getHESize()
29  << " HOSize " << m_topology.getHOSize()
30  << " HFSize " << m_topology.getHFSize() << std::endl;
31 #endif
32 
37 }
unsigned int getHFSize() const
Definition: HcalTopology.h:141
unsigned int getHOSize() const
Definition: HcalTopology.h:140
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
std::vector< IdealObliquePrism > HECellVec
Definition: HcalGeometry.h:27
bool m_mergePosition
Definition: HcalGeometry.h:161
bool getMergePositionFlag() const
Definition: HcalTopology.h:170
HBCellVec m_hbCellVec
Definition: HcalGeometry.h:170
HOCellVec m_hoCellVec
Definition: HcalGeometry.h:172
HFCellVec m_hfCellVec
Definition: HcalGeometry.h:173
std::vector< IdealObliquePrism > HOCellVec
Definition: HcalGeometry.h:28
std::vector< IdealZPrism > HFCellVec
Definition: HcalGeometry.h:29
std::vector< IdealObliquePrism > HBCellVec
Definition: HcalGeometry.h:26
unsigned int getHESize() const
Definition: HcalTopology.h:139
HECellVec m_heCellVec
Definition: HcalGeometry.h:171
unsigned int getHBSize() const
Definition: HcalTopology.h:138
void HcalGeometry::localCorners ( Pt3DVec lc,
const CCGFloat pv,
unsigned int  i,
Pt3D ref 
)

Definition at line 404 of file HcalGeometry.cc.

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

Referenced by numberOfAlignments().

407  {
409 
410  if (hid.subdet() == HcalForward ) {
411  IdealZPrism::localCorners( lc, pv, ref ) ;
412  } else {
413  IdealObliquePrism::localCorners( lc, pv, ref ) ;
414  }
415 }
DetId denseId2detId(unsigned int) const override
return a linear packed id
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:142
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
def pv(vc)
Definition: MetAnalyzer.py:7
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:122
void HcalGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
overridevirtual

Implements CaloSubdetectorGeometry.

Definition at line 456 of file HcalGeometry.cc.

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

Referenced by numberOfAlignments().

460  {
461 
462  unsigned int din = newCellImpl(f1,f2,f3,parm,detId);
463 
464  addValidID( detId ) ;
465  m_dins.emplace_back( din );
466 }
CaloSubdetectorGeometry::IVec m_dins
Definition: HcalGeometry.h:168
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 468 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(), HcalFlexiHardcodeGeometryLoader::fillHF(), and getGeometryBase().

472  {
473 
474  unsigned int din = newCellImpl(f1,f2,f3,parm,detId);
475 
476  m_validIds.emplace_back( detId ) ;
477  m_dins.emplace_back( din );
478 }
std::vector< DetId > m_validIds
CaloSubdetectorGeometry::IVec m_dins
Definition: HcalGeometry.h:168
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 417 of file HcalGeometry.cc.

References 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 getGeometryBase(), newCell(), and newCellFast().

421  {
422 
423  assert (detId.det()==DetId::Hcal);
424 
425  const HcalDetId hid ( detId ) ;
426  unsigned int din=m_topology.detId2denseId(detId);
427 
428 #ifdef EDM_ML_DEBUG
429  std::cout << "HcalGeometry: " << " newCell subdet "
430  << detId.subdetId() << ", raw ID "
431  << detId.rawId() << ", hid " << hid << ", din "
432  << din << ", index " << std::endl;
433 #endif
434 
435  if (hid.subdet()==HcalBarrel) {
436  m_hbCellVec.at( din ) = IdealObliquePrism( f1, cornersMgr(), parm ) ;
437  } else if (hid.subdet()==HcalEndcap) {
438  const unsigned int index ( din - m_hbCellVec.size() ) ;
439  m_heCellVec.at( index ) = IdealObliquePrism( f1, cornersMgr(), parm ) ;
440  } else if (hid.subdet()==HcalOuter) {
441  const unsigned int index ( din
442  - m_hbCellVec.size()
443  - m_heCellVec.size() ) ;
444  m_hoCellVec.at( index ) = IdealObliquePrism( f1, cornersMgr(), parm ) ;
445  } else {
446  const unsigned int index ( din
447  - m_hbCellVec.size()
448  - m_heCellVec.size()
449  - m_hoCellVec.size() ) ;
450  m_hfCellVec.at( index ) = IdealZPrism( f1, cornersMgr(), parm, hid.depth()==1 ? IdealZPrism::EM : IdealZPrism::HADR ) ;
451  }
452 
453  return din;
454 }
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
HBCellVec m_hbCellVec
Definition: HcalGeometry.h:170
HOCellVec m_hoCellVec
Definition: HcalGeometry.h:172
HFCellVec m_hfCellVec
Definition: HcalGeometry.h:173
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
CaloCellGeometry::CornersMgr * cornersMgr()
HECellVec m_heCellVec
Definition: HcalGeometry.h:171
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
static unsigned int HcalGeometry::numberOfAlignments ( )
inlinestatic
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
unsigned int HcalGeometry::numberOfShapes ( ) const
inlineoverridevirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 45 of file HcalGeometry.h.

References HcalTopology::getNumberOfShapes(), and m_topology.

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

45 { return m_topology.getNumberOfShapes() ; }
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
unsigned int getNumberOfShapes() const
Definition: HcalTopology.h:164
int HcalGeometry::phiBin ( HcalSubdetector  bc,
int  etaring,
double  phi 
) const
private

Definition at line 219 of file HcalGeometry.cc.

References m_topology, and HcalTopology::phiBin().

Referenced by getCells(), getClosestCell(), and getGeometryBase().

219  {
220  return m_topology.phiBin(bc, etaring, phi);
221 }
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
const HcalTopology & m_topology
Definition: HcalGeometry.h:160
static std::string HcalGeometry::producerTag ( )
inlinestatic
unsigned int HcalGeometry::sizeForDenseIndex ( const DetId id) const
inlineoverrideprotectedvirtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 122 of file HcalGeometry.h.

References getGeometryRawPtr(), m_topology, and HcalTopology::ncells().

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

Definition at line 584 of file HcalGeometry.cc.

References CaloSubdetectorGeometry::m_validIds.

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

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

Friends And Related Function Documentation

friend class HcalFlexiHardcodeGeometryLoader
friend

Definition at line 23 of file HcalGeometry.h.

friend class HcalGeometryPlan1Tester
friend

Definition at line 19 of file HcalGeometry.h.

friend class HcalHardcodeGeometryLoader
friend

Definition at line 24 of file HcalGeometry.h.

Member Data Documentation

CaloSubdetectorGeometry::IVec HcalGeometry::m_dins
private

Definition at line 168 of file HcalGeometry.h.

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

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

Definition at line 167 of file HcalGeometry.h.

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

HBCellVec HcalGeometry::m_hbCellVec
private

Definition at line 170 of file HcalGeometry.h.

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

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

Definition at line 163 of file HcalGeometry.h.

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

HECellVec HcalGeometry::m_heCellVec
private

Definition at line 171 of file HcalGeometry.h.

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

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

Definition at line 164 of file HcalGeometry.h.

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

HFCellVec HcalGeometry::m_hfCellVec
private

Definition at line 173 of file HcalGeometry.h.

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

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

Definition at line 166 of file HcalGeometry.h.

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

HOCellVec HcalGeometry::m_hoCellVec
private

Definition at line 172 of file HcalGeometry.h.

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

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

Definition at line 165 of file HcalGeometry.h.

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

bool HcalGeometry::m_mergePosition
private

Definition at line 161 of file HcalGeometry.h.

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

const HcalTopology& HcalGeometry::m_topology
private