00001 #ifndef DataFormats_SiStripDetId_PXFDetId_H 00002 #define DataFormats_SiStripDetId_PXFDetId_H 00003 00004 #include <ostream> 00005 #include <iostream> 00006 #include "DataFormats/DetId/interface/DetId.h" 00007 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" 00008 00012 class PXFDetId; 00013 00014 std::ostream& operator<<(std::ostream& os,const PXFDetId& id); 00015 00016 class PXFDetId : public DetId { 00017 public: 00019 PXFDetId(); 00021 PXFDetId(uint32_t rawid); 00023 PXFDetId(const DetId& id); 00024 00025 PXFDetId(uint32_t side, 00026 uint32_t disk, 00027 uint32_t blade, 00028 uint32_t panel, 00029 uint32_t module) : DetId(DetId::Tracker,PixelSubdetector::PixelEndcap){ 00030 id_ |= (side& sideMask_) << sideStartBit_ | 00031 (disk& diskMask_) << diskStartBit_ | 00032 (blade& bladeMask_) << bladeStartBit_ | 00033 (panel& panelMask_) << panelStartBit_ | 00034 (module& moduleMask_) << moduleStartBit_ ; 00035 } 00036 00037 00039 unsigned int side() const 00040 { 00041 return int((id_>>sideStartBit_) & sideMask_); 00042 } 00043 00045 unsigned int disk() const 00046 { 00047 return int((id_>>diskStartBit_) & diskMask_); 00048 } 00049 00051 unsigned int blade() const 00052 { 00053 if (this->disk() < 4) 00054 return ((id_>>bladeStartBit_) & bladeMask_); 00055 else 00056 { 00057 std::cerr << "W A R N I N G! Attempting to get PXF::blade() from Outer Tracker Endcap" << std::endl; 00058 return 9999999; 00059 } 00060 } 00061 00063 unsigned int ring() const 00064 { 00065 if (this->disk() > 3) 00066 return ((id_>>bladeStartBit_) & bladeMask_); 00067 else 00068 { 00069 std::cerr << "W A R N I N G! Attempting to get PXF::ring() from Outer Tracker Endcap" << std::endl; 00070 return 9999999; 00071 } 00072 } 00073 00074 00075 00077 unsigned int panel() const 00078 { 00079 return ((id_>>panelStartBit_) & panelMask_); 00080 } 00081 00083 unsigned int module() const 00084 { 00085 return ((id_>>moduleStartBit_) & moduleMask_); 00086 } 00087 00088 private: 00090 static const unsigned int sideStartBit_= 23; 00091 static const unsigned int diskStartBit_= 18;//16; 00092 static const unsigned int bladeStartBit_= 12;//10; 00093 static const unsigned int panelStartBit_= 10;//8; 00094 static const unsigned int moduleStartBit_= 2; 00095 static const unsigned int typeStartBit_ = 0; 00097 00098 static const unsigned int sideMask_= 0x3; 00099 static const unsigned int diskMask_= 0xF; 00100 static const unsigned int bladeMask_= 0x3F; 00101 static const unsigned int panelMask_= 0x3; 00102 static const unsigned int moduleMask_= 0xFF;//0x3F; 00103 static const unsigned int typeMask_ = 0x3; 00104 }; 00105 00106 #endif