CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DataFormats/SiPixelDetId/interface/PXFDetId.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiStripDetId_PXFDetId_H
00002 #define DataFormats_SiStripDetId_PXFDetId_H
00003 
00004 #include <ostream>
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00007 
00011 class PXFDetId;
00012 
00013 std::ostream& operator<<(std::ostream& os,const PXFDetId& id);
00014 
00015 class PXFDetId : public DetId {
00016  public:
00018   PXFDetId();
00020   PXFDetId(uint32_t rawid);
00022   PXFDetId(const DetId& id); 
00023   
00024   PXFDetId(uint32_t side,
00025            uint32_t disk,
00026            uint32_t blade,
00027            uint32_t panel,
00028            uint32_t module) : DetId(DetId::Tracker,PixelSubdetector::PixelEndcap){
00029     id_ |= (side& sideMask_)  << sideStartBit_   |
00030       (disk& diskMask_)        << diskStartBit_      |
00031       (blade& bladeMask_)      << bladeStartBit_     |
00032       (panel& panelMask_)      << panelStartBit_     |
00033       (module& moduleMask_)    << moduleStartBit_  ;
00034   }
00035   
00036   
00038   unsigned int side() const{
00039     return int((id_>>sideStartBit_) & sideMask_);
00040   }
00041   
00043   unsigned int disk() const{
00044     return int((id_>>diskStartBit_) & diskMask_);
00045   }
00046   
00048   unsigned int blade() const
00049     { return ((id_>>bladeStartBit_) & bladeMask_) ;}
00050   
00052   unsigned int panel() const
00053     { return ((id_>>panelStartBit_) & panelMask_) ;}
00054 
00056   unsigned int module() const
00057     { return ((id_>>moduleStartBit_) & moduleMask_) ;}
00058   
00059  private:
00061   static const unsigned int sideStartBit_=   23;
00062   static const unsigned int diskStartBit_=   16;
00063   static const unsigned int bladeStartBit_=  10;
00064   static const unsigned int panelStartBit_=  8;
00065   static const unsigned int moduleStartBit_= 2;
00067   
00068   static const unsigned int sideMask_=     0x3;
00069   static const unsigned int diskMask_=     0xF;
00070   static const unsigned int bladeMask_=    0x3F;
00071   static const unsigned int panelMask_=    0x3;
00072   static const unsigned int moduleMask_=   0x3F;
00073 };
00074 
00075 #endif