CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DataFormats/SiPixelDetId/interface/PXBDetId.h

Go to the documentation of this file.
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   
00034   unsigned int layer() const{
00035     return int((id_>>layerStartBit_) & layerMask_);}
00036   
00038   unsigned int ladder() const
00039     { return ((id_>>ladderStartBit_) & ladderMask_) ;}
00040   
00042   unsigned int module() const 
00043     { return ((id_>>moduleStartBit_)& moduleMask_) ;}
00044 
00045  private:
00047   static const unsigned int layerStartBit_=   20;
00048   static const unsigned int ladderStartBit_=  12;
00049   static const unsigned int moduleStartBit_=   2;
00050   static const unsigned int typeStartBit_ =    0;
00051   
00053   static const unsigned int layerMask_=       0xF;
00054   static const unsigned int ladderMask_=      0xFF;
00055   static const unsigned int moduleMask_=      0x3FF;
00056   static const unsigned int typeMask_=        0x3;
00057 
00058 };
00059 
00060 
00061 #endif