00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: TrkDetElemId.cxx,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-Madison 00016 // 00017 //------------------------------------------------------------------------ 00018 00019 //---------------- 00020 // BaBar header 00021 //---------------- 00022 //#include "BaBar/BaBar.hh" 00023 00024 //----------------------- 00025 // This Class's Header -- 00026 //----------------------- 00027 #include "TrkBase/TrkDetElemId.h" 00028 using std::endl; 00029 using std::ostream; 00030 00031 //------------- 00032 // C Headers -- 00033 //------------- 00034 extern "C" { 00035 } 00036 00037 //--------------- 00038 // C++ Headers -- 00039 //--------------- 00040 00041 //------------------------------- 00042 // Collaborating Class Headers -- 00043 //------------------------------- 00044 00045 //----------------------------------------------------------------------- 00046 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00047 //----------------------------------------------------------------------- 00048 00049 00050 00051 // ----------------------------------------------- 00052 // -- Static Data & Function Member Definitions -- 00053 // ----------------------------------------------- 00054 00055 const int TrkDetElemId::svtOffset(0); 00056 const int TrkDetElemId::mdcOffset(10000); 00057 const int TrkDetElemId::nullElemID(-1); 00058 00059 int TrkDetElemId::calcValue( const int& id, 00060 TrkDetElemId::systemIndex sysInd ){ 00061 int retVal(id); 00062 switch (sysInd) { 00063 case TrkDetElemId::svt: 00064 retVal += TrkDetElemId::svtOffset; 00065 return retVal; 00066 case TrkDetElemId::mdc: 00067 retVal += TrkDetElemId::mdcOffset; 00068 return retVal; 00069 default: 00070 break; 00071 } 00072 return TrkDetElemId::nullElemID; 00073 } 00074 00075 // ---------------------------------------- 00076 // -- Public Function Member Definitions -- 00077 // ---------------------------------------- 00078 00079 //---------------- 00080 // Constructors -- 00081 //---------------- 00082 00083 TrkDetElemId::TrkDetElemId( const int& id, TrkDetElemId::systemIndex sysInd ) 00084 :_id(id),_sysInd(sysInd){ 00085 } 00086 00087 00088 TrkDetElemId::TrkDetElemId( const TrkDetElemId& rhs ) 00089 :_id(rhs.systemElemId()),_sysInd(rhs.sysInd()){ 00090 } 00091 00092 //-------------- 00093 // Destructor -- 00094 //-------------- 00095 00096 TrkDetElemId::~TrkDetElemId(){ 00097 } 00098 00099 //------------- 00100 // Operators -- 00101 //------------- 00102 00103 TrkDetElemId& 00104 TrkDetElemId::operator= ( const TrkDetElemId& rhs ){ 00105 _id = rhs.systemElemId(); 00106 _sysInd = rhs.sysInd(); 00107 return *this; 00108 } 00109 00110 void 00111 TrkDetElemId::printAll( ostream& os ) const{ 00112 os << _id << ' ' << _sysInd << ' ' << elemId() << endl; 00113 } 00114 00115 ostream& operator<<(ostream& os, const TrkDetElemId& id){ 00116 id.printAll(os); 00117 return os; 00118 } 00119