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 protected:
00102
00103 virtual const CaloCellGeometry* cellGeomPtr( uint32_t index ) const ;
00104
00105 virtual unsigned int indexFor(const DetId& id) const { return theTopology.detId2denseId(id); }
00106 virtual unsigned int sizeForDenseIndex(const DetId& id) const { return theTopology.ncells(); }
00107
00108 private:
00109
00110 void fillDetIds() const ;
00111
00112 void init() ;
00113
00115 int etaRing(HcalSubdetector bc, double abseta) const;
00116 int phiBin(double phi, int etaring) const;
00117
00118
00119 const HcalTopology& theTopology;
00120
00121 mutable std::vector<DetId> m_hbIds ;
00122 mutable std::vector<DetId> m_heIds ;
00123 mutable std::vector<DetId> m_hoIds ;
00124 mutable std::vector<DetId> m_hfIds ;
00125 mutable std::vector<DetId> m_emptyIds ;
00126
00127 HBCellVec m_hbCellVec ;
00128 HECellVec m_heCellVec ;
00129 HOCellVec m_hoCellVec ;
00130 HFCellVec m_hfCellVec ;
00131 };
00132
00133
00134 #endif
00135