CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
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 = 5, kMinDet = 3, kNDets = kMaxDet - kMinDet + 1, kMaxSub = 4,
  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 7 of file CaloGeometry.cc.

7  :
8  m_geos ( kLength, 0 )
9 {
10 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62

Member Function Documentation

const CaloCellGeometry * CaloGeometry::getGeometry ( const DetId id) const
const GlobalPoint & CaloGeometry::getPosition ( const DetId id) const

Get the position of a given detector id.

Definition at line 68 of file CaloGeometry.cc.

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

Referenced by PileUpSubtractor::calculateOrphanInput(), HFClusterAlgo::clusterize(), egammaisolation::EgammaRecHitExtractor::collect(), egammaisolation::EgammaHcalExtractor::deposit(), ecalEnergyInCone(), EcalRecHitWorkerRecover::estimateEnergy(), Numbers::eta(), reco::HcalNoiseInfoProducer::fillrechits(), filterCellsInCone(), spr::findCone(), PileUpSubtractor::getCone(), ParametrizedSubtractor::getEt(), ParametrizedSubtractor::getEta(), spr::getGpos(), EgammaHLTHcalIsolationDoubleCone::isolPtSum(), PFRecoTauDiscriminationAgainstElectronDeadECAL::loopXtals(), HFClusterAlgo::makeCluster(), spr::matrixECALIds(), spr::matrixHCALIds(), Numbers::phi(), EcalIsolatedParticleCandidateProducer::produce(), cms::AlCaDiJetsProducer::produce(), AlCaIsoTracksProducer::produce(), EcalRecHitWorkerRecover::run(), and spr::timeOfFlight().

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

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

Referenced by IsolatedTracksCone::analyze(), EcalHaloAlgo::Calculate(), spr::chargeIsolationEcal(), EcalClusterPUCleaningTools::CleanedSuperCluster(), EcalClusterTools::covariances(), HcalRecHitsMaker::createVectorOfSubdetectorCells(), egammaisolation::EgammaRecHitExtractor::deposit(), InvRingCalib::EERingDef(), EgammaRecHitIsolation::EgammaRecHitIsolation(), EcalClusterLazyTools::eseffsirir(), EcalClusterLazyTools::eseffsixix(), EcalClusterLazyTools::eseffsiyiy(), HCALRecHitAnalyzer::FillGeometry(), spr::findDetIdECAL(), spr::findDetIdHCAL(), BetaCalculatorECAL::getDetailedTrackLengthInXtals(), HCaloDetIdAssociator::getDetIdPoints(), CaloDetIdAssociator::getDetIdPoints(), EcalClusterTools::getEnergyDepTopology(), EcalClusterLazyTools::getESHits(), getGeometry(), HoECalculator::getHoE(), getPosition(), HCaloDetIdAssociator::getPosition(), CaloDetIdAssociator::getPosition(), PhotonFixCMS::initialise(), EcalRingCalibrationTools::initializeFromGeometry(), CaloDetIdAssociator::insideElement(), HCaloDetIdAssociator::insideElement(), EcalClusterLocal::localCoordsEB(), EcalClusterLocal::localCoordsEE(), spr::matrixECALIds(), EcalClusterTools::meanClusterPosition(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), present(), HcalHitRelabeller::process(), EgammaHLTRechitInRegionsProducer::produce(), EgammaHLTHybridClusterProducer::produce(), HybridClusterProducer::produce(), spr::propagateCALO(), CaloDualConeSelector::select(), CaloConeSelector::select(), CaloTowersCreationAlgo::setGeometry(), EcalGeomPhiSymHelper::setup(), Calorimeter::setupGeometry(), CaloHitResponse::timeOfFlight(), and EcalDigiProducer::updateGeometry().

44 {
45  bool ok ;
46 
47  const unsigned int index ( makeIndex( id.det(),
48  id.subdetId(),
49  ok ) ) ;
50  return ( ok ? m_geos[ index ] : 0 ) ;
51 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:13
const CaloSubdetectorGeometry * CaloGeometry::getSubdetectorGeometry ( DetId::Detector  det,
int  subdet 
) const

access the subdetector geometry for the given subdetector directly

Definition at line 54 of file CaloGeometry.cc.

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

56 {
57  bool ok ;
58 
59  const unsigned int index ( makeIndex( det,
60  subdet,
61  ok ) ) ;
62  return ( ok ? m_geos[ index ] : 0 ) ;
63 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:13
std::vector< DetId > CaloGeometry::getValidDetIds ( ) const

Get the list of all valid detector ids.

Definition at line 90 of file CaloGeometry.cc.

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

Referenced by cms::HcalConstantsASCIIWriter::analyze(), cms::DiJetAnalyzer::analyze(), 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(), EcalRingCalibrationTools::initializeFromGeometry(), ParticleTowerProducer::resetTowers(), EcalGeomPhiSymHelper::setup(), ParametrizedSubtractor::setupGeometryMap(), PileUpSubtractor::setupGeometryMap(), HcalTBDigiProducer::updateGeometry(), and HcalDigitizer::updateGeometry().

91 {
92  std::vector<DetId> returnValue ;
93  returnValue.reserve( kLength ) ;
94 
95  bool doneHcal ( false ) ;
96  for( unsigned int i ( 0 ) ; i != m_geos.size() ; ++i )
97  {
98  if( 0 != m_geos[i] )
99  {
100  const std::vector< DetId >& aVec ( m_geos[i]->getValidDetIds() ) ;
101  const bool isHcal ( DetId::Hcal == aVec.front().det() ) ;
102  if( !doneHcal ||
103  !isHcal )
104  {
105  returnValue.insert( returnValue.end(), aVec.begin(), aVec.end() ) ;
106  if( !doneHcal &&
107  isHcal ) doneHcal = true ;
108  }
109  }
110  }
111  return returnValue ;
112 }
int i
Definition: DBlmapReader.cc:9
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:90
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 115 of file CaloGeometry.cc.

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

117 {
118  bool ok ;
119 
120  const unsigned int index ( makeIndex( det,
121  subdet,
122  ok ) ) ;
123 
124  return ( ok && ( 0 != m_geos[ index ] ) ?
125  m_geos[ index ]->getValidDetIds( det, subdet ) :
126  k_emptyVec ) ;
127 }
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:90
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:13
unsigned int CaloGeometry::makeIndex ( DetId::Detector  det,
int  subdet,
bool &  ok 
) const
private

Definition at line 13 of file CaloGeometry.cc.

References kMaxDet, kMaxSub, and kMinDet.

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

16 {
17  const unsigned int idet ( det ) ;
18 
19  ok = ( kMinDet <= idet &&
20  kMaxDet >= idet &&
21  0 < subdet &&
22  kMaxSub >= subdet ) ;
23 
24  return ( ( det - kMinDet )*kMaxSub + subdet - 1 ) ;
25 }
bool CaloGeometry::present ( const DetId id) const

is this detid present in the geometry?

Definition at line 84 of file CaloGeometry.cc.

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

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

Register a subdetector geometry.

Definition at line 28 of file CaloGeometry.cc.

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

31 {
32  bool ok ;
33  const unsigned int index = makeIndex( det, subdet, ok ) ;
34  if( ok ) m_geos[index] = geom ;
35 
36 // std::cout<<"Detector="<<(int)det<<", subset="<<subdet<<", index="<<index
37 // <<", size="<<m_geos.size()<<std::endl;
38 
39  assert( ok ) ;
40 }
std::vector< const CaloSubdetectorGeometry * > m_geos
Definition: CaloGeometry.h:62
unsigned int makeIndex(DetId::Detector det, int subdet, bool &ok) const
Definition: CaloGeometry.cc:13

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().