#include <MucIdTransform.h>
Public Member Functions | |
MucIdTransform () | |
~MucIdTransform () | |
int | GetId () |
int | GetPart () |
int | GetSegment () |
int | GetLayer () |
int | GetStrip () |
int | GetStripMax (int part, int segment, int layer) |
int | GetBoxId (int part, int segment, int layer) |
int | GetStripId (int part, int segment, int layer, int subid) |
bool | SetBoxPos (int boxid, int *part, int *segment, int *layer) |
bool | SetStripPos (int stripid, int *part, int *segment, int *layer, int *subid) |
void | Print (int) |
Private Attributes | |
int | m_Id |
int | m_Part |
int | m_Segment |
int | m_Layer |
int | m_Strip |
Definition at line 16 of file MucIdTransform.h.
MucIdTransform::MucIdTransform | ( | ) |
Definition at line 19 of file MucIdTransform.cxx.
References MucIdTransform::m_Id, MucIdTransform::m_Layer, MucIdTransform::m_Part, MucIdTransform::m_Segment, and MucIdTransform::m_Strip.
00020 { 00021 m_Id = 0; 00022 m_Part = 0; 00023 m_Segment = 0; 00024 m_Layer = 0; 00025 m_Strip = 0; 00026 }
MucIdTransform::~MucIdTransform | ( | ) |
int MucIdTransform::GetBoxId | ( | int | part, | |
int | segment, | |||
int | layer | |||
) |
Definition at line 52 of file MucIdTransform.cxx.
References BOX_PER_PART, BOX_PER_SEG, and genRecEmupikp::i.
00053 { 00054 int boxId = 0; 00055 for(int i=0; i<part; i++) { 00056 boxId += BOX_PER_PART[i]; 00057 } 00058 00059 if( segment == 0 ) 00060 boxId += layer; 00061 else 00062 boxId += ( segment * BOX_PER_SEG[part] + layer ); 00063 00064 return boxId; 00065 }
int MucIdTransform::GetId | ( | ) |
Definition at line 32 of file MucIdTransform.cxx.
References MucIdTransform::m_Id.
00032 { return m_Id; }
int MucIdTransform::GetLayer | ( | ) |
Definition at line 35 of file MucIdTransform.cxx.
References MucIdTransform::m_Layer.
00035 { return m_Layer; }
int MucIdTransform::GetPart | ( | ) |
Definition at line 33 of file MucIdTransform.cxx.
References MucIdTransform::m_Part.
00033 { return m_Part; }
int MucIdTransform::GetSegment | ( | ) |
Definition at line 34 of file MucIdTransform.cxx.
References MucIdTransform::m_Segment.
00034 { return m_Segment; }
int MucIdTransform::GetStrip | ( | ) |
Definition at line 36 of file MucIdTransform.cxx.
References MucIdTransform::m_Strip.
00036 { return m_Strip; }
int MucIdTransform::GetStripId | ( | int | part, | |
int | segment, | |||
int | layer, | |||
int | subid | |||
) |
Definition at line 68 of file MucIdTransform.cxx.
References B_PHISTR_NUM, B_STR_PER_SEG, B_TOP, B_TOPSTR_NUM, B_ZSTR_NUM, BOX_SUM, BRID, E_STR_NUM, EEID, MucIdTransform::GetBoxId(), and STR_PER_PART.
00069 { 00070 int strId = 0; 00071 int boxId = 0; 00072 00073 boxId = GetBoxId( part, segment, layer ); 00074 00075 if( part == EEID ) 00076 { 00077 strId = boxId*E_STR_NUM + strSubId; 00078 } 00079 else if( part == BRID ) 00080 { 00081 strId = STR_PER_PART[0]; 00082 00083 if( segment > B_TOP ) 00084 strId += segment * B_STR_PER_SEG[0] + E_STR_NUM; 00085 else 00086 strId += segment * B_STR_PER_SEG[0]; 00087 00088 strId += ((1+layer)/2) * B_ZSTR_NUM; 00089 strId += (layer/2) * ( (segment == B_TOP)?B_TOPSTR_NUM:B_PHISTR_NUM ); 00090 00091 strId += strSubId; 00092 } 00093 else 00094 { 00095 strId = STR_PER_PART[0] + STR_PER_PART[1]; 00096 strId += (boxId - BOX_SUM[1])*E_STR_NUM + strSubId; 00097 } 00098 00099 return strId; 00100 }
int MucIdTransform::GetStripMax | ( | int | part, | |
int | segment, | |||
int | layer | |||
) |
Definition at line 39 of file MucIdTransform.cxx.
References B_PHISTR_NUM, B_TOP, B_TOPSTR_NUM, B_ZSTR_NUM, BRID, E_STR_NUM, and max.
00040 { 00041 int max = 0; 00042 00043 if( part != BRID ) max = E_STR_NUM; 00044 else if( (layer+1)%2 == 1 ) max = B_ZSTR_NUM; 00045 else if( segment == B_TOP ) max = B_TOPSTR_NUM; 00046 else max = B_PHISTR_NUM; 00047 00048 return max; 00049 }
void MucIdTransform::Print | ( | int | ) |
Definition at line 204 of file MucIdTransform.cxx.
References MucIdTransform::m_Id, MucIdTransform::m_Layer, MucIdTransform::m_Part, MucIdTransform::m_Segment, and MucIdTransform::m_Strip.
00205 { 00206 if( mode == 0 ) // position to id 00207 { 00208 cout << "prt: " << m_Part 00209 << "\tseg: " << m_Segment 00210 << "\tlay: " << m_Layer 00211 << "\tstr: " << m_Strip 00212 << "\tid: " << m_Id << endl; 00213 } 00214 else // id to position 00215 { 00216 cout << "id: " << m_Id 00217 << "\tprt: " << m_Part 00218 << "\tseg: " << m_Segment 00219 << "\tlay: " << m_Layer 00220 << "\tstr: " << m_Strip << endl; 00221 } 00222 }
bool MucIdTransform::SetBoxPos | ( | int | boxid, | |
int * | part, | |||
int * | segment, | |||
int * | layer | |||
) |
Definition at line 103 of file MucIdTransform.cxx.
References B_LAY_NUM, BOX_MAX, BOX_SUM, BRID, and E_LAY_NUM.
Referenced by TreeMucCalibDataCnv::i_createObj(), and RootMucCalibDataCnv::i_createObj().
00104 { 00105 00106 if( (boxId < 0) || (boxId > BOX_MAX-1) ) 00107 { 00108 *part = 0; 00109 *segment = 0; 00110 *layer = 0; 00111 cout << "box id out range:\t" << boxId << "!" << endl; 00112 return false; 00113 } 00114 00115 // get part 00116 if( boxId < BOX_SUM[0] ) { *part = 0; } 00117 else if( boxId < BOX_SUM[1] ) { *part = 1; boxId -= BOX_SUM[0]; } 00118 else { *part = 2; boxId -= BOX_SUM[1]; } 00119 00120 // get segment and layer 00121 if( *part == BRID ) 00122 { 00123 *segment = boxId / B_LAY_NUM; 00124 *layer = boxId % B_LAY_NUM; 00125 } 00126 else 00127 { 00128 *segment = boxId / E_LAY_NUM; 00129 *layer = boxId % E_LAY_NUM; 00130 } 00131 00132 return true; 00133 }
bool MucIdTransform::SetStripPos | ( | int | stripid, | |
int * | part, | |||
int * | segment, | |||
int * | layer, | |||
int * | subid | |||
) |
Definition at line 136 of file MucIdTransform.cxx.
References B_PHISTR_NUM, B_STR_PER_SEG, B_TOP, B_TOPSTR_NUM, B_ZSTR_NUM, BRID, E_LAY_NUM, E_STR_NUM, STR_SUM, STRIP_MAX, and subSeperate::temp.
Referenced by TreeMucCalibDataCnv::i_createObj(), and RootMucCalibDataCnv::i_createObj().
00137 { 00138 if( (stripId < 0) || (stripId > STRIP_MAX-1) ) 00139 { 00140 *part = 0; 00141 *segment = 0; 00142 *layer = 0; 00143 *strSubId = 0; 00144 cout << "strip id out range:\t" << stripId << "!" << endl; 00145 return false; 00146 } 00147 00148 // get part 00149 if( stripId < STR_SUM[0] ) { *part = 0; } 00150 else if ( stripId < STR_SUM[1] ) { *part = 1; stripId -= STR_SUM[0]; } 00151 else { *part = 2; stripId -= STR_SUM[1]; } 00152 00153 // get segment and layer 00154 if( *part == BRID ) 00155 { 00156 int temp = 0; 00157 if ( stripId >= 2*B_STR_PER_SEG[0] && stripId < 2*B_STR_PER_SEG[0] + B_STR_PER_SEG[1] ) 00158 { 00159 // get segment 00160 *segment = B_TOP; 00161 00162 stripId -= 2*B_STR_PER_SEG[0]; 00163 temp = stripId % ( B_ZSTR_NUM + B_TOPSTR_NUM ); 00164 00165 // get layer 00166 if( temp < B_ZSTR_NUM ) *layer = 2*( stripId / ( B_ZSTR_NUM + B_TOPSTR_NUM ) ); 00167 else *layer = 2*( stripId / ( B_ZSTR_NUM + B_TOPSTR_NUM ) ) + 1; 00168 00169 // get strip 00170 if( temp < B_ZSTR_NUM ) *strSubId = temp; 00171 else *strSubId = temp - B_ZSTR_NUM; 00172 00173 } // top segment 00174 else 00175 { 00176 if (stripId >= 2*B_STR_PER_SEG[0] + B_STR_PER_SEG[1] ) stripId -= E_STR_NUM; 00177 00178 // get segment 00179 *segment = stripId / B_STR_PER_SEG[0]; 00180 00181 stripId %= B_STR_PER_SEG[0]; 00182 temp = stripId % ( B_ZSTR_NUM + B_PHISTR_NUM ); 00183 00184 // get layer 00185 if( temp < B_ZSTR_NUM ) *layer = 2*( stripId / ( B_ZSTR_NUM + B_PHISTR_NUM ) ); 00186 else *layer = 2*( stripId / ( B_ZSTR_NUM + B_PHISTR_NUM ) ) + 1; 00187 00188 // get strip 00189 if( temp < B_ZSTR_NUM ) *strSubId = temp; 00190 else *strSubId = temp - B_ZSTR_NUM; 00191 } 00192 } // barrel 00193 else 00194 { 00195 *strSubId = stripId % E_STR_NUM; 00196 *layer = ( stripId / E_STR_NUM ) % E_LAY_NUM ; 00197 *segment = ( stripId / E_STR_NUM ) / E_LAY_NUM ; 00198 } 00199 00200 return true; 00201 }
int CalibData::MucIdTransform::m_Id [private] |
Definition at line 37 of file MucIdTransform.h.
int CalibData::MucIdTransform::m_Layer [private] |
Definition at line 40 of file MucIdTransform.h.
int CalibData::MucIdTransform::m_Part [private] |
Definition at line 38 of file MucIdTransform.h.
int CalibData::MucIdTransform::m_Segment [private] |
Definition at line 39 of file MucIdTransform.h.
int CalibData::MucIdTransform::m_Strip [private] |
Definition at line 41 of file MucIdTransform.h.