CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DataFormats/SiStripDetId/interface/TIBDetId.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiStripDetId_TIBDetId_H
00002 #define DataFormats_SiStripDetId_TIBDetId_H
00003 
00004 #include <ostream>
00005 #include <vector>
00006 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
00007 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00008 
00012 class TIBDetId;
00013 
00014 std::ostream& operator<<(std::ostream& os,const TIBDetId& id);
00015 
00016 class TIBDetId : public SiStripDetId {
00017  public:
00019   TIBDetId();
00021   TIBDetId(uint32_t rawid);
00023   TIBDetId(const DetId& id); 
00024   
00025   TIBDetId(uint32_t layer,
00026            uint32_t str_fw_bw,
00027            uint32_t str_int_ext,
00028            uint32_t str,
00029            uint32_t module,
00030            uint32_t ster) : SiStripDetId(DetId::Tracker,StripSubdetector::TIB){
00031     id_ |= (layer& layerMask_) << layerStartBit_ |
00032       (str_fw_bw& str_fw_bwMask_) << str_fw_bwStartBit_ |
00033       (str_int_ext& str_int_extMask_) << str_int_extStartBit_ |
00034       (str& strMask_) << strStartBit_ |
00035       (module& moduleMask_) << moduleStartBit_ |
00036       (ster& sterMask_) << sterStartBit_ ;
00037   }
00038   
00039   
00041   unsigned int layer() const{
00042     return int((id_>>layerStartBit_) & layerMask_);
00043   }
00044   
00046 
00053   std::vector<unsigned int> string() const
00054     { std::vector<unsigned int> num;
00055       num.push_back( side() );
00056       num.push_back( order() );
00057       num.push_back(stringNumber());
00058       return num ;}
00059   
00061   unsigned int module() const 
00062     { return ((id_>>moduleStartBit_)& moduleMask_) ;}
00063   
00064   unsigned int order()const
00065   { return ((id_>>str_int_extStartBit_) & str_int_extMask_);}
00066 
00067   unsigned int side() const
00068   {return ((id_>>str_fw_bwStartBit_) & str_fw_bwMask_);}
00069 
00070 
00072   bool isDoubleSide() const;
00073   
00075   bool isZPlusSide() const
00076   { return (!isZMinusSide());}
00077   
00079   bool isZMinusSide() const
00080   { return (side() == 1);}
00081   
00083   unsigned int layerNumber() const
00084   { return layer();}
00085   
00087   unsigned int stringNumber() const
00088   { return ((id_>>strStartBit_) & strMask_);}
00089   
00091   unsigned int moduleNumber() const
00092   { return module();}
00093   
00095   bool isInternalString() const
00096   { return (order() == 1);}
00097   
00099   bool isExternalString() const
00100   { return (!isInternalString());}
00101   
00103   bool isRPhi()
00104   { return (stereo() == 0 && !isDoubleSide());}
00105   
00107   bool isStereo()
00108   { return (stereo() != 0 && !isDoubleSide());}
00109   
00110   
00111 private:
00113   static const unsigned int layerStartBit_=           14;
00114   static const unsigned int str_fw_bwStartBit_=       12;
00115   static const unsigned int str_int_extStartBit_=     10;
00116   static const unsigned int strStartBit_=             4;
00117   static const unsigned int moduleStartBit_=          2;
00118   static const unsigned int sterStartBit_=            0;
00120   
00121   static const unsigned int layerMask_=       0x7;
00122   static const unsigned int str_fw_bwMask_=   0x3;
00123   static const unsigned int str_int_extMask_= 0x3;
00124   static const unsigned int strMask_=         0x3F;
00125   static const unsigned int moduleMask_=      0x3;
00126   static const unsigned int sterMask_=        0x3;
00127 };
00128 
00129 
00130 #endif