CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/SiStripDetId/interface/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(order());
00064       num.push_back(petalNumber());
00065       return num ;}
00066   
00067   unsigned int order() const
00068   { return ((id_>>petal_fw_bwStartBit_) & petal_fw_bwMask_);}
00069 
00071   unsigned int ring() const
00072     { return ((id_>>ringStartBit_) & ringMask_) ;}
00073   
00075   unsigned int module() const
00076     { return ((id_>>moduleStartBit_) & moduleMask_);}
00077   
00079   bool isDoubleSide() const;
00080   
00082   bool isZPlusSide() const
00083   { return (!isZMinusSide());}
00084   
00086   bool isZMinusSide() const
00087   { return (side()==1);}
00088   
00090   unsigned int wheelNumber() const
00091   { return wheel();}
00092   
00094   unsigned int petalNumber() const
00095   { return ((id_>>petalStartBit_) & petalMask_);}
00096   
00098   unsigned int ringNumber() const
00099   { return ring();}
00100   
00102   unsigned int moduleNumber() const
00103   { return module();}
00104   
00106   bool isBackPetal() const
00107   { return (order()==1);}
00108   
00110   bool isFrontPetal() const
00111   { return (!isBackPetal());}
00112   
00114   bool isRPhi()
00115   { return (stereo() == 0 && !isDoubleSide());}
00116   
00118   bool isStereo()
00119   { return (stereo() != 0 && !isDoubleSide());}
00120   
00121 private:
00123   static const unsigned int sideStartBit_=           18;
00124   static const unsigned int wheelStartBit_=          14;  
00125   static const unsigned int petal_fw_bwStartBit_=    12;
00126   static const unsigned int petalStartBit_=          8;
00127   static const unsigned int ringStartBit_=           5;
00128   static const unsigned int moduleStartBit_=         2;
00129   static const unsigned int sterStartBit_=           0;
00131   static const unsigned int sideMask_=          0x3;
00132   static const unsigned int wheelMask_=         0xF;
00133   static const unsigned int petal_fw_bwMask_=   0x3;
00134   static const unsigned int petalMask_=         0xF;
00135   static const unsigned int ringMask_=          0x7;
00136   static const unsigned int moduleMask_=        0x7;
00137   static const unsigned int sterMask_=          0x3;
00138 };
00139 
00140 
00141 #endif