CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/SiStripDetId/interface/TOBDetId.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiStripDetId_TOBDetId_H
00002 #define DataFormats_SiStripDetId_TOBDetId_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 TOBDetId;
00013 
00014 std::ostream& operator<<(std::ostream& os,const TOBDetId& id);
00015 
00016 class TOBDetId : public SiStripDetId {
00017  public:
00019   TOBDetId();
00021   TOBDetId(uint32_t rawid);
00023   TOBDetId(const DetId& id); 
00024   
00025   TOBDetId(uint32_t layer,
00026            uint32_t rod_fw_bw,
00027            uint32_t rod,
00028            uint32_t module,
00029            uint32_t ster) : SiStripDetId(DetId::Tracker,StripSubdetector::TOB){
00030     id_ |= (layer& layerMask_) << layerStartBit_ |
00031       (rod_fw_bw& rod_fw_bwMask_) << rod_fw_bwStartBit_ |
00032       (rod& rodMask_) << rodStartBit_ |
00033       (module& moduleMask_) << moduleStartBit_ |
00034       (ster& sterMask_) << sterStartBit_ ;
00035   }
00036   
00037   
00039   unsigned int layer() const{
00040     return int((id_>>layerStartBit_) & layerMask_);
00041   }
00042   
00044 
00049   std::vector<unsigned int> rod() const
00050     { std::vector<unsigned int> num;
00051       num.push_back( side() );
00052       num.push_back( rodNumber() );
00053       return num ;}
00054   
00055   unsigned int side() const
00056   { return ((id_>>rod_fw_bwStartBit_) & rod_fw_bwMask_);}
00058   unsigned int module() const 
00059     { return ((id_>>moduleStartBit_)& moduleMask_) ;}
00060   
00062   bool isDoubleSide() const;
00063   
00065   bool isZPlusSide() const
00066   { return (!isZMinusSide());}
00067   
00069   bool isZMinusSide() const
00070   { return (side() == 1);}
00071   
00073   unsigned int layerNumber() const
00074   { return layer();}
00075   
00077   unsigned int rodNumber() const
00078   { return ((id_>>rodStartBit_) & rodMask_);}
00079   
00081   unsigned int moduleNumber() const
00082   { return module();}
00083   
00085   bool isRPhi()
00086   { return (stereo() == 0 && !isDoubleSide());}
00087   
00089   bool isStereo()
00090   { return (stereo() != 0 && !isDoubleSide());}
00091   
00092 private:
00094   static const unsigned int layerStartBit_=     14;
00095   static const unsigned int rod_fw_bwStartBit_= 12;
00096   static const unsigned int rodStartBit_=       5;
00097   static const unsigned int moduleStartBit_=    2;
00098   static const unsigned int sterStartBit_=      0;
00100   
00101   static const unsigned int layerMask_=       0x7;
00102   static const unsigned int rod_fw_bwMask_=   0x3;
00103   static const unsigned int rodMask_=         0x7F;
00104   static const unsigned int moduleMask_=      0x7;
00105   static const unsigned int sterMask_=        0x3;
00106 };
00107 
00108 
00109 #endif