CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DataFormats/MuonDetId/src/DTSuperLayerId.cc

Go to the documentation of this file.
00001 
00009 #include <iostream>
00010 #include <DataFormats/MuonDetId/interface/DTSuperLayerId.h>
00011 #include <FWCore/Utilities/interface/Exception.h>
00012 
00013 
00014 
00015 DTSuperLayerId::DTSuperLayerId() : DTChamberId() {}
00016 
00017 
00018 
00019 DTSuperLayerId::DTSuperLayerId(uint32_t id) {
00020   id_ = id & slIdMask_; // Mask the bits outside DTSuperLayerId fields
00021   checkMuonId();        // Check this is a valid id for muon DTs.
00022 }
00023 
00024 
00025 DTSuperLayerId::DTSuperLayerId(int wheel,
00026                int station,
00027                int sector,
00028                int superlayer) : DTChamberId(wheel, station, sector) {
00029                  if(superlayer < minSuperLayerId || superlayer > maxSuperLayerId) {
00030                    throw cms::Exception("InvalidDetId") << "DTSuperLayerId ctor:" 
00031                                                         << " Invalid parameters: " 
00032                                                         << " Wh:"<< wheel
00033                                                         << " St:"<< station
00034                                                         << " Se:"<< sector
00035                                                         << " Sl:"<< superlayer
00036                                                         << std::endl;
00037                  }
00038                  id_ |= (superlayer & slMask_) << slayerStartBit_;
00039                }
00040 
00041 
00042 
00043 // Copy Constructor.
00044 DTSuperLayerId::DTSuperLayerId(const DTSuperLayerId& slId) {
00045   // The mask is required for proper slicing, i.e. if slId is
00046   // actually a derived class.
00047   id_ = (slId.rawId() &  slIdMask_);                                             
00048 }
00049 
00050 
00051 
00052 // Constructor from a camberId and SL number
00053 DTSuperLayerId::DTSuperLayerId(const DTChamberId& chId, int superlayer) : DTChamberId(chId) {
00054   if(superlayer < minSuperLayerId || superlayer > maxSuperLayerId) {
00055     throw cms::Exception("InvalidDetId") << "DTSuperLayerId ctor:" 
00056                                          << " Invalid parameter: " 
00057                                          << " Sl:"<< superlayer
00058                                          << std::endl;
00059   }
00060   id_ |= (superlayer & slMask_) << slayerStartBit_;
00061 }
00062 
00063 
00064 
00065 
00066 
00067 
00068 std::ostream& operator<<( std::ostream& os, const DTSuperLayerId& id ){
00069   os << " Wh:"<< id.wheel()
00070      << " St:"<< id.station() 
00071      << " Se:"<< id.sector()
00072      << " Sl:"<< id.superlayer()
00073      <<" ";
00074 
00075   return os;
00076 }
00077