00001 #ifndef GEOMETRY_CALOGEOMETRY_CALOSUBDETECTORGEOMETRY_H 00002 #define GEOMETRY_CALOGEOMETRY_CALOSUBDETECTORGEOMETRY_H 1 00003 00004 #include <ext/hash_map> 00005 #include <vector> 00006 #include <set> 00007 #include "DataFormats/DetId/interface/DetId.h" 00008 #include "DataFormats/GeometryVector/interface/GlobalPoint.h" 00009 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" 00010 #include "PhysicsTools/Utilities/interface/deltaR.h" 00011 00022 class CaloSubdetectorGeometry { 00023 00024 public: 00025 00026 typedef __gnu_cxx::hash_map< unsigned int, const CaloCellGeometry *> CellCont; 00027 00028 typedef std::set<DetId> DetIdSet; 00029 00030 typedef CaloCellGeometry::ParMgr ParMgr ; 00031 typedef CaloCellGeometry::ParVec ParVec ; 00032 typedef CaloCellGeometry::ParVecVec ParVecVec ; 00033 00034 CaloSubdetectorGeometry() : 00035 m_parMgr ( 0 ) , 00036 m_cmgr ( 0 ) {} 00037 00039 virtual ~CaloSubdetectorGeometry(); 00040 00041 public: 00043 const CellCont& cellGeometries() const { return m_cellG ; } 00044 00046 void addCell( const DetId& id, 00047 const CaloCellGeometry* ccg ) ; 00048 00050 virtual bool present( const DetId& id ) const; 00051 00053 virtual const CaloCellGeometry* getGeometry( const DetId& id ) const ; 00054 00059 virtual const std::vector<DetId>& getValidDetIds( DetId::Detector det, 00060 int subdet ) const ; 00061 00062 // Get closest cell, etc... 00063 virtual DetId getClosestCell( const GlobalPoint& r ) const ; 00064 00071 virtual DetIdSet getCells( const GlobalPoint& r, double dR ) const ; 00072 00073 //FIXME: Hcal implements its own getValidDetId.... 00074 00075 void allocateCorners( CaloCellGeometry::CornersVec::size_type n ) ; 00076 00077 CaloCellGeometry::CornersMgr* cornersMgr() { return m_cmgr ; } 00078 00079 void allocatePar( ParVec::size_type n, unsigned int m ) ; 00080 00081 ParMgr* parMgr() { return m_parMgr ; } 00082 00083 ParVecVec& parVecVec() { return m_parVecVec ; } 00084 00085 protected: 00086 00087 ParVecVec m_parVecVec ; 00088 00089 mutable std::vector<DetId> m_validIds ; 00090 00091 static double deltaR( const GlobalPoint& p1, 00092 const GlobalPoint& p2 ) 00093 { return reco::deltaR( p1, p2 ) ; } 00094 00095 private: 00096 00097 ParMgr* m_parMgr ; 00098 00099 CaloCellGeometry::CornersMgr* m_cmgr ; 00100 00102 CaloSubdetectorGeometry( const CaloSubdetectorGeometry& ) ; 00103 CaloSubdetectorGeometry& operator=( const CaloSubdetectorGeometry& ) ; 00104 00105 CellCont m_cellG ; 00106 00107 }; 00108 00109 00110 #endif