00001 #ifndef __TofID_h__
00002 #define __TofID_h__
00003
00004 #include "Identifier/BesDetectorID.h"
00005 #include <string>
00006 #include <assert.h>
00007
00008 class TofID : public BesDetectorID
00009 {
00010 public:
00011 typedef Identifier::size_type size_type;
00012 typedef Identifier::value_type value_type;
00013
00015 TofID();
00016
00018 ~TofID();
00019
00021 static Identifier cell_id ( int barrel_ec,
00022 int layer,
00023 int phi_module,
00024 int end
00025 );
00026 static Identifier cell_id( int value );
00027
00028 static value_type getIntID ( int barrel_ec,
00029 int layer,
00030 int phi_module,
00031 int end
00032 );
00033
00035 static Identifier cell_id ( int barrel_ec,
00036 int endcap,
00037 int module,
00038 int strip,
00039 int end
00040 );
00041 static value_type getIntID ( int barrel_ec,
00042 int endcap,
00043 int module,
00044 int strip,
00045 int end
00046 );
00047
00048 static value_type getLAYER_BARREL_MAX();
00049 static value_type getLAYER_ENDCAP_MAX();
00050 static value_type getPHI_BARREL_MAX();
00051 static value_type getPHI_ENDCAP_MAX();
00052 static value_type getBARREL_EC_MAX();
00053 static value_type getBARREL_EC_MIN();
00054
00055 static bool values_ok ( const unsigned int barrel_ec,
00056 const unsigned int layer,
00057 const unsigned int phi_module,
00058 const unsigned int end
00059 ) ;
00060
00061
00062 static value_type getBARREL_EC_MRPC();
00063 static value_type getENDCAP_MRPC_MAX();
00064 static value_type getMODULE_MRPC_MAX();
00065 static value_type getSTRIP_MRPC_MAX();
00066
00067 static bool values_ok ( const unsigned int barrel_ec,
00068 const unsigned int endcap,
00069 const unsigned int module,
00070 const unsigned int strip,
00071 const unsigned int end
00072 ) ;
00073
00074
00076 static bool is_barrel (const Identifier& id) ;
00077 static bool is_barrel (const unsigned int barrel_ec) ;
00078
00080 static int barrel_ec (const Identifier& id) ;
00081 static int layer (const Identifier& id) ;
00082 static int phi_module (const Identifier& id) ;
00083 static int end (const Identifier& id) ;
00084
00086 int phi_module_max (const Identifier& id) ;
00087 int layer_max (const Identifier& id);
00088
00089
00090 static bool is_scin (const Identifier& id) ;
00091 static bool is_scin (const unsigned int barrel_ec) ;
00092 static bool is_mrpc (const Identifier& id) ;
00093 static bool is_mrpc (const unsigned int barrel_ec) ;
00094
00095 static int endcap (const Identifier& id) ;
00096 static int module (const Identifier& id) ;
00097 static int strip (const Identifier& id) ;
00098
00099
00100 private:
00101
00102 typedef std::vector<Identifier> id_vec;
00103 typedef id_vec::const_iterator id_vec_it;
00104
00105 static const unsigned int BARREL_EC_INDEX = 14;
00106 static const unsigned int BARREL_EC_MASK = 0x0000C000;
00107
00108 static const unsigned int LAYER_INDEX = 8;
00109 static const unsigned int LAYER_MASK = 0x00000100;
00110
00111 static const unsigned int PHI_INDEX = 1;
00112 static const unsigned int PHI_MASK = 0x000000FE;
00113
00114 static const unsigned int END_INDEX = 0;
00115 static const unsigned int END_MASK = 0x00000001;
00116
00117 static const unsigned int LAYER_BARREL_MAX = 1;
00118 static const unsigned int LAYER_ENDCAP_MAX = 0;
00119
00120 static const unsigned int PHI_BARREL_MAX = 87;
00121 static const unsigned int PHI_ENDCAP_MAX = 47;
00122
00123 static const unsigned int BARREL_EC_MAX = 2;
00124 static const unsigned int BARREL_EC_MIN = 0;
00125
00126
00127 static const unsigned int ENDCAP_INDEX = 11;
00128 static const unsigned int ENDCAP_MASK = 0x00000800;
00129
00130 static const unsigned int MODULE_INDEX = 5;
00131 static const unsigned int MODULE_MASK = 0x000007E0;
00132
00133 static const unsigned int STRIP_INDEX = 1;
00134 static const unsigned int STRIP_MASK = 0x0000001E;
00135
00136 static const unsigned int BARREL_EC_MRPC = 3;
00137 static const unsigned int ENDCAP_MRPC_MAX = 1;
00138 static const unsigned int MODULE_MRPC_MAX = 35;
00139 static const unsigned int STRIP_MRPC_MAX = 11;
00140
00141 };
00142
00143 #endif