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 ()
 
const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. More...
 
const GlobalPointgetPosition (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 = 6, kMinDet = 3, kNDets = kMaxDet - kMinDet + 1, kMaxSub = 6,
  kLength = kNDets*kMaxSub
}
 

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 22 of file CaloGeometry.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kMaxDet 
kMinDet 
kNDets 
kMaxSub 
kLength 

Definition at line 68 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:62

Member Function Documentation

const CaloCellGeometry * CaloGeometry::getGeometry ( const DetId id) const

Get the cell geometry of a given detector id.

Definition at line 78 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(), GlobalHitsAnalyzer::fillECal(), GlobalHitsProdHist::fillECal(), GlobalHitsProducer::fillECal(), ParticleTowerProducer::getNearestTower(), EgammaRecHitIsolation::getSum_(), CaloTowersCreationAlgo::hadShwPosFromCells(), ParticleTowerProducer::produce(), and ParticleTowerProducer::resetTowers().

79 {
81  const CaloCellGeometry* cell ( nullptr == geom ? nullptr : geom->getGeometry( id ) ) ;
82  return cell ;
83 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const GlobalPoint & CaloGeometry::getPosition ( const DetId id) const

Get the position of a given detector id.

Definition at line 70 of file CaloGeometry.cc.

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

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

71 {
73  const CaloCellGeometry* cell ( ( nullptr == geom ? nullptr : geom->getGeometry( id ) ) ) ;
74  return ( nullptr == cell ? notFound : cell->getPosition() ) ;
75 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
virtual 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 45 of file CaloGeometry.cc.

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

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), cms::ProducerAnalyzer::analyze(), PhiSymmetryCalibration::analyze(), DQMSourcePi0::analyze(), HcalRecHitsValidation::analyze(), IsolatedTracksCone::analyze(), CaloTowerConstituentsMapBuilder::assignEEtoHE(), PFECALHashNavigator::beginEvent(), PFRecHitQTestECALMultiThreshold::beginEvent(), CaloTruthAccumulator::beginLuminosityBlock(), ReducedESRecHitCollectionProducer::beginRun(), IsolatedPixelTrackCandidateProducer::beginRun(), IsolatedPixelTrackCandidateL1TProducer::beginRun(), PFCandidateRecalibrator::beginRun(), HGCDigitizer::beginRun(), HcalHBHEMuonAnalyzer::beginRun(), HGCalTriggerGeometryBase::bhGeometry(), EcalBoundaryInfoCalculator< EcalDetId >::boundaryRecHits(), CaloRecoTauAlgorithm::buildCaloTau(), PhotonEnergyCorrector::calculate(), HcalHaloAlgo::Calculate(), EcalHaloAlgo::Calculate(), CSCHaloAlgo::Calculate(), spr::chargeIsolationEcal(), EcalClusterPUCleaningTools::CleanedSuperCluster(), Multi5x5ClusterProducer::clusterizeECALPart(), EgammaHLTMulti5x5ClusterProducer::clusterizeECALPart(), CosmicClusterProducer::clusterizeECALPart(), EgammaHLTIslandClusterProducer::clusterizeECALPart(), IslandClusterProducer::clusterizeECALPart(), WriteESAlignments::convert(), EcalClusterToolsT< noZS >::covariances(), egammaisolation::EgammaRecHitExtractor::deposit(), HcalRecHitsAnalyzer::dqmBeginRun(), HcalDigisValidation::dqmBeginRun(), HGCalHitValidation::dqmBeginRun(), TrackDetMatchInfo::dumpGeometry(), Pi0FixedMassWindowCalibration::duringLoop(), HGCalTriggerGeometryBase::eeGeometry(), InvRingCalib::EERingDef(), EgammaRecHitIsolation::EgammaRecHitIsolation(), cms::MinBias::endJob(), HGCalTriggerGeometryBase::fhGeometry(), HCALRecHitAnalyzer::FillGeometry(), ECALRecHitAnalyzer::FillGeometry(), GlobalHitsAnalyzer::fillHCal(), GlobalHitsProdHist::fillHCal(), GlobalHitsProducer::fillHCal(), GlobalRecHitsAnalyzer::fillHCal(), GlobalRecHitsProducer::fillHCal(), AlCaHOCalibProducer::fillHOStore(), PhotonProducer::fillPhotonCollection(), HcalRecHitsValidation::fillRecHitsTmp(), EcalDeadCellBoundaryEnergyFilter::filter(), HLTEcalResonanceFilter::filter(), HLTRegionalEcalResonanceFilter::filter(), filterCellsInCone(), spr::findCone(), spr::findDetIdECAL(), spr::findDetIdHCAL(), EcalBoundaryInfoCalculator< EcalDetId >::gapRecHits(), BetaCalculatorECAL::getDetailedTrackLengthInXtals(), CaloDetIdAssociator::getDetIdPoints(), HCaloDetIdAssociator::getDetIdPoints(), EcalClusterToolsT< noZS >::getEnergyDepTopology(), EcalClusterLazyToolsBase::getESHits(), hgcal::RecHitTools::getEventSetup(), getGeometry(), EcalClusterLazyToolsBase::getGeometry(), spr::getGpos(), HoECalculator::getHoE(), hgcal::RecHitTools::getLayer(), hgcal::RecHitTools::getPosition(), getPosition(), HCaloDetIdAssociator::getPosition(), CaloDetIdAssociator::getPosition(), TrackDetMatchInfo::getPosition(), hgcal::RecHitTools::getRadiusToSide(), hgcal::RecHitTools::getSiThickness(), EcalClusterLocalContCorrection::getValue(), EcalBasicClusterLocalContCorrection::getValue(), EcalClusterCrackCorrection::getValue(), PFHBHERecHitCreator::importRecHits(), PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::importRecHits(), PFEcalRecHitCreatorMaxSample< Geometry, Layer, Detector >::importRecHits(), PFPSRecHitCreator::importRecHits(), PFHGCalRecHitCreator< DET, Layer, subdet >::importRecHits(), PFEcalBarrelRecHitCreator::importRecHits(), PFHFRecHitCreator::importRecHits(), PFEcalEndcapRecHitCreator::importRecHits(), PFHBHERecHitCreatorMaxSample::importRecHits(), PhotonFixCMS::initialise(), CaloDetIdAssociator::insideElement(), HCaloDetIdAssociator::insideElement(), hgcal::RecHitTools::isHalfCell(), EcalClusterLocal::localCoordsEB(), EcalClusterLocal::localCoordsEE(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl(), EgammaHLTNxNClusterProducer::makeNxNClusters(), PiZeroAnalyzer::makePizero(), spr::matrixECALIds(), spr::matrixHCALIds(), EcalClusterToolsT< noZS >::meanClusterPosition(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), present(), EgammaHLTHybridClusterProducer::produce(), HybridClusterProducer::produce(), PreshowerClusterShapeProducer::produce(), PreshowerPhiClusterProducer::produce(), PreshowerClusterProducer::produce(), PFClusterShapeProducer::produce(), EgammaSCCorrectionMaker::produce(), PFCTRecHitProducer::produce(), HLTRechitInRegionsProducer< T1 >::produce(), HiEgammaSCCorrectionMaker::produce(), PFCandidateRecalibrator::produce(), JetCrystalsAssociator::produce(), SelectedElectronFEDListProducer< TEle, TCand >::produce(), HLTRecHitInAllL1RegionsProducer< RecHitType >::produce(), spr::propagateCALO(), spr::propagateCosmicCALO(), 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().

46 {
47  bool ok ;
48 
49  const unsigned int index ( makeIndex( id.det(),
50  id.subdetId(),
51  ok ) ) ;
52  return ( ok ? m_geos[ index ] : nullptr ) ;
53 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
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 56 of file CaloGeometry.cc.

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

58 {
59  bool ok ;
60 
61  const unsigned int index ( makeIndex( det,
62  subdet,
63  ok ) ) ;
64  return ( ok ? m_geos[ index ] : nullptr ) ;
65 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
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 92 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(), HGCalImagingAlgo::computeThreshold(), 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::setUp(), PhiSymmetryCalibration_step2_SM::setUp(), ParametrizedSubtractor::setupGeometryMap(), PileUpSubtractor::setupGeometryMap(), HcalTBDigiProducer::updateGeometry(), and HcalDigitizer::updateGeometry().

93 {
94  std::vector<DetId> returnValue ;
95  returnValue.reserve( kLength ) ;
96 
97  bool doneHcal ( false ) ;
98  for( unsigned int i ( 0 ) ; i != m_geos.size() ; ++i )
99  {
100  if( nullptr != m_geos[i] )
101  {
102  const std::vector< DetId >& aVec = m_geos[i]->getValidDetIds();
103  if( aVec.empty() ) {
104  edm::LogWarning("EmptyDetIdList") << "Valid det id list at index " << i << " is empty!" << std::endl;
105  }
106  const bool isHcal ( !aVec.empty() && DetId::Hcal == aVec.front().det() ) ;
107  if( !doneHcal ||
108  !isHcal )
109  {
110  returnValue.insert( returnValue.end(), aVec.begin(), aVec.end() ) ;
111  if( !doneHcal &&
112  isHcal ) doneHcal = true ;
113  }
114  }
115  }
116  return returnValue ;
117 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
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 120 of file CaloGeometry.cc.

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

122 {
123  bool ok ;
124 
125  const unsigned int index ( makeIndex( det,
126  subdet,
127  ok ) ) ;
128 
129  return ( ok && ( nullptr != m_geos[ index ] ) ?
130  m_geos[ index ]->getValidDetIds( det, subdet ) :
131  k_emptyVec ) ;
132 }
static const std::vector< DetId > k_emptyVec
Definition: CaloGeometry.h:60
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:92
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, and kMinDet.

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 
26  return ( ( det - kMinDet )*kMaxSub + subdet - 1 ) ;
27 }
bool CaloGeometry::present ( const DetId id) const

is this detid present in the geometry?

Definition at line 86 of file CaloGeometry.cc.

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

87 {
89  return ( nullptr == geom ? false : geom->present( id ) ) ;
90 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
void CaloGeometry::setSubdetGeometry ( DetId::Detector  det,
int  subdet,
const CaloSubdetectorGeometry geom 
)

Register a subdetector geometry.

Definition at line 30 of file CaloGeometry.cc.

References relativeConstraints::geom, diffTreeTool::index, m_geos, makeIndex(), and convertSQLiteXML::ok.

33 {
34  bool ok ;
35  const unsigned int index = makeIndex( det, subdet, ok ) ;
36  if( ok ) m_geos[index] = geom ;
37 
38 // std::cout<<"Detector="<<(int)det<<", subset="<<subdet<<", index="<<index
39 // <<", size="<<m_geos.size()<<std::endl;
40 
41  assert( ok ) ;
42 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
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 60 of file CaloGeometry.h.

Referenced by getValidDetIds().

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

Definition at line 62 of file CaloGeometry.h.

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