CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DataFormats/MuonDetId/src/DTLayerId.cc

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