Go to the documentation of this file.00001
00002
00003 #include "DataFormats/SiStripCommon/interface/SiStripKey.h"
00004 #include "DataFormats/SiStripCommon/interface/Constants.h"
00005 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
00006 #include <iomanip>
00007
00008
00009
00010 SiStripKey::SiStripKey( const uint32_t& key ) :
00011 key_(key),
00012 path_(sistrip::null_),
00013 granularity_(sistrip::UNDEFINED_GRAN),
00014 channel_(sistrip::invalid_)
00015 {;}
00016
00017
00018
00019 SiStripKey::SiStripKey( const std::string& path ) :
00020 key_(sistrip::invalid32_),
00021 path_(path),
00022 granularity_(sistrip::UNDEFINED_GRAN),
00023 channel_(sistrip::invalid_)
00024 {;}
00025
00026
00027
00028 SiStripKey::SiStripKey( const SiStripKey& input ) :
00029 key_( input.key() ),
00030 path_( input.path() ),
00031 granularity_( input.granularity() ),
00032 channel_( input.channel() )
00033 {;}
00034
00035
00036
00037 const SiStripKey& SiStripKey::operator=( const SiStripKey& rhs ) {
00038 if ( this == &rhs ) { return *this; }
00039 key_ = rhs.key();
00040 path_ = rhs.path();
00041 granularity_ = rhs.granularity();
00042 channel_ = rhs.channel();
00043 return *this;
00044 }
00045
00046
00047
00048 SiStripKey::SiStripKey() :
00049 key_(sistrip::invalid32_),
00050 path_(sistrip::null_),
00051 granularity_(sistrip::UNDEFINED_GRAN),
00052 channel_(sistrip::invalid_)
00053 {;}
00054
00055
00056
00057 bool SiStripKey::isEqual( const SiStripKey& input ) const {
00058 if ( !(&input) ) { return false; }
00059 if ( key_ == input.key() &&
00060 path_ == input.path() &&
00061 granularity_ == input.granularity() &&
00062 channel_ == input.channel() ) {
00063 return true;
00064 } else { return false; }
00065 }
00066
00067
00068
00069 bool SiStripKey::isConsistent( const SiStripKey& input ) const {
00070 return isEqual(input);
00071 }
00072
00073
00074
00075 bool SiStripKey::isValid() const {
00076 return ( key_ != sistrip::invalid32_ &&
00077 path_ != sistrip::null_ &&
00078 granularity_ != sistrip::UNDEFINED_GRAN &&
00079 channel_ != sistrip::invalid_ );
00080 }
00081
00082
00083
00084 bool SiStripKey::isValid( const sistrip::Granularity& gran ) const {
00085 return isValid();
00086 }
00087
00088
00089
00090 bool SiStripKey::isInvalid() const {
00091 return ( key_ == sistrip::invalid32_ ||
00092 path_ == sistrip::null_ ||
00093 granularity_ == sistrip::UNDEFINED_GRAN ||
00094 channel_ == sistrip::invalid_ );
00095 }
00096
00097
00098
00099 bool SiStripKey::isInvalid( const sistrip::Granularity& gran ) const {
00100 return isInvalid();
00101 }
00102
00103
00104
00105 void SiStripKey::print( std::stringstream& ss ) const {
00106 ss << " [SiStripKey::print]" << std::endl
00107 << std::hex
00108 << " 32-bit key : 0x"
00109 << std::setfill('0')
00110 << std::setw(8) << key() << std::endl
00111 << std::setfill(' ')
00112 << std::dec
00113 << " Directory : " << path() << std::endl
00114 << " Granularity : "
00115 << SiStripEnumsAndStrings::granularity( granularity() ) << std::endl
00116 << " Channel : " << channel();
00117 }
00118
00119
00120
00121 std::ostream& operator<< ( std::ostream& os, const SiStripKey& input ) {
00122 std::stringstream ss;
00123 input.print(ss);
00124 os << ss.str();
00125 return os;
00126 }