38 if ( part !=
BRID )
max = E_STR_NUM;
40 else if ( segment == B_TOP )
max = B_TOPSTR_NUM;
41 else max = B_PHISTR_NUM;
48 for (
int i = 0; i < part; i++ ) { boxId += BOX_PER_PART[i]; }
50 if ( segment == 0 ) boxId += layer;
51 else boxId += ( segment * BOX_PER_SEG[part] + layer );
61 boxId =
GetBoxId( part, segment, layer );
63 if ( part ==
EEID ) strId = boxId * E_STR_NUM + strSubId;
64 else if ( part ==
BRID )
66 strId = STR_PER_PART[0];
68 if ( segment > B_TOP ) strId += segment * B_STR_PER_SEG[0] + E_STR_NUM;
69 else strId += segment * B_STR_PER_SEG[0];
72 strId += ( layer / 2 ) * ( ( segment == B_TOP ) ? B_TOPSTR_NUM : B_PHISTR_NUM );
78 strId = STR_PER_PART[0] + STR_PER_PART[1];
79 strId += ( boxId - BOX_SUM[1] ) * E_STR_NUM + strSubId;
87 if ( ( boxId < 0 ) || ( boxId > BOX_MAX - 1 ) )
92 cout <<
"box id out range:\t" << boxId <<
"!" << endl;
97 if ( boxId < BOX_SUM[0] ) { *part = 0; }
98 else if ( boxId < BOX_SUM[1] )
127 if ( ( stripId < 0 ) || ( stripId >
STRIP_MAX - 1 ) )
133 cout <<
"strip id out range:\t" << stripId <<
"!" << endl;
138 if ( stripId < STR_SUM[0] ) { *part = 0; }
139 else if ( stripId < STR_SUM[1] )
142 stripId -= STR_SUM[0];
147 stripId -= STR_SUM[1];
154 if ( stripId >= 2 * B_STR_PER_SEG[0] && stripId < 2 * B_STR_PER_SEG[0] + B_STR_PER_SEG[1] )
159 stripId -= 2 * B_STR_PER_SEG[0];
160 temp = stripId % (
B_ZSTR_NUM + B_TOPSTR_NUM );
164 else *layer = 2 * ( stripId / (
B_ZSTR_NUM + B_TOPSTR_NUM ) ) + 1;
172 if ( stripId >= 2 * B_STR_PER_SEG[0] + B_STR_PER_SEG[1] ) stripId -= E_STR_NUM;
175 *segment = stripId / B_STR_PER_SEG[0];
177 stripId %= B_STR_PER_SEG[0];
178 temp = stripId % (
B_ZSTR_NUM + B_PHISTR_NUM );
182 else *layer = 2 * ( stripId / (
B_ZSTR_NUM + B_PHISTR_NUM ) ) + 1;
191 *strSubId = stripId % E_STR_NUM;
192 *layer = ( stripId / E_STR_NUM ) %
E_LAY_NUM;
193 *segment = ( stripId / E_STR_NUM ) /
E_LAY_NUM;
203 cout <<
"prt: " << m_Part <<
"\tseg: " << m_Segment <<
"\tlay: " << m_Layer
204 <<
"\tstr: " << m_Strip <<
"\tid: " << m_Id << endl;
208 cout <<
"id: " << m_Id <<
"\tprt: " << m_Part <<
"\tseg: " << m_Segment
209 <<
"\tlay: " << m_Layer <<
"\tstr: " << m_Strip << endl;