00001 #ifndef DATAFORMATS_HCALDETID_HCALDETID_H
00002 #define DATAFORMATS_HCALDETID_HCALDETID_H 1
00003
00004 #include <ostream>
00005 #include <iostream>
00006 #include "DataFormats/DetId/interface/DetId.h"
00007 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00008
00009
00019 class HcalDetId : public DetId {
00020 public:
00022 HcalDetId();
00024 HcalDetId(uint32_t rawid);
00026 HcalDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth);
00028 HcalDetId(const DetId& id);
00030 HcalDetId& operator=(const DetId& id);
00031
00033 HcalSubdetector subdet() const { return (HcalSubdetector)(subdetId()); }
00035 int zside() const { return (id_&0x2000)?(1):(-1); }
00037 int ietaAbs() const { return (id_>>7)&0x3f; }
00039 int ieta() const { return zside()*ietaAbs(); }
00041 int iphi() const { return id_&0x7F; }
00043 int depth() const { return (id_>>14)&0x7; }
00045 int crystal_ieta_low() const { return ((ieta()-zside())*5)+zside(); }
00047 int crystal_ieta_high() const { return ((ieta()-zside())*5)+5*zside(); }
00049 int crystal_iphi_low() const;
00051 int crystal_iphi_high() const;
00052
00053 static bool validDetId( HcalSubdetector subdet,
00054 int tower_ieta,
00055 int tower_iphi,
00056 int depth ) ;
00057
00058
00059 int hashed_index() const;
00060
00061 uint32_t denseIndex() const { return hashed_index() ; }
00062
00063 static bool validDenseIndex( uint32_t din ) { return ( din < kSizeForDenseIndexing ) ; }
00064
00065 static HcalDetId detIdFromDenseIndex( uint32_t di ) ;
00066
00067 static const HcalDetId Undefined;
00068
00069 private:
00070
00071 enum { kHBhalf = 1296 ,
00072 kHEhalf = 1296 ,
00073 kHOhalf = 1080 ,
00074 kHFhalf = 864 ,
00075 kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf } ;
00076
00077 public:
00078
00079 enum { kSizeForDenseIndexing = 2*kHcalhalf } ;
00080
00081 };
00082
00083 std::ostream& operator<<(std::ostream&,const HcalDetId& id);
00084
00085 #endif