CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DataFormats/MuonDetId/src/DTWireId.cc

Go to the documentation of this file.
00001 
00010 #include <iostream>
00011 #include <DataFormats/MuonDetId/interface/DTWireId.h>
00012 #include <FWCore/Utilities/interface/Exception.h>
00013 
00014 
00015 
00016 DTWireId::DTWireId() : DTLayerId() {}
00017 
00018 
00019 
00020 DTWireId::DTWireId(uint32_t id) {
00021   id_= id;
00022   checkMuonId(); // Check this is a valid id for muon DTs.
00023 }
00024 
00025 
00026 
00027 DTWireId::DTWireId(int wheel,
00028                    int station,
00029                    int sector,
00030                    int superlayer,
00031                    int layer,
00032                    int wire) : DTLayerId(wheel, station, sector, superlayer, layer) {
00033                      if (wire < minWireId || wire > maxWireId) {
00034                        throw cms::Exception("InvalidDetId") << "DTWireId ctor:" 
00035                                                             << " Invalid parameters: " 
00036                                                             << " Wh:"<< wheel
00037                                                             << " St:"<< station
00038                                                             << " Se:"<< sector
00039                                                             << " Sl:"<< superlayer
00040                                                             << " La:"<< layer
00041                                                             << " Wi:"<< wire
00042                                                             << std::endl;
00043                      }
00044       
00045                      id_ |= (wire & wireMask_) << wireStartBit_;
00046                    }
00047 
00048 
00049 
00050 // Copy Constructor.
00051 DTWireId::DTWireId(const DTWireId& wireId) {
00052   id_ = wireId.rawId();
00053 }
00054 
00055 
00056 
00057 // Constructor from a CamberId and SL, layer and wire numbers
00058 DTWireId::DTWireId(const DTChamberId& chId, int superlayer, int layer, int wire) :
00059   DTLayerId(chId, superlayer, layer) {
00060     if (wire < minWireId || wire > maxWireId) {
00061       throw cms::Exception("InvalidDetId") << "DTWireId ctor:" 
00062                                            << " Invalid parameters: " 
00063                                            << " Wi:"<< wire
00064                                            << std::endl;
00065     }
00066       
00067     id_ |= (wire & wireMask_) << wireStartBit_;
00068   }
00069 
00070 
00071 
00072 // Constructor from a SuperLayerId and layer and wire numbers
00073 DTWireId::DTWireId(const DTSuperLayerId& slId, int layer, int wire) :
00074   DTLayerId(slId, layer) {
00075     if (wire < minWireId || wire > maxWireId) {
00076       throw cms::Exception("InvalidDetId") << "DTWireId ctor:" 
00077                                            << " Invalid parameters: " 
00078                                            << " Wi:"<< wire
00079                                            << std::endl;
00080     }
00081     
00082     id_ |= (wire & wireMask_) << wireStartBit_;
00083   }
00084 
00085 
00086 
00087 // Constructor from a layerId and a wire number
00088 DTWireId::DTWireId(const DTLayerId& layerId, int wire) : DTLayerId(layerId) {
00089   if (wire < minWireId || wire > maxWireId) {
00090     throw cms::Exception("InvalidDetId") << "DTWireId ctor:" 
00091                                          << " Invalid parameters: " 
00092                                          << " Wi:"<< wire
00093                                          << std::endl;
00094   }
00095     
00096   id_ |= (wire & wireMask_) << wireStartBit_;
00097 }
00098   
00099 
00100 
00101 // Ostream operator
00102 std::ostream& operator<<( std::ostream& os, const DTWireId& id ){
00103 
00104   os << " Wh:"<< id.wheel()
00105      << " St:"<< id.station() 
00106      << " Se:"<< id.sector()
00107      << " Sl:"<< id.superlayer()
00108      << " La:"<< id.layer()
00109      << " Wi:"<< id.wire()
00110      <<" ";
00111 
00112   return os;
00113 }
00114 
00115