CMS 3D CMS Logo

TECDetId.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiStripDetId_TECDetId_H
00002 #define DataFormats_SiStripDetId_TECDetId_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 TECDetId;
00013 
00014 std::ostream& operator<<(std::ostream& s,const TECDetId& id);
00015 
00016 class TECDetId : public SiStripDetId {
00017  public:
00019   TECDetId();
00021   TECDetId(uint32_t rawid);
00023   TECDetId(const DetId& id); 
00024   
00025   TECDetId(uint32_t side,
00026            uint32_t wheel,
00027            uint32_t petal_fw_bw,
00028            uint32_t petal,
00029            uint32_t ring,
00030            uint32_t module,
00031            uint32_t ster) : SiStripDetId(DetId::Tracker,StripSubdetector::TEC){
00032     id_ |= (side& sideMask_)         << sideStartBit_ |
00033       (wheel& wheelMask_)             << wheelStartBit_ |
00034       (petal_fw_bw& petal_fw_bwMask_) << petal_fw_bwStartBit_ |
00035       (petal& petalMask_)             << petalStartBit_ |
00036       (ring& ringMask_)               << ringStartBit_ |
00037       (module& moduleMask_)                 << moduleStartBit_ |
00038       (ster& sterMask_)               << sterStartBit_ ;
00039   }
00040   
00041   
00043 
00047   unsigned int side() const{
00048     return int((id_>>sideStartBit_) & sideMask_);
00049   }
00050   
00052   unsigned int wheel() const
00053     { return ((id_>>wheelStartBit_) & wheelMask_) ;}
00054   
00056 
00061   std::vector<unsigned int> petal() const
00062     { std::vector<unsigned int> num;
00063     num.push_back(((id_>>petal_fw_bwStartBit_) & petal_fw_bwMask_));
00064     num.push_back(((id_>>petalStartBit_) & petalMask_));
00065     return num ;}
00066   
00068   unsigned int ring() const
00069     { return ((id_>>ringStartBit_) & ringMask_) ;}
00070   
00072   unsigned int module() const
00073     { return ((id_>>moduleStartBit_) & moduleMask_);}
00074   
00076   bool isDoubleSide() const;
00077   
00079   bool isZPlusSide() const
00080   { return (!isZMinusSide());}
00081   
00083   bool isZMinusSide() const
00084   { return (side()==1);}
00085   
00087   unsigned int wheelNumber() const
00088   { return wheel();}
00089   
00091   unsigned int petalNumber() const
00092   { return petal()[1];}
00093   
00095   unsigned int ringNumber() const
00096   { return ring();}
00097   
00099   unsigned int moduleNumber() const
00100   { return module();}
00101   
00103   bool isBackPetal() const
00104   { return (petal()[0]==1);}
00105   
00107   bool isFrontPetal() const
00108   { return (!isBackPetal());}
00109   
00111   bool isRPhi()
00112   { return (stereo() == 0 && !isDoubleSide());}
00113   
00115   bool isStereo()
00116   { return (stereo() != 0 && !isDoubleSide());}
00117   
00118 private:
00120   static const unsigned int sideStartBit_=           18;
00121   static const unsigned int wheelStartBit_=          14;  
00122   static const unsigned int petal_fw_bwStartBit_=    12;
00123   static const unsigned int petalStartBit_=          8;
00124   static const unsigned int ringStartBit_=           5;
00125   static const unsigned int moduleStartBit_=         2;
00126   static const unsigned int sterStartBit_=           0;
00128   static const unsigned int sideMask_=          0x3;
00129   static const unsigned int wheelMask_=         0xF;
00130   static const unsigned int petal_fw_bwMask_=   0x3;
00131   static const unsigned int petalMask_=         0xF;
00132   static const unsigned int ringMask_=          0x7;
00133   static const unsigned int moduleMask_=        0x7;
00134   static const unsigned int sterMask_=          0x3;
00135 };
00136 
00137 
00138 #endif

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