Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /** \file
0002  * Impl of DTWireId
0003  *
0004  * \author G. Cerminara - INFN Torino
0005  * \date 02 Aug 2005
0006 */
0007 
0008 #include <iostream>
0009 #include <DataFormats/MuonDetId/interface/DTWireId.h>
0010 #include <FWCore/Utilities/interface/Exception.h>
0011 
0012 DTWireId::DTWireId() : DTLayerId() {}
0013 
0014 DTWireId::DTWireId(uint32_t id) {
0015   id_ = id;
0016   checkMuonId();  // Check this is a valid id for muon DTs.
0017 }
0018 
0019 DTWireId::DTWireId(int wheel, int station, int sector, int superlayer, int layer, int wire)
0020     : DTLayerId(wheel, station, sector, superlayer, layer) {
0021   if (wire < minWireId || wire > maxWireId) {
0022     throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
0023                                          << " Invalid parameters: "
0024                                          << " Wh:" << wheel << " St:" << station << " Se:" << sector
0025                                          << " Sl:" << superlayer << " La:" << layer << " Wi:" << wire << std::endl;
0026   }
0027 
0028   id_ |= (wire & wireMask_) << wireStartBit_;
0029 }
0030 
0031 // Copy Constructor.
0032 DTWireId::DTWireId(const DTWireId& wireId) : DTLayerId() { id_ = wireId.rawId(); }
0033 
0034 // Constructor from a CamberId and SL, layer and wire numbers
0035 DTWireId::DTWireId(const DTChamberId& chId, int superlayer, int layer, int wire) : DTLayerId(chId, superlayer, layer) {
0036   if (wire < minWireId || wire > maxWireId) {
0037     throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
0038                                          << " Invalid parameters: "
0039                                          << " Wi:" << wire << std::endl;
0040   }
0041 
0042   id_ |= (wire & wireMask_) << wireStartBit_;
0043 }
0044 
0045 // Constructor from a SuperLayerId and layer and wire numbers
0046 DTWireId::DTWireId(const DTSuperLayerId& slId, int layer, int wire) : DTLayerId(slId, layer) {
0047   if (wire < minWireId || wire > maxWireId) {
0048     throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
0049                                          << " Invalid parameters: "
0050                                          << " Wi:" << wire << std::endl;
0051   }
0052 
0053   id_ |= (wire & wireMask_) << wireStartBit_;
0054 }
0055 
0056 // Constructor from a layerId and a wire number
0057 DTWireId::DTWireId(const DTLayerId& layerId, int wire) : DTLayerId(layerId) {
0058   if (wire < minWireId || wire > maxWireId) {
0059     throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
0060                                          << " Invalid parameters: "
0061                                          << " Wi:" << wire << std::endl;
0062   }
0063 
0064   id_ |= (wire & wireMask_) << wireStartBit_;
0065 }
0066 
0067 // Ostream operator
0068 std::ostream& operator<<(std::ostream& os, const DTWireId& id) {
0069   os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " Sl:" << id.superlayer()
0070      << " La:" << id.layer() << " Wi:" << id.wire() << " ";
0071 
0072   return os;
0073 }