00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: TrkDetElemId.h,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $ 00004 // 00005 // Description: 00006 // Class TrkDetElemId 00007 // 00008 // Environment: 00009 // Software developed for BaBar expirment @ SLAC B-Factory 00010 // 00011 // Author List: 00012 // Eric A Charles 00013 // 00014 // Copyright Information: 00015 // Copyright (C) 1998 Univ. Wisconsin-Madsion 00016 // 00017 //------------------------------------------------------------------------ 00018 00019 #ifndef TRKDETELEMID_HH 00020 #define TRKDETELEMID_HH 00021 00022 //------------- 00023 // C Headers -- 00024 //------------- 00025 extern "C" { 00026 } 00027 00028 //--------------- 00029 // C++ Headers -- 00030 //--------------- 00031 00032 #include <iostream> 00033 00034 // --------------------- 00035 // -- Class Interface -- 00036 // --------------------- 00037 00038 class TrkDetElemId { 00039 00040 //------------------ 00041 // Static Members -- 00042 //------------------ 00043 00044 public: 00045 00046 // Typedefs, consts, and enums 00047 enum systemIndex { null=0, 00048 svt=1, 00049 mdc=2 }; 00050 00051 // functions 00052 static int calcValue( const int& id, 00053 TrkDetElemId::systemIndex sysInd ); 00054 00055 private: 00056 00057 static const int svtOffset; 00058 static const int mdcOffset; 00059 static const int nullElemID; 00060 00061 //-------------------- 00062 // Instance Members -- 00063 //-------------------- 00064 00065 public: 00066 00067 // Constructors 00068 TrkDetElemId( const int& id, TrkDetElemId::systemIndex sysInd ); 00069 00070 // Copy Constructor 00071 TrkDetElemId( const TrkDetElemId& ); 00072 00073 // Destructor 00074 virtual ~TrkDetElemId( ); 00075 00076 // Operators 00077 00078 TrkDetElemId& operator= ( const TrkDetElemId& ); 00079 00080 bool operator==( const TrkDetElemId& rhs ) const{ 00081 return elemId() == rhs.elemId(); 00082 } 00083 bool operator<( const TrkDetElemId& rhs) const { 00084 return elemId() < rhs.elemId(); 00085 } 00086 00087 // Selectors (const) 00088 int elemId() const{ 00089 return calcValue(_id,_sysInd); 00090 }; 00091 00092 const int& systemElemId() const{ 00093 return _id; 00094 } 00095 00096 const TrkDetElemId::systemIndex& sysInd() const { 00097 return _sysInd; 00098 } 00099 00100 void printAll( std::ostream& os=std::cout ) const; 00101 00102 private: 00103 00104 // Data members 00105 int _id; 00106 TrkDetElemId::systemIndex _sysInd; 00107 00108 }; 00109 00110 std::ostream& operator<<(std::ostream& os, const TrkDetElemId& id); 00111 00112 // Inline implementations 00113 //#include "TrkDetElemId.icc" 00114 00115 #endif