CMS 3D CMS Logo

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 CaloCellGeometrygetGeometry (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 23 of file CaloGeometry.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kMaxDet 
kMinDet 
kNDets 
kMaxSub 
kNSubDets 
kLength 

Definition at line 69 of file CaloGeometry.h.

Constructor & Destructor Documentation

CaloGeometry::CaloGeometry ( )

Definition at line 9 of file CaloGeometry.cc.

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

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 85 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(), ECALMultifitAnalyzer_HI::analyze(), CaloTowersCreationAlgo::assignHitEcal(), HFClusterAlgo::clusterize(), EcalDetailedTimeRecHitProducer::deltaTimeOfFlight(), CaloTowersCreationAlgo::emCrystalShwrPos(), ParticleTowerProducer::getNearestTower(), hgcal::RecHitTools::getPosition(), EgammaRecHitIsolation::getSum_(), CaloTowersCreationAlgo::hadShwPosFromCells(), ParticleTowerProducer::produce(), and ParticleTowerProducer::resetTowers().

85  {
87  if (geom) {
88  auto cell = geom->getGeometry(id);
89  return cell;
90  } else {
91  return std::shared_ptr<const CaloCellGeometry>();
92  }
93 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
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 74 of file CaloGeometry.cc.

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

Referenced by cms::ProducerAnalyzer::analyze(), EopTreeWriter::analyze(), AntiElectronDeadECAL::beginEvent(), HFClusterAlgo::clusterize(), egammaisolation::EgammaRecHitExtractor::collect(), muonisolation::CaloExtractor::deposit(), egammaisolation::EgammaHcalExtractor::deposit(), muonisolation::CaloExtractorByAssociator::deposits(), ecalEnergyInCone(), EcalRecHitWorkerRecover::estimateEnergy(), ecaldqm::eta(), reco::HcalNoiseInfoProducer::fillrechits(), HcalIsoTrkAnalyzer::fillTree(), muonisolation::CaloExtractor::fillVetos(), HFNoisyHitsFilter::filter(), EcalBadCalibFilter::filter(), AlCaIsoTracksFilter::filter(), filterCellsInCone(), spr::findCone(), ParametrizedSubtractor::getEt(), ParametrizedSubtractor::getEta(), spr::getGpos(), EgammaHcalIsolation::getHcalSum(), HCaloDetIdAssociator::getPosition(), HcalHaloAlgo::getPosition(), CSCHaloAlgo::getPosition(), EgammaHLTHcalIsolationDoubleCone::isolPtSum(), HFClusterAlgo::makeCluster(), spr::matrixECALIds(), EcalIsolatedParticleCandidateProducer::produce(), IsolatedEcalPixelTrackCandidateProducer::produce(), EleIsoDetIdCollectionProducer::produce(), GamIsoDetIdCollectionProducer::produce(), EcalRecHitWorkerRecover::run(), and spr::timeOfFlight().

74  {
76  if (geom) {
77  GlobalPoint pos = geom->getGeometry(id)->getPosition();
78  return pos;
79  } else {
80  return notFound;
81  }
82 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
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 49 of file CaloGeometry.cc.

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

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), DQMSourcePi0::analyze(), cms::ProducerAnalyzer::analyze(), PhiSymmetryCalibration::analyze(), HcalRecHitsValidation::analyze(), IsolatedTracksCone::analyze(), CaloTowerConstituentsMapBuilder::assignEEtoHE(), PFECALHashNavigator::beginEvent(), PFRecHitQTestECALMultiThreshold::beginEvent(), CaloTruthAccumulator::beginLuminosityBlock(), ReducedESRecHitCollectionProducer::beginRun(), IsolatedPixelTrackCandidateProducer::beginRun(), IsolatedPixelTrackCandidateL1TProducer::beginRun(), PFCandidateRecalibrator::beginRun(), HcalHBHEMuonAnalyzer::beginRun(), HGCDigitizer::beginRun(), HGCalTriggerGeometryBase::bhGeometry(), EcalBoundaryInfoCalculator< EcalDetId >::boundaryRecHits(), CaloRecoTauAlgorithm::buildCaloTau(), PhotonEnergyCorrector::calculate(), HcalHaloAlgo::Calculate(), EcalHaloAlgo::Calculate(), CSCHaloAlgo::Calculate(), spr::chargeIsolationEcal(), EcalClusterPUCleaningTools::CleanedSuperCluster(), Multi5x5ClusterProducer::clusterizeECALPart(), EgammaHLTIslandClusterProducer::clusterizeECALPart(), EgammaHLTMulti5x5ClusterProducer::clusterizeECALPart(), CosmicClusterProducer::clusterizeECALPart(), IslandClusterProducer::clusterizeECALPart(), EcalClusterToolsT< noZS >::covariances(), egammaisolation::EgammaRecHitExtractor::deposit(), HcalRecHitsAnalyzer::dqmBeginRun(), HcalDigisValidation::dqmBeginRun(), HGCalHitValidation::dqmBeginRun(), TrackDetMatchInfo::dumpGeometry(), Pi0FixedMassWindowCalibration::duringLoop(), EcalBarrelTopology::EcalBarrelTopology(), EcalClusterLazyToolsBase::EcalClusterLazyToolsBase(), EcalEndcapTopology::EcalEndcapTopology(), HGCalTriggerGeometryBase::eeGeometry(), InvRingCalib::EERingDef(), EgammaRecHitIsolation::EgammaRecHitIsolation(), cms::MinBias::endJob(), HGCalTriggerGeometryBase::fhGeometry(), GlobalHitsProdHist::fillECal(), GlobalHitsAnalyzer::fillECal(), GlobalHitsProducer::fillECal(), HCALRecHitAnalyzer::FillGeometry(), ECALRecHitAnalyzer::FillGeometry(), GlobalHitsProdHist::fillHCal(), GlobalHitsAnalyzer::fillHCal(), GlobalHitsProducer::fillHCal(), GlobalRecHitsAnalyzer::fillHCal(), GlobalRecHitsProducer::fillHCal(), AlCaHOCalibProducer::fillHOStore(), PhotonProducer::fillPhotonCollection(), HcalRecHitsValidation::fillRecHitsTmp(), CaloParticleDebugger::fillSimHits(), EcalDeadCellBoundaryEnergyFilter::filter(), HLTEcalResonanceFilter::filter(), HLTRegionalEcalResonanceFilter::filter(), filterCellsInCone(), spr::findCone(), spr::findDetIdECAL(), spr::findDetIdHCAL(), EcalBoundaryInfoCalculator< EcalDetId >::gapRecHits(), BetaCalculatorECAL::getDetailedTrackLengthInXtals(), HCaloDetIdAssociator::getDetIdPoints(), CaloDetIdAssociator::getDetIdPoints(), EcalClusterToolsT< noZS >::getEnergyDepTopology(), EcalClusterLazyToolsBase::getESHits(), hgcal::RecHitTools::getEventSetup(), getGeometry(), spr::getGpos(), HoECalculator::getHoE(), hgcal::RecHitTools::getLayer(), getPosition(), HCaloDetIdAssociator::getPosition(), CaloDetIdAssociator::getPosition(), TrackDetMatchInfo::getPosition(), hgcal::RecHitTools::getSubdetectorGeometry(), EcalClusterLocalContCorrection::getValue(), EcalBasicClusterLocalContCorrection::getValue(), EcalClusterCrackCorrection::getValue(), PFHBHERecHitCreator::importRecHits(), PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::importRecHits(), PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >::importRecHits(), PFHGCalRecHitCreator< DET, Layer, det, subdet >::importRecHits(), PFPSRecHitCreator::importRecHits(), PFEcalBarrelRecHitCreator::importRecHits(), PFHFRecHitCreator::importRecHits(), PFEcalEndcapRecHitCreator::importRecHits(), PFHBHERecHitCreatorMaxSample::importRecHits(), PFBadHcalPseudoClusterProducer::init(), PhotonFixCMS::initialise(), CaloDetIdAssociator::insideElement(), HCaloDetIdAssociator::insideElement(), egammaTools::localEcalClusterCoordsEB(), egammaTools::localEcalClusterCoordsEE(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl(), EgammaHLTNxNClusterProducer::makeNxNClusters(), PiZeroAnalyzer::makePizero(), spr::matrixECALIds(), spr::matrixHCALIds(), EcalClusterToolsT< noZS >::meanClusterPosition(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), present(), HGCalTriggerGeometryESProducer::produce(), EgammaHLTHybridClusterProducer::produce(), HybridClusterProducer::produce(), PreshowerClusterShapeProducer::produce(), PreshowerPhiClusterProducer::produce(), PreshowerClusterProducer::produce(), EgammaSCCorrectionMaker::produce(), PFCTRecHitProducer::produce(), HiEgammaSCCorrectionMaker::produce(), HLTRechitInRegionsProducer< T1 >::produce(), PFCandidateRecalibrator::produce(), SelectedElectronFEDListProducer< TEle, TCand >::produce(), HLTRecHitInAllL1RegionsProducer< RecHitType >::produce(), spr::propagateCALO(), spr::propagateCosmicCALO(), spr::propagateHCAL(), spr::propagateHCALBack(), spr::propagateIdECAL(), CaloDualConeSelector< HBHERecHit >::selectCallback(), CaloConeSelector< T >::selectCallback(), CaloTowersCreationAlgo::setGeometry(), EcalGeomPhiSymHelper::setup(), Calorimeter::setupGeometry(), spr::timeOfFlight(), CaloHitResponse::timeOfFlight(), EcalTimeDigiProducer::updateGeometry(), EcalDigiProducer::updateGeometry(), ValidateGeometry::validateCaloGeometry(), and reco::writeSpecific().

50 {
51  bool ok ;
52 
53  const unsigned int index ( makeIndex( id.det(),
54  id.subdetId(),
55  ok ) ) ;
56  return ( ok ? m_geos[ index ] : nullptr ) ;
57 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:63
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:15
const CaloSubdetectorGeometry * CaloGeometry::getSubdetectorGeometry ( DetId::Detector  det,
int  subdet 
) const

access the subdetector geometry for the given subdetector directly

Definition at line 60 of file CaloGeometry.cc.

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

62 {
63  bool ok ;
64 
65  const unsigned int index ( makeIndex( det,
66  subdet,
67  ok ) ) ;
68  return ( ok ? m_geos[ index ] : nullptr ) ;
69 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:63
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:15
std::vector< DetId > CaloGeometry::getValidDetIds ( ) const

Get the list of all valid detector ids.

Definition at line 102 of file CaloGeometry.cc.

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

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), FWTGeoRecoGeometryESProducer::addCaloTowerGeometry(), FWTGeoRecoGeometryESProducer::addEcalCaloGeometry(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryBarrel(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryEndcap(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryForward(), FWTGeoRecoGeometryESProducer::addHcalCaloGeometryOuter(), cms::MinBias::beginRun(), HcalRecHitsDQMClient::beginRun(), CastorDigiProducer::checkGeometry(), EcalDccWeightBuilder::computeAllWeights(), EcalMixingModuleValidation::computeSDBunchDigi(), InvRingCalib::duringLoop(), EcalEleCalibLooper::duringLoop(), Pi0FixedMassWindowCalibration::duringLoop(), HEcalDetIdAssociator::getASetOfValidDetIds(), HHcalDetIdAssociator::getASetOfValidDetIds(), HCaloDetIdAssociator::getASetOfValidDetIds(), ParticleTowerProducer::getNearestTower(), PreshowerDetIdAssociator::getValidDetIds(), HODetIdAssociator::getValidDetIds(), EcalDetIdAssociator::getValidDetIds(), HcalDetIdAssociator::getValidDetIds(), getValidDetIds(), CaloDetIdAssociator::getValidDetIds(), EcalTBDigiProducer::initializeEvent(), ParticleTowerProducer::resetTowers(), EcalGeomPhiSymHelper::setup(), PhiSymmetryCalibration_step2_SM::setUp(), PhiSymmetryCalibration_step2::setUp(), ParametrizedSubtractor::setupGeometryMap(), PileUpSubtractor::setupGeometryMap(), HcalTBDigiProducer::updateGeometry(), and HcalDigitizer::updateGeometry().

103 {
104  std::vector<DetId> returnValue ;
105  returnValue.reserve( kLength ) ;
106 
107  bool doneHcal ( false ) ;
108  for( unsigned int i ( 0 ) ; i != m_geos.size() ; ++i )
109  {
110  if( nullptr != m_geos[i] )
111  {
112  const std::vector< DetId >& aVec = m_geos[i]->getValidDetIds();
113  if( aVec.empty() ) {
114  edm::LogWarning("CaloGeometry") << "Valid det id list at index "
115  << i << " is empty!";
116  }
117  const bool isHcal ( !aVec.empty() && DetId::Hcal == aVec.front().det() ) ;
118  if( !doneHcal ||
119  !isHcal )
120  {
121  returnValue.insert( returnValue.end(), aVec.begin(), aVec.end() ) ;
122  if( !doneHcal &&
123  isHcal ) doneHcal = true ;
124  }
125  }
126  }
127  return returnValue ;
128 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:63
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 131 of file CaloGeometry.cc.

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

133 {
134  bool ok ;
135 
136  const unsigned int index ( makeIndex( det,
137  subdet,
138  ok ) ) ;
139 
140  return ( ok && ( nullptr != m_geos[ index ] ) ?
141  m_geos[ index ]->getValidDetIds( det, subdet ) :
142  k_emptyVec ) ;
143 }
static const std::vector< DetId > k_emptyVec
Definition: CaloGeometry.h:61
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:63
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:15
unsigned int CaloGeometry::makeIndex ( DetId::Detector  det,
int  subdet,
bool &  ok 
) const
private

Definition at line 15 of file CaloGeometry.cc.

References kMaxDet, kMaxSub, kMinDet, and kNSubDets.

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

18 {
19  const unsigned int idet ( det ) ;
20 
21  ok = ( kMinDet <= idet &&
22  kMaxDet >= idet &&
23  0 <= subdet &&
24  kMaxSub >= subdet ) ;
25  if (!ok)
26  edm::LogWarning("CaloGeometry") << "Det:Subdet " << idet << ":" << subdet
27  << " min|max Det " << kMinDet << ":"
28  << kMaxDet << " min|max subdet 0:" <<kMaxSub;
29 
30  return ( ( det - kMinDet ) * kNSubDets + subdet ) ;
31 }
bool CaloGeometry::present ( const DetId id) const

is this detid present in the geometry?

Definition at line 96 of file CaloGeometry.cc.

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

97 {
99  return ( nullptr == geom ? false : geom->present( id ) ) ;
100 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
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 34 of file CaloGeometry.cc.

References relativeConstraints::geom, createfilelist::int, m_geos, makeIndex(), and convertSQLiteXML::ok.

36  {
37  bool ok ;
38  const unsigned int index = makeIndex( det, subdet, ok ) ;
39  if( ok ) m_geos[index] = geom ;
40 
41  edm::LogVerbatim("CaloGeometry") << "Detector=" << (int)det << ", subset="
42  << subdet << ", index=" << index
43  << ", size=" << m_geos.size();
44 
45  assert( ok ) ;
46 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:63
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:15

Member Data Documentation

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

Definition at line 61 of file CaloGeometry.h.

Referenced by getValidDetIds().

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

Definition at line 63 of file CaloGeometry.h.

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