CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 IdealGeometryRecord      IdealRecord   ;
00023       typedef EcalEndcapGeometryRecord AlignedRecord ;
00024       typedef EEAlignmentRcd           AlignmentRecord ;
00025       typedef PEcalEndcapRcd           PGeometryRecord ;
00026 
00027       typedef EZArrayFL<EBDetId> OrderedListOfEBDetId ; // like an stl vector: begin(), end(), [i]
00028 
00029       typedef std::vector<OrderedListOfEBDetId*>  VecOrdListEBDetIdPtr ;
00030 
00031       typedef EcalEndcapNumberingScheme NumberingScheme ;
00032 
00033       typedef EEDetId DetIdType ;
00034 
00035       enum { k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing } ;
00036 
00037       enum { k_NumberOfShapes = 1 } ;
00038 
00039       enum { k_NumberOfParametersPerShape = 11 } ;
00040 
00041 
00042       static std::string dbString() { return "PEcalEndcapRcd" ; }
00043 
00044       virtual unsigned int numberOfShapes() const { return k_NumberOfShapes ; }
00045       virtual unsigned int numberOfParametersPerShape() const { return k_NumberOfParametersPerShape ; }
00046 
00047       EcalEndcapGeometry() ;
00048   
00049       virtual ~EcalEndcapGeometry();
00050 
00051       int getNumberOfModules()          const { return _nnmods ; }
00052 
00053       int getNumberOfCrystalPerModule() const { return _nncrys ; }
00054 
00055       void setNumberOfModules(          const int nnmods ) { _nnmods=nnmods ; }
00056 
00057       void setNumberOfCrystalPerModule( const int nncrys ) { _nncrys=nncrys ; }
00058 
00059       const OrderedListOfEBDetId* getClosestBarrelCells( EEDetId id ) const ;
00060       // Get closest cell, etc...
00061       virtual DetId getClosestCell( const GlobalPoint& r ) const ;
00062 
00063       virtual CaloSubdetectorGeometry::DetIdSet getCells( const GlobalPoint& r,
00064                                                           double             dR ) const ;
00065 
00066       virtual void initializeParms() ;
00067 
00068       double avgAbsZFrontFaceCenter() const ; // average over both endcaps. Positive!
00069 
00070       static std::string hitString() { return "EcalHitsEE" ; }
00071 
00072       static std::string producerTag() { return "EcalEndcap" ; }
00073 
00074       static unsigned int numberOfAlignments() { return 4 ; }
00075 
00076       static unsigned int alignmentTransformIndexLocal( const DetId& id ) ;
00077 
00078       static unsigned int alignmentTransformIndexGlobal( const DetId& id ) ;
00079 
00080       static DetId detIdFromLocalAlignmentIndex( unsigned int iLoc ) ;
00081 
00082       static std::vector<HepGeom::Point3D<double> > localCorners( const double* pv,
00083                                                    unsigned int  i,
00084                                                    HepGeom::Point3D<double> &   ref ) ;
00085 
00086       static CaloCellGeometry* newCell( const GlobalPoint& f1 ,
00087                                         const GlobalPoint& f2 ,
00088                                         const GlobalPoint& f3 ,
00089                                         CaloCellGeometry::CornersMgr* mgr,
00090                                         const double*      parm ,
00091                                         const DetId&       detId   ) ;
00092 
00093    private:
00094 
00095       static int myPhi( int i ) { i+=720; return ( 1 + (i-1)%360 ) ; }
00096 
00098       int _nnmods;
00099   
00101       int _nncrys; 
00102 
00103       double zeP, zeN;
00104 
00105       double m_wref, m_xlo[2], m_xhi[2], m_ylo[2], m_yhi[2], m_xoff[2], m_yoff[2], m_del ;
00106 
00107       unsigned int m_nref ;
00108 
00109       unsigned int xindex( double x, double z ) const ;
00110       unsigned int yindex( double y, double z ) const ;
00111 
00112       EEDetId gId( float x, float y, float z ) const ;
00113 
00114       mutable EZMgrFL<EBDetId>*     m_borderMgr ;
00115 
00116       mutable VecOrdListEBDetIdPtr* m_borderPtrVec ;
00117 
00118       mutable double m_avgZ ;
00119 } ;
00120 
00121 
00122 #endif
00123