Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:50:42

0001 #ifndef MuonDetId_DTChamberId_H
0002 #define MuonDetId_DTChamberId_H
0003 
0004 /** \class DTChamberId
0005  *  DetUnit identifier for DT chambers.
0006  *  
0007  *  \author Stefano ARGIRO & G. Cerminara
0008  */
0009 
0010 #include <DataFormats/DetId/interface/DetId.h>
0011 
0012 #include <iosfwd>
0013 
0014 class DTChamberId : public DetId {
0015 public:
0016   /// Default constructor.
0017   /// Fills the common part in the base and leaves 0 in all other fields
0018   DTChamberId();
0019 
0020   /// Construct from a packed id.
0021   /// It is required that the packed id represents a valid DT DetId
0022   /// (proper Detector and  SubDet fields), otherwise an exception is thrown.
0023   /// Any bits outside the DTChamberId fields are zeroed; apart for
0024   /// this, no check is done on the vaildity of the values.
0025   DTChamberId(uint32_t id);
0026   DTChamberId(DetId id);
0027 
0028   /// Construct from indexes.
0029   /// Input values are required to be within legal ranges, otherwise an
0030   /// exception is thrown.
0031   DTChamberId(int wheel, int station, int sector);
0032 
0033   /// Copy Constructor.
0034   /// Any bits outside the DTChamberId fields are zeroed; apart for
0035   /// this, no check is done on the vaildity of the values.
0036   DTChamberId(const DTChamberId& chId);
0037 
0038   /// Return the wheel number
0039   int wheel() const { return int((id_ >> wheelStartBit_) & wheelMask_) + minWheelId - 1; }
0040 
0041   /// Return the station number
0042   int station() const { return ((id_ >> stationStartBit_) & stationMask_); }
0043 
0044   /// Return the sector number. Sectors are numbered from 1 to 12,
0045   /// starting at phi=0 and increasing with phi.
0046   /// In station 4, where the top and bottom setcors are made of two chambers,
0047   /// two additional sector numbers are used, 13 (after sector 4, top)
0048   /// and 14 (after sector 10, bottom).
0049   int sector() const { return ((id_ >> sectorStartBit_) & sectorMask_); }
0050 
0051   /// lowest station id
0052   static const int minStationId = 1;
0053   /// highest station id
0054   static const int maxStationId = 4;
0055   /// lowest sector id. 0 indicates all sectors (a station)
0056   static const int minSectorId = 0;
0057   /// highest sector id.
0058   static const int maxSectorId = 14;
0059   /// lowest wheel number
0060   static const int minWheelId = -2;
0061   /// highest wheel number
0062   static const int maxWheelId = 2;
0063   /// loweset super layer id. 0 indicates a full chamber
0064   static const int minSuperLayerId = 0;
0065   /// highest superlayer id
0066   static const int maxSuperLayerId = 3;
0067   /// lowest layer id. 0 indicates a full SL
0068   static const int minLayerId = 0;
0069   /// highest layer id
0070   static const int maxLayerId = 4;
0071   /// lowest wire id (numbering starts from 1 or 2). 0 indicates a full layer
0072   static const int minWireId = 0;
0073   /// highest wire id (chambers have 48 to 96 wires)
0074   static const int maxWireId = 97;
0075 
0076 protected:
0077   /// two bits would be enough, but  we could use the number "0" as a wildcard
0078   static const int wireNumBits_ = 7;
0079   static const int wireStartBit_ = 3;
0080   static const int layerNumBits_ = 3;
0081   static const int layerStartBit_ = wireStartBit_ + wireNumBits_;
0082   static const int slayerNumBits_ = 2;
0083   static const int slayerStartBit_ = layerStartBit_ + layerNumBits_;
0084   static const int wheelNumBits_ = 3;
0085   static const int wheelStartBit_ = slayerStartBit_ + slayerNumBits_;
0086   static const int sectorNumBits_ = 4;
0087   static const int sectorStartBit_ = wheelStartBit_ + wheelNumBits_;
0088   /// two bits would be enough, but  we could use the number "0" as a wildcard
0089   static const int stationNumBits_ = 3;
0090   static const int stationStartBit_ = sectorStartBit_ + sectorNumBits_;
0091 
0092   static const uint32_t wheelMask_ = 0x7;
0093   static const uint32_t stationMask_ = 0x7;
0094   static const uint32_t sectorMask_ = 0xf;
0095   static const uint32_t slMask_ = 0x3;
0096   static const uint32_t lMask_ = 0x7;
0097   static const uint32_t wireMask_ = 0x7f;
0098 
0099   static const uint32_t layerIdMask_ = ~(wireMask_ << wireStartBit_);
0100   static const uint32_t slIdMask_ = ~((wireMask_ << wireStartBit_) | (lMask_ << layerStartBit_));
0101   static const uint32_t chamberIdMask_ =
0102       ~((wireMask_ << wireStartBit_) | (lMask_ << layerStartBit_) | (slMask_ << slayerStartBit_));
0103 
0104   // Perform a consistency check of the id with a DT Id
0105   // It thorows an exception if this is not the case
0106   void checkMuonId();
0107 };
0108 
0109 std::ostream& operator<<(std::ostream& os, const DTChamberId& id);
0110 
0111 #endif