CMS 3D CMS Logo

CaloSubdetectorGeometry Class Reference

Base class for a geometry container for a specific calorimetry subdetector. More...

#include <Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h>

Inheritance diagram for CaloSubdetectorGeometry:

CaloTowerGeometry CastorGeometry EcalBarrelGeometry EcalEndcapGeometry EcalPreshowerGeometry HcalDDDGeometry HcalGeometry ZdcGeometry

List of all members.

Public Types

typedef __gnu_cxx::hash_map
< unsigned int, const
CaloCellGeometry * > 
CellCont
typedef std::set< DetIdDetIdSet
typedef CaloCellGeometry::ParMgr ParMgr
typedef CaloCellGeometry::ParVec ParVec
typedef CaloCellGeometry::ParVecVec ParVecVec

Public Member Functions

void addCell (const DetId &id, const CaloCellGeometry *ccg)
 Add a cell to the geometry.
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
void allocatePar (ParVec::size_type n, unsigned int m)
 CaloSubdetectorGeometry ()
const CellContcellGeometries () const
 the cells
CaloCellGeometry::CornersMgrcornersMgr ()
virtual DetIdSet getCells (const GlobalPoint &r, double dR) const
 Get a list of all cells within a dR of the given cell.
virtual DetId getClosestCell (const GlobalPoint &r) const
virtual const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found.
virtual const std::vector
< DetId > & 
getValidDetIds (DetId::Detector det, int subdet) const
 Get a list of valid detector ids (for the given subdetector).
ParMgrparMgr ()
ParVecVecparVecVec ()
virtual bool present (const DetId &id) const
 is this detid present in the geometry?
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects.

Static Protected Member Functions

static double deltaR (const GlobalPoint &p1, const GlobalPoint &p2)

Protected Attributes

ParVecVec m_parVecVec
std::vector< DetIdm_validIds

Private Member Functions

 CaloSubdetectorGeometry (const CaloSubdetectorGeometry &)
 avoid copies
CaloSubdetectorGeometryoperator= (const CaloSubdetectorGeometry &)

Private Attributes

CellCont m_cellG
CaloCellGeometry::CornersMgrm_cmgr
ParMgrm_parMgr


Detailed Description

Base class for a geometry container for a specific calorimetry subdetector.

Date
2008/02/29 14:52:51
Revision
1.15
Author:
J. Mans - Minnesota

Definition at line 22 of file CaloSubdetectorGeometry.h.


Member Typedef Documentation

typedef __gnu_cxx::hash_map< unsigned int, const CaloCellGeometry *> CaloSubdetectorGeometry::CellCont

Definition at line 26 of file CaloSubdetectorGeometry.h.

typedef std::set<DetId> CaloSubdetectorGeometry::DetIdSet

Definition at line 28 of file CaloSubdetectorGeometry.h.

typedef CaloCellGeometry::ParMgr CaloSubdetectorGeometry::ParMgr

Definition at line 30 of file CaloSubdetectorGeometry.h.

typedef CaloCellGeometry::ParVec CaloSubdetectorGeometry::ParVec

Reimplemented in EcalPreshowerGeometry.

Definition at line 31 of file CaloSubdetectorGeometry.h.

typedef CaloCellGeometry::ParVecVec CaloSubdetectorGeometry::ParVecVec

Reimplemented in EcalPreshowerGeometry.

Definition at line 32 of file CaloSubdetectorGeometry.h.


Constructor & Destructor Documentation

CaloSubdetectorGeometry::CaloSubdetectorGeometry (  )  [inline]

Definition at line 34 of file CaloSubdetectorGeometry.h.

00034                                 : 
00035          m_parMgr ( 0 ) ,
00036          m_cmgr   ( 0 )   {}

CaloSubdetectorGeometry::~CaloSubdetectorGeometry (  )  [virtual]

The base class DOES assume that it owns the CaloCellGeometry objects.

Definition at line 3 of file CaloSubdetectorGeometry.cc.

References i, m_cellG, m_cmgr, and m_parMgr.

00004 { 
00005    for( CellCont::iterator i ( m_cellG.begin() );
00006         i!=m_cellG.end(); ++i )
00007    {
00008       delete const_cast<CaloCellGeometry*>((*i).second) ;
00009    }
00010 
00011    delete m_cmgr ; // must delete after geometries!
00012    delete m_parMgr ; 
00013 }

CaloSubdetectorGeometry::CaloSubdetectorGeometry ( const CaloSubdetectorGeometry  )  [private]

avoid copies


Member Function Documentation

void CaloSubdetectorGeometry::addCell ( const DetId id,
const CaloCellGeometry ccg 
)

Add a cell to the geometry.

Definition at line 16 of file CaloSubdetectorGeometry.cc.

References m_cellG.

