CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DataFormats/EcalDetId/interface/ESDetId.h

Go to the documentation of this file.
00001 #ifndef ECALDETID_ESDETID_H
00002 #define ECALDETID_ESDETID_H
00003 
00004 #include <ostream>
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00007 
00015 class ESDetId : public DetId {
00016  public:
00017 
00018   enum { Subdet = EcalPreshower } ;
00020   ESDetId();
00022   ESDetId(uint32_t rawid);  
00024   ESDetId(int strip, int ixs, int iys, int plane, int iz);
00026   ESDetId(const DetId& id);
00028   ESDetId& operator=(const DetId& id);
00029 
00031   EcalSubdetector subdet() const { return EcalSubdetector(subdetId()); }
00033   int zside() const { return (id_&0x80000)?(1):(-1); }
00035   int plane() const { return ((id_>>18)&0x1)+1; }
00037   int six() const { return (id_>>6)&0x3F; }
00039   int siy() const { return (id_>>12)&0x3F; }
00041   int strip() const { return (id_&0x3F); }
00043   int hashedIndex() const ;
00044 
00045   uint32_t denseIndex() const { return hashedIndex() ; }
00046 
00047   static bool validDenseIndex( uint32_t din ) { return validHashIndex( din ) ; }
00048 
00049   static ESDetId detIdFromDenseIndex( uint32_t din ) { return unhashIndex( din ) ; }
00050 
00052   static ESDetId unhashIndex(    int hi ) ;
00053   static bool    validHashIndex( int hi ) { return ( hi < kSizeForDenseIndexing ) ; }
00055   static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz) ;
00056 
00057   static const int IX_MIN=1;
00058   static const int IY_MIN=1;
00059   static const int IX_MAX=40;
00060   static const int IY_MAX=40;
00061   static const int ISTRIP_MIN=1;
00062   static const int ISTRIP_MAX=32;
00063   static const int PLANE_MIN=1;
00064   static const int PLANE_MAX=2;
00065   static const int IZ_NUM=2;
00066 
00067    private :
00068 
00069       enum { kXYMAX=1072,
00070              kXYMIN=   1,
00071              kXMAX =  40,
00072              kYMAX =  40,
00073              kXMIN =   1,
00074              kYMIN =   1,
00075              // now normalize to A-D notation for ease of use
00076              kNa   =IZ_NUM,
00077              kNb   =PLANE_MAX - PLANE_MIN + 1,
00078              kNc   =kXYMAX - kXYMIN + 1,
00079              kNd   =ISTRIP_MAX - ISTRIP_MIN + 1,
00080              kLd   =kNd,
00081              kLc   =kLd*kNc,
00082              kLb   =kLc*kNb,
00083              kLa   =kLb*kNa } ;
00084       
00085       static const unsigned short hxy1[ kXMAX ][ kYMAX ] ;
00086       static const unsigned short hx1[ kXYMAX ] ;
00087       static const unsigned short hy1[ kXYMAX ] ;
00088       
00089       static const unsigned short hxy2[ kXMAX ][ kYMAX ] ;
00090       static const unsigned short hx2[ kXYMAX ] ;
00091       static const unsigned short hy2[ kXYMAX ] ;
00092 
00093    public:
00094 
00095       enum { kSizeForDenseIndexing = kLa } ;
00096 
00097 };
00098 
00099 std::ostream& operator<<(std::ostream&,const ESDetId& id);
00100 
00101 
00102 #endif