CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/SiStripDetId/src/SiStripDetId.cc

Go to the documentation of this file.
00001 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
00002 #include <iomanip>
00003 
00004 // -----------------------------------------------------------------------------
00005 //
00006 SiStripDetId::SiStripDetId() : DetId() {;}
00007 
00008 // -----------------------------------------------------------------------------
00009 //
00010 SiStripDetId::SiStripDetId( const uint32_t& raw_id ) : DetId( raw_id ) {;}
00011 
00012 // -----------------------------------------------------------------------------
00013 //
00014 SiStripDetId::SiStripDetId( const DetId& det_id ) : DetId( det_id.rawId() ) {;}
00015 
00016 // -----------------------------------------------------------------------------
00017 //
00018 SiStripDetId::SiStripDetId( Detector det, int subdet ) : DetId( det, subdet ) {;}
00019 
00020 // -----------------------------------------------------------------------------
00021 //
00022 SiStripDetId::SiStripDetId( const uint32_t& raw_id, 
00023                             const uint16_t& reserved )
00024   : DetId( raw_id ) 
00025 {
00026   id_ &= ( ~static_cast<uint32_t>(reservedMask_<<reservedStartBit_) );
00027   id_ |= ( ( reserved & reservedMask_ ) << reservedStartBit_ );
00028 }
00029 
00030 // -----------------------------------------------------------------------------
00031 //
00032 SiStripDetId::SiStripDetId( const DetId& det_id, 
00033                             const uint16_t& reserved )
00034   : DetId( det_id.rawId() ) 
00035 {
00036   id_ &= ( ~static_cast<uint32_t>(reservedMask_<<reservedStartBit_) );
00037   id_ |= ( ( reserved & reservedMask_ ) << reservedStartBit_ );
00038 }
00039 
00040 // -----------------------------------------------------------------------------
00041 //
00042 std::ostream& operator<< ( std::ostream& os, const SiStripDetId& id ) {
00043   return os << "[SiStripDetId::print]" << std::endl
00044             << " rawId       : 0x" 
00045             << std::hex << std::setfill('0') << std::setw(8)
00046             << id.rawId()
00047             << std::dec << std::endl
00048             << " bits[0:24]  : " 
00049             << std::hex << std::setfill('0') << std::setw(8) 
00050             << (0x01FFFFFF & id.rawId())
00051             << std::dec << std::endl
00052             << " Detector    : " << id.det() << std::endl 
00053             << " SubDetector : " << id.subdetId() << std::endl
00054             << " reserved    : " << id.reserved();
00055 }
00056