CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/SiStripDetId/interface/TIDDetId.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiStripDetId_TIDDetId_H
00002 #define DataFormats_SiStripDetId_TIDDetId_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 TIDDetId;
00013 
00014 std::ostream& operator<<(std::ostream& os,const TIDDetId& id);
00015 
00016 class TIDDetId : public SiStripDetId {
00017  public:
00019   TIDDetId();
00021   TIDDetId(uint32_t rawid);
00023   TIDDetId(const DetId& id); 
00024   
00025   TIDDetId(uint32_t side,
00026            uint32_t wheel,
00027            uint32_t ring,
00028            uint32_t module_fw_bw,
00029            uint32_t module,
00030            uint32_t ster) : SiStripDetId(DetId::Tracker,StripSubdetector::TID){
00031     id_ |= (side& sideMask_)      << sideStartBit_    |
00032       (wheel& wheelMask_)          << wheelStartBit_      |
00033       (ring& ringMask_)            << ringStartBit_       |
00034       (module_fw_bw& module_fw_bwMask_)  << module_fw_bwStartBit_  |
00035       (module& moduleMask_)              << moduleStartBit_        |
00036       (ster& sterMask_)            << sterStartBit_ ;
00037   }
00038   
00039   
00041 
00045   unsigned int side() const{
00046     return int((id_>>sideStartBit_) & sideMask_);
00047   }
00048   
00050   unsigned int wheel() const{
00051     return int((id_>>wheelStartBit_) & wheelMask_);
00052   }
00053   
00055   unsigned int ring() const
00056     { return ((id_>>ringStartBit_) & ringMask_) ;}
00057   
00059 
00064   std::vector<unsigned int> module() const
00065     { std::vector<unsigned int> num;
00066       num.push_back( order() );
00067       num.push_back( moduleNumber() );
00068       return num ;}
00069   
00070   unsigned int order() const 
00071   { return ((id_>>module_fw_bwStartBit_) & module_fw_bwMask_);}
00072 
00074   bool isDoubleSide() const;
00075   
00077   bool isZPlusSide() const
00078   { return (!isZMinusSide());}
00079   
00081   bool isZMinusSide() const
00082   { return (side()==1);}
00083   
00085   bool isBackRing() const
00086   { return (order()==1);}
00087   
00089   bool isFrontRing() const
00090   { return (!isBackRing());}
00091   
00093   unsigned int diskNumber() const
00094   { return wheel();}
00095   
00097   unsigned int ringNumber() const
00098   { return ring();}
00099   
00101   unsigned int moduleNumber() const
00102   { return ((id_>>moduleStartBit_) & moduleMask_);}
00103   
00105   bool isRPhi()
00106   { return (stereo() == 0 && !isDoubleSide());}
00107   
00109   bool isStereo()
00110   { return (stereo() != 0 && !isDoubleSide());}
00111   
00112 private:
00114   static const unsigned int sideStartBit_=          13;
00115   static const unsigned int wheelStartBit_=         11;
00116   static const unsigned int ringStartBit_=          9;
00117   static const unsigned int module_fw_bwStartBit_=  7;
00118   static const unsigned int moduleStartBit_=        2;
00119   static const unsigned int sterStartBit_=          0;
00121   static const unsigned int sideMask_=           0x3;
00122   static const unsigned int wheelMask_=          0x3;
00123   static const unsigned int ringMask_=           0x3;
00124   static const unsigned int module_fw_bwMask_=   0x3;
00125   static const unsigned int moduleMask_=         0x1F;
00126   static const unsigned int sterMask_=           0x3;
00127 };
00128 
00129 
00130 #endif
00131 
00132