00001 #ifndef DataFormats_SiStripDetId_PXBDetId_H 00002 #define DataFormats_SiStripDetId_PXBDetId_H 00003 00004 #include <ostream> 00005 #include "DataFormats/DetId/interface/DetId.h" 00006 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" 00007 00012 class PXBDetId; 00013 00014 std::ostream& operator<<(std::ostream& os,const PXBDetId& id); 00015 00016 class PXBDetId : public DetId { 00017 public: 00019 PXBDetId(); 00021 PXBDetId(uint32_t rawid); 00023 PXBDetId(const DetId& id); 00024 00025 PXBDetId(uint32_t layer, 00026 uint32_t ladder, 00027 uint32_t module) : DetId(DetId::Tracker,PixelSubdetector::PixelBarrel){ 00028 id_ |= (layer& layerMask_) << layerStartBit_ | 00029 (ladder& ladderMask_) << ladderStartBit_ | 00030 (module& moduleMask_) << moduleStartBit_; 00031 } 00032 00033 00035 unsigned int layer() const{ 00036 return int((id_>>layerStartBit_) & layerMask_);} 00037 00039 unsigned int ladder() const 00040 { return ((id_>>ladderStartBit_) & ladderMask_) ;} 00041 00043 unsigned int module() const 00044 { return ((id_>>moduleStartBit_)& moduleMask_) ;} 00045 00046 private: 00048 static const unsigned int layerStartBit_= 16; 00049 static const unsigned int ladderStartBit_= 8; 00050 static const unsigned int moduleStartBit_= 2; 00052 static const unsigned int layerMask_= 0xF; 00053 static const unsigned int ladderMask_= 0xFF; 00054 static const unsigned int moduleMask_= 0x3F; 00055 }; 00056 00057 00058 #endif