40 if( part != BRID )
max = E_STR_NUM;
42 else if( segment == B_TOP )
max = B_TOPSTR_NUM;
43 else max = B_PHISTR_NUM;
51 for(
int i=0; i<part; i++) {
52 boxId += BOX_PER_PART[i];
55 if( segment == 0 ) boxId += layer;
56 else boxId += ( segment * BOX_PER_SEG[part] + layer );
67 boxId =
GetBoxId( part, segment, layer );
69 if( part == EEID ) strId = boxId*E_STR_NUM + strSubId;
70 else if( part == BRID )
72 strId = STR_PER_PART[0];
75 strId += segment * B_STR_PER_SEG[0] + E_STR_NUM;
77 strId += segment * B_STR_PER_SEG[0];
79 strId += ((1+layer)/2) * B_ZSTR_NUM;
80 strId += (layer/2) * ( (segment == B_TOP)?B_TOPSTR_NUM:B_PHISTR_NUM );
85 strId = STR_PER_PART[0] + STR_PER_PART[1];
86 strId += (boxId - BOX_SUM[1])*E_STR_NUM + strSubId;
95 if( (boxId < 0) || (boxId > BOX_MAX-1) )
100 cout <<
"box id out range:\t" << boxId <<
"!" << endl;
105 if( boxId < BOX_SUM[0] ) { *part = 0; }
106 else if( boxId < BOX_SUM[1] ) { *part = 1; boxId -= BOX_SUM[0]; }
107 else { *part = 2; boxId -= BOX_SUM[1]; }
110 if( *part == BRID ) {
125 if( (stripId < 0) || (stripId > STRIP_MAX-1) )
131 cout <<
"strip id out range:\t" << stripId <<
"!" << endl;
136 if( stripId < STR_SUM[0] ) { *part = 0; }
137 else if ( stripId < STR_SUM[1] ) { *part = 1; stripId -= STR_SUM[0]; }
138 else { *part = 2; stripId -= STR_SUM[1]; }
144 if ( stripId >= 2*B_STR_PER_SEG[0] && stripId < 2*B_STR_PER_SEG[0] + B_STR_PER_SEG[1] )
149 stripId -= 2*B_STR_PER_SEG[0];
150 temp = stripId % (
B_ZSTR_NUM + B_TOPSTR_NUM );
153 if( temp < B_ZSTR_NUM ) *layer = 2*( stripId / (
B_ZSTR_NUM + B_TOPSTR_NUM ) );
154 else *layer = 2*( stripId / (
B_ZSTR_NUM + B_TOPSTR_NUM ) ) + 1;
157 if( temp < B_ZSTR_NUM ) *strSubId = temp;
162 if (stripId >= 2*B_STR_PER_SEG[0] + B_STR_PER_SEG[1] ) stripId -= E_STR_NUM;
165 *segment = stripId / B_STR_PER_SEG[0];
167 stripId %= B_STR_PER_SEG[0];
168 temp = stripId % (
B_ZSTR_NUM + B_PHISTR_NUM );
171 if( temp < B_ZSTR_NUM ) *layer = 2*( stripId / (
B_ZSTR_NUM + B_PHISTR_NUM ) );
172 else *layer = 2*( stripId / (
B_ZSTR_NUM + B_PHISTR_NUM ) ) + 1;
175 if( temp < B_ZSTR_NUM ) *strSubId = temp;
181 *strSubId = stripId % E_STR_NUM;
182 *layer = ( stripId / E_STR_NUM ) % E_LAY_NUM ;
183 *segment = ( stripId / E_STR_NUM ) / E_LAY_NUM ;
194 cout <<
"prt: " << m_Part
195 <<
"\tseg: " << m_Segment
196 <<
"\tlay: " << m_Layer
197 <<
"\tstr: " << m_Strip
198 <<
"\tid: " << m_Id << endl;
202 cout <<
"id: " << m_Id
203 <<
"\tprt: " << m_Part
204 <<
"\tseg: " << m_Segment
205 <<
"\tlay: " << m_Layer
206 <<
"\tstr: " << m_Strip << endl;