CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DataFormats/SiPixelDetId/interface/StackedTrackerDetId.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef STACKED_TRACKER_ID_H
00019 #define STACKED_TRACKER_ID_H
00020 
00021 #include <ostream>
00022 #include "DataFormats/DetId/interface/DetId.h"
00023 
00024 #include<iostream>
00025 
00028 
00029 class StackedTrackerDetId : public DetId {
00030  private:
00031   static const unsigned int StackedTracker = 7;
00032 
00033  public:
00036   StackedTrackerDetId();
00038   StackedTrackerDetId(uint32_t rawid);
00040   StackedTrackerDetId(const DetId& id); 
00041 
00044   StackedTrackerDetId(uint32_t layer, uint32_t rod, uint32_t module);
00046   StackedTrackerDetId(uint32_t side, uint32_t disk, uint32_t ring, uint32_t module);
00047 
00048 
00050 
00053   unsigned int subdet() const
00054   { return ((id_ >> iSubDetStartBit_) & iSubDetMask_); }
00055 
00057   bool isBarrel() const {
00058     unsigned int layoutType = ((id_ >> iSwitchStartBit_) & iSwitchMask_);
00059     return (layoutType == 1);
00060   }
00061   bool isEndcap() const {
00062     unsigned int layoutType = ((id_ >> iSwitchStartBit_) & iSwitchMask_);
00063     return (layoutType == 2);
00064   }
00065 
00067   unsigned int iLayer() const {
00068     if (this->isBarrel())
00069       return ((id_ >> iLayerStartBit_B_) & iLayerMask_B_);
00070     else
00071       return 999999;
00072   }
00073 
00075   unsigned int layer() const {
00076     std::cerr << "W A R N I N G! StackedTrackerDetId::layer()" << std::endl;
00077     std::cerr << "               This method is OBSOLETE, please change it!" << std::endl;
00078     return this->iLayer();
00079   }
00080 
00082   unsigned int iPhi() const {
00083     if (this->isBarrel())
00084       return ((id_ >> iPhiStartBit_B_) & iPhiMask_B_);
00085     else if (this->isEndcap())
00086       return ((id_ >> iPhiStartBit_E_) & iPhiMask_E_);
00087     else
00088       return 999999;
00089   }
00090 
00092   unsigned int iZ() const {
00093     if (this->isBarrel())
00094       return ((id_ >> iZStartBit_B_) & iZMask_B_);
00095     else if (this->isEndcap())
00096       return ((id_ >> iZStartBit_E_) & iZMask_E_);
00097     else
00098       return 999999;
00099   }
00100 
00102   unsigned int iDisk() const {
00103     if (this->isEndcap())
00104       return ((id_ >> iZStartBit_E_) & iZMask_E_);
00105     else
00106       return 999999;
00107   }
00108 
00110   unsigned int iRing() const {
00111     if (this->isEndcap())
00112       return ((id_ >> iRingStartBit_E_) & iRingMask_E_);
00113     else
00114       return 999999;
00115   }
00116 
00118   unsigned int iSide() const {
00119     if (this->isEndcap())
00120       return ((id_ >> iSideStartBit_E_) & iSideMask_E_);
00121     else
00122       return 999999;
00123   }
00124 
00125  private:
00126 
00127   // SUBDET AND SWITCH BARREL/ENDCAP
00128   static const unsigned int iSubDetStartBit_  = 25;
00129   static const unsigned int iSubDetMask_      = 0x7; // 0-7
00130 
00131   static const unsigned int iSwitchStartBit_  = 23;
00132   static const unsigned int iSwitchMask_      = 0x3; // 0-3
00133 
00134   // BARREL SCHEME
00135   // 0001111BB___LLLLPPPPPPPPZZZZZZZZ
00136   // F   7  3 ___F   FF      FF
00137   //     25 23   15  7       0
00138   
00139   static const unsigned int iZStartBit_B_     = 0;
00140   static const unsigned int iPhiStartBit_B_   = 8;
00141   static const unsigned int iLayerStartBit_B_ = 16;
00142 
00143   static const unsigned int iZMask_B_         = 0xFF; // 0-127
00144   static const unsigned int iPhiMask_B_       = 0xFF; // 0-255
00145   static const unsigned int iLayerMask_B_     = 0xF;  // 0-15
00146 
00147   // ENDCAP SCHEME
00148   // 0001111BBSS_____ZZZZRRRRRPPPPPPP
00149   // F   7  3 3 _____F   1F   7F
00150   //    25 23 21     12  7    0
00151 
00152   static const unsigned int iPhiStartBit_E_   = 0;
00153   static const unsigned int iRingStartBit_E_  = 7;
00154   static const unsigned int iZStartBit_E_     = 12;
00155   static const unsigned int iSideStartBit_E_  = 21;
00156 
00157   static const unsigned int iPhiMask_E_       = 0x7F; // 0-127
00158   static const unsigned int iRingMask_E_      = 0x1F; // 0-31
00159   static const unsigned int iZMask_E_         = 0xF;  // 0-15
00160   static const unsigned int iSideMask_E_      = 0x3;  // 0-3
00161 
00162 };
00163 
00164 
00165 std::ostream& operator<<(std::ostream& os,const StackedTrackerDetId& id);
00166 
00167 #endif
00168