CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DataFormats/HcalDetId/interface/HcalDetId.h

Go to the documentation of this file.
00001 #ifndef DATAFORMATS_HCALDETID_HCALDETID_H
00002 #define DATAFORMATS_HCALDETID_HCALDETID_H 1
00003 
00004 #include <iosfwd>
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00007 
00008 
00018 class HcalDetId : public DetId {
00019 public:
00021   HcalDetId();
00023   HcalDetId(uint32_t rawid);
00025   HcalDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth);
00027   HcalDetId(const DetId& id);
00029   HcalDetId& operator=(const DetId& id);
00030 
00032   HcalSubdetector subdet() const { return (HcalSubdetector)(subdetId()); }
00034   int zside() const { return (id_&0x2000)?(1):(-1); }
00036   int ietaAbs() const { return (id_>>7)&0x3f; }
00038   int ieta() const { return zside()*ietaAbs(); }
00040   int iphi() const { return id_&0x7F; }
00042   int depth() const { return (id_>>14)&0x1F; }
00044   int crystal_ieta_low() const { return ((ieta()-zside())*5)+zside(); }
00046   int crystal_ieta_high() const { return ((ieta()-zside())*5)+5*zside(); }
00048   int crystal_iphi_low() const; 
00050   int crystal_iphi_high() const;
00051 
00052   static bool validDetId( HcalSubdetector subdet,
00053                           int             tower_ieta,
00054                           int             tower_iphi,
00055                           int             depth       ) ;
00056 
00057   // get the hashed index
00058   int hashed_index() const;
00059 
00060   uint32_t denseIndex() const { return hashed_index() ; }
00061 
00062   static bool validDenseIndex( uint32_t din ) { return ( din < kSizeForDenseIndexing ) ; }
00063 
00064   static HcalDetId detIdFromDenseIndex( uint32_t di ) ;
00065 
00066   static const HcalDetId Undefined;
00067 
00068    private:
00069 
00070       enum { kHBhalf = 1296 ,
00071              kHEhalf = 1296 ,
00072              kHOhalf = 1080 ,
00073              kHFhalf = 864  ,
00074              kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf } ;
00075 
00076    public:
00077 
00078       enum { kSizeForDenseIndexing = 2*kHcalhalf } ;
00079       enum { kHBSize = 2*kHBhalf } ;
00080       enum { kHESize = 2*kHEhalf } ;
00081       enum { kHOSize = 2*kHOhalf } ;
00082       enum { kHFSize = 2*kHFhalf } ;
00083 
00084 };
00085 
00086 std::ostream& operator<<(std::ostream&,const HcalDetId& id);
00087 
00088 #endif