Go to the documentation of this file.00001 #ifndef HcalGeometry_h
00002 #define HcalGeometry_h
00003
00004 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00005 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00006 #include "Geometry/CaloGeometry/interface/IdealObliquePrism.h"
00007 #include "Geometry/CaloGeometry/interface/IdealZPrism.h"
00008 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00009 #include "CondFormats/AlignmentRecord/interface/HcalAlignmentRcd.h"
00010 #include "Geometry/Records/interface/HcalGeometryRecord.h"
00011
00012 class HcalGeometry : public CaloSubdetectorGeometry {
00013
00014 public:
00015
00016 typedef std::vector<IdealObliquePrism> HBCellVec ;
00017 typedef std::vector<IdealObliquePrism> HECellVec ;
00018 typedef std::vector<IdealObliquePrism> HOCellVec ;
00019 typedef std::vector<IdealZPrism> HFCellVec ;
00020
00021 typedef CaloCellGeometry::CCGFloat CCGFloat ;
00022 typedef CaloCellGeometry::Pt3D Pt3D ;
00023 typedef CaloCellGeometry::Pt3DVec Pt3DVec ;
00024
00025 typedef HcalAlignmentRcd AlignmentRecord ;
00026 typedef HcalGeometryRecord AlignedRecord ;
00027 typedef PHcalRcd PGeometryRecord ;
00028 typedef HcalDetId DetIdType ;
00029
00030
00031 enum { k_NumberOfParametersPerShape = 5 } ;
00032
00033 static std::string dbString() { return "PHcalRcd" ; }
00034
00035 virtual unsigned int numberOfShapes() const { return theTopology.getNumberOfShapes() ; }
00036 virtual unsigned int numberOfParametersPerShape() const { return k_NumberOfParametersPerShape ; }
00037
00038 explicit HcalGeometry(const HcalTopology& topology);
00039
00041 virtual ~HcalGeometry();
00042
00043 virtual const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector ( 0 ),
00044 int subdet = 0 ) const;
00045
00046 virtual DetId getClosestCell(const GlobalPoint& r) const ;
00047
00048 virtual CaloSubdetectorGeometry::DetIdSet getCells( const GlobalPoint& r,
00049 double dR ) const ;
00050
00051
00052 static std::string producerTag() { return "HCAL" ; }
00053
00054 static unsigned int numberOfBarrelAlignments() { return 36 ; }
00055
00056 static unsigned int numberOfEndcapAlignments() { return 36 ; }
00057
00058 static unsigned int numberOfForwardAlignments() { return 36 ; }
00059
00060 static unsigned int numberOfOuterAlignments() { return 60 ; }
00061
00062
00063
00064 static unsigned int numberOfAlignments()
00065 { return ( numberOfBarrelAlignments() +
00066 numberOfEndcapAlignments() +
00067 numberOfOuterAlignments() +
00068 numberOfForwardAlignments() ) ; }
00069
00070 static unsigned int alignmentBarrelIndexLocal( const DetId& id ) ;
00071 static unsigned int alignmentEndcapIndexLocal( const DetId& id ) ;
00072 static unsigned int alignmentForwardIndexLocal( const DetId& id ) ;
00073 static unsigned int alignmentOuterIndexLocal( const DetId& id ) ;
00074 static unsigned int alignmentTransformIndexLocal( const DetId& id ) ;
00075
00076 static unsigned int alignmentBarEndForIndexLocal( const DetId& id,unsigned int nD ) ;
00077
00078 static unsigned int alignmentTransformIndexGlobal( const DetId& id ) ;
00079
00080 static DetId detIdFromLocalAlignmentIndex( unsigned int i ) ;
00081 static DetId detIdFromBarrelAlignmentIndex( unsigned int i ) ;
00082 static DetId detIdFromEndcapAlignmentIndex( unsigned int i ) ;
00083 static DetId detIdFromForwardAlignmentIndex( unsigned int i ) ;
00084 static DetId detIdFromOuterAlignmentIndex( unsigned int i ) ;
00085
00086 void localCorners( Pt3DVec& lc ,
00087 const CCGFloat* pv ,
00088 unsigned int i ,
00089 Pt3D& ref ) ;
00090
00091 virtual void newCell( const GlobalPoint& f1 ,
00092 const GlobalPoint& f2 ,
00093 const GlobalPoint& f3 ,
00094 const CCGFloat* parm,
00095 const DetId& detId ) ;
00096
00097 virtual const CaloCellGeometry* getGeometry( const DetId& id ) const {
00098 return cellGeomPtr( theTopology.detId2denseId( id ) ) ;
00099 }
00100
00101 virtual void getSummary( CaloSubdetectorGeometry::TrVec& trVector,
00102 CaloSubdetectorGeometry::IVec& iVector,
00103 CaloSubdetectorGeometry::DimVec& dimVector,
00104 CaloSubdetectorGeometry::IVec& dinsVector ) const ;
00105 protected:
00106
00107 virtual const CaloCellGeometry* cellGeomPtr( unsigned int index ) const ;
00108
00109 virtual unsigned int indexFor(const DetId& id) const { return theTopology.detId2denseId(id); }
00110 virtual unsigned int sizeForDenseIndex(const DetId& id) const { return theTopology.ncells(); }
00111
00112 private:
00113
00114 void fillDetIds() const ;
00115
00116 void init() ;
00117
00119 int etaRing(HcalSubdetector bc, double abseta) const;
00120 int phiBin(double phi, int etaring) const;
00121
00122
00123 const HcalTopology& theTopology;
00124
00125 mutable std::vector<DetId> m_hbIds ;
00126 mutable std::vector<DetId> m_heIds ;
00127 mutable std::vector<DetId> m_hoIds ;
00128 mutable std::vector<DetId> m_hfIds ;
00129 mutable std::vector<DetId> m_emptyIds ;
00130 mutable CaloSubdetectorGeometry::IVec m_dins;
00131
00132 HBCellVec m_hbCellVec ;
00133 HECellVec m_heCellVec ;
00134 HOCellVec m_hoCellVec ;
00135 HFCellVec m_hfCellVec ;
00136 };
00137
00138
00139 #endif
00140