CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DataFormats/SiStripDetId/interface/StripSubdetector.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiStripDetId_StripSubdetector_H
00002 #define DataFormats_SiStripDetId_StripSubdetector_H
00003 
00010 #include "DataFormats/DetId/interface/DetId.h"
00011 
00012 class StripSubdetector :public DetId { 
00013  public:
00014  enum SubDetector { TIB=3,TID=4,TOB=5,TEC=6 };
00015  
00017  StripSubdetector(uint32_t rawid) : DetId(rawid) {}
00019  StripSubdetector(const DetId& id) : DetId(id) {}
00020  
00021  
00023 
00027  unsigned int glued() const
00028    {
00029      if(((id_>>sterStartBit_)& sterMask_) == 1){
00030        return (id_ -1);
00031      }else if(((id_>>sterStartBit_)& sterMask_) == 2){
00032        return (id_ -2);
00033      }else{
00034        return 0;
00035      }
00036    }
00037  
00039 
00043  unsigned int stereo() const 
00044    {
00045      if(((id_>>sterStartBit_)& sterMask_)==1){
00046        return ((id_>>sterStartBit_)& sterMask_);
00047      }else{
00048        return 0;
00049      }
00050    }
00051  
00057  unsigned int partnerDetId() const
00058    {
00059      if(((id_>>sterStartBit_)& sterMask_)==1){
00060        return (id_ + 1);
00061      }else if(((id_>>sterStartBit_)& sterMask_)==2){
00062        return (id_ - 1);
00063      }else{
00064        return 0;
00065      }
00066    }
00067  
00068  private:
00069  static const unsigned int detStartBit_=       2;
00070  static const unsigned int sterStartBit_=      0;
00071  
00072  static const unsigned int detMask_=           0x3;
00073  static const unsigned int sterMask_=          0x3;
00074  
00075  
00076 };
00077 
00078 
00079 #endif