CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Geometry/EcalAlgo/interface/EcalEndcapGeometry.h

Go to the documentation of this file.
00001 #ifndef EcalEndcapGeometry_h
00002 #define EcalEndcapGeometry_h
00003 
00004 #include "Geometry/CaloGeometry/interface/EZArrayFL.h"
00005 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00006 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00007 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00008 #include "Geometry/Records/interface/EcalEndcapGeometryRecord.h"
00009 #include "CondFormats/AlignmentRecord/interface/EEAlignmentRcd.h"
00010 #include "Geometry/EcalCommonData/interface/EcalEndcapNumberingScheme.h"
00011 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00012 #include "Geometry/Records/interface/PEcalEndcapRcd.h"
00013 #include <vector>
00014 #include <map>
00015 
00016 class TruncatedPyramid;
00017 
00018 class EcalEndcapGeometry : public CaloSubdetectorGeometry 
00019 {
00020    public:
00021 
00022       typedef std::vector<TruncatedPyramid> CellVec ;
00023 
00024       typedef CaloCellGeometry::CCGFloat CCGFloat ;
00025       typedef CaloCellGeometry::Pt3D     Pt3D     ;
00026       typedef CaloCellGeometry::Pt3DVec  Pt3DVec  ;
00027 
00028       typedef IdealGeometryRecord      IdealRecord   ;
00029       typedef EcalEndcapGeometryRecord AlignedRecord ;
00030       typedef EEAlignmentRcd           AlignmentRecord ;
00031       typedef PEcalEndcapRcd           PGeometryRecord ;
00032 
00033       typedef EZArrayFL<EBDetId> OrderedListOfEBDetId ; // like an stl vector: begin(), end(), [i]
00034 
00035       typedef std::vector<OrderedListOfEBDetId*>  VecOrdListEBDetIdPtr ;
00036 
00037       typedef EcalEndcapNumberingScheme NumberingScheme ;
00038 
00039       typedef EEDetId DetIdType ;
00040 
00041       enum { k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing } ;
00042 
00043       enum { k_NumberOfShapes = 1 } ;
00044 
00045       enum { k_NumberOfParametersPerShape = 11 } ;
00046 
00047 
00048       static std::string dbString() { return "PEcalEndcapRcd" ; }
00049 
00050       virtual unsigned int numberOfShapes() const { return k_NumberOfShapes ; }
00051       virtual unsigned int numberOfParametersPerShape() const { return k_NumberOfParametersPerShape ; }
00052 
00053       EcalEndcapGeometry() ;
00054   
00055       virtual ~EcalEndcapGeometry();
00056 
00057       int getNumberOfModules()          const { return _nnmods ; }
00058 
00059       int getNumberOfCrystalPerModule() const { return _nncrys ; }
00060 
00061       void setNumberOfModules(          const int nnmods ) { _nnmods=nnmods ; }
00062 
00063       void setNumberOfCrystalPerModule( const int nncrys ) { _nncrys=nncrys ; }
00064 
00065       const OrderedListOfEBDetId* getClosestBarrelCells( EEDetId id ) const ;
00066       // Get closest cell, etc...
00067       virtual DetId getClosestCell( const GlobalPoint& r ) const ;
00068 
00069       virtual CaloSubdetectorGeometry::DetIdSet getCells( const GlobalPoint& r,
00070                                                           double             dR ) const ;
00071 
00072       virtual void initializeParms() ;
00073 
00074       CCGFloat avgAbsZFrontFaceCenter() const ; // average over both endcaps. Positive!
00075 
00076       static std::string hitString() { return "EcalHitsEE" ; }
00077 
00078       static std::string producerTag() { return "EcalEndcap" ; }
00079 
00080       static unsigned int numberOfAlignments() { return 4 ; }
00081 
00082       static unsigned int alignmentTransformIndexLocal( const DetId& id ) ;
00083 
00084       static unsigned int alignmentTransformIndexGlobal( const DetId& id ) ;
00085 
00086       static DetId detIdFromLocalAlignmentIndex( unsigned int iLoc ) ;
00087 
00088       static void localCorners( Pt3DVec&        lc  ,
00089                                 const CCGFloat* pv  ,
00090                                 unsigned int    i   ,
00091                                 Pt3D&           ref   ) ;
00092 
00093       virtual void newCell( const GlobalPoint& f1 ,
00094                             const GlobalPoint& f2 ,
00095                             const GlobalPoint& f3 ,
00096                             const CCGFloat*    parm ,
00097                             const DetId&       detId   ) ;
00098 
00099    protected:
00100 
00101       virtual const CaloCellGeometry* cellGeomPtr( uint32_t index ) const ;
00102 
00103    private:
00104 
00105       static int myPhi( int i ) { i+=720; return ( 1 + (i-1)%360 ) ; }
00106 
00108       int _nnmods;
00109   
00111       int _nncrys; 
00112 
00113       CCGFloat zeP, zeN;
00114 
00115       CCGFloat m_wref, m_xlo[2], m_xhi[2], m_ylo[2], m_yhi[2], m_xoff[2], m_yoff[2], m_del ;
00116 
00117       unsigned int m_nref ;
00118 
00119       unsigned int xindex( CCGFloat x, CCGFloat z ) const ;
00120       unsigned int yindex( CCGFloat y, CCGFloat z ) const ;
00121 
00122       EEDetId gId( float x, float y, float z ) const ;
00123 
00124       mutable EZMgrFL<EBDetId>*     m_borderMgr ;
00125 
00126       mutable VecOrdListEBDetIdPtr* m_borderPtrVec ;
00127 
00128       mutable CCGFloat m_avgZ ;
00129 
00130       CellVec m_cellVec ;
00131 } ;
00132 
00133 
00134 #endif
00135