Referenced by HcalDDDGeometryLoader::fill(), CastorHardcodeGeometryLoader::fill(), HcalHardcodeGeometryLoader::fill(), CaloTowerHardcodeGeometryLoader::load(), and EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry().

00018 {
00019    m_cellG.insert( std::make_pair( id, ccg ) ) ;
00020 }

void CaloSubdetectorGeometry::allocateCorners ( CaloCellGeometry::CornersVec::size_type  n  ) 

Definition at line 110 of file CaloSubdetectorGeometry.cc.

References CaloCellGeometry::k_cornerSize, and m_cmgr.

Referenced by CaloTowerHardcodeGeometryLoader::load(), HcalDDDGeometryLoader::load(), HcalHardcodeGeometryLoader::load(), and EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry().

00111 {
00112    assert( 0 == m_cmgr ) ;
00113    m_cmgr = new CaloCellGeometry::CornersMgr( n*( CaloCellGeometry::k_cornerSize ),
00114                                               CaloCellGeometry::k_cornerSize        ) ; 
00115 }

void CaloSubdetectorGeometry::allocatePar ( ParVec::size_type  n,
unsigned int  m 
)

Definition at line 118 of file CaloSubdetectorGeometry.cc.

References m_parMgr.

Referenced by CaloTowerHardcodeGeometryLoader::load(), HcalDDDGeometryLoader::load(), HcalHardcodeGeometryLoader::load(), and EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry().

00120 {
00121    assert( 0 == m_parMgr ) ;
00122    m_parMgr = new ParMgr( n*m, m ) ;
00123 }

const CellCont& CaloSubdetectorGeometry::cellGeometries (  )  const [inline]

the cells

Definition at line 43 of file CaloSubdetectorGeometry.h.

References m_cellG.

Referenced by HcalDDDGeometry::getValidDetIds(), ZdcGeometry::getValidDetIds(), CastorGeometry::getValidDetIds(), HcalGeometry::getValidDetIds(), getValidDetIds(), and EcalEndcapGeometry::initialize().

00043 { return m_cellG ; }  

CaloCellGeometry::CornersMgr* CaloSubdetectorGeometry::cornersMgr (  )  [inline]

Definition at line 77 of file CaloSubdetectorGeometry.h.

References m_cmgr.

Referenced by CaloTowerHardcodeGeometryLoader::load(), HcalDDDGeometryLoader::load(), HcalHardcodeGeometryLoader::load(), HcalHardcodeGeometryLoader::makeCell(), CaloTowerHardcodeGeometryLoader::makeCell(), CastorHardcodeGeometryLoader::makeCell(), HcalDDDGeometryLoader::makeCell(), and EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry().

00077 { return m_cmgr ; }

static double CaloSubdetectorGeometry::deltaR ( const GlobalPoint p1,
const GlobalPoint p2 
) [inline, static, protected]

Definition at line 91 of file CaloSubdetectorGeometry.h.

References reco::deltaR().

00093       { return reco::deltaR( p1, p2 ) ; }

CaloSubdetectorGeometry::DetIdSet CaloSubdetectorGeometry::getCells ( const GlobalPoint r,
double  dR 
) const [virtual]

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 in EcalBarrelGeometry, and EcalEndcapGeometry.

Definition at line 77 of file CaloSubdetectorGeometry.cc.

References reco::deltaR2(), eta, PV3DBase< T, PVType, FrameType >::eta(), i, m_cellG, p, PV3DBase< T, PVType, FrameType >::phi(), and phi.

Referenced by EcalEndcapGeometry::getCells(), EcalBarrelGeometry::getCells(), CaloConeSelector::select(), and CaloDualConeSelector::select().

00079 {
00080    const double dR2 ( dR*dR ) ;
00081    const double eta ( r.eta() ) ;
00082    const double phi ( r.phi() ) ;
00083 
00084    DetIdSet dss;
00085    
00086    if( 0.000001 < dR )
00087    {
00088       for( CellCont::const_iterator i ( m_cellG.begin() ); 
00089            i != m_cellG.end() ; ++i ) 
00090       {
00091          const GlobalPoint& p ( i->second->getPosition() ) ;
00092          const double eta0 ( p.eta() ) ;
00093          if( fabs( eta - eta0 ) < dR )
00094          {
00095             const double phi0 ( p.phi() ) ;
00096             double delp ( fabs( phi - phi0 ) ) ;
00097             if( delp > M_PI ) delp = 2*M_PI - delp ;
00098             if( delp < dR )
00099             {
00100                const double dist2 ( reco::deltaR2( eta0, phi0, eta, phi ) ) ;
00101                if( dist2 < dR2 ) dss.insert( i->first ) ;
00102             }
00103          }
00104       }   
00105    }
00106    return dss;
00107 }

DetId CaloSubdetectorGeometry::getClosestCell ( const GlobalPoint r  )  const [virtual]

