CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/MuonDetId/interface/DTChamberId.h

Go to the documentation of this file.
00001 #ifndef MuonDetId_DTChamberId_H
00002 #define MuonDetId_DTChamberId_H
00003 
00012 #include <DataFormats/DetId/interface/DetId.h>
00013 
00014 #include <iosfwd>
00015 
00016 class DTChamberId : public DetId {
00017 public:
00020   DTChamberId();
00021   
00022 
00028   DTChamberId(uint32_t id);
00029   DTChamberId(DetId id);
00030 
00031 
00035   DTChamberId(int wheel, 
00036               int station, 
00037               int sector);
00038 
00039 
00043   DTChamberId(const DTChamberId& chId);
00044 
00045 
00047   int wheel() const {
00048     return int((id_>>wheelStartBit_) & wheelMask_)+ minWheelId -1;
00049   }
00050 
00051 
00053   int station() const {
00054     return ((id_>>stationStartBit_) & stationMask_);
00055   }
00056 
00057 
00063   int sector() const {
00064     return ((id_>>sectorStartBit_)& sectorMask_);
00065   }
00066 
00067 
00069   static const int minStationId=    1;
00071   static const int maxStationId=    4;
00073   static const int minSectorId=     0;
00075   static const int maxSectorId=    14;
00077   static const int minWheelId=     -2;
00079   static const int maxWheelId=      2;
00081   static const int minSuperLayerId= 0;
00083   static const int maxSuperLayerId= 3;
00085   static const int minLayerId=      0;
00087   static const int maxLayerId=      4;
00089   static const int minWireId=       0;
00091   static const int maxWireId=      97;
00092  
00093 
00094  protected:
00096   static const int wireNumBits_=   7;  
00097   static const int wireStartBit_=  3;
00098   static const int layerNumBits_=   3;
00099   static const int layerStartBit_=  wireStartBit_ + wireNumBits_;
00100   static const int slayerNumBits_=  2;
00101   static const int slayerStartBit_= layerStartBit_+ layerNumBits_;
00102   static const int wheelNumBits_  = 3;
00103   static const int wheelStartBit_=  slayerStartBit_ + slayerNumBits_;
00104   static const int sectorNumBits_=  4;
00105   static const int sectorStartBit_= wheelStartBit_ + wheelNumBits_;
00107   static const int stationNumBits_= 3;
00108   static const int stationStartBit_ = sectorStartBit_ + sectorNumBits_;
00109 
00110 
00111   static const uint32_t wheelMask_=    0x7;
00112   static const uint32_t stationMask_=  0x7;
00113   static const uint32_t sectorMask_=   0xf;
00114   static const uint32_t slMask_=       0x3;
00115   static const uint32_t lMask_=        0x7;
00116   static const uint32_t wireMask_=    0x7f;
00117 
00118   static const uint32_t layerIdMask_= ~(wireMask_<<wireStartBit_);
00119   static const uint32_t slIdMask_ = ~((wireMask_<<wireStartBit_) |
00120                                       (lMask_<<layerStartBit_));
00121   static const uint32_t chamberIdMask_ = ~((wireMask_<<wireStartBit_) |
00122                                            (lMask_<<layerStartBit_) |
00123                                            (slMask_<<slayerStartBit_));
00124 
00125   // Perform a consistency check of the id with a DT Id
00126   // It thorows an exception if this is not the case
00127   void checkMuonId();
00128   
00129 };
00130 
00131 
00132 std::ostream& operator<<( std::ostream& os, const DTChamberId& id );
00133 
00134 #endif
00135