00001 #ifndef BESDETECTORID_H 00002 #define BESDETECTORID_H 00003 00004 #include "Identifier/Identifier.h" 00005 #include <string> 00006 00015 class BesDetectorID { 00016 00017 public: 00018 BesDetectorID(void); 00019 ~BesDetectorID(void); 00020 00021 // Detector systems: 00022 Identifier mdc(void) const; 00023 Identifier tof(void) const; 00024 Identifier emc(void) const; 00025 Identifier muc(void) const; 00026 Identifier hlt(void) const; 00027 Identifier mrpc(void) const; 00028 00029 00030 00031 // Short print out of any identifier (optionally provide 00032 // separation character - default is '.'): 00033 // void show(const Identifier& id, char sep = '.' ) const; 00034 00035 // or provide the printout in string form 00036 // std::string show_to_string (const Identifier& id, char sep = '.' ) const; 00037 00038 // Expanded print out of any identifier 00039 // void print(const Identifier& id) const; 00040 00041 // or provide the printout in string form 00042 // std::string print_to_string (const Identifier& id) const; 00043 00044 // Test of an Identifier to see if it belongs to a particular 00045 // detector system: 00046 bool is_mdc (const Identifier& id) const; 00047 bool is_tof (const Identifier& id) const; 00048 bool is_emc (const Identifier& id) const; 00049 bool is_muc (const Identifier& id) const; 00050 bool is_hlt (const Identifier& id) const; 00051 bool is_mrpc (const Identifier& id) const; 00052 00053 00054 protected: 00056 int mdc_field_value () const; 00057 int tof_field_value () const; 00058 int emc_field_value () const; 00059 int muc_field_value () const; 00060 int hlt_field_value () const; 00061 int mrpc_field_value () const; 00062 00063 // extract detector id information 00064 int get_detectorID (const Identifier& id) const; 00065 00066 static const unsigned int MDC_ID = 0x10; 00067 static const unsigned int MDC_INDEX = 24; 00068 static const unsigned int MDC_MASK = 0xFF000000; 00069 00070 static const unsigned int TOF_ID = 0x20; 00071 static const unsigned int TOF_INDEX = 24; 00072 static const unsigned int TOF_MASK = 0xFF000000; 00073 00074 static const unsigned int EMC_ID = 0x30; 00075 static const unsigned int EMC_INDEX = 24; 00076 static const unsigned int EMC_MASK = 0xFF000000; 00077 00078 static const unsigned int MUC_ID = 0x40; 00079 static const unsigned int MUC_INDEX = 24; 00080 static const unsigned int MUC_MASK = 0xFF000000; 00081 00082 static const unsigned int HLT_ID = 0x50; 00083 static const unsigned int HLT_INDEX = 24; 00084 static const unsigned int HLT_MASK = 0xFF000000; 00085 00086 static const unsigned int MRPC_ID = 0x70; 00087 static const unsigned int MRPC_INDEX = 24; 00088 static const unsigned int MRPC_MASK = 0xFF000000; 00089 00090 00091 00092 00093 private: 00094 int m_MdcId; 00095 int m_TofId; 00096 int m_EmcId; 00097 int m_MucId; 00098 int m_HltId; 00099 int m_MrpcId; 00100 }; 00101 00102 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00104 inline int 00105 BesDetectorID::mdc_field_value() const {return (m_MdcId);} 00106 00107 inline int 00108 BesDetectorID::tof_field_value() const {return (m_TofId);} 00109 00110 inline int 00111 BesDetectorID::emc_field_value() const {return (m_EmcId);} 00112 00113 inline int 00114 BesDetectorID::muc_field_value() const {return (m_MucId);} 00115 00116 inline int 00117 BesDetectorID::hlt_field_value() const {return (m_HltId);} 00118 00119 inline int 00120 BesDetectorID::mrpc_field_value() const {return (m_MrpcId);} 00121 00122 #endif // BESDETECTORID_H