CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
CaloGeometry Class Reference

#include <CaloGeometry.h>

Public Member Functions

 CaloGeometry ()
 
std::shared_ptr< const
CaloCellGeometry
getGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. More...
 
GlobalPoint getPosition (const DetId &id) const
 Get the position of a given detector id. More...
 
const CaloSubdetectorGeometrygetSubdetectorGeometry (const DetId &id) const
 access the subdetector geometry for the given subdetector directly More...
 
const CaloSubdetectorGeometrygetSubdetectorGeometry (DetId::Detector det, int subdet) const
 access the subdetector geometry for the given subdetector directly More...
 
std::vector< DetIdgetValidDetIds () const
 Get the list of all valid detector ids. More...
 
const std::vector< DetId > & getValidDetIds (DetId::Detector det, int subdet) const
 Get the list of valid detector ids for the given subdetector. More...
 
bool present (const DetId &id) const
 is this detid present in the geometry? More...
 
void setSubdetGeometry (DetId::Detector det, int subdet, const CaloSubdetectorGeometry *geom)
 Register a subdetector geometry. More...
 

Private Types

enum  {
  kMaxDet = 10, kMinDet = 3, kNDets = kMaxDet - kMinDet + 1, kMaxSub = 6,
  kNSubDets = kMaxSub + 1, kLength = kNDets * kNSubDets
}
 

Private Member Functions

unsigned int makeIndex (DetId::Detector det, int subdet, bool &ok) const
 

Private Attributes

std::vector< const
CaloSubdetectorGeometry * > 
m_geos
 

Static Private Attributes

static const std::vector< DetIdk_emptyVec
 

Detailed Description

Interface class to the geometry information for all calorimetry subdetectors.

Revision:
1.7
Author
J. Mans and P. Meridiani

Definition at line 21 of file CaloGeometry.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kMaxDet 
kMinDet 
kNDets 
kMaxSub 
kNSubDets 
kLength 

Definition at line 59 of file CaloGeometry.h.

Constructor & Destructor Documentation

CaloGeometry::CaloGeometry ( )

Definition at line 9 of file CaloGeometry.cc.

9 : m_geos(kLength, nullptr) {}
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:55

Member Function Documentation

std::shared_ptr< const CaloCellGeometry > CaloGeometry::getGeometry ( const DetId id) const

Get the cell geometry of a given detector id.

Definition at line 60 of file CaloGeometry.cc.

