Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:46

0001 /** \file
0002  * Impl of DTLayerId
0003  *
0004  * \author Stefano ARGIRO
0005  * \date 02 Aug 2005
0006 */
0007 
0008 #include <iostream>
0009 #include <DataFormats/MuonDetId/interface/DTLayerId.h>
0010 #include <FWCore/Utilities/interface/Exception.h>
0011 
0012 DTLayerId::DTLayerId() : DTSuperLayerId() {}
0013 
0014 DTLayerId::DTLayerId(uint32_t id) {
0015   // Mask the bits outside DTLayerId fields (notably, the wire number)
0016   id_ = id & layerIdMask_;
0017   // Check this is a valid id for muon DTs.
0018   checkMuonId();
0019 }
0020 
0021 // Copy Constructor.
0022 DTLayerId::DTLayerId(const DTLayerId& layerId) : DTSuperLayerId() {
0023   // The mask is required for proper slicing, i.e. if layerId is
0024   // actually a derived class.
0025   id_ = (layerId.rawId() & layerIdMask_);
0026 }
0027 
0028 // Constructor from a camberId and SL and layer numbers
0029 DTLayerId::DTLayerId(const DTChamberId& chId, int superlayer, int layer) : DTSuperLayerId(chId, superlayer) {
0030   if (layer < minLayerId || layer > maxLayerId) {
0031     throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
0032                                          << " Invalid parameters: "
0033                                          << " La:" << layer << std::endl;
0034   }
0035   id_ |= (layer & lMask_) << layerStartBit_;
0036 }
0037 
0038 // Constructor from a SuperLayerId and layer number
0039 DTLayerId::DTLayerId(const DTSuperLayerId& slId, int layer) : DTSuperLayerId(slId) {
0040   if (layer < minLayerId || layer > maxLayerId) {
0041     throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
0042                                          << " Invalid parameters: "
0043                                          << " La:" << layer << std::endl;
0044   }
0045   id_ |= (layer & lMask_) << layerStartBit_;
0046 }
0047 
0048 DTLayerId::DTLayerId(int wheel, int station, int sector, int superlayer, int layer)
0049     : DTSuperLayerId(wheel, station, sector, superlayer) {
0050   if (layer < minLayerId || layer > maxLayerId) {
0051     throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
0052                                          << " Invalid parameters: "
0053                                          << " Wh:" << wheel << " St:" << station << " Se:" << sector
0054                                          << " Sl:" << superlayer << " La:" << layer << std::endl;
0055   }
0056 
0057   id_ |= (layer & lMask_) << layerStartBit_;
0058 }
0059 
0060 std::ostream& operator<<(std::ostream& os, const DTLayerId& id) {
0061   os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " Sl:" << id.superlayer()
0062      << " La:" << id.layer() << " ";
0063 
0064   return os;
0065 }