Reimplemented in EcalBarrelGeometry, EcalEndcapGeometry, EcalPreshowerGeometry, CastorGeometry, ZdcGeometry, HcalDDDGeometry, and HcalGeometry.

Definition at line 54 of file CaloSubdetectorGeometry.cc.

References reco::deltaR2(), eta, PV3DBase< T, PVType, FrameType >::eta(), i, m_cellG, p, PV3DBase< T, PVType, FrameType >::phi(), and phi.

Referenced by SinglePionEfficiencyNew::analyze(), CaloGeometryHelper::getClosestCell(), and HoECalculator::getHoE().

00055 {
00056    const double eta ( r.eta() ) ;
00057    const double phi ( r.phi() ) ;
00058    double closest ( 1e9 ) ;
00059    DetId retval(0);
00060    for( CellCont::const_iterator i ( m_cellG.begin() ); 
00061         i != m_cellG.end() ; ++i ) 
00062    {
00063       const GlobalPoint& p ( i->second->getPosition() ) ;
00064       const double eta0 ( p.eta() ) ;
00065       const double phi0 ( p.phi() ) ;
00066       const double dR2 ( reco::deltaR2( eta0, phi0, eta, phi ) ) ;
00067       if( dR2 < closest ) 
00068       {
00069          closest = dR2 ;
00070          retval  = i->first ;
00071       }
00072    }   
00073    return retval;
00074 }

const CaloCellGeometry * CaloSubdetectorGeometry::getGeometry ( const DetId id  )  const [virtual]

Get the cell geometry of a given detector id. Should return false if not found.

Definition at line 23 of file CaloSubdetectorGeometry.cc.

References i, and m_cellG.

Referenced by EcalTPGParamBuilder::analyze(), EcalTrigPrimAnalyzer::analyze(), EcalSelectiveReadoutValidation::analyzeEB(), EcalSelectiveReadoutValidation::analyzeEE(), PhiSymmetryCalibration::beginJob(), VisEventSetup::build(), VisEventSetupService::buildCaloDet(), CaloGeometryHelper::buildCrystalArray(), SuperClusterShapeAlgo::Calculate_Covariances(), ClusterShapeAlgo::Calculate_Covariances(), ClusterShapeAlgo::Calculate_EnergyDepTopology(), PositionCalc::Calculate_Location(), TBPositionCalc::CalculateCMSPos(), CaloTowersCreationAlgo::convert(), EcalClusterTools::covariances(), PFRecHitProducerECAL::createEcalRecHit(), PFRecHitProducerHCAL::createHcalRecHit(), DistanceToCell::DistanceToCell(), EcalHitMaker::EcalHitMaker(), InvRingCalib::EERingDef(), ECALRecHitAnalyzer::FillGeometry(), CaloTowerAnalyzer::FillGeometry(), HCALRecHitAnalyzer::FillGeometry(), PFRecHitProducerECAL::findEcalRecHitGeometry(), EcalEndcapGeometry::getCells(), EcalBarrelGeometry::getCells(), EcalEndcapGeometry::getClosestBarrelCells(), HcalGeometry::getClosestCell(), CaloGeometryHelper::getClosestCell(), EcalBarrelGeometry::getClosestCell(), EcalEndcapGeometry::getClosestCell(), HardTauAlgorithm::getClusterEnergy(), HCaloDetIdAssociator::getDetIdPoints(), CaloDetIdAssociator::getDetIdPoints(), L2TauNarrowConeIsolationProducer::getECALHits(), L2TauIsolationProducer::getECALHits(), EcalClusterTools::getEnergyDepTopology(), CaloGeometry::getGeometry(), CaloGeometry::getPosition(), CaloDetIdAssociator::getPosition(), HCaloDetIdAssociator::getPosition(), CaloRecoTauTagInfoAlgorithm::getPositionAndEnergyEcalRecHits(), CaloGeometryHelper::initialize(), EcalRingCalibrationTools::initializeFromGeometry(), CaloDetIdAssociator::insideElement(), HCaloDetIdAssociator::insideElement(), CosmicClusterAlgo::makeClusters(), Multi5x5ClusterAlgo::makeClusters(), IslandClusterAlgo::makeClusters(), PreshowerClusterAlgo::makeOneCluster(), JetMaker::makeSpecific(), EcalClusterTools::meanClusterPosition(), DistanceToCell::operator()(), processHits(), JetCrystalsAssociator::produce(), EcalSelectiveReadoutValidation::setTtEtSums(), EcalSelectiveReadoutSuppressor::setTtFlags(), and CaloHitResponse::timeOfFlight().

00024 {
00025    CellCont::const_iterator i ( m_cellG.find( id ) ) ;
00026    return ( i == m_cellG.end() ? 0 : i->second ) ;
00027 }

