Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:09

0001 /** \file
0002  *  See header file for a description of this class.
0003  *
0004  *  \author G. Cerminara - INFN Torino
0005  */
0006 
0007 #include <iostream>
0008 #include <DataFormats/MuonDetId/interface/DTSuperLayerId.h>
0009 #include <FWCore/Utilities/interface/Exception.h>
0010 
0011 DTSuperLayerId::DTSuperLayerId() : DTChamberId() {}
0012 
0013 DTSuperLayerId::DTSuperLayerId(uint32_t id) {
0014   id_ = id & slIdMask_;  // Mask the bits outside DTSuperLayerId fields
0015   checkMuonId();         // Check this is a valid id for muon DTs.
0016 }
0017 
0018 DTSuperLayerId::DTSuperLayerId(int wheel, int station, int sector, int superlayer)
0019     : DTChamberId(wheel, station, sector) {
0020   if (superlayer < minSuperLayerId || superlayer > maxSuperLayerId) {
0021     throw cms::Exception("InvalidDetId") << "DTSuperLayerId ctor:"
0022                                          << " Invalid parameters: "
0023                                          << " Wh:" << wheel << " St:" << station << " Se:" << sector
0024                                          << " Sl:" << superlayer << std::endl;
0025   }
0026   id_ |= (superlayer & slMask_) << slayerStartBit_;
0027 }
0028 
0029 // Copy Constructor.
0030 DTSuperLayerId::DTSuperLayerId(const DTSuperLayerId& slId) : DTChamberId() {
0031   // The mask is required for proper slicing, i.e. if slId is
0032   // actually a derived class.
0033   id_ = (slId.rawId() & slIdMask_);
0034 }
0035 
0036 // Constructor from a camberId and SL number
0037 DTSuperLayerId::DTSuperLayerId(const DTChamberId& chId, int superlayer) : DTChamberId(chId) {
0038   if (superlayer < minSuperLayerId || superlayer > maxSuperLayerId) {
0039     throw cms::Exception("InvalidDetId") << "DTSuperLayerId ctor:"
0040                                          << " Invalid parameter: "
0041                                          << " Sl:" << superlayer << std::endl;
0042   }
0043   id_ |= (superlayer & slMask_) << slayerStartBit_;
0044 }
0045 
0046 std::ostream& operator<<(std::ostream& os, const DTSuperLayerId& id) {
0047   os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " Sl:" << id.superlayer() << " ";
0048 
0049   return os;
0050 }