CMS 3D CMS Logo

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(((id_>>str_fw_bwStartBit_) & str_fw_bwMask_));
00056     num.push_back(((id_>>str_int_extStartBit_) & str_int_extMask_));
00057     num.push_back(((id_>>strStartBit_) & strMask_));
00058     return num ;}
00059   
00061   unsigned int module() const 
00062     { return ((id_>>moduleStartBit_)& moduleMask_) ;}
00063   
00065   bool isDoubleSide() const;
00066   
00068   bool isZPlusSide() const
00069   { return (!isZMinusSide());}
00070   
00072   bool isZMinusSide() const
00073   { return (string()[0] == 1);}
00074   
00076   unsigned int layerNumber() const
00077   { return layer();}
00078   
00080   unsigned int stringNumber() const
00081   { return string()[2];}
00082   
00084   unsigned int moduleNumber() const
00085   { return module();}
00086   
00088   bool isInternalString() const
00089   { return (string()[1] == 1);}
00090   
00092   bool isExternalString() const
00093   { return (!isInternalString());}
00094   
00096   bool isRPhi()
00097   { return (stereo() == 0 && !isDoubleSide());}
00098   
00100   bool isStereo()
00101   { return (stereo() != 0 && !isDoubleSide());}
00102   
00103   
00104 private:
00106   static const unsigned int layerStartBit_=           14;
00107   static const unsigned int str_fw_bwStartBit_=       12;
00108   static const unsigned int str_int_extStartBit_=     10;
00109   static const unsigned int strStartBit_=             4;
00110   static const unsigned int moduleStartBit_=          2;
00111   static const unsigned int sterStartBit_=            0;
00113   
00114   static const unsigned int layerMask_=       0x7;
00115   static const unsigned int str_fw_bwMask_=   0x3;
00116   static const unsigned int str_int_extMask_= 0x3;
00117   static const unsigned int strMask_=         0x3F;
00118   static const unsigned int moduleMask_=      0x3;
00119   static const unsigned int sterMask_=        0x3;
00120 };
00121 
00122 
00123 #endif

Generated on Tue Jun 9 17:31:45 2009 for CMSSW by  doxygen 1.5.4