const std::vector< DetId > & CaloSubdetectorGeometry::getValidDetIds ( DetId::Detector  det,
int  subdet 
) const [virtual]

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 in ZdcGeometry, HcalDDDGeometry, and HcalGeometry.

Definition at line 37 of file CaloSubdetectorGeometry.cc.

References begin, cellGeometries(), i, m_cellG, m_validIds, and python::multivaluedict::sort().

Referenced by EcalTPGParamBuilder::analyze(), testEcalTPGScale::analyze(), VisEventSetup::build(), VisEventSetupService::buildCaloDet(), CaloGeometryHelper::buildCrystalArray(), CaloGeometryHelper::buildNeighbourArray(), VisEventSetupService::caloTextRep(), HcalRecHitsMaker::createVectorOfSubdetectorCells(), EcalPreshowerRecHitsMaker::createVectorsOfCells(), PFRecHitProducerECAL::ecalNeighbArray(), ECALRecHitAnalyzer::FillGeometry(), CaloTowerAnalyzer::FillGeometry(), HCALRecHitAnalyzer::FillGeometry(), EcalEndcapRecHitsMaker::init(), EcalBarrelRecHitsMaker::init(), EcalTPCondAnalyzer::printCRYSTAL(), and CalorimetryManager::reconstruct().

00039 {
00040    if( m_validIds.empty() ) 
00041    {
00042       m_validIds.reserve( m_cellG.size() ) ;
00043       for( CellCont::const_iterator i ( cellGeometries().begin() ); 
00044            i != cellGeometries().end() ; ++i )
00045       {
00046          m_validIds.push_back(i->first);
00047       }
00048       std::sort( m_validIds.begin(), m_validIds.end() ) ;
00049    }
00050    return m_validIds ;    
00051 }

CaloSubdetectorGeometry& CaloSubdetectorGeometry::operator= ( const CaloSubdetectorGeometry  )  [private]

ParMgr* CaloSubdetectorGeometry::parMgr (  )  [inline]

Definition at line 81 of file CaloSubdetectorGeometry.h.

References m_parMgr.

Referenced by CaloTowerHardcodeGeometryLoader::load(), HcalDDDGeometryLoader::load(), HcalHardcodeGeometryLoader::load(), HcalHardcodeGeometryLoader::makeCell(), CaloTowerHardcodeGeometryLoader::makeCell(), CastorHardcodeGeometryLoader::makeCell(), HcalDDDGeometryLoader::makeCell(), and EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry().

00081 { return m_parMgr ; }

ParVecVec& CaloSubdetectorGeometry::parVecVec (  )  [inline]

Definition at line 83 of file CaloSubdetectorGeometry.h.

References m_parVecVec.

Referenced by HcalHardcodeGeometryLoader::makeCell(), CaloTowerHardcodeGeometryLoader::makeCell(), CastorHardcodeGeometryLoader::makeCell(), HcalDDDGeometryLoader::makeCell(), and EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry().

00083 { return m_parVecVec ; }

bool CaloSubdetectorGeometry::present ( const DetId id  )  const [virtual]

is this detid present in the geometry?

Definition at line 30 of file CaloSubdetectorGeometry.cc.

References m_cellG.

Referenced by EcalBarrelGeometry::getClosestCell(), EcalPreshowerGeometry::getClosestCellInPlane(), and CaloGeometry::present().

00031 {
00032    return m_cellG.find( id ) != m_cellG.end() ;
00033 }


Member Data Documentation

CellCont CaloSubdetectorGeometry::m_cellG [private]

Definition at line 105 of file CaloSubdetectorGeometry.h.

Referenced by addCell(), cellGeometries(), getCells(), getClosestCell(), getGeometry(), getValidDetIds(), present(), and ~CaloSubdetectorGeometry().

CaloCellGeometry::CornersMgr* CaloSubdetectorGeometry::m_cmgr [private]

Definition at line 99 of file CaloSubdetectorGeometry.h.

Referenced by allocateCorners(), cornersMgr(), and ~CaloSubdetectorGeometry().

ParMgr* CaloSubdetectorGeometry::m_parMgr [private]

Definition at line 97 of file CaloSubdetectorGeometry.h.

Referenced by allocatePar(), parMgr(), and ~CaloSubdetectorGeometry().

ParVecVec CaloSubdetectorGeometry::m_parVecVec [protected]

Definition at line 87 of file CaloSubdetectorGeometry.h.

Referenced by parVecVec().

std::vector<DetId> CaloSubdetectorGeometry::m_validIds [mutable, protected]

Reimplemented in CastorGeometry.

Definition at line 89 of file CaloSubdetectorGeometry.h.

Referenced by HcalDDDGeometry::getValidDetIds(), ZdcGeometry::getValidDetIds(), HcalGeometry::getValidDetIds(), and getValidDetIds().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:15:58 2009 for CMSSW by  doxygen 1.5.4