References relativeConstraints::geom, CaloSubdetectorGeometry::getGeometry(), and getSubdetectorGeometry().

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), FWTGeoRecoGeometryESProducer::addCaloTowerGeometry(), FWTGeoRecoGeometryESProducer::addEcalCaloGeometry(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryBarrel(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryEndcap(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryForward(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryOuter(), EcalPileUpDepMonitor::analyze(), EcalSimple2007H4TBAnalyzer::analyze(), EcalSimHitStudy::analyzeHits(), CaloTowersCreationAlgo::assignHitEcal(), HFClusterAlgo::clusterize(), EcalDetailedTimeRecHitProducer::deltaTimeOfFlight(), CaloTowersCreationAlgo::emCrystalShwrPos(), L2TauNNProducer::fillCaloRecHits(), hgcal::RecHitTools::getPosition(), EgammaHcalIsolation::goodHitEnergy(), and CaloTowersCreationAlgo::hadShwPosFromCells().

60  {
62  if (geom) {
63  auto cell = geom->getGeometry(id);
64  return cell;
65  } else {
66  return std::shared_ptr<const CaloCellGeometry>();
67  }
68 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
GlobalPoint CaloGeometry::getPosition ( const DetId id) const

Get the position of a given detector id.

Definition at line 50 of file CaloGeometry.cc.

References relativeConstraints::geom, CaloSubdetectorGeometry::getGeometry(), getSubdetectorGeometry(), and notFound.

Referenced by ValidIsoTrkCalib::analyze(), CaloSimHitAnalysis::analyzeHits(), MultipleAlgoIterator::calculateOrphanInput(), HFClusterAlgo::clusterize(), egammaisolation::EgammaRecHitExtractor::collect(), egammaisolation::EgammaHcalExtractor::deposit(), ecalEnergyInCone(), EcalRecHitWorkerRecover::estimateEnergy(), ecaldqm::eta(), HcalIsoTrkSimAnalyzer::eThreshold(), HcalIsoTrkAnalyzer::eThreshold(), AlCaHcalIsotrkProducer::eThreshold(), reco::HcalNoiseInfoProducer::fillrechits(), EcalBadCalibFilter::filter(), AlCaIsoTracksFilter::filter(), filterCellsInCone(), spr::findCone(), MultipleAlgoIterator::getEt(), ParametrizedSubtractor::getEt(), MultipleAlgoIterator::getEta(), ParametrizedSubtractor::getEta(), spr::getGpos(), HCaloDetIdAssociator::getPosition(), HcalHaloAlgo::getPosition(), EcalHaloAlgo::getPosition(), CSCHaloAlgo::getPosition(), HLTJetTimingProducer< T >::jetTimeFromEcalCells(), HFClusterAlgo::makeCluster(), spr::matrixECALIds(), EcalIsolatedParticleCandidateProducer::produce(), IsolatedEcalPixelTrackCandidateProducer::produce(), EcalRecHitWorkerRecover::run(), EEBadScFilter::scan5x5(), HiPuRhoProducer::setupGeometryMap(), and spr::timeOfFlight().

50  {
52  if (geom) {
53  GlobalPoint pos = geom->getGeometry(id)->getPosition();
54  return pos;
55  } else {
56  return notFound;
57  }
58 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static const GlobalPoint notFound(0, 0, 0)
const CaloSubdetectorGeometry * CaloGeometry::getSubdetectorGeometry ( const DetId id) const

access the subdetector geometry for the given subdetector directly

Definition at line 34 of file CaloGeometry.cc.

References m_geos, makeIndex(), and convertSQLiteXML::ok.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), HcalTestSimHitID::analyze(), HcalSimHitAnalysis::analyze(), HcalSimHitsValidation::analyze(), CaloSimHitAnalysis::analyze(), HcalRecHitsValidation::analyze(), ValidIsoTrkCalib::analyze(), IsolatedTracksCone::analyze(), CaloTowerConstituentsMapBuilder::assignEEtoHE(), PFCandidateRecalibrator::beginRun(), IsolatedPixelTrackCandidateProducer::beginRun(), IsolatedPixelTrackCandidateL1TProducer::beginRun(), HcalHBHEMuonAnalyzer::beginRun(), HcalHBHEMuonHighEtaAnalyzer::beginRun(), AlCaHcalHBHEMuonProducer::beginRun(), EcalBoundaryInfoCalculator< EcalDetId >::boundaryRecHits(), HcalHaloAlgo::Calculate(), EcalHaloAlgo::Calculate(), CSCHaloAlgo::Calculate(), spr::chargeIsolationEcal(), EcalClusterToolsT< noZS >::covariances(), egammaisolation::EgammaRecHitExtractor::deposit(), HcalDigisValidation::dqmBeginRun(), HcalRecHitsAnalyzer::dqmBeginRun(), TrackDetMatchInfo::dumpGeometry(), EcalBarrelTopology::EcalBarrelTopology(), EcalClusterLazyToolsBase::EcalClusterLazyToolsBase(), EcalEndcapTopology::EcalEndcapTopology(), EgammaRecHitIsolation::EgammaRecHitIsolation(), cms::MinBias::endJob(), GlobalHitsProdHist::fillECal(), GlobalHitsAnalyzer::fillECal(), GlobalHitsProducer::fillECal(), HCALRecHitAnalyzer::FillGeometry(), ECALRecHitAnalyzer::FillGeometry(), GlobalHitsProdHist::fillHCal(), GlobalHitsAnalyzer::fillHCal(), GlobalHitsProducer::fillHCal(), GlobalRecHitsAnalyzer::fillHCal(), GlobalRecHitsProducer::fillHCal(), PhotonProducer::fillPhotonCollection(), HcalRecHitsValidation::fillRecHitsTmp(), HcalRecHitsAnalyzer::fillRecHitsTmp(), filterCellsInCone(), EgammaHLTPhase2ExtraProducer::filterRecHits(), EgammaHLTExtraProducer::filterRecHits(), spr::findCone(), spr::findDetIdECAL(), spr::findDetIdHCAL(), EcalBoundaryInfoCalculator< EcalDetId >::gapRecHits(), CaloDetIdAssociator::getDetIdPoints(), HCaloDetIdAssociator::getDetIdPoints(), EcalClusterToolsT< noZS >::getEnergyDepTopology(), EcalClusterLazyToolsBase::getESHits(), getGeometry(), spr::getGpos(), FixedGridRhoProducerFastjetFromRecHit::getHitP4(), HoECalculator::getHoE(), hgcal::RecHitTools::getLayer(), getPosition(), CaloDetIdAssociator::getPosition(), HCaloDetIdAssociator::getPosition(), TrackDetMatchInfo::getPosition(), hgcal::RecHitTools::getPositionLayer(), hgcal::RecHitTools::getSubdetectorGeometry(), EcalClusterCrackCorrection::getValue(), PFHGCalRecHitCreator< DET, Layer, det, subdet >::importRecHits(), PFBadHcalPseudoClusterProducer::init(), HGCDigitizer::initializeEvent(), CaloDetIdAssociator::insideElement(), HCaloDetIdAssociator::insideElement(), egammaTools::localEcalClusterCoordsEB(), egammaTools::localEcalClusterCoordsEE(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl(), ticl::SeedingRegionByHF::makeRegions(), spr::matrixECALIds(), spr::matrixHCALIds(), EcalClusterToolsT< noZS >::meanClusterPosition(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), present(), HybridClusterProducer::produce(), PFCandidateRecalibrator::produce(), AlCaHOCalibProducer::produce(), spr::propagateCALO(), spr::propagateCosmicCALO(), spr::propagateHCAL(), spr::propagateHCALBack(), spr::propagateIdECAL(), CaloDualConeSelector< T >::selectCallback(), CaloConeSelector< T >::selectCallback(), hgcal::RecHitTools::setGeometry(), CaloTowersCreationAlgo::setGeometry(), EcalGeomPhiSymHelper::setup(), Calorimeter::setupGeometry(), CaloHitResponse::timeOfFlight(), spr::timeOfFlight(), EcalTimeDigiProducer::updateGeometry(), EcalDigiProducer_Ph2::updateGeometry(), EcalDigiProducer::updateGeometry(), and reco::writeSpecific().

34  {
35  bool ok;
36 
37  const unsigned int index(makeIndex(id.det(), id.subdetId(), ok));
38  return (ok ? m_geos[index] : nullptr);
39 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:55
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:11
const CaloSubdetectorGeometry * CaloGeometry::getSubdetectorGeometry ( DetId::Detector  det,
int  subdet 
) const

access the subdetector geometry for the given subdetector directly

Definition at line 41 of file CaloGeometry.cc.

References m_geos, makeIndex(), and convertSQLiteXML::ok.

41  {
42  bool ok;
43 
44  const unsigned int index(makeIndex(det, subdet, ok));
45  return (ok ? m_geos[index] : nullptr);
46 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:55
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:11
std::vector< DetId > CaloGeometry::getValidDetIds ( ) const

Get the list of all valid detector ids.

Definition at line 75 of file CaloGeometry.cc.

References DetId::Hcal, mps_fire::i, kLength, and m_geos.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), FWTGeoRecoGeometryESProducer::addCaloTowerGeometry(), FWTGeoRecoGeometryESProducer::addEcalCaloGeometry(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryBarrel(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryEndcap(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryForward(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryOuter(), cms::MinBias::beginRun(), HcalRecHitsDQMClient::beginRun(), CastorDigiProducer::checkGeometry(), EcalMixingModuleValidation::computeSDBunchDigi(), HEcalDetIdAssociator::getASetOfValidDetIds(), HHcalDetIdAssociator::getASetOfValidDetIds(), HCaloDetIdAssociator::getASetOfValidDetIds(), HODetIdAssociator::getValidDetIds(), PreshowerDetIdAssociator::getValidDetIds(), EcalDetIdAssociator::getValidDetIds(), HcalDetIdAssociator::getValidDetIds(), getValidDetIds(), CaloDetIdAssociator::getValidDetIds(), PFHCALDenseIdNavigator< HcalDetId, HcalTopology, false >::init(), EcalGeomPhiSymHelper::setup(), HiPuRhoProducer::setupGeometryMap(), HcalTBDigiProducer::updateGeometry(), and HcalDigitizer::updateGeometry().

75  {
76  std::vector<DetId> returnValue;
77  returnValue.reserve(kLength);
78 
79  bool doneHcal(false);
80  for (unsigned int i(0); i != m_geos.size(); ++i) {
81  if (nullptr != m_geos[i]) {
82  const std::vector<DetId>& aVec = m_geos[i]->getValidDetIds();
83  if (aVec.empty()) {
84  edm::LogWarning("CaloGeometry") << "Valid det id list at index " << i << " is empty!";
85  }
86  const bool isHcal(!aVec.empty() && DetId::Hcal == aVec.front().det());
87  if (!doneHcal || !isHcal) {
88  returnValue.insert(returnValue.end(), aVec.begin(), aVec.end());
89  if (!doneHcal && isHcal)
90  doneHcal = true;
91  }
92  }
93  }
94  return returnValue;
95 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:55
Log< level::Warning, false > LogWarning
const std::vector< DetId > & CaloGeometry::getValidDetIds ( DetId::Detector  det,
int  subdet 
) const

Get the list of valid detector ids for the given subdetector.

Definition at line 97 of file CaloGeometry.cc.

References getValidDetIds(), k_emptyVec, m_geos, makeIndex(), and convertSQLiteXML::ok.

97  {
98  bool ok;
99 
100  const unsigned int index(makeIndex(det, subdet, ok));
101 
102  return (ok && (nullptr != m_geos[index]) ? m_geos[index]->getValidDetIds(det, subdet) : k_emptyVec);
103 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:55
static const std::vector< DetId > k_emptyVec
Definition: CaloGeometry.h:53
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:11
unsigned int CaloGeometry::makeIndex ( DetId::Detector  det,
int  subdet,
bool &  ok 
) const
private

Definition at line 11 of file CaloGeometry.cc.

References kMaxDet, kMaxSub, kMinDet, and kNSubDets.

Referenced by getSubdetectorGeometry(), getValidDetIds(), and setSubdetGeometry().

11  {
12  const unsigned int idet(det);
13 
14  ok = (kMinDet <= idet && kMaxDet >= idet && 0 <= subdet && kMaxSub >= subdet);
15  if (!ok)
16  edm::LogWarning("CaloGeometry") << "Det:Subdet " << idet << ":" << subdet << " min|max Det " << kMinDet << ":"
17  << kMaxDet << " min|max subdet 0:" << kMaxSub;
18 
19  return ((det - kMinDet) * kNSubDets + subdet);
20 }
Log< level::Warning, false > LogWarning
bool CaloGeometry::present ( const DetId id) const

is this detid present in the geometry?

Definition at line 70 of file CaloGeometry.cc.

References relativeConstraints::geom, getSubdetectorGeometry(), and CaloSubdetectorGeometry::present().

70  {
72  return (nullptr == geom ? false : geom->present(id));
73 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
virtual bool present(const DetId &id) const
is this detid present in the geometry?
void CaloGeometry::setSubdetGeometry ( DetId::Detector  det,
int  subdet,
const CaloSubdetectorGeometry geom 
)

Register a subdetector geometry.

Definition at line 22 of file CaloGeometry.cc.

References cms::cuda::assert(), relativeConstraints::geom, m_geos, makeIndex(), and convertSQLiteXML::ok.

22  {
23  bool ok;
24  const unsigned int index = makeIndex(det, subdet, ok);
25  if (ok)
26  m_geos[index] = geom;
27 
28  edm::LogVerbatim("CaloGeometry") << "Detector=" << (int)det << ", subset=" << subdet << ", index=" << index
29  << ", size=" << m_geos.size();
30 
31  assert(ok);
32 }
Log< level::Info, true > LogVerbatim
assert(be >=bs)
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:55
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:11

Member Data Documentation

const std::vector< DetId > CaloGeometry::k_emptyVec
staticprivate

Definition at line 53 of file CaloGeometry.h.

Referenced by getValidDetIds().

std::vector<const CaloSubdetectorGeometry*> CaloGeometry::m_geos
private

Definition at line 55 of file CaloGeometry.h.

Referenced by getSubdetectorGeometry(), getValidDetIds(), and setSubdetGeometry().